From 52dc49f2b9e6da35e530687578aad26d0ed24629 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Wed, 27 Jun 2018 15:56:20 -0700 Subject: [PATCH 01/58] Prereq for converting tag helper tests --- .../Legacy/TagHelperRewritingTestBase.cs | 6 ++ .../Language/Legacy/ParserTestBase.cs | 18 +++-- .../Language/Legacy/SyntaxTreeNodeWriter.cs | 70 ++++++++++++++++++- 3 files changed, 87 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperRewritingTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperRewritingTestBase.cs index 8271cee1a9..770591d394 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperRewritingTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperRewritingTestBase.cs @@ -68,6 +68,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy .OrderBy(error => error.Span.AbsoluteIndex) .ToList(); + if (UseBaselineTests && !IsTheory) + { + BaselineTest(actualTree, verifySyntaxTree: false, actualErrors.ToArray()); + return; + } + EvaluateRazorErrors(actualErrors, expectedErrors.ToList()); EvaluateParseTree(actualTree, expectedOutput); } diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ParserTestBase.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ParserTestBase.cs index 4089843e22..34b9269fe0 100644 --- a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ParserTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ParserTestBase.cs @@ -162,16 +162,24 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return Regex.Replace(content, "(? Date: Thu, 28 Jun 2018 16:48:57 -0700 Subject: [PATCH 02/58] Bumping version from 2.2.0 to 3.0.0 --- version.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.props b/version.props index 88598148cd..584473c9bb 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,7 @@ - + - 2.2.0 - preview1 + 3.0.0 + alpha1 $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final t000 From 57fbd1c499bf38310305fa7b08814a61b6400c1b Mon Sep 17 00:00:00 2001 From: "Nate McMaster (automated)" Date: Mon, 2 Jul 2018 12:40:33 -0700 Subject: [PATCH 03/58] [automated] Change default branch to master --- .travis.yml | 2 +- korebuild.json | 4 ++-- run.ps1 | 6 +++--- run.sh | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) 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/korebuild.json b/korebuild.json index 6a6da7bd51..cb46ef120b 100644 --- a/korebuild.json +++ b/korebuild.json @@ -1,6 +1,6 @@ { - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", - "channel": "dev", + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json", + "channel": "master", "toolsets": { "visualstudio": { "required": false, diff --git a/run.ps1 b/run.ps1 index 3b27382468..34604c7175 100644 --- a/run.ps1 +++ b/run.ps1 @@ -52,8 +52,8 @@ in the file are overridden by command line parameters. Example config file: ```json { - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", - "channel": "dev", + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json", + "channel": "master", "toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools" } ``` @@ -192,7 +192,7 @@ if (!$DotNetHome) { else { Join-Path $PSScriptRoot '.dotnet'} } -if (!$Channel) { $Channel = 'dev' } +if (!$Channel) { $Channel = 'master' } if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' } # Execute diff --git a/run.sh b/run.sh index 02aac15874..61f7a53385 100755 --- a/run.sh +++ b/run.sh @@ -248,7 +248,7 @@ if [ -f "$config_file" ]; then [ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source" fi -[ -z "$channel" ] && channel='dev' +[ -z "$channel" ] && channel='master' [ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' get_korebuild From d4c652a7d57b4d4e19949550f06118f3d966230c Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 3 Jul 2018 16:24:43 +0000 Subject: [PATCH 04/58] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 16 ++++++++-------- korebuild-lock.txt | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index c83a59e6f3..db673f1ad8 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 0.10.13 - 2.2.0-preview1-17090 - 2.2.0-preview1-34530 - 2.2.0-preview1-34530 - 2.2.0-preview1-34530 + 3.0.0-alpha1-10000 + 3.0.0-alpha1-10016 + 3.0.0-alpha1-10016 + 3.0.0-alpha1-10016 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 2.2.0-preview1-34530 - 2.2.0-preview1-34530 + 3.0.0-alpha1-10016 + 3.0.0-alpha1-10016 2.2.0-preview1-26618-02 - 2.2.0-preview1-34530 - 2.2.0-preview1-34530 + 3.0.0-alpha1-10016 + 3.0.0-alpha1-10016 2.0.0 2.1.0 2.2.0-preview1-26618-02 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 3e694b2ed8..3f870e51fe 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.2.0-preview1-17090 -commithash:b19e903e946579cd9482089bce7d917e8bacd765 +version:3.0.0-alpha1-10000 +commithash:b7b88d08d55abc8b71de9abf16e26fc713e332cd From 61aeae10233e52025090e836f3cbf70a13a2679f Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 8 Jul 2018 20:06:52 +0000 Subject: [PATCH 05/58] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 18 +++++++++--------- korebuild-lock.txt | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index db673f1ad8..9179085d61 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 0.10.13 - 3.0.0-alpha1-10000 - 3.0.0-alpha1-10016 - 3.0.0-alpha1-10016 - 3.0.0-alpha1-10016 + 3.0.0-alpha1-10005 + 3.0.0-alpha1-10044 + 3.0.0-alpha1-10044 + 3.0.0-alpha1-10044 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 3.0.0-alpha1-10016 - 3.0.0-alpha1-10016 + 3.0.0-alpha1-10044 + 3.0.0-alpha1-10044 2.2.0-preview1-26618-02 - 3.0.0-alpha1-10016 - 3.0.0-alpha1-10016 + 3.0.0-alpha1-10044 + 3.0.0-alpha1-10044 2.0.0 2.1.0 2.2.0-preview1-26618-02 @@ -59,7 +59,7 @@ 2.9.0-beta4-62911-02 0.8.0 2.3.1 - 2.4.0-beta.1.build3945 + 2.4.0-rc.1.build4038 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 3f870e51fe..2395ab5956 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:3.0.0-alpha1-10000 -commithash:b7b88d08d55abc8b71de9abf16e26fc713e332cd +version:3.0.0-alpha1-10005 +commithash:05570853de976a526462ca140a55b1ac59d9a351 From a06c2b243f5e446a04d9439a87d62f6794c6c1ff Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 15 Jul 2018 20:09:12 +0000 Subject: [PATCH 06/58] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- korebuild-lock.txt | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 9179085d61..7d0045e5df 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,22 +4,22 @@ 0.10.13 - 3.0.0-alpha1-10005 - 3.0.0-alpha1-10044 - 3.0.0-alpha1-10044 - 3.0.0-alpha1-10044 + 3.0.0-alpha1-10009 + 3.0.0-alpha1-10081 + 3.0.0-alpha1-10081 + 3.0.0-alpha1-10081 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 3.0.0-alpha1-10044 - 3.0.0-alpha1-10044 - 2.2.0-preview1-26618-02 - 3.0.0-alpha1-10044 - 3.0.0-alpha1-10044 - 2.0.0 - 2.1.0 + 3.0.0-alpha1-10081 + 3.0.0-alpha1-10081 + 3.0.0-preview1-26710-03 + 3.0.0-alpha1-10081 + 3.0.0-alpha1-10081 + 2.0.9 + 2.1.2 2.2.0-preview1-26618-02 15.6.1 15.0.26606 @@ -43,9 +43,9 @@ 2.0.3 11.0.2 1.1.92 - 4.6.0-preview1-26617-01 + 4.6.0-preview1-26708-04 4.3.0 - 4.6.0-preview1-26617-01 + 4.6.0-preview1-26708-04 9.0.1 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 @@ -57,7 +57,7 @@ 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 - 0.8.0 + 0.9.0 2.3.1 2.4.0-rc.1.build4038 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 2395ab5956..c6adb40215 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:3.0.0-alpha1-10005 -commithash:05570853de976a526462ca140a55b1ac59d9a351 +version:3.0.0-alpha1-10009 +commithash:86be4707e47d2f1930a982f2b59eacfc4196da33 From a5bcb5fdc27e0df95256ba0ab6d2af4707311973 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Tue, 10 Jul 2018 09:51:06 -0700 Subject: [PATCH 07/58] Make master build a 16.0 VSIX This change updates the master branch of Razor to start producing a VS16 branded VSIX. I haven't updated any package dependencies at this time, just changed the version number and make our version range dependencies more flexible. --- .../Microsoft.VisualStudio.RazorExtension.csproj | 2 +- .../source.extension.vsixmanifest | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj b/tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj index 491559471e..6bdb8d5376 100644 --- a/tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj +++ b/tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj @@ -1,7 +1,7 @@  - 15.8 + 16.0 99999 diff --git a/tooling/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest b/tooling/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest index 253dcc8b70..d50e2d376b 100644 --- a/tooling/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest +++ b/tooling/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest @@ -13,11 +13,11 @@ - + - - + + From 52304f76a980d1bdb65e86e80ddbb10e51b3a6e1 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 22 Jul 2018 13:11:16 -0700 Subject: [PATCH 08/58] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 16 ++++++++-------- korebuild-lock.txt | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 7d0045e5df..e4656f54ad 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 0.10.13 - 3.0.0-alpha1-10009 - 3.0.0-alpha1-10081 - 3.0.0-alpha1-10081 - 3.0.0-alpha1-10081 + 3.0.0-alpha1-10011 + 3.0.0-alpha1-10123 + 3.0.0-alpha1-10123 + 3.0.0-alpha1-10123 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 3.0.0-alpha1-10081 - 3.0.0-alpha1-10081 + 3.0.0-alpha1-10123 + 3.0.0-alpha1-10123 3.0.0-preview1-26710-03 - 3.0.0-alpha1-10081 - 3.0.0-alpha1-10081 + 3.0.0-alpha1-10123 + 3.0.0-alpha1-10123 2.0.9 2.1.2 2.2.0-preview1-26618-02 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index c6adb40215..4cfdfb010e 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:3.0.0-alpha1-10009 -commithash:86be4707e47d2f1930a982f2b59eacfc4196da33 +version:3.0.0-alpha1-10011 +commithash:717c2eb1f91dafd2580c1a9b8e5064d12dd8c054 From 1de182b6b8f6f89f1197a2f6a20c04f5142553de Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Tue, 24 Jul 2018 10:55:13 -0700 Subject: [PATCH 09/58] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From 9e73caa4adc2e8fad6b7398b9ceb9caa9473aeea Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 29 Jul 2018 20:07:24 +0000 Subject: [PATCH 10/58] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 27 ++++++++++++++------------- korebuild-lock.txt | 4 ++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index e4656f54ad..3e4d6ec313 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 0.10.13 - 3.0.0-alpha1-10011 - 3.0.0-alpha1-10123 - 3.0.0-alpha1-10123 - 3.0.0-alpha1-10123 + 3.0.0-alpha1-10015 + 3.0.0-alpha1-10173 + 3.0.0-alpha1-10173 + 3.0.0-alpha1-10173 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 3.0.0-alpha1-10123 - 3.0.0-alpha1-10123 - 3.0.0-preview1-26710-03 - 3.0.0-alpha1-10123 - 3.0.0-alpha1-10123 + 3.0.0-alpha1-10173 + 3.0.0-alpha1-10173 + 3.0.0-preview1-26727-03 + 3.0.0-alpha1-10173 + 3.0.0-alpha1-10173 2.0.9 2.1.2 2.2.0-preview1-26618-02 @@ -43,9 +43,9 @@ 2.0.3 11.0.2 1.1.92 - 4.6.0-preview1-26708-04 + 4.6.0-preview1-26727-04 4.3.0 - 4.6.0-preview1-26708-04 + 4.6.0-preview1-26727-04 9.0.1 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 @@ -57,10 +57,11 @@ 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 - 0.9.0 + 0.10.0 2.3.1 - 2.4.0-rc.1.build4038 + 2.4.0 + diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 4cfdfb010e..8c70cbad9f 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:3.0.0-alpha1-10011 -commithash:717c2eb1f91dafd2580c1a9b8e5064d12dd8c054 +version:3.0.0-alpha1-10015 +commithash:3f36e5c2f061712f76f2766c435d2555681d5c55 From 94a131414627d4eda52d1ffd6649277134f906a3 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Mon, 30 Jul 2018 18:07:54 -0700 Subject: [PATCH 11/58] Add IVT to strong name shim for investigative purposes. --- .../Properties/AssemblyInfo.cs | 1 + .../Properties/AssemblyInfo.cs | 1 + src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs index 7214d8baca..e47484c273 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.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.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.StrongNamed, 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.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs index fefb5cd1de..36e4a39988 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.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.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.StrongNamed, 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/Properties/AssemblyInfo.cs b/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs index 0de18b91dc..b19b6cc23a 100644 --- a/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs +++ b/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Runtime.CompilerServices; - +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.StrongNamed, 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.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs b/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs index 47ff95c911..b862d878ba 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.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.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.StrongNamed, 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")] From cc4fbfe2d95fa75afd6238b7185fdd09b5a76045 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 5 Aug 2018 20:02:00 +0000 Subject: [PATCH 12/58] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 18 +++++++++--------- korebuild-lock.txt | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 3e4d6ec313..910334101b 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 0.10.13 - 3.0.0-alpha1-10015 - 3.0.0-alpha1-10173 - 3.0.0-alpha1-10173 - 3.0.0-alpha1-10173 + 3.0.0-alpha1-20180731.2 + 3.0.0-alpha1-10221 + 3.0.0-alpha1-10221 + 3.0.0-alpha1-10221 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 3.0.0-alpha1-10173 - 3.0.0-alpha1-10173 - 3.0.0-preview1-26727-03 - 3.0.0-alpha1-10173 - 3.0.0-alpha1-10173 + 3.0.0-alpha1-10221 + 3.0.0-alpha1-10221 + 3.0.0-preview1-26731-01 + 3.0.0-alpha1-10221 + 3.0.0-alpha1-10221 2.0.9 2.1.2 2.2.0-preview1-26618-02 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 8c70cbad9f..fe0f897b25 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:3.0.0-alpha1-10015 -commithash:3f36e5c2f061712f76f2766c435d2555681d5c55 +version:3.0.0-alpha1-20180731.2 +commithash:1179f1083695ac9213c8a70a4d1d6c45a52caf41 From aec88e3eba339f91f75a4d1aa68ff7736aee34ee Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 6 Jun 2018 14:30:42 -0700 Subject: [PATCH 13/58] Change Razor directive completions to use new completions API. - Kept the same behavior as we previously had with Razor directive completions. - Attempted adding additional functionalities such as lighting up Razor directive completion when completion was invoked on top of Razor directives (non-C#) but ran into issues involving the core HTML editor not consuming the new completion APIs yet. That's something we'll have to re-visit once they move to the new completion APIs. - Added tests to validate all aspects of new completion APIs. - Made completion provider turn on and off based off of feature flag. #1743 #1813 --- build/dependencies.props | 3 +- ...Microsoft.VisualStudio.Editor.Razor.csproj | 4 +- .../RazorDirectiveCompletionProvider.cs | 28 +- .../RazorDirectiveCompletionSource.cs | 167 ++++++++ .../RazorDirectiveCompletionSourceProvider.cs | 64 +++ .../RazorDirectiveCompletionProviderTest.cs | 73 +++- ...orDirectiveCompletionSourceProviderTest.cs | 99 +++++ .../RazorDirectiveCompletionSourceTest.cs | 369 ++++++++++++++++++ 8 files changed, 786 insertions(+), 21 deletions(-) create mode 100644 src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs create mode 100644 src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceProviderTest.cs create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceTest.cs diff --git a/build/dependencies.props b/build/dependencies.props index 910334101b..3668a75360 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -25,6 +25,7 @@ 15.0.26606 15.6.161-preview 15.6.161-preview + 15.8.519 7.10.6070 15.3.224 2.0.6142705 @@ -42,7 +43,7 @@ 4.7.49 2.0.3 11.0.2 - 1.1.92 + 1.3.23 4.6.0-preview1-26727-04 4.3.0 4.6.0-preview1-26727-04 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..0022ff4c94 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,9 @@ - + + + diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs index 6a2d017716..fc3a4b9ed3 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs @@ -13,9 +13,9 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.CodeAnalysis; 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 +36,33 @@ namespace Microsoft.VisualStudio.Editor.Razor CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, }; private readonly Lazy _codeDocumentProvider; + private readonly IAsyncCompletionBroker _asyncCompletionBroker; + private readonly RazorTextBufferProvider _textBufferProvider; [ImportingConstructor] - public RazorDirectiveCompletionProvider([Import(typeof(RazorCodeDocumentProvider))] Lazy codeDocumentProvider) + public RazorDirectiveCompletionProvider( + [Import(typeof(RazorCodeDocumentProvider))] Lazy codeDocumentProvider, + IAsyncCompletionBroker asyncCompletionBroker, + RazorTextBufferProvider textBufferProvider) { if (codeDocumentProvider == null) { throw new ArgumentNullException(nameof(codeDocumentProvider)); } + if (asyncCompletionBroker == null) + { + throw new ArgumentNullException(nameof(asyncCompletionBroker)); + } + + if (textBufferProvider == null) + { + throw new ArgumentNullException(nameof(textBufferProvider)); + } + _codeDocumentProvider = codeDocumentProvider; + _asyncCompletionBroker = asyncCompletionBroker; + _textBufferProvider = textBufferProvider; } public override Task GetDescriptionAsync(Document document, CompletionItem item, CancellationToken cancellationToken) @@ -86,6 +103,13 @@ namespace Microsoft.VisualStudio.Editor.Razor return Task.CompletedTask; } + if (!_textBufferProvider.TryGetFromDocument(context.Document, out var textBuffer) || + !_asyncCompletionBroker.IsCompletionSupported(textBuffer.ContentType)) + { + // Completion is not supported. + return Task.CompletedTask; + } + var result = AddCompletionItems(context); return result; diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs new file mode 100644 index 0000000000..06677a843c --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs @@ -0,0 +1,167 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Legacy; +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(); + private static readonly IEnumerable DefaultDirectives = new[] + { + CSharpCodeParser.AddTagHelperDirectiveDescriptor, + CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, + CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, + }; + + // Internal for testing + internal readonly VisualStudioRazorParser _parser; + private readonly ForegroundDispatcher _foregroundDispatcher; + + public RazorDirectiveCompletionSource( + VisualStudioRazorParser parser, + ForegroundDispatcher foregroundDispatcher) + { + if (parser == null) + { + throw new ArgumentNullException(nameof(parser)); + } + + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + _parser = parser; + _foregroundDispatcher = foregroundDispatcher; + } + + public Task GetCompletionContextAsync( + InitialTrigger trigger, + SnapshotPoint triggerLocation, + SnapshotSpan applicableSpan, + CancellationToken token) + { + _foregroundDispatcher.AssertBackgroundThread(); + + var syntaxTree = _parser.CodeDocument?.GetSyntaxTree(); + if (!AtDirectiveCompletionPoint(syntaxTree, triggerLocation)) + { + return Task.FromResult(CompletionContext.Empty); + } + + var completionItems = GetCompletionItems(syntaxTree); + var context = new CompletionContext(completionItems.ToImmutableArray()); + return Task.FromResult(context); + } + + public Task GetDescriptionAsync(CompletionItem item, CancellationToken token) + { + if (!item.Properties.TryGetProperty(DescriptionKey, out var directiveDescription)) + { + directiveDescription = string.Empty; + } + + return Task.FromResult(directiveDescription); + } + + public bool TryGetApplicableToSpan(char typeChar, SnapshotPoint triggerLocation, out SnapshotSpan applicableToSpan, 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. + applicableToSpan = default(SnapshotSpan); + return false; + } + + // Internal for testing + internal List GetCompletionItems(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 CompletionItem( + displayText: completionDisplayText, + filterText: completionDisplayText, + insertText: directive.Directive, + source: this, + icon: DirectiveImageGlyph, + filters: DirectiveCompletionFilters, + suffix: string.Empty, + sortText: completionDisplayText, + attributeIcons: ImmutableArray.Empty); + completionItem.Properties.AddProperty(DescriptionKey, directive.Description); + completionItems.Add(completionItem); + } + + return completionItems; + } + + // Internal for testing + internal static bool AtDirectiveCompletionPoint(RazorSyntaxTree syntaxTree, SnapshotPoint location) + { + if (syntaxTree == null) + { + return false; + } + + var change = new SourceChange(location.Position, 0, 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(IToken token) + { + if (!(token is CSharpToken csharpToken)) + { + return false; + } + + return csharpToken.Type == CSharpTokenType.Identifier || + // Marker symbol + csharpToken.Type == CSharpTokenType.Unknown; + } + } +} diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs new file mode 100644 index 0000000000..343bfba36f --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs @@ -0,0 +1,64 @@ +// 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; + + [ImportingConstructor] + public RazorDirectiveCompletionSourceProvider(ForegroundDispatcher foregroundDispatcher) + { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + _foregroundDispatcher = foregroundDispatcher; + } + + 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(parser, _foregroundDispatcher); + return completionSource; + } + } +} diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs index 1b76f772b6..d6e5ff747d 100644 --- a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.ComponentModel.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -16,9 +15,12 @@ using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Tags; using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Utilities; using Moq; using Xunit; +using ITextBuffer = Microsoft.VisualStudio.Text.ITextBuffer; namespace Microsoft.VisualStudio.Editor.Razor { @@ -31,12 +33,23 @@ namespace Microsoft.VisualStudio.Editor.Razor CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, }; + public RazorDirectiveCompletionProviderTest() + { + CompletionBroker = Mock.Of(broker => broker.IsCompletionSupported(It.IsAny()) == true); + var razorBuffer = Mock.Of(buffer => buffer.ContentType == Mock.Of()); + TextBufferProvider = Mock.Of(provider => provider.TryGetFromDocument(It.IsAny(), out razorBuffer) == true); + } + + private IAsyncCompletionBroker CompletionBroker { get; } + + private RazorTextBufferProvider TextBufferProvider { get; } + [Fact] public void AtDirectiveCompletionPoint_ReturnsFalseIfChangeHasNoOwner() { // Arrange var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider); + var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); var document = CreateDocument(); codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); var syntaxTree = codeDocument.GetSyntaxTree(); @@ -61,7 +74,10 @@ namespace Microsoft.VisualStudio.Editor.Razor [RazorDirectiveCompletionProvider.DescriptionKey] = expectedDescription, }).ToImmutableDictionary()); var codeDocumentProvider = new Mock(); - var completionProvider = new RazorDirectiveCompletionProvider(new Lazy(() => codeDocumentProvider.Object)); + var completionProvider = new RazorDirectiveCompletionProvider( + new Lazy(() => codeDocumentProvider.Object), + CompletionBroker, + TextBufferProvider); // Act var description = await completionProvider.GetDescriptionAsync(document, item, CancellationToken.None); @@ -80,7 +96,10 @@ namespace Microsoft.VisualStudio.Editor.Razor var document = CreateDocument(); var item = CompletionItem.Create("TestDirective"); var codeDocumentProvider = new Mock(); - var completionProvider = new RazorDirectiveCompletionProvider(new Lazy(() => codeDocumentProvider.Object)); + var completionProvider = new RazorDirectiveCompletionProvider( + new Lazy(() => codeDocumentProvider.Object), + CompletionBroker, + TextBufferProvider); // Act var description = await completionProvider.GetDescriptionAsync(document, item, CancellationToken.None); @@ -95,7 +114,10 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var codeDocumentProvider = new Mock(MockBehavior.Strict); - var completionProvider = new FailOnGetCompletionsProvider(new Lazy(() => codeDocumentProvider.Object)); + var completionProvider = new FailOnGetCompletionsProvider( + new Lazy(() => codeDocumentProvider.Object), + CompletionBroker, + TextBufferProvider); var document = CreateDocument(); document = document.WithFilePath("NotRazor.cs"); var context = CreateContext(1, completionProvider, document); @@ -121,7 +143,10 @@ namespace Microsoft.VisualStudio.Editor.Razor }); var codeDocumentProvider = new Mock(MockBehavior.Strict); - var completionProvider = new FailOnGetCompletionsProvider(new Lazy(() => codeDocumentProvider.Object)); + var completionProvider = new FailOnGetCompletionsProvider( + new Lazy(() => codeDocumentProvider.Object), + CompletionBroker, + TextBufferProvider); var context = CreateContext(1, completionProvider, document); // Act & Assert @@ -136,7 +161,10 @@ namespace Microsoft.VisualStudio.Editor.Razor var codeDocumentProvider = new Mock(); codeDocumentProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out codeDocument)) .Returns(false); - var completionProvider = new FailOnGetCompletionsProvider(new Lazy(() => codeDocumentProvider.Object)); + var completionProvider = new FailOnGetCompletionsProvider( + new Lazy(() => codeDocumentProvider.Object), + CompletionBroker, + TextBufferProvider); var document = CreateDocument(); var context = CreateContext(1, completionProvider, document); @@ -149,7 +177,11 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, false); + var completionProvider = new FailOnGetCompletionsProvider( + codeDocumentProvider, + CompletionBroker, + TextBufferProvider, + canGetSnapshotPoint: false); var document = CreateDocument(); var context = CreateContext(0, completionProvider, document); @@ -162,7 +194,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider); + var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); var document = CreateDocument(); var context = CreateContext(0, completionProvider, document); @@ -177,7 +209,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var codeDocumentProvider = CreateCodeDocumentProvider("@" + content, Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider); + var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); var document = CreateDocument(); var context = CreateContext(1, completionProvider, document); @@ -190,7 +222,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var codeDocumentProvider = CreateCodeDocumentProvider("@()", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider); + var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); var document = CreateDocument(); var context = CreateContext(2, completionProvider, document); @@ -206,7 +238,10 @@ namespace Microsoft.VisualStudio.Editor.Razor var codeDocument = TestRazorCodeDocument.CreateEmpty(); codeDocumentProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out codeDocument)) .Returns(true); - var completionProvider = new FailOnGetCompletionsProvider(new Lazy(() => codeDocumentProvider.Object)); + var completionProvider = new FailOnGetCompletionsProvider( + new Lazy(() => codeDocumentProvider.Object), + CompletionBroker, + TextBufferProvider); var document = CreateDocument(); var context = CreateContext(2, completionProvider, document); @@ -219,7 +254,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider); + var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); var document = CreateDocument(); codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); var syntaxTree = codeDocument.GetSyntaxTree(); @@ -240,7 +275,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var codeDocumentProvider = CreateCodeDocumentProvider("@", new[] { SectionDirective.Directive }); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider); + var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); var document = CreateDocument(); codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); var syntaxTree = codeDocument.GetSyntaxTree(); @@ -263,7 +298,7 @@ namespace Microsoft.VisualStudio.Editor.Razor // Arrange var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom"); var codeDocumentProvider = CreateCodeDocumentProvider("@", new[] { customDirective }); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider); + var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); var document = CreateDocument(); codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); var syntaxTree = codeDocument.GetSyntaxTree(); @@ -348,8 +383,12 @@ namespace Microsoft.VisualStudio.Editor.Razor { private readonly bool _canGetSnapshotPoint; - public FailOnGetCompletionsProvider(Lazy codeDocumentProvider, bool canGetSnapshotPoint = true) - : base(codeDocumentProvider) + public FailOnGetCompletionsProvider( + Lazy codeDocumentProvider, + IAsyncCompletionBroker asyncCompletionBroker, + RazorTextBufferProvider textBufferProvider, + bool canGetSnapshotPoint = true) + : base(codeDocumentProvider, asyncCompletionBroker, textBufferProvider) { _canGetSnapshotPoint = canGetSnapshotPoint; } diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceProviderTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceProviderTest.cs new file mode 100644 index 0000000000..5cffff529b --- /dev/null +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceProviderTest.cs @@ -0,0 +1,99 @@ +// 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.ObjectModel; +using Microsoft.CodeAnalysis.Razor; +using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.Text.Projection; +using Microsoft.VisualStudio.Utilities; +using Moq; +using Xunit; + +namespace Microsoft.VisualStudio.Editor.Razor +{ + public class RazorDirectiveCompletionSourceProviderTest : ForegroundDispatcherTestBase + { + private IContentType RazorContentType { get; } = Mock.Of(c => c.IsOfType(RazorLanguage.ContentType) == true); + + private IContentType NonRazorContentType { get; } = Mock.Of(c => c.IsOfType(It.IsAny()) == false); + + [Fact] + public void CreateCompletionSource_ReturnsNullIfParserHasNotBeenAssocitedWithRazorBuffer() + { + // Arrange + var expectedParser = Mock.Of(); + var properties = new PropertyCollection(); + properties.AddProperty(typeof(VisualStudioRazorParser), expectedParser); + var razorBuffer = Mock.Of(buffer => buffer.ContentType == RazorContentType && buffer.Properties == properties); + var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher); + + // Act + var completionSource = completionSourceProvider.CreateCompletionSource(razorBuffer); + + // Assert + var completionSourceImpl = Assert.IsType(completionSource); + Assert.Same(expectedParser, completionSourceImpl._parser); + } + + [Fact] + public void CreateCompletionSource_CreatesACompletionSourceWithTextBuffersParser() + { + // Arrange + var razorBuffer = Mock.Of(buffer => buffer.ContentType == RazorContentType && buffer.Properties == new PropertyCollection()); + var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher); + + // Act + var completionSource = completionSourceProvider.CreateCompletionSource(razorBuffer); + + // Assert + Assert.Null(completionSource); + } + + [Fact] + public void GetOrCreate_ReturnsNullIfRazorBufferHasNotBeenAssociatedWithTextView() + { + // Arrange + var textView = CreateTextView(NonRazorContentType, new PropertyCollection()); + var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher); + + // Act + var completionSource = completionSourceProvider.GetOrCreate(textView); + + // Assert + Assert.Null(completionSource); + } + + [Fact] + public void GetOrCreate_CachesCompletionSource() + { + // Arrange + var expectedParser = Mock.Of(); + var properties = new PropertyCollection(); + properties.AddProperty(typeof(VisualStudioRazorParser), expectedParser); + var textView = CreateTextView(RazorContentType, properties); + var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher); + + // Act + var completionSource1 = completionSourceProvider.GetOrCreate(textView); + var completionSource2 = completionSourceProvider.GetOrCreate(textView); + + // Assert + Assert.Same(completionSource1, completionSource2); + } + + private static ITextView CreateTextView(IContentType contentType, PropertyCollection properties) + { + var bufferGraph = new Mock(); + bufferGraph.Setup(graph => graph.GetTextBuffers(It.IsAny>())) + .Returns(new Collection() + { + Mock.Of(buffer => buffer.ContentType == contentType && buffer.Properties == properties) + }); + var textView = Mock.Of(view => view.BufferGraph == bufferGraph.Object); + + return textView; + } + } +} diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceTest.cs new file mode 100644 index 0000000000..3e51fbf0fe --- /dev/null +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceTest.cs @@ -0,0 +1,369 @@ +// 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.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Extensions; +using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; +using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data; +using Microsoft.VisualStudio.Text; +using Moq; +using Xunit; +using Span = Microsoft.VisualStudio.Text.Span; + +namespace Microsoft.VisualStudio.Editor.Razor +{ + public class RazorDirectiveCompletionSourceTest : ForegroundDispatcherTestBase + { + private static readonly IReadOnlyList DefaultDirectives = new[] + { + CSharpCodeParser.AddTagHelperDirectiveDescriptor, + CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, + CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, + }; + + [ForegroundFact] + public async Task GetCompletionContextAsync_DoesNotProvideCompletionsPriorToParseResults() + { + // Arrange + var text = "@validCompletion"; + var parser = Mock.Of(); // CodeDocument will be null faking a parser without a parse. + var completionSource = new RazorDirectiveCompletionSource(parser, Dispatcher); + var documentSnapshot = new StringTextSnapshot(text); + var triggerLocation = new SnapshotPoint(documentSnapshot, 4); + var applicableSpan = new SnapshotSpan(documentSnapshot, new Span(1, text.Length - 1 /* @ */)); + + // Act + var completionContext = await Task.Run( + async () => await completionSource.GetCompletionContextAsync(new InitialTrigger(), triggerLocation, applicableSpan, CancellationToken.None)); + + // Assert + Assert.Empty(completionContext.Items); + } + + [ForegroundFact] + public async Task GetCompletionContextAsync_DoesNotProvideCompletionsWhenNotAtCompletionPoint() + { + // Arrange + var text = "@(NotValidCompletionLocation)"; + var parser = CreateParser(text); + var completionSource = new RazorDirectiveCompletionSource(parser, Dispatcher); + var documentSnapshot = new StringTextSnapshot(text); + var triggerLocation = new SnapshotPoint(documentSnapshot, 4); + var applicableSpan = new SnapshotSpan(documentSnapshot, new Span(2, text.Length - 3 /* @() */)); + + // Act + var completionContext = await Task.Run( + async () => await completionSource.GetCompletionContextAsync(new InitialTrigger(), triggerLocation, applicableSpan, CancellationToken.None)); + + // Assert + Assert.Empty(completionContext.Items); + } + + // This is more of an integration level test validating the end-to-end completion flow. + [ForegroundFact] + public async Task GetCompletionContextAsync_ProvidesCompletionsWhenAtCompletionPoint() + { + // Arrange + var text = "@addTag"; + var parser = CreateParser(text, SectionDirective.Directive); + var completionSource = new RazorDirectiveCompletionSource(parser, Dispatcher); + var documentSnapshot = new StringTextSnapshot(text); + var triggerLocation = new SnapshotPoint(documentSnapshot, 4); + var applicableSpan = new SnapshotSpan(documentSnapshot, new Span(1, text.Length - 1 /* @ */)); + + // Act + var completionContext = await Task.Run( + async () => await completionSource.GetCompletionContextAsync(new InitialTrigger(), triggerLocation, applicableSpan, CancellationToken.None)); + + // Assert + Assert.Collection( + completionContext.Items, + item => AssertRazorCompletionItem(SectionDirective.Directive, item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[0], item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[1], item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[2], item, completionSource)); + } + + [Fact] + public void GetCompletionItems_ReturnsDefaultDirectivesAsCompletionItems() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@addTag"); + var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); + + // Act + var completionItems = completionSource.GetCompletionItems(syntaxTree); + + // Assert + Assert.Collection( + completionItems, + item => AssertRazorCompletionItem(DefaultDirectives[0], item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[1], item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[2], item, completionSource)); + } + + [Fact] + public void GetCompletionItems_ReturnsCustomDirectivesAsCompletionItems() + { + // Arrange + var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom", builder => + { + builder.Description = "My Custom Directive."; + }); + var syntaxTree = CreateSyntaxTree("@addTag", customDirective); + var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); + + // Act + var completionItems = completionSource.GetCompletionItems(syntaxTree); + + // Assert + Assert.Collection( + completionItems, + item => AssertRazorCompletionItem(customDirective, item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[0], item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[1], item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[2], item, completionSource)); + } + + [Fact] + public void GetCompletionItems_UsesDisplayNamesWhenNotNull() + { + // Arrange + var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom", builder => + { + builder.DisplayName = "different"; + builder.Description = "My Custom Directive."; + }); + var syntaxTree = CreateSyntaxTree("@addTag", customDirective); + var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); + + // Act + var completionItems = completionSource.GetCompletionItems(syntaxTree); + + // Assert + Assert.Collection( + completionItems, + item => AssertRazorCompletionItem("different", customDirective, item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[0], item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[1], item, completionSource), + item => AssertRazorCompletionItem(DefaultDirectives[2], item, completionSource)); + } + + [Fact] + public async Task GetDescriptionAsync_AddsDirectiveDescriptionIfPropertyExists() + { + // Arrange + var completionItem = new CompletionItem("TestDirective", Mock.Of()); + var expectedDescription = "The expected description"; + completionItem.Properties.AddProperty(RazorDirectiveCompletionSource.DescriptionKey, expectedDescription); + var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); + + // Act + var descriptionObject = await completionSource.GetDescriptionAsync(completionItem, CancellationToken.None); + + // Assert + var description = Assert.IsType(descriptionObject); + Assert.Equal(expectedDescription, descriptionObject); + } + + [Fact] + public async Task GetDescriptionAsync_DoesNotAddDescriptionWhenPropertyAbsent() + { + // Arrange + var completionItem = new CompletionItem("TestDirective", Mock.Of()); + var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); + + // Act + var descriptionObject = await completionSource.GetDescriptionAsync(completionItem, CancellationToken.None); + + // Assert + var description = Assert.IsType(descriptionObject); + Assert.Equal(string.Empty, description); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseIfSyntaxTreeNull() + { + // Act + var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree: null, location: new SnapshotPoint()); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseIfNoOwner() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@"); + var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@ text"), 2); + + // Act + var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsNotExpression() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@{"); + var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@{"), 2); + + // Act + var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsComplexExpression() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@DateTime.Now"); + var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@DateTime.Now"), 2); + + // Act + var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsExplicitExpression() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@(something)"); + var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@(something)"), 4); + + // Act + var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsTrueForSimpleImplicitExpressions() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@mod"); + var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@mod"), 2); + + // Act + var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); + + // Assert + Assert.True(result); + } + + [Fact] + public void IsDirectiveCompletableToken_ReturnsTrueForCSharpIdentifiers() + { + // Arrange + var csharpToken = new CSharpToken("model", CSharpTokenType.Identifier); + + // Act + var result = RazorDirectiveCompletionSource.IsDirectiveCompletableToken(csharpToken); + + // Assert + Assert.True(result); + } + + [Fact] + public void IsDirectiveCompletableToken_ReturnsTrueForCSharpMarkerTokens() + { + // Arrange + var csharpToken = new CSharpToken(string.Empty, CSharpTokenType.Unknown); + + // Act + var result = RazorDirectiveCompletionSource.IsDirectiveCompletableToken(csharpToken); + + // Assert + Assert.True(result); + } + + [Fact] + public void IsDirectiveCompletableToken_ReturnsFalseForNonCSharpTokens() + { + // Arrange + var token = Mock.Of(); + + // Act + var result = RazorDirectiveCompletionSource.IsDirectiveCompletableToken(token); + + // Assert + Assert.False(result); + } + + [Fact] + public void IsDirectiveCompletableToken_ReturnsFalseForInvalidCSharpTokens() + { + // Arrange + var csharpToken = new CSharpToken("~", CSharpTokenType.Tilde); + + // Act + var result = RazorDirectiveCompletionSource.IsDirectiveCompletableToken(csharpToken); + + // Assert + Assert.False(result); + } + + private static void AssertRazorCompletionItem(string completionDisplayText, DirectiveDescriptor directive, CompletionItem item, IAsyncCompletionSource source) + { + Assert.Equal(item.DisplayText, completionDisplayText); + Assert.Equal(item.FilterText, completionDisplayText); + Assert.Equal(item.InsertText, directive.Directive); + Assert.Same(item.Source, source); + Assert.True(item.Properties.TryGetProperty(RazorDirectiveCompletionSource.DescriptionKey, out var actualDescription)); + Assert.Equal(directive.Description, actualDescription); + + AssertRazorCompletionItemDefaults(item); + } + + private static void AssertRazorCompletionItem(DirectiveDescriptor directive, CompletionItem item, IAsyncCompletionSource source) => + AssertRazorCompletionItem(directive.Directive, directive, item, source); + + private static void AssertRazorCompletionItemDefaults(CompletionItem item) + { + Assert.Equal(item.Icon.ImageId.Guid, RazorDirectiveCompletionSource.DirectiveImageGlyph.ImageId.Guid); + var filter = Assert.Single(item.Filters); + Assert.Same(RazorDirectiveCompletionSource.DirectiveCompletionFilters[0], filter); + Assert.Equal(string.Empty, item.Suffix); + Assert.Equal(item.DisplayText, item.SortText); + Assert.Empty(item.AttributeIcons); + } + + private static VisualStudioRazorParser CreateParser(string text, params DirectiveDescriptor[] directives) + { + var syntaxTree = CreateSyntaxTree(text, directives); + var codeDocument = TestRazorCodeDocument.Create(text); + codeDocument.SetSyntaxTree(syntaxTree); + var parser = Mock.Of(p => p.CodeDocument == codeDocument); + + return parser; + } + + private static RazorSyntaxTree CreateSyntaxTree(string text, params DirectiveDescriptor[] directives) + { + var sourceDocument = TestRazorSourceDocument.Create(text); + var options = RazorParserOptions.Create(builder => + { + foreach (var directive in directives) + { + builder.Directives.Add(directive); + } + }); + var syntaxTree = RazorSyntaxTree.Parse(sourceDocument, options); + return syntaxTree; + } + } +} From 572b55690dd23e9df3239681dba5fc3c46022e6e Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 10 Aug 2018 11:41:11 -0700 Subject: [PATCH 14/58] Refactor completion logic into standalone service. - Migrated the completion item source provider and the legacy directive completion provider to use the new service. - Cleaned up duplicate tests that were both verifying common completion functionality. - Ensured that the legacy `RazorDirectiveCompletionProvider` did not result in additional Razor assembly loads when in C# scenarios. #2530 --- .../DefaultRazorCompletionFactsService.cs | 98 +++++++ .../RazorCompletionFactsService.cs | 13 + .../RazorCompletionItem.cs | 45 ++++ .../RazorCompletionItemKind.cs | 10 + .../RazorDirectiveCompletionProvider.cs | 73 ++---- .../RazorDirectiveCompletionSource.cs | 126 +++------ .../RazorDirectiveCompletionSourceProvider.cs | 13 +- .../DefaultRazorCompletionFactsServiceTest.cs | 239 ++++++++++++++++++ .../RazorDirectiveCompletionProviderTest.cs | 179 +------------ ...orDirectiveCompletionSourceProviderTest.cs | 10 +- .../RazorDirectiveCompletionSourceTest.cs | 213 +--------------- 11 files changed, 501 insertions(+), 518 deletions(-) create mode 100644 src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorCompletionFactsService.cs create mode 100644 src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionFactsService.cs create mode 100644 src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItem.cs create mode 100644 src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItemKind.cs create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorCompletionFactsServiceTest.cs diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorCompletionFactsService.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorCompletionFactsService.cs new file mode 100644 index 0000000000..57ac8ddb8d --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorCompletionFactsService.cs @@ -0,0 +1,98 @@ +// 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.ComponentModel.Composition; +using System.Linq; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Legacy; + +namespace Microsoft.VisualStudio.Editor.Razor +{ + [System.Composition.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(IToken token) + { + if (!(token is CSharpToken csharpToken)) + { + return false; + } + + return csharpToken.Type == CSharpTokenType.Identifier || + // Marker symbol + csharpToken.Type == CSharpTokenType.Unknown; + } + } +} diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionFactsService.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionFactsService.cs new file mode 100644 index 0000000000..5009002d13 --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/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.VisualStudio.Editor.Razor +{ + internal abstract class RazorCompletionFactsService + { + public abstract IReadOnlyList GetCompletionItems(RazorSyntaxTree syntaxTree, SourceSpan location); + } +} diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItem.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItem.cs new file mode 100644 index 0000000000..94a7bdb769 --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/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.VisualStudio.Editor.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.VisualStudio.Editor.Razor/RazorCompletionItemKind.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItemKind.cs new file mode 100644 index 0000000000..9925cb134a --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/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.VisualStudio.Editor.Razor +{ + internal enum RazorCompletionItemKind + { + Directive + } +} diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs index fc3a4b9ed3..607270c978 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs @@ -36,12 +36,14 @@ namespace Microsoft.VisualStudio.Editor.Razor CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, }; private readonly Lazy _codeDocumentProvider; + private readonly Lazy _completionFactsService; private readonly IAsyncCompletionBroker _asyncCompletionBroker; private readonly RazorTextBufferProvider _textBufferProvider; [ImportingConstructor] public RazorDirectiveCompletionProvider( [Import(typeof(RazorCodeDocumentProvider))] Lazy codeDocumentProvider, + [Import(typeof(RazorCompletionFactsService))] Lazy completionFactsService, IAsyncCompletionBroker asyncCompletionBroker, RazorTextBufferProvider textBufferProvider) { @@ -50,6 +52,11 @@ namespace Microsoft.VisualStudio.Editor.Razor throw new ArgumentNullException(nameof(codeDocumentProvider)); } + if (completionFactsService == null) + { + throw new ArgumentNullException(nameof(completionFactsService)); + } + if (asyncCompletionBroker == null) { throw new ArgumentNullException(nameof(asyncCompletionBroker)); @@ -61,6 +68,7 @@ namespace Microsoft.VisualStudio.Editor.Razor } _codeDocumentProvider = codeDocumentProvider; + _completionFactsService = completionFactsService; _asyncCompletionBroker = asyncCompletionBroker; _textBufferProvider = textBufferProvider; } @@ -133,70 +141,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 = _completionFactsService.Value.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) diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs index 06677a843c..6224fc43d4 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs @@ -4,11 +4,9 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.CodeAnalysis.Razor; using Microsoft.VisualStudio.Core.Imaging; using Microsoft.VisualStudio.Imaging; @@ -29,33 +27,35 @@ namespace Microsoft.VisualStudio.Editor.Razor internal static readonly ImmutableArray DirectiveCompletionFilters = new[] { new CompletionFilter("Razor Directive", "r", DirectiveImageGlyph) }.ToImmutableArray(); - private static readonly IEnumerable DefaultDirectives = new[] - { - CSharpCodeParser.AddTagHelperDirectiveDescriptor, - CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, - CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, - }; // Internal for testing internal readonly VisualStudioRazorParser _parser; + private readonly RazorCompletionFactsService _completionFactsService; private readonly ForegroundDispatcher _foregroundDispatcher; public RazorDirectiveCompletionSource( + ForegroundDispatcher foregroundDispatcher, VisualStudioRazorParser parser, - ForegroundDispatcher foregroundDispatcher) + RazorCompletionFactsService completionFactsService) { - if (parser == null) - { - throw new ArgumentNullException(nameof(parser)); - } - if (foregroundDispatcher == null) { throw new ArgumentNullException(nameof(foregroundDispatcher)); } - _parser = parser; + 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( @@ -67,12 +67,31 @@ namespace Microsoft.VisualStudio.Editor.Razor _foregroundDispatcher.AssertBackgroundThread(); var syntaxTree = _parser.CodeDocument?.GetSyntaxTree(); - if (!AtDirectiveCompletionPoint(syntaxTree, triggerLocation)) - { - return Task.FromResult(CompletionContext.Empty); - } + var location = new SourceSpan(applicableSpan.Start.Position, applicableSpan.Length); + var razorCompletionItems = _completionFactsService.GetCompletionItems(syntaxTree, location); - var completionItems = GetCompletionItems(syntaxTree); + 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); } @@ -96,72 +115,5 @@ namespace Microsoft.VisualStudio.Editor.Razor applicableToSpan = default(SnapshotSpan); return false; } - - // Internal for testing - internal List GetCompletionItems(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 CompletionItem( - displayText: completionDisplayText, - filterText: completionDisplayText, - insertText: directive.Directive, - source: this, - icon: DirectiveImageGlyph, - filters: DirectiveCompletionFilters, - suffix: string.Empty, - sortText: completionDisplayText, - attributeIcons: ImmutableArray.Empty); - completionItem.Properties.AddProperty(DescriptionKey, directive.Description); - completionItems.Add(completionItem); - } - - return completionItems; - } - - // Internal for testing - internal static bool AtDirectiveCompletionPoint(RazorSyntaxTree syntaxTree, SnapshotPoint location) - { - if (syntaxTree == null) - { - return false; - } - - var change = new SourceChange(location.Position, 0, 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(IToken token) - { - if (!(token is CSharpToken csharpToken)) - { - return false; - } - - return csharpToken.Type == CSharpTokenType.Identifier || - // Marker symbol - csharpToken.Type == CSharpTokenType.Unknown; - } } } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs index 343bfba36f..0c9e40a38f 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs @@ -19,16 +19,25 @@ namespace Microsoft.VisualStudio.Editor.Razor internal class RazorDirectiveCompletionSourceProvider : IAsyncCompletionSourceProvider { private readonly ForegroundDispatcher _foregroundDispatcher; + private readonly RazorCompletionFactsService _completionFactsService; [ImportingConstructor] - public RazorDirectiveCompletionSourceProvider(ForegroundDispatcher foregroundDispatcher) + 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) @@ -57,7 +66,7 @@ namespace Microsoft.VisualStudio.Editor.Razor return null; } - var completionSource = new RazorDirectiveCompletionSource(parser, _foregroundDispatcher); + var completionSource = new RazorDirectiveCompletionSource(_foregroundDispatcher, parser, _completionFactsService); return completionSource; } } diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorCompletionFactsServiceTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorCompletionFactsServiceTest.cs new file mode 100644 index 0000000000..a5f095be0d --- /dev/null +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorCompletionFactsServiceTest.cs @@ -0,0 +1,239 @@ +// 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; +using Microsoft.AspNetCore.Razor.Language.Legacy; +using Moq; +using Xunit; + +namespace Microsoft.VisualStudio.Editor.Razor +{ + public class DefaultRazorCompletionFactsServiceTest + { + private static readonly IReadOnlyList DefaultDirectives = new[] + { + CSharpCodeParser.AddTagHelperDirectiveDescriptor, + CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, + CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, + }; + + [Fact] + public void GetDirectiveCompletionItems_ReturnsDefaultDirectivesAsCompletionItems() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@addTag"); + + // Act + var completionItems = DefaultRazorCompletionFactsService.GetDirectiveCompletionItems(syntaxTree); + + // Assert + Assert.Collection( + completionItems, + item => AssertRazorCompletionItem(DefaultDirectives[0], item), + item => AssertRazorCompletionItem(DefaultDirectives[1], item), + item => AssertRazorCompletionItem(DefaultDirectives[2], item)); + } + + [Fact] + public void GetDirectiveCompletionItems_ReturnsCustomDirectivesAsCompletionItems() + { + // Arrange + var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom", builder => + { + builder.Description = "My Custom Directive."; + }); + var syntaxTree = CreateSyntaxTree("@addTag", customDirective); + + // Act + var completionItems = DefaultRazorCompletionFactsService.GetDirectiveCompletionItems(syntaxTree); + + // Assert + Assert.Collection( + completionItems, + item => AssertRazorCompletionItem(customDirective, item), + item => AssertRazorCompletionItem(DefaultDirectives[0], item), + item => AssertRazorCompletionItem(DefaultDirectives[1], item), + item => AssertRazorCompletionItem(DefaultDirectives[2], item)); + } + + [Fact] + public void GetDirectiveCompletionItems_UsesDisplayNamesWhenNotNull() + { + // Arrange + var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom", builder => + { + builder.DisplayName = "different"; + builder.Description = "My Custom Directive."; + }); + var syntaxTree = CreateSyntaxTree("@addTag", customDirective); + + // Act + var completionItems = DefaultRazorCompletionFactsService.GetDirectiveCompletionItems(syntaxTree); + + // Assert + Assert.Collection( + completionItems, + item => AssertRazorCompletionItem("different", customDirective, item), + item => AssertRazorCompletionItem(DefaultDirectives[0], item), + item => AssertRazorCompletionItem(DefaultDirectives[1], item), + item => AssertRazorCompletionItem(DefaultDirectives[2], item)); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseIfSyntaxTreeNull() + { + // Act + var result = DefaultRazorCompletionFactsService.AtDirectiveCompletionPoint(syntaxTree: null, location: new SourceSpan(0, 0)); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseIfNoOwner() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@"); + var location = new SourceSpan(2, 0); + + // Act + var result = DefaultRazorCompletionFactsService.AtDirectiveCompletionPoint(syntaxTree, location); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsNotExpression() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@{"); + var location = new SourceSpan(2, 0); + + // Act + var result = DefaultRazorCompletionFactsService.AtDirectiveCompletionPoint(syntaxTree, location); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsComplexExpression() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@DateTime.Now"); + var location = new SourceSpan(2, 0); + + // Act + var result = DefaultRazorCompletionFactsService.AtDirectiveCompletionPoint(syntaxTree, location); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsExplicitExpression() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@(something)"); + var location = new SourceSpan(4, 0); + + // Act + var result = DefaultRazorCompletionFactsService.AtDirectiveCompletionPoint(syntaxTree, location); + + // Assert + Assert.False(result); + } + + [Fact] + public void AtDirectiveCompletionPoint_ReturnsTrueForSimpleImplicitExpressions() + { + // Arrange + var syntaxTree = CreateSyntaxTree("@mod"); + var location = new SourceSpan(2, 0); + + // Act + var result = DefaultRazorCompletionFactsService.AtDirectiveCompletionPoint(syntaxTree, location); + + // Assert + Assert.True(result); + } + + [Fact] + public void IsDirectiveCompletableToken_ReturnsTrueForCSharpIdentifiers() + { + // Arrange + var csharpToken = new CSharpToken("model", CSharpTokenType.Identifier); + + // Act + var result = DefaultRazorCompletionFactsService.IsDirectiveCompletableToken(csharpToken); + + // Assert + Assert.True(result); + } + + [Fact] + public void IsDirectiveCompletableToken_ReturnsTrueForCSharpMarkerTokens() + { + // Arrange + var csharpToken = new CSharpToken(string.Empty, CSharpTokenType.Unknown); + + // Act + var result = DefaultRazorCompletionFactsService.IsDirectiveCompletableToken(csharpToken); + + // Assert + Assert.True(result); + } + + [Fact] + public void IsDirectiveCompletableToken_ReturnsFalseForNonCSharpTokens() + { + // Arrange + var token = Mock.Of(); + + // Act + var result = DefaultRazorCompletionFactsService.IsDirectiveCompletableToken(token); + + // Assert + Assert.False(result); + } + + [Fact] + public void IsDirectiveCompletableToken_ReturnsFalseForInvalidCSharpTokens() + { + // Arrange + var csharpToken = new CSharpToken("~", CSharpTokenType.Tilde); + + // Act + var result = DefaultRazorCompletionFactsService.IsDirectiveCompletableToken(csharpToken); + + // Assert + Assert.False(result); + } + + private static void AssertRazorCompletionItem(string completionDisplayText, DirectiveDescriptor directive, RazorCompletionItem item) + { + Assert.Equal(item.DisplayText, completionDisplayText); + Assert.Equal(item.InsertText, directive.Directive); + Assert.Equal(directive.Description, item.Description); + } + + private static void AssertRazorCompletionItem(DirectiveDescriptor directive, RazorCompletionItem item) => + AssertRazorCompletionItem(directive.Directive, directive, item); + + private static RazorSyntaxTree CreateSyntaxTree(string text, params DirectiveDescriptor[] directives) + { + var sourceDocument = TestRazorSourceDocument.Create(text); + var options = RazorParserOptions.Create(builder => + { + foreach (var directive in directives) + { + builder.Directives.Add(directive); + } + }); + var syntaxTree = RazorSyntaxTree.Parse(sourceDocument, options); + return syntaxTree; + } + } +} diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs index d6e5ff747d..cd35510b36 100644 --- a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs @@ -8,12 +8,9 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Extensions; -using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Tags; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; using Microsoft.VisualStudio.Text; @@ -26,41 +23,19 @@ namespace Microsoft.VisualStudio.Editor.Razor { public class RazorDirectiveCompletionProviderTest { - private static readonly IReadOnlyList DefaultDirectives = new[] - { - CSharpCodeParser.AddTagHelperDirectiveDescriptor, - CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, - CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, - }; - public RazorDirectiveCompletionProviderTest() { CompletionBroker = Mock.Of(broker => broker.IsCompletionSupported(It.IsAny()) == true); var razorBuffer = Mock.Of(buffer => buffer.ContentType == Mock.Of()); TextBufferProvider = Mock.Of(provider => provider.TryGetFromDocument(It.IsAny(), out razorBuffer) == true); + CompletionFactsService = new DefaultRazorCompletionFactsService(); } private IAsyncCompletionBroker CompletionBroker { get; } private RazorTextBufferProvider TextBufferProvider { get; } - [Fact] - public void AtDirectiveCompletionPoint_ReturnsFalseIfChangeHasNoOwner() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); - var document = CreateDocument(); - codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - var completionContext = CreateContext(2, completionProvider, document); - - // Act - var result = completionProvider.AtDirectiveCompletionPoint(syntaxTree, completionContext); - - // Assert - Assert.False(result); - } + private RazorCompletionFactsService CompletionFactsService { get; } [Fact] public async Task GetDescriptionAsync_AddsDirectiveDescriptionIfPropertyExists() @@ -76,6 +51,7 @@ namespace Microsoft.VisualStudio.Editor.Razor var codeDocumentProvider = new Mock(); var completionProvider = new RazorDirectiveCompletionProvider( new Lazy(() => codeDocumentProvider.Object), + new Lazy(() => CompletionFactsService), CompletionBroker, TextBufferProvider); @@ -98,6 +74,7 @@ namespace Microsoft.VisualStudio.Editor.Razor var codeDocumentProvider = new Mock(); var completionProvider = new RazorDirectiveCompletionProvider( new Lazy(() => codeDocumentProvider.Object), + new Lazy(() => CompletionFactsService), CompletionBroker, TextBufferProvider); @@ -126,7 +103,6 @@ namespace Microsoft.VisualStudio.Editor.Razor await completionProvider.ProvideCompletionsAsync(context); } - [Fact] public async Task ProvideCompletionAsync_DoesNotProvideCompletionsForDocumentWithoutPath() { @@ -189,145 +165,6 @@ namespace Microsoft.VisualStudio.Editor.Razor await completionProvider.ProvideCompletionsAsync(context); } - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsWhenNotAtCompletionPoint() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); - var document = CreateDocument(); - var context = CreateContext(0, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Theory] - [InlineData("DateTime.Now")] - [InlineData("SomeMethod()")] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsWhenAtComplexExpressions(string content) - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@" + content, Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); - var document = CreateDocument(); - var context = CreateContext(1, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsForExplicitExpressions() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@()", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); - var document = CreateDocument(); - var context = CreateContext(2, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsForCodeDocumentWithoutSyntaxTree() - { - // Arrange - var codeDocumentProvider = new Mock(); - var codeDocument = TestRazorCodeDocument.CreateEmpty(); - codeDocumentProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out codeDocument)) - .Returns(true); - var completionProvider = new FailOnGetCompletionsProvider( - new Lazy(() => codeDocumentProvider.Object), - CompletionBroker, - TextBufferProvider); - var document = CreateDocument(); - var context = CreateContext(2, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public void GetCompletionItems_ProvidesCompletionsForDefaultDirectives() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); - var document = CreateDocument(); - codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - - // Act - var completionItems = completionProvider.GetCompletionItems(syntaxTree); - - // Assert - Assert.Collection( - completionItems, - item => AssertRazorCompletionItem(DefaultDirectives[0].Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[1].Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[2].Description, item)); - } - - [Fact] - public void GetCompletionItems_ProvidesCompletionsForDefaultAndExtensibleDirectives() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", new[] { SectionDirective.Directive }); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); - var document = CreateDocument(); - codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - - // Act - var completionItems = completionProvider.GetCompletionItems(syntaxTree); - - // Assert - Assert.Collection( - completionItems, - item => AssertRazorCompletionItem(SectionDirective.Directive.Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[0].Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[1].Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[2].Description, item)); - } - - [Fact] - public void GetCompletionItems_ProvidesCompletionsForDirectivesWithoutDescription() - { - // Arrange - var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom"); - var codeDocumentProvider = CreateCodeDocumentProvider("@", new[] { customDirective }); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider, CompletionBroker, TextBufferProvider); - var document = CreateDocument(); - codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - - // Act - var completionItems = completionProvider.GetCompletionItems(syntaxTree); - - // Assert - var customDirectiveCompletion = Assert.Single(completionItems, item => item.DisplayText == customDirective.Directive); - AssertRazorCompletionItemDefaults(customDirectiveCompletion); - Assert.DoesNotContain(customDirectiveCompletion.Properties, property => property.Key == RazorDirectiveCompletionProvider.DescriptionKey); - } - - private static void AssertRazorCompletionItem(string expectedDescription, CompletionItem item) - { - Assert.True(item.Properties.TryGetValue(RazorDirectiveCompletionProvider.DescriptionKey, out var actualDescription)); - Assert.Equal(expectedDescription, actualDescription); - - AssertRazorCompletionItemDefaults(item); - } - - private static void AssertRazorCompletionItemDefaults(CompletionItem item) - { - Assert.Equal("_RazorDirective_", item.SortText); - Assert.False(item.Rules.FormatOnCommit); - var tag = Assert.Single(item.Tags); - Assert.Equal(WellKnownTags.Intrinsic, tag); - } - private static Lazy CreateCodeDocumentProvider(string text, IEnumerable directives) { var codeDocumentProvider = new Mock(); @@ -388,17 +225,11 @@ namespace Microsoft.VisualStudio.Editor.Razor IAsyncCompletionBroker asyncCompletionBroker, RazorTextBufferProvider textBufferProvider, bool canGetSnapshotPoint = true) - : base(codeDocumentProvider, asyncCompletionBroker, textBufferProvider) + : base(codeDocumentProvider, new Lazy(() => new DefaultRazorCompletionFactsService()), asyncCompletionBroker, textBufferProvider) { _canGetSnapshotPoint = canGetSnapshotPoint; } - internal override IEnumerable GetCompletionItems(RazorSyntaxTree syntaxTree) - { - Assert.False(true, "Completions should not have been attempted."); - return null; - } - protected override bool TryGetRazorSnapshotPoint(CompletionContext context, out SnapshotPoint snapshotPoint) { if (!_canGetSnapshotPoint) diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceProviderTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceProviderTest.cs index 5cffff529b..ac8dba7e3c 100644 --- a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceProviderTest.cs +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceProviderTest.cs @@ -19,6 +19,8 @@ namespace Microsoft.VisualStudio.Editor.Razor private IContentType NonRazorContentType { get; } = Mock.Of(c => c.IsOfType(It.IsAny()) == false); + private RazorCompletionFactsService CompletionFactsService { get; } = Mock.Of(); + [Fact] public void CreateCompletionSource_ReturnsNullIfParserHasNotBeenAssocitedWithRazorBuffer() { @@ -27,7 +29,7 @@ namespace Microsoft.VisualStudio.Editor.Razor var properties = new PropertyCollection(); properties.AddProperty(typeof(VisualStudioRazorParser), expectedParser); var razorBuffer = Mock.Of(buffer => buffer.ContentType == RazorContentType && buffer.Properties == properties); - var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher); + var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher, CompletionFactsService); // Act var completionSource = completionSourceProvider.CreateCompletionSource(razorBuffer); @@ -42,7 +44,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var razorBuffer = Mock.Of(buffer => buffer.ContentType == RazorContentType && buffer.Properties == new PropertyCollection()); - var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher); + var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher, CompletionFactsService); // Act var completionSource = completionSourceProvider.CreateCompletionSource(razorBuffer); @@ -56,7 +58,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var textView = CreateTextView(NonRazorContentType, new PropertyCollection()); - var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher); + var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher, CompletionFactsService); // Act var completionSource = completionSourceProvider.GetOrCreate(textView); @@ -73,7 +75,7 @@ namespace Microsoft.VisualStudio.Editor.Razor var properties = new PropertyCollection(); properties.AddProperty(typeof(VisualStudioRazorParser), expectedParser); var textView = CreateTextView(RazorContentType, properties); - var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher); + var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(Dispatcher, CompletionFactsService); // Act var completionSource1 = completionSourceProvider.GetOrCreate(textView); diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceTest.cs index 3e51fbf0fe..1c9516fa8a 100644 --- a/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceTest.cs +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionSourceTest.cs @@ -25,16 +25,18 @@ namespace Microsoft.VisualStudio.Editor.Razor CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, }; + private RazorCompletionFactsService CompletionFactsService { get; } = new DefaultRazorCompletionFactsService(); + [ForegroundFact] public async Task GetCompletionContextAsync_DoesNotProvideCompletionsPriorToParseResults() { // Arrange var text = "@validCompletion"; var parser = Mock.Of(); // CodeDocument will be null faking a parser without a parse. - var completionSource = new RazorDirectiveCompletionSource(parser, Dispatcher); + var completionSource = new RazorDirectiveCompletionSource(Dispatcher, parser, CompletionFactsService); var documentSnapshot = new StringTextSnapshot(text); var triggerLocation = new SnapshotPoint(documentSnapshot, 4); - var applicableSpan = new SnapshotSpan(documentSnapshot, new Span(1, text.Length - 1 /* @ */)); + var applicableSpan = new SnapshotSpan(documentSnapshot, new Span(1, text.Length - 1 /* validCompletion */)); // Act var completionContext = await Task.Run( @@ -50,7 +52,7 @@ namespace Microsoft.VisualStudio.Editor.Razor // Arrange var text = "@(NotValidCompletionLocation)"; var parser = CreateParser(text); - var completionSource = new RazorDirectiveCompletionSource(parser, Dispatcher); + var completionSource = new RazorDirectiveCompletionSource(Dispatcher, parser, CompletionFactsService); var documentSnapshot = new StringTextSnapshot(text); var triggerLocation = new SnapshotPoint(documentSnapshot, 4); var applicableSpan = new SnapshotSpan(documentSnapshot, new Span(2, text.Length - 3 /* @() */)); @@ -70,10 +72,10 @@ namespace Microsoft.VisualStudio.Editor.Razor // Arrange var text = "@addTag"; var parser = CreateParser(text, SectionDirective.Directive); - var completionSource = new RazorDirectiveCompletionSource(parser, Dispatcher); + var completionSource = new RazorDirectiveCompletionSource(Dispatcher, parser, CompletionFactsService); var documentSnapshot = new StringTextSnapshot(text); var triggerLocation = new SnapshotPoint(documentSnapshot, 4); - var applicableSpan = new SnapshotSpan(documentSnapshot, new Span(1, text.Length - 1 /* @ */)); + var applicableSpan = new SnapshotSpan(documentSnapshot, new Span(1, 6 /* addTag */)); // Act var completionContext = await Task.Run( @@ -88,71 +90,6 @@ namespace Microsoft.VisualStudio.Editor.Razor item => AssertRazorCompletionItem(DefaultDirectives[2], item, completionSource)); } - [Fact] - public void GetCompletionItems_ReturnsDefaultDirectivesAsCompletionItems() - { - // Arrange - var syntaxTree = CreateSyntaxTree("@addTag"); - var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); - - // Act - var completionItems = completionSource.GetCompletionItems(syntaxTree); - - // Assert - Assert.Collection( - completionItems, - item => AssertRazorCompletionItem(DefaultDirectives[0], item, completionSource), - item => AssertRazorCompletionItem(DefaultDirectives[1], item, completionSource), - item => AssertRazorCompletionItem(DefaultDirectives[2], item, completionSource)); - } - - [Fact] - public void GetCompletionItems_ReturnsCustomDirectivesAsCompletionItems() - { - // Arrange - var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom", builder => - { - builder.Description = "My Custom Directive."; - }); - var syntaxTree = CreateSyntaxTree("@addTag", customDirective); - var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); - - // Act - var completionItems = completionSource.GetCompletionItems(syntaxTree); - - // Assert - Assert.Collection( - completionItems, - item => AssertRazorCompletionItem(customDirective, item, completionSource), - item => AssertRazorCompletionItem(DefaultDirectives[0], item, completionSource), - item => AssertRazorCompletionItem(DefaultDirectives[1], item, completionSource), - item => AssertRazorCompletionItem(DefaultDirectives[2], item, completionSource)); - } - - [Fact] - public void GetCompletionItems_UsesDisplayNamesWhenNotNull() - { - // Arrange - var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom", builder => - { - builder.DisplayName = "different"; - builder.Description = "My Custom Directive."; - }); - var syntaxTree = CreateSyntaxTree("@addTag", customDirective); - var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); - - // Act - var completionItems = completionSource.GetCompletionItems(syntaxTree); - - // Assert - Assert.Collection( - completionItems, - item => AssertRazorCompletionItem("different", customDirective, item, completionSource), - item => AssertRazorCompletionItem(DefaultDirectives[0], item, completionSource), - item => AssertRazorCompletionItem(DefaultDirectives[1], item, completionSource), - item => AssertRazorCompletionItem(DefaultDirectives[2], item, completionSource)); - } - [Fact] public async Task GetDescriptionAsync_AddsDirectiveDescriptionIfPropertyExists() { @@ -160,7 +97,7 @@ namespace Microsoft.VisualStudio.Editor.Razor var completionItem = new CompletionItem("TestDirective", Mock.Of()); var expectedDescription = "The expected description"; completionItem.Properties.AddProperty(RazorDirectiveCompletionSource.DescriptionKey, expectedDescription); - var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); + var completionSource = new RazorDirectiveCompletionSource(Dispatcher, Mock.Of(), CompletionFactsService); // Act var descriptionObject = await completionSource.GetDescriptionAsync(completionItem, CancellationToken.None); @@ -175,7 +112,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { // Arrange var completionItem = new CompletionItem("TestDirective", Mock.Of()); - var completionSource = new RazorDirectiveCompletionSource(Mock.Of(), Dispatcher); + var completionSource = new RazorDirectiveCompletionSource(Dispatcher, Mock.Of(), CompletionFactsService); // Act var descriptionObject = await completionSource.GetDescriptionAsync(completionItem, CancellationToken.None); @@ -185,138 +122,6 @@ namespace Microsoft.VisualStudio.Editor.Razor Assert.Equal(string.Empty, description); } - [Fact] - public void AtDirectiveCompletionPoint_ReturnsFalseIfSyntaxTreeNull() - { - // Act - var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree: null, location: new SnapshotPoint()); - - // Assert - Assert.False(result); - } - - [Fact] - public void AtDirectiveCompletionPoint_ReturnsFalseIfNoOwner() - { - // Arrange - var syntaxTree = CreateSyntaxTree("@"); - var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@ text"), 2); - - // Act - var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); - - // Assert - Assert.False(result); - } - - [Fact] - public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsNotExpression() - { - // Arrange - var syntaxTree = CreateSyntaxTree("@{"); - var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@{"), 2); - - // Act - var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); - - // Assert - Assert.False(result); - } - - [Fact] - public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsComplexExpression() - { - // Arrange - var syntaxTree = CreateSyntaxTree("@DateTime.Now"); - var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@DateTime.Now"), 2); - - // Act - var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); - - // Assert - Assert.False(result); - } - - [Fact] - public void AtDirectiveCompletionPoint_ReturnsFalseWhenOwnerIsExplicitExpression() - { - // Arrange - var syntaxTree = CreateSyntaxTree("@(something)"); - var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@(something)"), 4); - - // Act - var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); - - // Assert - Assert.False(result); - } - - [Fact] - public void AtDirectiveCompletionPoint_ReturnsTrueForSimpleImplicitExpressions() - { - // Arrange - var syntaxTree = CreateSyntaxTree("@mod"); - var snapshotPoint = new SnapshotPoint(new StringTextSnapshot("@mod"), 2); - - // Act - var result = RazorDirectiveCompletionSource.AtDirectiveCompletionPoint(syntaxTree, snapshotPoint); - - // Assert - Assert.True(result); - } - - [Fact] - public void IsDirectiveCompletableToken_ReturnsTrueForCSharpIdentifiers() - { - // Arrange - var csharpToken = new CSharpToken("model", CSharpTokenType.Identifier); - - // Act - var result = RazorDirectiveCompletionSource.IsDirectiveCompletableToken(csharpToken); - - // Assert - Assert.True(result); - } - - [Fact] - public void IsDirectiveCompletableToken_ReturnsTrueForCSharpMarkerTokens() - { - // Arrange - var csharpToken = new CSharpToken(string.Empty, CSharpTokenType.Unknown); - - // Act - var result = RazorDirectiveCompletionSource.IsDirectiveCompletableToken(csharpToken); - - // Assert - Assert.True(result); - } - - [Fact] - public void IsDirectiveCompletableToken_ReturnsFalseForNonCSharpTokens() - { - // Arrange - var token = Mock.Of(); - - // Act - var result = RazorDirectiveCompletionSource.IsDirectiveCompletableToken(token); - - // Assert - Assert.False(result); - } - - [Fact] - public void IsDirectiveCompletableToken_ReturnsFalseForInvalidCSharpTokens() - { - // Arrange - var csharpToken = new CSharpToken("~", CSharpTokenType.Tilde); - - // Act - var result = RazorDirectiveCompletionSource.IsDirectiveCompletableToken(csharpToken); - - // Assert - Assert.False(result); - } - private static void AssertRazorCompletionItem(string completionDisplayText, DirectiveDescriptor directive, CompletionItem item, IAsyncCompletionSource source) { Assert.Equal(item.DisplayText, completionDisplayText); From 692e09b017d355229c10ea3f88b41f3a5f1a44a9 Mon Sep 17 00:00:00 2001 From: Artak <34246760+mkArtakMSFT@users.noreply.github.com> Date: Fri, 10 Aug 2018 14:46:58 -0700 Subject: [PATCH 15/58] Fixes #2491: Treating RazorCommentTransition-s similar to Transitions in tag content (#2531) * Treating RazorCommentTransition-s similar to Transitions in tag content --- .../Legacy/HtmlMarkupParser.cs | 4 +-- .../Legacy/CSharpRazorCommentsTest.cs | 12 +++++++++ .../RazorComments.cshtml | 3 +++ .../RazorComments_DesignTime.ir.txt | 13 ++++++++-- .../RazorComments_Runtime.codegen.cs | 7 +++--- .../RazorComments_Runtime.ir.txt | 13 ++++++++-- .../RazorCommentInClosingTagBlock.cspans.txt | 8 ++++++ .../RazorCommentInClosingTagBlock.stree.txt | 25 +++++++++++++++++++ .../RazorCommentInOpeningTagBlock.cspans.txt | 8 ++++++ .../RazorCommentInOpeningTagBlock.stree.txt | 25 +++++++++++++++++++ 10 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs index cbf0c1021a..4f4d710616 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs @@ -856,7 +856,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Capture whitespace var whitespace = ReadWhile(token => token.Type == HtmlTokenType.WhiteSpace || token.Type == HtmlTokenType.NewLine); - if (At(HtmlTokenType.Transition)) + if (At(HtmlTokenType.Transition) || At(HtmlTokenType.RazorCommentTransition)) { // Transition outside of attribute value => Switch to recovery mode Accept(whitespace); @@ -931,7 +931,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { // 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); 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/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/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..4ac1dd74e2 --- /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 + HtmlTokenType.OpenAngle;[<]; + HtmlTokenType.Text;[text]; + HtmlTokenType.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 + HtmlTokenType.RazorCommentTransition;[@]; + MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 + HtmlTokenType.RazorCommentStar;[*]; + Comment span - Gen - [ razor comment ] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 + HtmlTokenType.RazorComment;[ razor comment ]; + MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 + HtmlTokenType.RazorCommentStar;[*]; + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 + HtmlTokenType.RazorCommentTransition;[@]; + Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 + HtmlTokenType.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..2b80249ac8 --- /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 + HtmlTokenType.RazorCommentTransition;[@]; + MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (7:0,7) - Tokens:1 + HtmlTokenType.RazorCommentStar;[*]; + Comment span - Gen - [ razor comment ] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 + HtmlTokenType.RazorComment;[ razor comment ]; + MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 + HtmlTokenType.RazorCommentStar;[*]; + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (24:0,24) - Tokens:1 + HtmlTokenType.RazorCommentTransition;[@]; + Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 + HtmlTokenType.CloseAngle;[>]; + Tag block - Gen - 7 - (26:0,26) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:4 + HtmlTokenType.OpenAngle;[<]; + HtmlTokenType.ForwardSlash;[/]; + HtmlTokenType.Text;[text]; + HtmlTokenType.CloseAngle;[>]; From 220595393a7a6b2195edf5bc76ed9e81d7e37dff Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 10 Aug 2018 14:52:39 -0700 Subject: [PATCH 16/58] Expose RazorCompletionFactsService. --- .../RazorCompletionFactsService.cs | 2 +- src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItem.cs | 2 +- .../RazorCompletionItemKind.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionFactsService.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionFactsService.cs index 5009002d13..2995b49007 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionFactsService.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionFactsService.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Razor.Language; namespace Microsoft.VisualStudio.Editor.Razor { - internal abstract class RazorCompletionFactsService + public abstract class RazorCompletionFactsService { public abstract IReadOnlyList GetCompletionItems(RazorSyntaxTree syntaxTree, SourceSpan location); } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItem.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItem.cs index 94a7bdb769..6b88af94f3 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItem.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItem.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.VisualStudio.Editor.Razor { - internal sealed class RazorCompletionItem + public sealed class RazorCompletionItem { public RazorCompletionItem( string displayText, diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItemKind.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItemKind.cs index 9925cb134a..89ed05205e 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItemKind.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorCompletionItemKind.cs @@ -3,7 +3,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { - internal enum RazorCompletionItemKind + public enum RazorCompletionItemKind { Directive } From 7450a3a0fb93edbf3d90758ad600ada53408b953 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 12 Aug 2018 20:11:44 +0000 Subject: [PATCH 17/58] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 22 +++++++++++----------- korebuild-lock.txt | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 3668a75360..cffc8e9cee 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 0.10.13 - 3.0.0-alpha1-20180731.2 - 3.0.0-alpha1-10221 - 3.0.0-alpha1-10221 - 3.0.0-alpha1-10221 + 3.0.0-alpha1-20180810.1 + 3.0.0-alpha1-10275 + 3.0.0-alpha1-10275 + 3.0.0-alpha1-10275 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 3.0.0-alpha1-10221 - 3.0.0-alpha1-10221 - 3.0.0-preview1-26731-01 - 3.0.0-alpha1-10221 - 3.0.0-alpha1-10221 + 3.0.0-alpha1-10275 + 3.0.0-alpha1-10275 + 3.0.0-preview1-26810-02 + 3.0.0-alpha1-10275 + 3.0.0-alpha1-10275 2.0.9 2.1.2 2.2.0-preview1-26618-02 @@ -44,9 +44,9 @@ 2.0.3 11.0.2 1.3.23 - 4.6.0-preview1-26727-04 + 4.6.0-preview1-26807-04 4.3.0 - 4.6.0-preview1-26727-04 + 4.6.0-preview1-26807-04 9.0.1 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index fe0f897b25..c53be3fca9 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:3.0.0-alpha1-20180731.2 -commithash:1179f1083695ac9213c8a70a4d1d6c45a52caf41 +version:3.0.0-alpha1-20180810.1 +commithash:45c32b4f020e14a9295be31866051a18d293309d From 9a9931d59fb9f6c8cd1dd7a9dc98b2c7d4085b41 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Mon, 13 Aug 2018 11:26:24 -0700 Subject: [PATCH 18/58] Initial infrastrucure for a better html parser (#2522) Initial infrastrucure for a better html parser - Added new syntax node types that follow Roslyn's red/green pattern - Modified the html text node in the current syntax tree to use the new nodes - Updated test infrastructure - Generated baselines --- .../Legacy/CSharpToken.cs | 11 + .../Legacy/HtmlMarkupParser.cs | 15 +- .../Legacy/HtmlToken.cs | 43 + .../Legacy/IToken.cs | 6 + .../Legacy/Span.cs | 4 + .../Legacy/SpanBuilder.cs | 30 +- .../Legacy/TokenBase.cs | 10 +- .../Legacy/TokenizerBackedParser.cs | 21 +- .../Syntax/ArrayElement.cs | 58 ++ .../Syntax/GreenNode.cs | 514 ++++++++++++ .../Syntax/HtmlNodeSyntax.cs | 20 + .../Syntax/HtmlTextSyntax.cs | 42 + .../Syntax/HtmlTextTokenSyntax.cs | 27 + .../Syntax/InternalSyntax/HtmlNodeSyntax.cs | 28 + .../Syntax/InternalSyntax/HtmlTextSyntax.cs | 59 ++ .../InternalSyntax/HtmlTextTokenSyntax.cs | 53 ++ .../InternalSyntax/NewLineTokenSyntax.cs | 50 ++ .../InternalSyntax/PunctuationSyntax.cs | 45 + .../Syntax/InternalSyntax/SyntaxFactory.cs | 38 + .../Syntax/InternalSyntax/SyntaxList.cs | 418 ++++++++++ .../InternalSyntax/SyntaxListBuilder.cs | 201 +++++ .../InternalSyntax/SyntaxListBuilderOfT.cs | 115 +++ .../Syntax/InternalSyntax/SyntaxListOfT.cs | 139 ++++ .../Syntax/InternalSyntax/SyntaxToken.cs | 119 +++ .../Syntax/InternalSyntax/SyntaxTrivia.cs | 80 ++ .../Syntax/InternalSyntax/SyntaxVisitor.cs | 43 + .../InternalSyntax/UnknownTokenSyntax.cs | 50 ++ .../InternalSyntax/WhitespaceTokenSyntax.cs | 50 ++ .../Syntax/NewLineTokenSyntax.cs | 27 + .../Syntax/NodeFlags.cs | 21 + .../Syntax/ObjectPool.cs | 248 ++++++ .../Syntax/ParserState.cs | 14 + .../Syntax/PunctuationSyntax.cs | 27 + .../Syntax/SpecializedCollections.cs | 169 ++++ .../Syntax/SyntaxAnnotation.cs | 93 +++ .../Syntax/SyntaxKind.cs | 32 + .../Syntax/SyntaxList.cs | 118 +++ .../Syntax/SyntaxListBuilder.cs | 172 ++++ .../Syntax/SyntaxListBuilderExtensions.cs | 29 + .../Syntax/SyntaxListBuilderOfT.cs | 93 +++ .../Syntax/SyntaxListOfT.cs | 606 ++++++++++++++ .../Syntax/SyntaxNode.cs | 252 ++++++ .../Syntax/SyntaxToken.cs | 91 ++ .../Syntax/SyntaxTrivia.cs | 54 ++ .../Syntax/SyntaxTriviaList.cs | 785 ++++++++++++++++++ .../Syntax/SyntaxTriviaListBuilder.cs | 138 +++ .../Syntax/SyntaxVisitor.cs | 43 + .../Syntax/TextSpan.cs | 261 ++++++ .../Syntax/UnknownTokenSyntax.cs | 27 + .../Syntax/WhitespaceTokenSyntax.cs | 27 + ...rectiveAutoCompleteAtStartOfFile.stree.txt | 4 +- ...rWhiteSpaceCommentsAndDirectives.stree.txt | 13 +- ...escriptor_UnderstandsRazorBlocks.stree.txt | 13 +- .../Parse_SectionDirective.stree.txt | 13 +- ...rCommentWithExtraNewLineInMarkup.stree.txt | 4 +- .../RazorCommentsSurroundingMarkup.stree.txt | 4 +- ...aceMultipleLinesBelowSectionName.stree.txt | 4 +- ...ceBetweenSectionNameAndOpenBrace.stree.txt | 4 +- .../HandlesUnterminatedSection.stree.txt | 9 +- ...rserOutputsErrorOnNestedSections.stree.txt | 4 +- .../ParsesNamedSectionCorrectly.stree.txt | 4 +- ...NotFollowedByIdentifierStartChar.stree.txt | 4 +- ...lockIfNameNotFollowedByOpenBrace.stree.txt | 4 +- ...tmlCommentSupportsMultipleDashes.stree.txt | 12 +- ...lyHandlesOddlySpacedHTMLElements.stree.txt | 9 +- ...ineOfMarkupWithEmbeddedStatement.stree.txt | 7 +- ...hToCodeOnEmailAddressInAttribute.stree.txt | 9 +- ...pportsDollarOpenBraceCombination.stree.txt | 4 +- .../RendersTextPseudoTagAsMarkup.stree.txt | 4 +- .../VoidElementFollowedByOtherTag.stree.txt | 435 +++++----- ...oCodeIfThereIsNoMarkupOnThatLine.stree.txt | 4 +- ...TreatsTwoAtSignsAsEscapeSequence.stree.txt | 7 +- ...TreatsTwoAtSignsAsEscapeSequence.stree.txt | 7 +- ...oCodeIfThereIsNoMarkupOnThatLine.stree.txt | 4 +- .../CanHandleSymbolBoundAttributes3.stree.txt | 9 +- .../CanHandleSymbolBoundAttributes4.stree.txt | 9 +- ...eatesErrorForMalformedTagHelper6.stree.txt | 4 +- ...eatesErrorForMalformedTagHelper7.stree.txt | 7 +- ...eTreeRewriter_AllowsInvalidHtml1.stree.txt | 7 +- ...TreeRewriter_AllowsInvalidHtml10.stree.txt | 7 +- ...eTreeRewriter_AllowsInvalidHtml6.stree.txt | 7 +- ...eTreeRewriter_AllowsInvalidHtml7.stree.txt | 7 +- ...eTreeRewriter_AllowsInvalidHtml8.stree.txt | 7 +- ...eTreeRewriter_AllowsInvalidHtml9.stree.txt | 15 +- ...atesErrorForIncompleteTagHelper2.stree.txt | 11 +- ...atesErrorForIncompleteTagHelper3.stree.txt | 11 +- ...atesErrorForIncompleteTagHelper4.stree.txt | 11 +- ...plexAttributeTagHelperTagBlocks3.stree.txt | 9 +- ...plexAttributeTagHelperTagBlocks4.stree.txt | 9 +- ...plexAttributeTagHelperTagBlocks5.stree.txt | 12 +- ...plexAttributeTagHelperTagBlocks6.stree.txt | 12 +- ...plexAttributeTagHelperTagBlocks7.stree.txt | 28 +- ...writesComplexTagHelperTagBlocks5.stree.txt | 4 +- ...writesComplexTagHelperTagBlocks6.stree.txt | 4 +- ...writesComplexTagHelperTagBlocks7.stree.txt | 11 +- ...writesComplexTagHelperTagBlocks8.stree.txt | 11 +- ...esOddlySpacedTagHelperTagBlocks2.stree.txt | 9 +- ...esOddlySpacedTagHelperTagBlocks3.stree.txt | 12 +- ...RewritesPlainTagHelperTagBlocks2.stree.txt | 9 +- ...RewritesPlainTagHelperTagBlocks3.stree.txt | 12 +- ...RewritesPlainTagHelperTagBlocks4.stree.txt | 28 +- ...writer_RewritesScriptTagHelpers3.stree.txt | 8 +- ...writer_RewritesScriptTagHelpers4.stree.txt | 4 +- ...writer_RewritesScriptTagHelpers6.stree.txt | 14 +- ...writer_RewritesScriptTagHelpers7.stree.txt | 14 +- ...r_RewritesSelfClosingTagHelpers2.stree.txt | 14 +- ...r_RewritesSelfClosingTagHelpers3.stree.txt | 4 +- ...esTagHelpersWithPlainAttributes2.stree.txt | 9 +- ...esTagHelpersWithPlainAttributes3.stree.txt | 12 +- ...esTagHelpersWithPlainAttributes4.stree.txt | 28 +- ...gHelpersWithQuotelessAttributes2.stree.txt | 9 +- ...gHelpersWithQuotelessAttributes3.stree.txt | 9 +- ...gHelpersWithQuotelessAttributes4.stree.txt | 12 +- ...gHelpersWithQuotelessAttributes5.stree.txt | 28 +- .../AllowsPrefixedTagHelpers10.stree.txt | 13 +- .../AllowsPrefixedTagHelpers2.stree.txt | 13 +- .../AllowsRazorCommentsAsChildren.stree.txt | 4 +- .../AllowsRazorMarkupInHtmlComment.stree.txt | 4 +- ...lowsSimpleHtmlCommentsAsChildren.stree.txt | 4 +- ...entOptOutHTML_WithAttributeData3.stree.txt | 13 +- ...ElementOptOutHTML_WithBlockData4.stree.txt | 13 +- ...dleInvalidChildrenWithWhitespace.stree.txt | 24 +- ...pleTagHelpersWithAllowedChildren.stree.txt | 9 +- ...lpersWithAllowedChildren_OneNull.stree.txt | 9 +- ...sNotRewriteSpecialTagTagHelpers3.stree.txt | 23 +- ...sNotRewriteSpecialTagTagHelpers4.stree.txt | 9 +- ...sNotRewriteSpecialTagTagHelpers5.stree.txt | 7 +- ...sNotRewriteSpecialTagTagHelpers6.stree.txt | 25 +- ...sNotRewriteSpecialTagTagHelpers7.stree.txt | 29 +- ...sNotRewriteSpecialTagTagHelpers8.stree.txt | 11 +- ...riteTextTagTransitionTagHelpers1.stree.txt | 9 +- ...CreateTagHelperBlocksCorrectly12.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly13.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly18.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly21.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly22.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly23.stree.txt | 12 +- ...CreateTagHelperBlocksCorrectly25.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly27.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly28.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly29.stree.txt | 13 +- ...CreateTagHelperBlocksCorrectly30.stree.txt | 12 +- ...sCreateTagHelperBlocksCorrectly7.stree.txt | 13 +- ...sCreateTagHelperBlocksCorrectly8.stree.txt | 13 +- ...sCreateTagHelperBlocksCorrectly9.stree.txt | 12 +- ...ewritesNestedTagHelperTagBlocks2.stree.txt | 11 +- ...ewritesNestedTagHelperTagBlocks3.stree.txt | 16 +- ...ewritesNestedTagHelperTagBlocks4.stree.txt | 16 +- .../UnderstandsAllowedChildren10.stree.txt | 21 +- .../UnderstandsAllowedChildren11.stree.txt | 21 +- .../UnderstandsAllowedChildren14.stree.txt | 12 +- .../UnderstandsAllowedChildren2.stree.txt | 8 +- .../UnderstandsAllowedChildren4.stree.txt | 4 +- .../UnderstandsAllowedChildren6.stree.txt | 4 +- .../UnderstandsAllowedChildren7.stree.txt | 8 +- .../UnderstandsAllowedChildren8.stree.txt | 8 +- .../UnderstandsAllowedChildren9.stree.txt | 19 +- .../Language/Legacy/RawTextToken.cs | 6 +- .../Language/Legacy/SyntaxTreeNodeWriter.cs | 51 ++ 159 files changed, 6494 insertions(+), 758 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/ArrayElement.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlNodeSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextTokenSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlNodeSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextTokenSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/NewLineTokenSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/PunctuationSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxList.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListBuilder.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListBuilderOfT.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListOfT.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxVisitor.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/UnknownTokenSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/WhitespaceTokenSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/NewLineTokenSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/NodeFlags.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/ObjectPool.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/ParserState.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/PunctuationSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SpecializedCollections.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxAnnotation.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxList.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilder.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilderExtensions.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilderOfT.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListOfT.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTrivia.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTriviaList.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTriviaListBuilder.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/TextSpan.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/UnknownTokenSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/WhitespaceTokenSyntax.cs diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs index c928f0880e..02428c2691 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs @@ -3,6 +3,8 @@ using System; using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -33,6 +35,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public CSharpKeyword? Keyword { get; set; } + protected override SyntaxToken GetSyntaxToken() + { + switch (Type) + { + default: + return SyntaxFactory.UnknownToken(Content, Errors.ToArray()); + } + } + public override bool Equals(object obj) { var other = obj as CSharpToken; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs index 4f4d710616..c1292b44bd 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs @@ -1590,6 +1590,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { Span.Start = CurrentLocation; + ParserState = ParserState.Misc; NextToken(); while (!EndOfFile) { @@ -1636,7 +1637,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return; } - Output(SpanKindInternal.Markup); + if (ParserState == ParserState.Content) + { + Output(SpanKindInternal.Markup, SyntaxKind.HtmlText); + } + else + { + Output(SpanKindInternal.Markup); + } // Start tag block var tagBlock = Context.Builder.StartBlock(BlockKindInternal.Tag); @@ -1645,6 +1653,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (!At(HtmlTokenType.ForwardSlash)) { + ParserState = ParserState.StartTag; OptionalBangEscape(); // Parsing a start tag @@ -1655,6 +1664,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Optional(HtmlTokenType.ForwardSlash); Optional(HtmlTokenType.CloseAngle); + ParserState = ParserState.Content; + // If the script tag expects javascript content then we should do minimal parsing until we reach // the end script tag. Don't want to incorrectly parse a "var tag = '';" as an HTML tag. if (scriptTag && !CurrentScriptTagExpectsHtml()) @@ -1670,6 +1681,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { // Parsing an end tag // This section can accept things like: '

' or '

' etc. + ParserState = ParserState.EndTag; Optional(HtmlTokenType.ForwardSlash); // Whitespace here is invalid (according to the spec) @@ -1677,6 +1689,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Optional(HtmlTokenType.Text); Optional(HtmlTokenType.WhiteSpace); Optional(HtmlTokenType.CloseAngle); + ParserState = ParserState.Content; } Output(SpanKindInternal.Markup); diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs index 2d52ed14e2..9659d85360 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs @@ -3,6 +3,8 @@ using System; using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -30,5 +32,46 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy throw new ArgumentNullException(nameof(content)); } } + + protected override SyntaxToken GetSyntaxToken() + { + switch (Type) + { + case HtmlTokenType.Text: + return SyntaxFactory.HtmlTextToken(Content, Errors.ToArray()); + case HtmlTokenType.WhiteSpace: + return SyntaxFactory.WhitespaceToken(Content, Errors.ToArray()); + case HtmlTokenType.NewLine: + return SyntaxFactory.NewLineToken(Content, Errors.ToArray()); + case HtmlTokenType.OpenAngle: + return SyntaxFactory.Punctuation(SyntaxKind.OpenAngle, Content, Errors.ToArray()); + case HtmlTokenType.Bang: + return SyntaxFactory.Punctuation(SyntaxKind.Bang, Content, Errors.ToArray()); + case HtmlTokenType.ForwardSlash: + return SyntaxFactory.Punctuation(SyntaxKind.ForwardSlash, Content, Errors.ToArray()); + case HtmlTokenType.QuestionMark: + return SyntaxFactory.Punctuation(SyntaxKind.QuestionMark, Content, Errors.ToArray()); + case HtmlTokenType.DoubleHyphen: + return SyntaxFactory.Punctuation(SyntaxKind.DoubleHyphen, Content, Errors.ToArray()); + case HtmlTokenType.LeftBracket: + return SyntaxFactory.Punctuation(SyntaxKind.LeftBracket, Content, Errors.ToArray()); + case HtmlTokenType.CloseAngle: + return SyntaxFactory.Punctuation(SyntaxKind.CloseAngle, Content, Errors.ToArray()); + case HtmlTokenType.RightBracket: + return SyntaxFactory.Punctuation(SyntaxKind.RightBracket, Content, Errors.ToArray()); + case HtmlTokenType.Equals: + return SyntaxFactory.Punctuation(SyntaxKind.Equals, Content, Errors.ToArray()); + case HtmlTokenType.DoubleQuote: + return SyntaxFactory.Punctuation(SyntaxKind.DoubleQuote, Content, Errors.ToArray()); + case HtmlTokenType.SingleQuote: + return SyntaxFactory.Punctuation(SyntaxKind.SingleQuote, Content, Errors.ToArray()); + case HtmlTokenType.Transition: + return SyntaxFactory.Punctuation(SyntaxKind.Transition, Content, Errors.ToArray()); + case HtmlTokenType.Colon: + return SyntaxFactory.Punctuation(SyntaxKind.Colon, Content, Errors.ToArray()); + default: + return SyntaxFactory.UnknownToken(Content, Errors.ToArray()); + } + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs index 2f8eb1214d..a57f9dbf4d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs @@ -1,6 +1,8 @@ // 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 IToken @@ -10,5 +12,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy string Content { get; } SourceLocation Start { get; } + + SyntaxKind SyntaxKind { get; } + + SyntaxToken SyntaxToken { get; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs index fbf9f9f2c2..ec448d0dc4 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -31,6 +32,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public SpanEditHandler EditHandler { get; private set; } + public HtmlNodeSyntax SyntaxNode { get; private set; } + public override bool IsBlock => false; public override int Length @@ -94,6 +97,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { Kind = builder.Kind; Tokens = builder.Tokens; + SyntaxNode = builder.SyntaxNode; for (var i = 0; i (SyntaxListBuilder.Create()); + foreach (var token in Tokens) + { + if (token.SyntaxKind == SyntaxKind.Unknown) + { + Debug.Assert(false, $"Unexpected html token {((HtmlToken)token).Type}"); + continue; + } + + textTokens.Add(token.SyntaxToken); + } + var textResult = textTokens.ToList(); + return SyntaxFactory.HtmlText(new SyntaxList(textResult.Node)); + } + + return null; + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenBase.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenBase.cs index 562a41f5bc..ade6bfc95c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenBase.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenBase.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -58,10 +59,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } + public SyntaxKind SyntaxKind => SyntaxToken.Kind; + + public SyntaxToken SyntaxToken => GetSyntaxToken(); + + protected abstract SyntaxToken GetSyntaxToken(); + public override bool Equals(object obj) { - var other = obj as TokenBase; - return other != null && + return obj is TokenBase other && string.Equals(Content, other.Content, StringComparison.Ordinal) && Type.Equals(other.Type); } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs index af5a08831f..f7b054ecff 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs @@ -5,6 +5,7 @@ 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 { @@ -25,6 +26,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Span = new SpanBuilder(CurrentLocation); } + protected ParserState ParserState { get; set; } + protected SpanBuilder Span { get; private set; } protected Action SpanConfig { get; set; } @@ -34,6 +37,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy get { return _tokenizer.Current; } } + protected SyntaxToken CurrentSyntaxToken => CurrentToken?.SyntaxToken; + protected TToken PreviousToken { get; private set; } protected SourceLocation CurrentLocation => _tokenizer.Tokenizer.CurrentLocation; @@ -388,31 +393,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); 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/GreenNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs new file mode 100644 index 0000000000..e90374ad2b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs @@ -0,0 +1,514 @@ +// 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 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 + + internal virtual GreenNode Accept(InternalSyntax.SyntaxVisitor visitor) + { + return visitor.Visit(this); + } + + #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/HtmlNodeSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlNodeSyntax.cs new file mode 100644 index 0000000000..c247183c1d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlNodeSyntax.cs @@ -0,0 +1,20 @@ +// 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 HtmlNodeSyntax : SyntaxNode + { + internal HtmlNodeSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal new InternalSyntax.HtmlNodeSyntax Green => (InternalSyntax.HtmlNodeSyntax)base.Green; + + internal override SyntaxNode Accept(SyntaxVisitor visitor) + { + return visitor.VisitHtmlNode(this); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextSyntax.cs new file mode 100644 index 0000000000..a28dc9bbdd --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextSyntax.cs @@ -0,0 +1,42 @@ +// 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 class HtmlTextSyntax : HtmlNodeSyntax + { + private SyntaxNode _textTokens; + + internal HtmlTextSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public SyntaxList TextTokens => new SyntaxList(GetRed(ref _textTokens, 0)); + + public string Value => TextTokens[0]?.ToFullString() ?? string.Empty; + + internal override SyntaxNode Accept(SyntaxVisitor visitor) + { + return visitor.VisitHtmlText(this); + } + + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _textTokens; + default: return null; + } + } + + internal override SyntaxNode GetNodeSlot(int slot) + { + switch (slot) + { + case 0: return GetRed(ref _textTokens, 0); + default: return null; + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextTokenSyntax.cs new file mode 100644 index 0000000000..9130b5c5d4 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextTokenSyntax.cs @@ -0,0 +1,27 @@ +// 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 class HtmlTextTokenSyntax : SyntaxToken + { + internal HtmlTextTokenSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal new InternalSyntax.HtmlTextTokenSyntax Green => (InternalSyntax.HtmlTextTokenSyntax)base.Green; + + public string Value => Text; + + internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.HtmlTextTokenSyntax(Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as HtmlTextTokenSyntax; + } + + internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.HtmlTextTokenSyntax(Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as HtmlTextTokenSyntax; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlNodeSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlNodeSyntax.cs new file mode 100644 index 0000000000..4289dfa683 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlNodeSyntax.cs @@ -0,0 +1,28 @@ +// 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 class HtmlNodeSyntax : GreenNode + { + protected HtmlNodeSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected HtmlNodeSyntax(SyntaxKind kind, int fullWidth) + : base(kind, fullWidth) + { + } + + protected HtmlNodeSyntax(SyntaxKind kind, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + } + + internal override GreenNode Accept(SyntaxVisitor visitor) + { + return visitor.VisitHtmlNode(this); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextSyntax.cs new file mode 100644 index 0000000000..57e3c4f113 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextSyntax.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.InternalSyntax +{ + internal class HtmlTextSyntax : HtmlNodeSyntax + { + private readonly GreenNode _value; + + internal HtmlTextSyntax(GreenNode value) : base(SyntaxKind.HtmlText) + { + SlotCount = 1; + _value = value; + AdjustFlagsAndWidth(value); + } + + internal HtmlTextSyntax(GreenNode value, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(SyntaxKind.HtmlText, diagnostics, annotations) + { + SlotCount = 1; + _value = value; + AdjustFlagsAndWidth(value); + } + + internal SyntaxList TextTokens => new SyntaxList(_value); + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _value; + } + + throw new InvalidOperationException(); + } + + internal override GreenNode Accept(SyntaxVisitor visitor) + { + return visitor.VisitHtmlText(this); + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.HtmlTextSyntax(this, parent, position); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new HtmlTextSyntax(_value, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new HtmlTextSyntax(_value, GetDiagnostics(), annotations); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextTokenSyntax.cs new file mode 100644 index 0000000000..68d6eecd97 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextTokenSyntax.cs @@ -0,0 +1,53 @@ +// 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 class HtmlTextTokenSyntax : SyntaxToken + { + internal HtmlTextTokenSyntax(string text, params RazorDiagnostic[] diagnostics) + : base(SyntaxKind.HtmlTextLiteralToken, text, null, null, diagnostics, null) + { + } + + internal HtmlTextTokenSyntax(string text, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(SyntaxKind.HtmlTextLiteralToken, text, leadingTrivia, trailingTrivia) + { + } + + protected HtmlTextTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(kind, name, leadingTrivia, trailingTrivia) + { + } + + protected HtmlTextTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) + { + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.HtmlTextTokenSyntax(this, parent, position); + } + + public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) + { + return new HtmlTextTokenSyntax(Kind, Text, trivia, TrailingTrivia); + } + + public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) + { + return new HtmlTextTokenSyntax(Kind, Text, LeadingTrivia, trivia); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new HtmlTextTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new HtmlTextTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/NewLineTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/NewLineTokenSyntax.cs new file mode 100644 index 0000000000..97d47e9fb9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/NewLineTokenSyntax.cs @@ -0,0 +1,50 @@ +// 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 class NewLineTokenSyntax : SyntaxToken + { + internal NewLineTokenSyntax(string text, params RazorDiagnostic[] diagnostics) + : base(SyntaxKind.NewLine, text, null, null, diagnostics, null) + { + } + + internal NewLineTokenSyntax(string text, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(SyntaxKind.NewLine, text, leadingTrivia, trailingTrivia) + { + } + + protected NewLineTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(kind, name, leadingTrivia, trailingTrivia) + { + } + + protected NewLineTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) + { + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) => new Syntax.NewLineTokenSyntax(this, parent, position); + + public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) + { + return new NewLineTokenSyntax(Kind, Text, trivia, TrailingTrivia); + } + + public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) + { + return new NewLineTokenSyntax(Kind, Text, LeadingTrivia, trivia); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new NewLineTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new NewLineTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/PunctuationSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/PunctuationSyntax.cs new file mode 100644 index 0000000000..0c2bb06b61 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/PunctuationSyntax.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. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal class PunctuationSyntax : SyntaxToken + { + internal PunctuationSyntax(SyntaxKind kind, string name, RazorDiagnostic[] diagnostics) + : this(kind, name, null, null, diagnostics, null) + { + } + + internal PunctuationSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) + : this(kind, name, leadingTrivia, trailingTrivia, null, null) + { + } + + internal PunctuationSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) + { + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) => new Syntax.PunctuationSyntax(this, parent, position); + + public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) + { + return new PunctuationSyntax(Kind, Text, trivia, TrailingTrivia); + } + + public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) + { + return new PunctuationSyntax(Kind, Text, LeadingTrivia, trivia); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new PunctuationSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new PunctuationSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); + } + } +} 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..a6f5ce2e1f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs @@ -0,0 +1,38 @@ +// 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 static class SyntaxFactory + { + internal static HtmlTextSyntax HtmlText(SyntaxList textTokens) + { + return new HtmlTextSyntax(textTokens.Node); + } + + internal static HtmlTextTokenSyntax HtmlTextToken(string text, params RazorDiagnostic[] diagnostics) + { + return new HtmlTextTokenSyntax(text, diagnostics); + } + + internal static WhitespaceTokenSyntax WhitespaceToken(string text, params RazorDiagnostic[] diagnostics) + { + return new WhitespaceTokenSyntax(text, diagnostics); + } + + internal static NewLineTokenSyntax NewLineToken(string text, params RazorDiagnostic[] diagnostics) + { + return new NewLineTokenSyntax(text, diagnostics); + } + + internal static PunctuationSyntax Punctuation(SyntaxKind syntaxKind, string text, params RazorDiagnostic[] diagnostics) + { + return new PunctuationSyntax(syntaxKind, text, diagnostics); + } + + internal static UnknownTokenSyntax UnknownToken(string text, params RazorDiagnostic[] diagnostics) + { + return new UnknownTokenSyntax(text, 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..cd6270b599 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxList.cs @@ -0,0 +1,418 @@ +// 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); + } + } + + 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..d9167704b5 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.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.IO; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal abstract class SyntaxToken : GreenNode + { + internal SyntaxToken(SyntaxKind tokenKind, string text, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(tokenKind, text.Length) + { + Text = text; + LeadingTrivia = leadingTrivia; + AdjustFlagsAndWidth(leadingTrivia); + TrailingTrivia = trailingTrivia; + AdjustFlagsAndWidth(trailingTrivia); + } + + internal SyntaxToken(SyntaxKind tokenKind, string text, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(tokenKind, text.Length, diagnostics, annotations) + { + Text = text; + LeadingTrivia = leadingTrivia; + AdjustFlagsAndWidth(leadingTrivia); + TrailingTrivia = trailingTrivia; + AdjustFlagsAndWidth(trailingTrivia); + } + + public string Text { get; } + + public GreenNode LeadingTrivia { get; } + + public GreenNode TrailingTrivia { get; } + + internal override bool IsToken => true; + + public override int Width => Text.Length; + + 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(Text); + + 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 abstract SyntaxToken TokenWithLeadingTrivia(GreenNode trivia); + + public sealed override GreenNode WithTrailingTrivia(GreenNode trivia) + { + return TokenWithTrailingTrivia(trivia); + } + + public abstract SyntaxToken TokenWithTrailingTrivia(GreenNode trivia); + + protected override sealed int GetSlotCount() + { + return 0; + } + + internal override sealed GreenNode GetSlot(int index) + { + throw new InvalidOperationException(); + } + + internal override GreenNode Accept(SyntaxVisitor visitor) + { + return visitor.VisitSyntaxToken(this); + } + + public override string ToString() + { + return Text; + } + } +} 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..6618b20c69 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs @@ -0,0 +1,80 @@ +// 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); + } + + internal override GreenNode Accept(SyntaxVisitor visitor) + { + return visitor.VisitSyntaxTrivia(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); + } + } +} 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..5e54b752f3 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxVisitor.cs @@ -0,0 +1,43 @@ +// 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 class SyntaxVisitor + { + public virtual GreenNode Visit(GreenNode node) + { + if (node != null) + { + return node.Accept(this); + } + + return null; + } + + public virtual GreenNode VisitSyntaxNode(GreenNode node) + { + return node; + } + + public virtual GreenNode VisitHtmlNode(HtmlNodeSyntax node) + { + return VisitSyntaxNode(node); + } + + public virtual GreenNode VisitHtmlText(HtmlTextSyntax node) + { + return VisitHtmlNode(node); + } + + public virtual SyntaxToken VisitSyntaxToken(SyntaxToken token) + { + return token; + } + + public virtual SyntaxTrivia VisitSyntaxTrivia(SyntaxTrivia trivia) + { + return trivia; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/UnknownTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/UnknownTokenSyntax.cs new file mode 100644 index 0000000000..4c6cd4608b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/UnknownTokenSyntax.cs @@ -0,0 +1,50 @@ +// 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 class UnknownTokenSyntax : SyntaxToken + { + internal UnknownTokenSyntax(string text, params RazorDiagnostic[] diagnostics) + : base(SyntaxKind.Unknown, text, null, null, diagnostics, null) + { + } + + internal UnknownTokenSyntax(string text, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(SyntaxKind.Unknown, text, leadingTrivia, trailingTrivia) + { + } + + protected UnknownTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(kind, name, leadingTrivia, trailingTrivia) + { + } + + protected UnknownTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) + { + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) => new Syntax.UnknownTokenSyntax(this, parent, position); + + public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) + { + return new UnknownTokenSyntax(Kind, Text, trivia, TrailingTrivia); + } + + public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) + { + return new UnknownTokenSyntax(Kind, Text, LeadingTrivia, trivia); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new UnknownTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new UnknownTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/WhitespaceTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/WhitespaceTokenSyntax.cs new file mode 100644 index 0000000000..b576b60e3a --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/WhitespaceTokenSyntax.cs @@ -0,0 +1,50 @@ +// 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 class WhitespaceTokenSyntax : SyntaxToken + { + internal WhitespaceTokenSyntax(string text, params RazorDiagnostic[] diagnostics) + : base(SyntaxKind.Whitespace, text, null, null, diagnostics, null) + { + } + + internal WhitespaceTokenSyntax(string text, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(SyntaxKind.Whitespace, text, leadingTrivia, trailingTrivia) + { + } + + protected WhitespaceTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(kind, name, leadingTrivia, trailingTrivia) + { + } + + protected WhitespaceTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) + { + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) => new Syntax.WhitespaceTokenSyntax(this, parent, position); + + public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) + { + return new WhitespaceTokenSyntax(Kind, Text, trivia, TrailingTrivia); + } + + public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) + { + return new WhitespaceTokenSyntax(Kind, Text, LeadingTrivia, trivia); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new WhitespaceTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new WhitespaceTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/NewLineTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/NewLineTokenSyntax.cs new file mode 100644 index 0000000000..d164f069e9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/NewLineTokenSyntax.cs @@ -0,0 +1,27 @@ +// 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 class NewLineTokenSyntax : SyntaxToken + { + internal NewLineTokenSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal new InternalSyntax.NewLineTokenSyntax Green => (InternalSyntax.NewLineTokenSyntax)base.Green; + + public string Value => Text; + + internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.NewLineTokenSyntax(Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as NewLineTokenSyntax; + } + + internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.NewLineTokenSyntax(Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as NewLineTokenSyntax; + } + } +} 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/PunctuationSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/PunctuationSyntax.cs new file mode 100644 index 0000000000..0f25740ecd --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/PunctuationSyntax.cs @@ -0,0 +1,27 @@ +// 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 class PunctuationSyntax : SyntaxToken + { + internal PunctuationSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal new InternalSyntax.PunctuationSyntax Green => (InternalSyntax.PunctuationSyntax)base.Green; + + public string Punctuation => Text; + + internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.PunctuationSyntax(Kind, Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as PunctuationSyntax; + } + + internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.PunctuationSyntax(Kind, Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as PunctuationSyntax; + } + } +} 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/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/SyntaxKind.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs new file mode 100644 index 0000000000..46dad28dee --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs @@ -0,0 +1,32 @@ +// 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 SyntaxKind : byte + { + Unknown, + List, + Whitespace, + NewLine, + + // HTML + HtmlText, + HtmlDocument, + HtmlDeclaration, + HtmlTextLiteralToken, + OpenAngle, + Bang, + ForwardSlash, + QuestionMark, + DoubleHyphen, + LeftBracket, + CloseAngle, + RightBracket, + Equals, + DoubleQuote, + SingleQuote, + Transition, + Colon, + } +} 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..e57b65599f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxList.cs @@ -0,0 +1,118 @@ +// 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) + { + } + + internal override SyntaxNode Accept(SyntaxVisitor visitor) + { + return 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..d55504d46e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs @@ -0,0 +1,252 @@ +// 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; + + internal abstract SyntaxNode 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; + } + + 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; + } + + 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 override string ToString() + { + return Green.ToString(); + } + + public virtual string ToFullString() + { + return Green.ToFullString(); + } + } +} 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..d3ffa0096c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs @@ -0,0 +1,91 @@ +// 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.Linq; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal abstract class SyntaxToken : SyntaxNode + { + internal SyntaxToken(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal new InternalSyntax.SyntaxToken Green => (InternalSyntax.SyntaxToken)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(); + } + + internal override SyntaxNode Accept(SyntaxVisitor visitor) + { + return visitor.VisitSyntaxToken(this); + } + + internal abstract SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia); + + internal abstract SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia); + + public SyntaxToken WithLeadingTrivia(SyntaxNode trivia) => WithLeadingTriviaCore(trivia); + + public SyntaxToken WithTrailingTrivia(SyntaxNode trivia) => WithTrailingTriviaCore(trivia); + + public SyntaxToken WithLeadingTrivia(IEnumerable trivia) + { + var greenList = trivia?.Select(t => t.Green); + return WithLeadingTriviaCore(Green.CreateList(greenList)?.CreateRed()); + } + + public SyntaxToken WithTrailingTrivia(IEnumerable trivia) + { + var greenList = trivia?.Select(t => t.Green); + return WithTrailingTriviaCore(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 Text; + } + } +} 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..c576fee3d0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTrivia.cs @@ -0,0 +1,54 @@ +// 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(); + } + + internal override SyntaxNode Accept(SyntaxVisitor visitor) + { + return visitor.VisitSyntaxTrivia(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..08d833e515 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs @@ -0,0 +1,43 @@ +// 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 SyntaxVisitor + { + public virtual SyntaxNode Visit(SyntaxNode node) + { + if (node != null) + { + return node.Accept(this); + } + + return null; + } + + public virtual SyntaxNode VisitSyntaxNode(SyntaxNode node) + { + return node; + } + + public virtual SyntaxNode VisitHtmlNode(HtmlNodeSyntax node) + { + return VisitSyntaxNode(node); + } + + public virtual SyntaxNode VisitHtmlText(HtmlTextSyntax node) + { + return VisitHtmlNode(node); + } + + public virtual SyntaxToken VisitSyntaxToken(SyntaxToken token) + { + return token; + } + + public virtual SyntaxTrivia VisitSyntaxTrivia(SyntaxTrivia trivia) + { + return trivia; + } + } +} 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.AspNetCore.Razor.Language/Syntax/UnknownTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/UnknownTokenSyntax.cs new file mode 100644 index 0000000000..238b36d1af --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/UnknownTokenSyntax.cs @@ -0,0 +1,27 @@ +// 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 class UnknownTokenSyntax : SyntaxToken + { + internal UnknownTokenSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal new InternalSyntax.UnknownTokenSyntax Green => (InternalSyntax.UnknownTokenSyntax)base.Green; + + public string Value => Text; + + internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.UnknownTokenSyntax(Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as UnknownTokenSyntax; + } + + internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.UnknownTokenSyntax(Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as UnknownTokenSyntax; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/WhitespaceTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/WhitespaceTokenSyntax.cs new file mode 100644 index 0000000000..5a8222f802 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/WhitespaceTokenSyntax.cs @@ -0,0 +1,27 @@ +// 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 class WhitespaceTokenSyntax : SyntaxToken + { + internal WhitespaceTokenSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal new InternalSyntax.WhitespaceTokenSyntax Green => (InternalSyntax.WhitespaceTokenSyntax)base.Green; + + public string Value => Text; + + internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.WhitespaceTokenSyntax(Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as WhitespaceTokenSyntax; + } + + internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) + { + return new InternalSyntax.WhitespaceTokenSyntax(Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as WhitespaceTokenSyntax; + } + } +} 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..d59300fc29 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 @@ -19,8 +19,8 @@ Directive block - Gen]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (22:1,3) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlText - [Foo] - [22..25) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Foo]; Tag block - Gen - 4 - (25:1,6) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (25:1,6) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..15bd38868f 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 @@ -51,12 +51,13 @@ Markup block - Gen - 130 - (0:0,0) 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.HtmlText - [This is extra] - [113..126) - FullWidth: 13 - Slots: 1 + SyntaxKind.List - [This is extra] - [113..126) - FullWidth: 13 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[This]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[is]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[extra]; Tag block - Gen - 4 - (126:5,16) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (126:5,16) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..fad1a9c949 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 @@ -19,12 +19,13 @@ Directive block - Gen - 33 - (0:0,0) 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]; + SyntaxKind.HtmlText - [F{o}o] - [22..27) - FullWidth: 5 - Slots: 1 + SyntaxKind.List - [F{o}o] - [22..27) - FullWidth: 5 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[F]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.HtmlTextLiteralToken;[o]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.HtmlTextLiteralToken;[o]; Tag block - Gen - 4 - (27:0,27) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..77d3e85124 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 @@ -19,12 +19,13 @@ Directive block - Gen - 32 - (0:0,0 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]; + SyntaxKind.HtmlText - [F{o}o] - [21..26) - FullWidth: 5 - Slots: 1 + SyntaxKind.List - [F{o}o] - [21..26) - FullWidth: 5 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[F]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.HtmlTextLiteralToken;[o]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.HtmlTextLiteralToken;[o]; Tag block - Gen - 4 - (26:0,26) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..45a7650f51 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 @@ -33,8 +33,8 @@ Markup block - Gen - 45 - (0:0,0) HtmlTokenType.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.HtmlText - [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;[<]; 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..c9889ac49d 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 @@ -32,8 +32,8 @@ Markup block - Gen - 42 - (0:0,0) HtmlTokenType.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.HtmlText - [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;[<]; 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..fbbb614257 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 @@ -28,8 +28,8 @@ Markup block - Gen - 46 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[p]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (36:7,3) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlText - [Foo] - [36..39) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Foo]; Tag block - Gen - 4 - (39:7,6) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (39:7,6) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..9935f5f1ed 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 @@ -20,8 +20,8 @@ Markup block - Gen - 26 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[p]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlText - [Foo] - [17..20) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Foo]; Tag block - Gen - 4 - (20:0,20) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..98086ac2d7 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 @@ -22,10 +22,11 @@ Markup block - Gen - 27 - (0:0,0) 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.HtmlText - [Foo{}] - [18..23) - FullWidth: 5 - Slots: 1 + SyntaxKind.List - [Foo{}] - [18..23) - FullWidth: 5 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.HtmlTextLiteralToken;[}]; Tag block - Gen - 4 - (23:0,23) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..d7963d4182 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 @@ -38,8 +38,8 @@ Markup block - Gen - 44 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[p]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (33:0,33) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlText - [Foo] - [33..36) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Foo]; Tag block - Gen - 4 - (36:0,36) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..7832e92bdc 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 @@ -22,8 +22,8 @@ Markup block - Gen - 27 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[p]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlText - [Foo] - [18..21) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Foo]; Tag block - Gen - 4 - (21:0,21) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..67fadc74d1 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 @@ -18,8 +18,8 @@ Markup block - Gen - 25 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[p]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlText - [Foo] - [16..19) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Foo]; Tag block - Gen - 4 - (19:0,19) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:4 HtmlTokenType.OpenAngle;[<]; 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..ba78c51800 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 @@ -20,8 +20,8 @@ Markup block - Gen - 31 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[p]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlText - [Foo] - [22..25) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Foo]; Tag block - Gen - 4 - (25:0,25) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlBlockTest/HtmlCommentSupportsMultipleDashes.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlBlockTest/HtmlCommentSupportsMultipleDashes.stree.txt index 5887f79ffc..9209fdbddc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlBlockTest/HtmlCommentSupportsMultipleDashes.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlBlockTest/HtmlCommentSupportsMultipleDashes.stree.txt @@ -26,8 +26,8 @@ Markup block - Gen - 165 - (0:0,0) HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[div]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (33:0,33) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [LF] - [33..35) - FullWidth: 2 - Slots: 1 + SyntaxKind.NewLine;[LF]; Tag block - Gen - 5 - (35:1,0) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (35:1,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -55,8 +55,8 @@ Markup block - Gen - 165 - (0:0,0) HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[div]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (70:1,35) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [LF] - [70..72) - FullWidth: 2 - Slots: 1 + SyntaxKind.NewLine;[LF]; Tag block - Gen - 5 - (72:2,0) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (72:2,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -86,8 +86,8 @@ Markup block - Gen - 165 - (0:0,0) HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[div]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (109:2,37) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [LF] - [109..111) - FullWidth: 2 - Slots: 1 + SyntaxKind.NewLine;[LF]; Tag block - Gen - 5 - (111:3,0) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (111:3,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/CorrectlyHandlesOddlySpacedHTMLElements.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/CorrectlyHandlesOddlySpacedHTMLElements.stree.txt index 9c1abf332f..da5099b7ee 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/CorrectlyHandlesOddlySpacedHTMLElements.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/CorrectlyHandlesOddlySpacedHTMLElements.stree.txt @@ -23,10 +23,11 @@ Markup block - Gen - 39 - (0:0,0) HtmlTokenType.SingleQuote;[']; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Foo]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ Foo ] - [23..28) - FullWidth: 5 - Slots: 1 + SyntaxKind.List - [ Foo ] - [23..28) - FullWidth: 5 - Slots: 3 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 4 - (28:0,28) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/CorrectlyHandlesSingleLineOfMarkupWithEmbeddedStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/CorrectlyHandlesSingleLineOfMarkupWithEmbeddedStatement.stree.txt index c4571ddfed..04894092c5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/CorrectlyHandlesSingleLineOfMarkupWithEmbeddedStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/CorrectlyHandlesSingleLineOfMarkupWithEmbeddedStatement.stree.txt @@ -18,9 +18,10 @@ Markup block - Gen - 31 - (0:0,0) CSharpTokenType.WhiteSpace;[ ]; CSharpTokenType.LeftBrace;[{]; CSharpTokenType.RightBrace;[}]; - Markup span - Gen - [ Bar] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Bar]; + SyntaxKind.HtmlText - [ Bar] - [21..25) - FullWidth: 4 - Slots: 1 + SyntaxKind.List - [ Bar] - [21..25) - FullWidth: 4 - Slots: 2 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Bar]; Tag block - Gen - 6 - (25:0,25) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/DoesNotSwitchToCodeOnEmailAddressInAttribute.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/DoesNotSwitchToCodeOnEmailAddressInAttribute.stree.txt index 1cd8f8d382..49f7bab75a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/DoesNotSwitchToCodeOnEmailAddressInAttribute.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/DoesNotSwitchToCodeOnEmailAddressInAttribute.stree.txt @@ -15,10 +15,11 @@ Markup block - Gen - 51 - (0:0,0) HtmlTokenType.DoubleQuote;["]; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (38:0,38) - Tokens:1 HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Email me] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:3 - HtmlTokenType.Text;[Email]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[me]; + SyntaxKind.HtmlText - [Email me] - [39..47) - FullWidth: 8 - Slots: 1 + SyntaxKind.List - [Email me] - [39..47) - FullWidth: 8 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Email]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[me]; Tag block - Gen - 4 - (47:0,47) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (47:0,47) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/NoLongerSupportsDollarOpenBraceCombination.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/NoLongerSupportsDollarOpenBraceCombination.stree.txt index 7be20b9bb1..af6cd12e73 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/NoLongerSupportsDollarOpenBraceCombination.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/NoLongerSupportsDollarOpenBraceCombination.stree.txt @@ -4,8 +4,8 @@ Markup block - Gen - 17 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[foo]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [${bar}] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:1 - HtmlTokenType.Text;[${bar}]; + SyntaxKind.HtmlText - [${bar}] - [5..11) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[${bar}]; Tag block - Gen - 6 - (11:0,11) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/RendersTextPseudoTagAsMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/RendersTextPseudoTagAsMarkup.stree.txt index 6d5fca2bac..1dc42d172d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/RendersTextPseudoTagAsMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlDocumentTest/RendersTextPseudoTagAsMarkup.stree.txt @@ -7,8 +7,8 @@ Markup block - Gen - 20 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[text]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlText - [Foo] - [10..13) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Foo]; Tag block - Gen - 7 - (13:0,13) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlTagsTest/VoidElementFollowedByOtherTag.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlTagsTest/VoidElementFollowedByOtherTag.stree.txt index ff1e45cbe0..dcc9e60c04 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlTagsTest/VoidElementFollowedByOtherTag.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlTagsTest/VoidElementFollowedByOtherTag.stree.txt @@ -12,20 +12,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (16:1,13) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [16..38) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [16..38) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 6 - (38:4,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (38:4,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -36,20 +37,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (51:4,13) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [51..73) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [51..73) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 4 - (73:7,0) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (73:7,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -60,20 +62,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (84:7,11) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [84..106) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [84..106) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 5 - (106:10,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (106:10,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -84,20 +87,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (118:10,12) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [118..140) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [118..140) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 9 - (140:13,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (140:13,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -108,20 +112,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (156:13,16) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [156..178) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [156..178) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 7 - (178:16,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (178:16,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -132,20 +137,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (192:16,14) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [192..214) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [192..214) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 4 - (214:19,0) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (214:19,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -156,20 +162,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (225:19,11) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [225..247) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [225..247) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 5 - (247:22,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (247:22,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -180,20 +187,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (259:22,12) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [259..281) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [259..281) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 7 - (281:25,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (281:25,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -204,20 +212,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (295:25,14) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [295..317) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [295..317) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 8 - (317:28,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (317:28,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -228,20 +237,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (332:28,15) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [332..354) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [332..354) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 6 - (354:31,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (354:31,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -252,20 +262,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (367:31,13) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [367..389) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [367..389) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 6 - (389:34,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (389:34,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -276,20 +287,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (402:34,13) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [402..424) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [402..424) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 7 - (424:37,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (424:37,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -300,20 +312,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (438:37,14) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [438..460) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [438..460) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 8 - (460:40,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (460:40,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -324,20 +337,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (475:40,15) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [475..497) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [475..497) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 7 - (497:43,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (497:43,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -348,20 +362,21 @@ Markup block - Gen - 564 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[other]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ var x = true;LF}LF{LF] - SpanEditHandler;Accepts:Any - (511:43,14) - Tokens:13 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[var]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[x]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[true;]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[}]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.Text;[{]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [ var x = true;LF}LF{LF] - [511..533) - FullWidth: 22 - Slots: 1 + SyntaxKind.List - [ var x = true;LF}LF{LF] - [511..533) - FullWidth: 22 - Slots: 13 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[x]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Equals;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[true;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteralToken;[{]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 5 - (533:46,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (533:46,0) - Tokens:3 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/ParseDocumentGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/ParseDocumentGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine.stree.txt index 97fd746b22..6cbf72896e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/ParseDocumentGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/ParseDocumentGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine.stree.txt @@ -57,8 +57,8 @@ Markup block - Gen - 95 - (0:0,0) CSharpTokenType.WhiteSpace;[ ]; CSharpTokenType.RightBrace;[}]; CSharpTokenType.NewLine;[LF]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (86:4,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [86..90) - FullWidth: 4 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 5 - (90:4,4) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (90:4,4) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/ParseDocumentTreatsTwoAtSignsAsEscapeSequence.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/ParseDocumentTreatsTwoAtSignsAsEscapeSequence.stree.txt index e870829b98..1a12555431 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/ParseDocumentTreatsTwoAtSignsAsEscapeSequence.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/ParseDocumentTreatsTwoAtSignsAsEscapeSequence.stree.txt @@ -6,9 +6,10 @@ Markup block - Gen - 16 - (0:0,0) HtmlTokenType.CloseAngle;[>]; Markup span - Gen - [@] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:1 HtmlTokenType.Transition;[@]; - Markup span - Gen - [@bar] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:2 - HtmlTokenType.Transition;[@]; - HtmlTokenType.Text;[bar]; + SyntaxKind.HtmlText - [@bar] - [6..10) - FullWidth: 4 - Slots: 1 + SyntaxKind.List - [@bar] - [6..10) - FullWidth: 4 - Slots: 2 + SyntaxKind.Transition;[@]; + SyntaxKind.HtmlTextLiteralToken;[bar]; Tag block - Gen - 6 - (10:0,10) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SectionBodyTreatsTwoAtSignsAsEscapeSequence.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SectionBodyTreatsTwoAtSignsAsEscapeSequence.stree.txt index 8314633d3a..e339ea4c7b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SectionBodyTreatsTwoAtSignsAsEscapeSequence.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SectionBodyTreatsTwoAtSignsAsEscapeSequence.stree.txt @@ -24,9 +24,10 @@ Markup block - Gen - 33 - (0:0,0) HtmlTokenType.CloseAngle;[>]; Markup span - Gen - [@] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 HtmlTokenType.Transition;[@]; - Markup span - Gen - [@bar] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:2 - HtmlTokenType.Transition;[@]; - HtmlTokenType.Text;[bar]; + SyntaxKind.HtmlText - [@bar] - [21..25) - FullWidth: 4 - Slots: 1 + SyntaxKind.List - [@bar] - [21..25) - FullWidth: 4 - Slots: 2 + SyntaxKind.Transition;[@]; + SyntaxKind.HtmlTextLiteralToken;[bar]; Tag block - Gen - 6 - (25:0,25) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SectionContextGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SectionContextGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine.stree.txt index 4b833c9b90..6679cbc713 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SectionContextGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SectionContextGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine.stree.txt @@ -74,8 +74,8 @@ Markup block - Gen - 127 - (0:0,0) CSharpTokenType.WhiteSpace;[ ]; CSharpTokenType.RightBrace;[}]; CSharpTokenType.NewLine;[LF]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (115:5,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [115..119) - FullWidth: 4 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 5 - (119:5,4) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (119:5,4) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes3.stree.txt index 366dbc6078..e5de15c751 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes3.stree.txt @@ -5,7 +5,8 @@ Markup block - Gen - 55 - (0:0,0) (click) - SingleQuotes Code span - Gen - [doSomething()] - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K14 - (23:0,23) - Tokens:1 HtmlTokenType.Text;[doSomething()]; - Markup span - Gen - [Click Me] - SpanEditHandler;Accepts:Any - (38:0,38) - Tokens:3 - HtmlTokenType.Text;[Click]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Me]; + SyntaxKind.HtmlText - [Click Me] - [38..46) - FullWidth: 8 - Slots: 1 + SyntaxKind.List - [Click Me] - [38..46) - FullWidth: 8 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Click]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Me]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes4.stree.txt index cbf0f2b725..50715ec4ce 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes4.stree.txt @@ -5,7 +5,8 @@ Markup block - Gen - 56 - (0:0,0) (^click) - SingleQuotes Code span - Gen - [doSomething()] - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K14 - (24:0,24) - Tokens:1 HtmlTokenType.Text;[doSomething()]; - Markup span - Gen - [Click Me] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:3 - HtmlTokenType.Text;[Click]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Me]; + SyntaxKind.HtmlText - [Click Me] - [39..47) - FullWidth: 8 - Slots: 1 + SyntaxKind.List - [Click Me] - [39..47) - FullWidth: 8 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Click]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Me]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelper6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelper6.stree.txt index fe4a84da78..7f6efaa0b4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelper6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelper6.stree.txt @@ -11,8 +11,8 @@ Markup block - Gen - 16 - (0:0,0) HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [11..12) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 1 - (12:0,12) Markup span - Gen - [<] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelper7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelper7.stree.txt index 7be3a33a3d..c8c9775478 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelper7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelper7.stree.txt @@ -7,9 +7,10 @@ Markup block - Gen - 16 - (0:0,0) HtmlTokenType.OpenAngle;[<]; Tag block - Gen - 14 - (2:0,2) - strong - strongtaghelper StartTagAndEndTag - - Markup span - Gen - [> ] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:2 - HtmlTokenType.CloseAngle;[>]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [> ] - [10..12) - FullWidth: 2 - Slots: 1 + SyntaxKind.List - [> ] - [10..12) - FullWidth: 2 - Slots: 2 + SyntaxKind.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 1 - (12:0,12) Markup span - Gen - [<] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml1.stree.txt index 691f1ef5f0..651de5616b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml1.stree.txt @@ -7,6 +7,7 @@ Markup block - Gen - 11 - (0:0,0) HtmlTokenType.OpenAngle;[<]; Tag block - Gen - 9 - (2:0,2) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [>>] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:2 - HtmlTokenType.CloseAngle;[>]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [>>] - [5..7) - FullWidth: 2 - Slots: 1 + SyntaxKind.List - [>>] - [5..7) - FullWidth: 2 - Slots: 2 + SyntaxKind.CloseAngle;[>]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml10.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml10.stree.txt index 3bd9e0da8b..7162e0ec6e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml10.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml10.stree.txt @@ -27,6 +27,7 @@ Markup block - Gen - 42 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [ >] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [ >] - [36..38) - FullWidth: 2 - Slots: 1 + SyntaxKind.List - [ >] - [36..38) - FullWidth: 2 - Slots: 2 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml6.stree.txt index 205fa19ad5..8a18d0f97d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml6.stree.txt @@ -8,8 +8,9 @@ Markup block - Gen - 13 - (0:0,0) HtmlTokenType.OpenAngle;[<]; Tag block - Gen - 9 - (3:0,3) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [/>] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:2 - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [/>] - [6..8) - FullWidth: 2 - Slots: 1 + SyntaxKind.List - [/>] - [6..8) - FullWidth: 2 - Slots: 2 + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 HtmlTokenType.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml7.stree.txt index 08d08394e4..4db6a53c07 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml7.stree.txt @@ -8,9 +8,10 @@ Markup block - Gen - 21 - (0:0,0) HtmlTokenType.OpenAngle;[<]; Tag block - Gen - 17 - (3:0,3) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [/>] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:2 - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [/>] - [6..8) - FullWidth: 2 - Slots: 1 + SyntaxKind.List - [/>] - [6..8) - FullWidth: 2 - Slots: 2 + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 8 - (8:0,8) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:3 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml8.stree.txt index 5b8eb5624a..a2778a175d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml8.stree.txt @@ -15,9 +15,10 @@ Markup block - Gen - 34 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [/>] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:2 - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [/>] - [19..21) - FullWidth: 2 - Slots: 1 + SyntaxKind.List - [/>] - [19..21) - FullWidth: 2 - Slots: 2 + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 8 - (21:0,21) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:3 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml9.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml9.stree.txt index be1f5cade9..450dc56e03 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml9.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml9.stree.txt @@ -4,8 +4,8 @@ Markup block - Gen - 52 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.WhiteSpace;[ ]; - Markup span - Gen - [/] - SpanEditHandler;Accepts:Any - (4:0,4) - Tokens:1 - HtmlTokenType.ForwardSlash;[/]; + SyntaxKind.HtmlText - [/] - [4..5) - FullWidth: 1 - Slots: 1 + SyntaxKind.ForwardSlash;[/]; Tag block - Gen - 4 - (5:0,5) Markup span - Gen - [< >] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:3 HtmlTokenType.OpenAngle;[<]; @@ -20,11 +20,12 @@ Markup block - Gen - 52 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [ / >] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [ / >] - [25..29) - FullWidth: 4 - Slots: 1 + SyntaxKind.List - [ / >] - [25..29) - FullWidth: 4 - Slots: 4 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 8 - (29:0,29) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:3 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper2.stree.txt index 7507d4edbb..d5041a70bd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper2.stree.txt @@ -6,13 +6,14 @@ Markup block - Gen - 42 - (0:0,0) HtmlTokenType.CloseAngle;[>]; Tag block - Gen - 37 - (5:0,5) - p - ptaghelper StartTagAndEndTag -

- Markup span - Gen - [Hello ] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello ] - [8..14) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [Hello ] - [8..14) - FullWidth: 6 - Slots: 2 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 22 - (14:0,14) - strong - strongtaghelper StartTagAndEndTag - ... - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [22..27) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; Tag block - Gen - 6 - (36:0,36) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper3.stree.txt index 4db15664cc..ec641a65dc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper3.stree.txt @@ -6,13 +6,14 @@ Markup block - Gen - 33 - (0:0,0) HtmlTokenType.CloseAngle;[>]; Tag block - Gen - 28 - (5:0,5) - p - ptaghelper StartTagAndEndTag -

- Markup span - Gen - [Hello ] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello ] - [8..14) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [Hello ] - [8..14) - FullWidth: 6 - Slots: 2 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 19 - (14:0,14) - strong - strongtaghelper StartTagAndEndTag - - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [22..27) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; Tag block - Gen - 6 - (27:0,27) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper4.stree.txt index 53f8db31af..d65111c91c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper4.stree.txt @@ -4,13 +4,14 @@ Markup block - Gen - 52 - (0:0,0) class - DoubleQuotes Markup span - Gen - [foo] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 HtmlTokenType.Text;[foo]; - Markup span - Gen - [Hello ] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:2 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello ] - [15..21) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [Hello ] - [15..21) - FullWidth: 6 - Slots: 2 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 31 - (21:0,21) - p - ptaghelper StartTagAndEndTag -

...

style - DoubleQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [43..48) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks3.stree.txt index f0ca32e92b..0e92db66cb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks3.stree.txt @@ -21,7 +21,8 @@ Markup block - Gen - 62 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (47:0,47) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [47..58) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [47..58) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks4.stree.txt index ae4ff2e8b5..58dedb903f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks4.stree.txt @@ -103,7 +103,8 @@ Markup block - Gen - 164 - (0:0,0) CSharpTokenType.GreaterThan;[>]; CSharpTokenType.RightParenthesis;[)]; CSharpTokenType.Semicolon;[;]; - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (149:0,149) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [149..160) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [149..160) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks5.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks5.stree.txt index 96fd57b5b6..8c66f6af06 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks5.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks5.stree.txt @@ -11,10 +11,10 @@ Markup block - Gen - 69 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - HtmlTokenType.Text;[Hello]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (34:0,34) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello] - [25..30) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.HtmlText - [ ] - [34..35) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 34 - (35:0,35) - p - ptaghelper StartTagAndEndTag -

...

style - SingleQuotes @@ -27,5 +27,5 @@ Markup block - Gen - 69 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (60:0,60) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [60..65) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks6.stree.txt index 227cfafca6..f857b3b159 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks6.stree.txt @@ -52,10 +52,10 @@ Markup block - Gen - 171 - (0:0,0) CSharpTokenType.GreaterThan;[>]; CSharpTokenType.RightParenthesis;[)]; CSharpTokenType.Semicolon;[;]; - Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (76:0,76) - Tokens:1 - HtmlTokenType.Text;[Hello]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (85:0,85) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello] - [76..81) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.HtmlText - [ ] - [85..86) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 85 - (86:0,86) - p - ptaghelper StartTagAndEndTag -

...

style - SingleQuotes @@ -109,5 +109,5 @@ Markup block - Gen - 171 - (0:0,0) CSharpTokenType.GreaterThan;[>]; CSharpTokenType.RightParenthesis;[)]; CSharpTokenType.Semicolon;[;]; - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (162:0,162) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [162..167) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks7.stree.txt index d7b3ddaf13..0370e716d7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexAttributeTagHelperTagBlocks7.stree.txt @@ -21,11 +21,12 @@ Markup block - Gen - 122 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [Hello World ] - SpanEditHandler;Accepts:Any - (47:0,47) - Tokens:4 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello World ] - [47..59) - FullWidth: 12 - Slots: 1 + SyntaxKind.List - [Hello World ] - [47..59) - FullWidth: 12 - Slots: 4 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 30 - (59:0,59) Markup span - Gen - [ - 122 - (0:0,0) HtmlTokenType.DoubleQuote;["]; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (88:0,88) - Tokens:1 HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [inside of strong tag] - SpanEditHandler;Accepts:Any - (89:0,89) - Tokens:7 - HtmlTokenType.Text;[inside]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[of]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[strong]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[tag]; + SyntaxKind.HtmlText - [inside of strong tag] - [89..109) - FullWidth: 20 - Slots: 1 + SyntaxKind.List - [inside of strong tag] - [89..109) - FullWidth: 20 - Slots: 7 + SyntaxKind.HtmlTextLiteralToken;[inside]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[of]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[strong]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[tag]; Tag block - Gen - 9 - (109:0,109) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (109:0,109) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks5.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks5.stree.txt index 4b1ec685e7..f56e242178 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks5.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks5.stree.txt @@ -8,8 +8,8 @@ Markup block - Gen - 41 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [20..21) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 20 - (21:0,21) - p - ptaghelper StartTagAndEndTag -

...

Expression block - Gen - 13 - (24:0,24) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks6.stree.txt index ea99ab8b27..1c73cb4a04 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks6.stree.txt @@ -42,8 +42,8 @@ Markup block - Gen - 131 - (0:0,0) CSharpTokenType.GreaterThan;[>]; CSharpTokenType.RightParenthesis;[)]; CSharpTokenType.Semicolon;[;]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (65:0,65) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [65..66) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 65 - (66:0,66) - p - ptaghelper StartTagAndEndTag -

...

Statement block - Gen - 58 - (69:0,69) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks7.stree.txt index 65a743ab54..89b597f453 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks7.stree.txt @@ -28,11 +28,12 @@ Markup block - Gen - 77 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [ strong tag] - SpanEditHandler;Accepts:Any - (53:0,53) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[strong]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[tag]; + SyntaxKind.HtmlText - [ strong tag] - [53..64) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [ strong tag] - [53..64) - FullWidth: 11 - Slots: 4 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[strong]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[tag]; Tag block - Gen - 9 - (64:0,64) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (64:0,64) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks8.stree.txt index 0a629daead..39f7f0e90e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesComplexTagHelperTagBlocks8.stree.txt @@ -96,11 +96,12 @@ Markup block - Gen - 167 - (0:0,0) CSharpTokenType.GreaterThan;[>]; CSharpTokenType.RightParenthesis;[)]; CSharpTokenType.Semicolon;[;]; - Markup span - Gen - [ strong tag] - SpanEditHandler;Accepts:Any - (143:0,143) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[strong]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[tag]; + SyntaxKind.HtmlText - [ strong tag] - [143..154) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [ strong tag] - [143..154) - FullWidth: 11 - Slots: 4 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[strong]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[tag]; Tag block - Gen - 9 - (154:0,154) Markup span - Gen - [
] - SpanEditHandler;Accepts:Any - (154:0,154) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesOddlySpacedTagHelperTagBlocks2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesOddlySpacedTagHelperTagBlocks2.stree.txt index dcbff8cf35..4899139986 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesOddlySpacedTagHelperTagBlocks2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesOddlySpacedTagHelperTagBlocks2.stree.txt @@ -21,7 +21,8 @@ Markup block - Gen - 77 - (0:0,0) HtmlTokenType.Text;[;]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (53:0,53) - Tokens:1 HtmlTokenType.WhiteSpace;[ ]; - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (62:0,62) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [62..73) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [62..73) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesOddlySpacedTagHelperTagBlocks3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesOddlySpacedTagHelperTagBlocks3.stree.txt index f8e29d153c..e50a16ac77 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesOddlySpacedTagHelperTagBlocks3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesOddlySpacedTagHelperTagBlocks3.stree.txt @@ -8,10 +8,10 @@ Markup block - Gen - 73 - (0:0,0) HtmlTokenType.Text;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 HtmlTokenType.WhiteSpace;[ ]; - Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - HtmlTokenType.Text;[Hello]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (34:0,34) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello] - [25..30) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.HtmlText - [ ] - [34..35) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 38 - (35:0,35) - p - ptaghelper StartTagAndEndTag -

...

style - DoubleQuotes @@ -21,5 +21,5 @@ Markup block - Gen - 73 - (0:0,0) HtmlTokenType.Text;[color:red;]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (60:0,60) - Tokens:1 HtmlTokenType.WhiteSpace;[ ]; - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (64:0,64) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [64..69) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks2.stree.txt index 9342e8c17f..037159aa8b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks2.stree.txt @@ -1,7 +1,8 @@ Markup block - Gen - 18 - (0:0,0) Tag block - Gen - 18 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [3..14) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [3..14) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks3.stree.txt index 416fb1eea7..c0d42d889b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks3.stree.txt @@ -1,11 +1,11 @@ Markup block - Gen - 25 - (0:0,0) Tag block - Gen - 12 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.Text;[Hello]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello] - [3..8) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.HtmlText - [ ] - [12..13) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 12 - (13:0,13) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [16..21) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks4.stree.txt index abfc92081e..57227a6b9c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesPlainTagHelperTagBlocks4.stree.txt @@ -1,24 +1,26 @@ Markup block - Gen - 56 - (0:0,0) Tag block - Gen - 56 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hello World ] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:4 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello World ] - [3..15) - FullWidth: 12 - Slots: 1 + SyntaxKind.List - [Hello World ] - [3..15) - FullWidth: 12 - Slots: 4 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 8 - (15:0,15) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:3 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [inside of strong tag] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:7 - HtmlTokenType.Text;[inside]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[of]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[strong]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[tag]; + SyntaxKind.HtmlText - [inside of strong tag] - [23..43) - FullWidth: 20 - Slots: 1 + SyntaxKind.List - [inside of strong tag] - [23..43) - FullWidth: 20 - Slots: 7 + SyntaxKind.HtmlTextLiteralToken;[inside]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[of]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[strong]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[tag]; Tag block - Gen - 9 - (43:0,43) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers3.stree.txt index ac2d4ce18f..ca53775995 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers3.stree.txt @@ -11,11 +11,11 @@ Markup block - Gen - 53 - (0:0,0) HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[p]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [29..30) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 23 - (30:0,30) - p - ptaghelper StartTagAndEndTag -

...

Tag block - Gen - 16 - (33:0,33) - div - divtaghelper StartTagAndEndTag -
...
- Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (38:0,38) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [38..43) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers4.stree.txt index 2bc0cce4d1..8e9b5e2654 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers4.stree.txt @@ -11,8 +11,8 @@ Markup block - Gen - 75 - (0:0,0) HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [39..40) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 35 - (40:0,40) - script - scripttaghelper StartTagAndEndTag - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (48:0,48) - Tokens:8 diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers6.stree.txt index 8a460e1b8a..9b1944707c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers6.stree.txt @@ -1,9 +1,10 @@ Markup block - Gen - 67 - (0:0,0) Tag block - Gen - 67 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hello ] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:2 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello ] - [3..9) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [Hello ] - [3..9) - FullWidth: 6 - Slots: 2 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 48 - (9:0,9) - script - scripttaghelper StartTagAndEndTag - class - DoubleQuotes @@ -12,6 +13,7 @@ Markup block - Gen - 67 - (0:0,0) style - DoubleQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [ World] - SpanEditHandler;Accepts:Any - (57:0,57) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [ World] - [57..63) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [ World] - [57..63) - FullWidth: 6 - Slots: 2 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers7.stree.txt index cd797ecdad..44250bb25c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesScriptTagHelpers7.stree.txt @@ -1,9 +1,10 @@ Markup block - Gen - 77 - (0:0,0) Tag block - Gen - 77 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hello ] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:2 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello ] - [3..9) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [Hello ] - [3..9) - FullWidth: 6 - Slots: 2 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 58 - (9:0,9) - script - scripttaghelper StartTagAndEndTag - class - DoubleQuotes @@ -18,6 +19,7 @@ Markup block - Gen - 77 - (0:0,0) style - DoubleQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (46:0,46) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [ World] - SpanEditHandler;Accepts:Any - (67:0,67) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [ World] - [67..73) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [ World] - [67..73) - FullWidth: 6 - Slots: 2 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesSelfClosingTagHelpers2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesSelfClosingTagHelpers2.stree.txt index f2e8370abd..e208c481fc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesSelfClosingTagHelpers2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesSelfClosingTagHelpers2.stree.txt @@ -1,9 +1,10 @@ Markup block - Gen - 55 - (0:0,0) Tag block - Gen - 55 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hello ] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:2 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello ] - [3..9) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [Hello ] - [3..9) - FullWidth: 6 - Slots: 2 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 36 - (9:0,9) - p - ptaghelper SelfClosing -

class - DoubleQuotes @@ -12,6 +13,7 @@ Markup block - Gen - 55 - (0:0,0) style - DoubleQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [ World] - SpanEditHandler;Accepts:Any - (45:0,45) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [ World] - [45..51) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [ World] - [45..51) - FullWidth: 6 - Slots: 2 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesSelfClosingTagHelpers3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesSelfClosingTagHelpers3.stree.txt index 172a414a85..240216bd1b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesSelfClosingTagHelpers3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesSelfClosingTagHelpers3.stree.txt @@ -6,8 +6,8 @@ Markup block - Gen - 52 - (0:0,0) class - DoubleQuotes Markup span - Gen - [foo] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 HtmlTokenType.Text;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [22..23) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 24 - (23:0,23) - p - ptaghelper SelfClosing -

style - DoubleQuotes diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes2.stree.txt index 139d9edd0b..14d467f45c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes2.stree.txt @@ -7,7 +7,8 @@ Markup block - Gen - 49 - (0:0,0) style - DoubleQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (34:0,34) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [34..45) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [34..45) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes3.stree.txt index 4a1b76e66f..3ef0269912 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes3.stree.txt @@ -4,14 +4,14 @@ Markup block - Gen - 56 - (0:0,0) class - DoubleQuotes Markup span - Gen - [foo] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 HtmlTokenType.Text;[foo]; - Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - HtmlTokenType.Text;[Hello]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello] - [15..20) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.HtmlText - [ ] - [24..25) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 31 - (25:0,25) - p - ptaghelper StartTagAndEndTag -

...

style - DoubleQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (47:0,47) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [47..52) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes4.stree.txt index c0735871ee..dbbf227e04 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithPlainAttributes4.stree.txt @@ -7,11 +7,12 @@ Markup block - Gen - 99 - (0:0,0) style - DoubleQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [Hello World ] - SpanEditHandler;Accepts:Any - (34:0,34) - Tokens:4 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello World ] - [34..46) - FullWidth: 12 - Slots: 1 + SyntaxKind.List - [Hello World ] - [34..46) - FullWidth: 12 - Slots: 4 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 20 - (46:0,46) Markup span - Gen - [ - 99 - (0:0,0) HtmlTokenType.DoubleQuote;["]; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (65:0,65) - Tokens:1 HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [inside of strong tag] - SpanEditHandler;Accepts:Any - (66:0,66) - Tokens:7 - HtmlTokenType.Text;[inside]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[of]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[strong]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[tag]; + SyntaxKind.HtmlText - [inside of strong tag] - [66..86) - FullWidth: 20 - Slots: 1 + SyntaxKind.List - [inside of strong tag] - [66..86) - FullWidth: 20 - Slots: 7 + SyntaxKind.HtmlTextLiteralToken;[inside]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[of]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[strong]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[tag]; Tag block - Gen - 9 - (86:0,86) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (86:0,86) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes2.stree.txt index 69000027f8..66909a9b03 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes2.stree.txt @@ -17,7 +17,8 @@ Markup block - Gen - 67 - (0:0,0) style - NoQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (41:0,41) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (52:0,52) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [52..63) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [52..63) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes3.stree.txt index 5678b9c2a8..bda8459af3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes3.stree.txt @@ -25,7 +25,8 @@ Markup block - Gen - 69 - (0:0,0) HtmlTokenType.Transition;[@]; Markup span - Gen - [:red;] - SpanEditHandler;Accepts:Any - (48:0,48) - Tokens:1 HtmlTokenType.Text;[:red;]; - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (54:0,54) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [54..65) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [54..65) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes4.stree.txt index d8b15f08be..c584c614d3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes4.stree.txt @@ -14,10 +14,10 @@ Markup block - Gen - 96 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 - HtmlTokenType.Text;[Hello]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (44:0,44) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello] - [35..40) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.HtmlText - [ ] - [44..45) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 51 - (45:0,45) - p - ptaghelper StartTagAndEndTag -

...

style - NoQuotes @@ -33,5 +33,5 @@ Markup block - Gen - 96 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (87:0,87) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [87..92) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes5.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes5.stree.txt index b8af7a90a7..682edd9cb7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes5.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_RewritesTagHelpersWithQuotelessAttributes5.stree.txt @@ -17,11 +17,12 @@ Markup block - Gen - 117 - (0:0,0) style - NoQuotes Markup span - Gen - [color:red;] - SpanEditHandler;Accepts:Any - (41:0,41) - Tokens:1 HtmlTokenType.Text;[color:red;]; - Markup span - Gen - [Hello World ] - SpanEditHandler;Accepts:Any - (52:0,52) - Tokens:4 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello World ] - [52..64) - FullWidth: 12 - Slots: 1 + SyntaxKind.List - [Hello World ] - [52..64) - FullWidth: 12 - Slots: 4 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 20 - (64:0,64) Markup span - Gen - [ - 117 - (0:0,0) HtmlTokenType.DoubleQuote;["]; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (83:0,83) - Tokens:1 HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [inside of strong tag] - SpanEditHandler;Accepts:Any - (84:0,84) - Tokens:7 - HtmlTokenType.Text;[inside]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[of]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[strong]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[tag]; + SyntaxKind.HtmlText - [inside of strong tag] - [84..104) - FullWidth: 20 - Slots: 1 + SyntaxKind.List - [inside of strong tag] - [84..104) - FullWidth: 20 - Slots: 7 + SyntaxKind.HtmlTextLiteralToken;[inside]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[of]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[strong]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[tag]; Tag block - Gen - 9 - (104:0,104) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (104:0,104) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsPrefixedTagHelpers10.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsPrefixedTagHelpers10.stree.txt index 57ede0c7c8..2261b505dd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsPrefixedTagHelpers10.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsPrefixedTagHelpers10.stree.txt @@ -4,9 +4,10 @@ Markup block - Gen - 47 - (0:0,0) class - DoubleQuotes Markup span - Gen - [btn] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 HtmlTokenType.Text;[btn]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [21..37) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [21..37) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsPrefixedTagHelpers2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsPrefixedTagHelpers2.stree.txt index ff9ec4c836..f1a4ac271a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsPrefixedTagHelpers2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsPrefixedTagHelpers2.stree.txt @@ -4,12 +4,13 @@ Markup block - Gen - 27 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[th:]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [5..21) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [5..21) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; Tag block - Gen - 6 - (21:0,21) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsRazorCommentsAsChildren.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsRazorCommentsAsChildren.stree.txt index 65a33c1dd7..2185b6c7d8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsRazorCommentsAsChildren.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsRazorCommentsAsChildren.stree.txt @@ -6,8 +6,8 @@ Markup block - Gen - 26 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[b]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [asdf] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:1 - HtmlTokenType.Text;[asdf]; + SyntaxKind.HtmlText - [asdf] - [6..10) - FullWidth: 4 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[asdf]; Tag block - Gen - 4 - (10:0,10) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsRazorMarkupInHtmlComment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsRazorMarkupInHtmlComment.stree.txt index e2c3d3f02e..179b922d73 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsRazorMarkupInHtmlComment.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsRazorMarkupInHtmlComment.stree.txt @@ -6,8 +6,8 @@ Markup block - Gen - 37 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[b]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [asdf] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:1 - HtmlTokenType.Text;[asdf]; + SyntaxKind.HtmlText - [asdf] - [6..10) - FullWidth: 4 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[asdf]; Tag block - Gen - 4 - (10:0,10) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsSimpleHtmlCommentsAsChildren.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsSimpleHtmlCommentsAsChildren.stree.txt index 6bded863a8..015f78b77e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsSimpleHtmlCommentsAsChildren.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsSimpleHtmlCommentsAsChildren.stree.txt @@ -6,8 +6,8 @@ Markup block - Gen - 36 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[b]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [asdf] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:1 - HtmlTokenType.Text;[asdf]; + SyntaxKind.HtmlText - [asdf] - [6..10) - FullWidth: 4 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[asdf]; Tag block - Gen - 4 - (10:0,10) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsTagHelperElementOptOutHTML_WithAttributeData3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsTagHelperElementOptOutHTML_WithAttributeData3.stree.txt index 89bdbd9827..7d584c965c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsTagHelperElementOptOutHTML_WithAttributeData3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/AllowsTagHelperElementOptOutHTML_WithAttributeData3.stree.txt @@ -18,12 +18,13 @@ Markup block - Gen - 37 - (0:0,0) HtmlTokenType.DoubleQuote;["]; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [16..32) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [16..32) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; Tag block - Gen - 5 - (32:0,32) Markup span - Gen - [ - 25 - (0:0,0) Markup span - Gen - [p>] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:2 HtmlTokenType.Text;[p]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (4:0,4) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [4..20) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [4..20) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; Tag block - Gen - 5 - (20:0,20) Markup span - Gen - [ - 53 - (0:0,0) Tag block - Gen - 53 - (0:0,0) - p - PTagHelper StartTagAndEndTag -

...

- Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:2 - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [LF ] - [3..9) - FullWidth: 6 - Slots: 1 + SyntaxKind.List - [LF ] - [3..9) - FullWidth: 6 - Slots: 2 + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 8 - (9:1,4) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (9:1,4) - Tokens:3 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [LF HelloLF ] - SpanEditHandler;Accepts:Any - (17:1,12) - Tokens:5 - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Hello]; - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [LF HelloLF ] - [17..38) - FullWidth: 21 - Slots: 1 + SyntaxKind.List - [LF HelloLF ] - [17..38) - FullWidth: 21 - Slots: 5 + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 9 - (38:3,4) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (38:3,4) - Tokens:4 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (47:3,13) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [LF] - [47..49) - FullWidth: 2 - Slots: 1 + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/CanHandleMultipleTagHelpersWithAllowedChildren.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/CanHandleMultipleTagHelpersWithAllowedChildren.stree.txt index 39abf8bc1c..559893493c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/CanHandleMultipleTagHelpersWithAllowedChildren.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/CanHandleMultipleTagHelpersWithAllowedChildren.stree.txt @@ -3,9 +3,10 @@ Markup block - Gen - 39 - (0:0,0) StartTagAndEndTag -

...

Tag block - Gen - 28 - (3:0,3) - strong - StrongTagHelper StartTagAndEndTag - ... - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [11..22) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [11..22) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; Tag block - Gen - 4 - (31:0,31) - br - BRTagHelper StartTagOnly -
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/CanHandleMultipleTagHelpersWithAllowedChildren_OneNull.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/CanHandleMultipleTagHelpersWithAllowedChildren_OneNull.stree.txt index 39abf8bc1c..559893493c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/CanHandleMultipleTagHelpersWithAllowedChildren_OneNull.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/CanHandleMultipleTagHelpersWithAllowedChildren_OneNull.stree.txt @@ -3,9 +3,10 @@ Markup block - Gen - 39 - (0:0,0) StartTagAndEndTag -

...

Tag block - Gen - 28 - (3:0,3) - strong - StrongTagHelper StartTagAndEndTag - ... - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [11..22) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [11..22) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; Tag block - Gen - 4 - (31:0,31) - br - BRTagHelper StartTagOnly -
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers3.stree.txt index ae0fe4b2d3..5f423530de 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers3.stree.txt @@ -4,17 +4,18 @@ Markup block - Gen - 31 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[foo]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:10 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.QuestionMark;[?]; - HtmlTokenType.Text;[xml]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.QuestionMark;[?]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [] - [5..25) - FullWidth: 20 - Slots: 1 + SyntaxKind.List - [] - [5..25) - FullWidth: 20 - Slots: 10 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.HtmlTextLiteralToken;[xml]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 6 - (25:0,25) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers4.stree.txt index 70ff974ca4..2dc95b7645 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers4.stree.txt @@ -14,10 +14,11 @@ Markup block - Gen - 24 - (0:0,0) CSharpTokenType.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (12:0,12) - Tokens:1 CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ?>] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.QuestionMark;[?]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [ ?>] - [15..18) - FullWidth: 3 - Slots: 1 + SyntaxKind.List - [ ?>] - [15..18) - FullWidth: 3 - Slots: 3 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 6 - (18:0,18) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers5.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers5.stree.txt index c1c7227367..862e8828b5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers5.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers5.stree.txt @@ -14,9 +14,10 @@ Markup block - Gen - 27 - (0:0,0) CSharpTokenType.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (16:0,16) - Tokens:1 CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ >] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [ >] - [19..21) - FullWidth: 2 - Slots: 1 + SyntaxKind.List - [ >] - [19..21) - FullWidth: 2 - Slots: 2 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 6 - (21:0,21) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers6.stree.txt index db02a12d1e..fa19d6d74d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers6.stree.txt @@ -4,18 +4,19 @@ Markup block - Gen - 36 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[foo]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:11 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Bang;[!]; - HtmlTokenType.Text;[DOCTYPE]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[hello]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.DoubleQuote;["]; - HtmlTokenType.Text;[world]; - HtmlTokenType.DoubleQuote;["]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [] - [5..30) - FullWidth: 25 - Slots: 1 + SyntaxKind.List - [] - [5..30) - FullWidth: 25 - Slots: 11 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Bang;[!]; + SyntaxKind.HtmlTextLiteralToken;[DOCTYPE]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[hello]; + SyntaxKind.Equals;[=]; + SyntaxKind.DoubleQuote;["]; + SyntaxKind.HtmlTextLiteralToken;[world]; + SyntaxKind.DoubleQuote;["]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 6 - (30:0,30) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers7.stree.txt index 9191c0df85..d5ef09e795 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers7.stree.txt @@ -4,20 +4,21 @@ Markup block - Gen - 36 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[foo]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:13 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Bang;[!]; - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.Text;[CDATA]; - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [] - [5..30) - FullWidth: 25 - Slots: 1 + SyntaxKind.List - [] - [5..30) - FullWidth: 25 - Slots: 13 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Bang;[!]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.HtmlTextLiteralToken;[CDATA]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 6 - (30:0,30) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers8.stree.txt index 269d727534..2f0435624a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers8.stree.txt @@ -16,11 +16,12 @@ Markup block - Gen - 29 - (0:0,0) CSharpTokenType.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (16:0,16) - Tokens:1 CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ]]>] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.HtmlText - [ ]]>] - [19..23) - FullWidth: 4 - Slots: 1 + SyntaxKind.List - [ ]]>] - [19..23) - FullWidth: 4 - Slots: 4 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 6 - (23:0,23) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteTextTagTransitionTagHelpers1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteTextTagTransitionTagHelpers1.stree.txt index 71ab735856..8bb9161487 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteTextTagTransitionTagHelpers1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteTextTagTransitionTagHelpers1.stree.txt @@ -1,7 +1,8 @@ Markup block - Gen - 24 - (0:0,0) Tag block - Gen - 24 - (0:0,0) - text - texttaghelper StartTagAndEndTag - ... - Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [Hello World] - [6..17) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [Hello World] - [6..17) - FullWidth: 11 - Slots: 3 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly12.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly12.stree.txt index e4144deee1..15e6a99460 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly12.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly12.stree.txt @@ -4,9 +4,10 @@ Markup block - Gen - 47 - (0:0,0) catchAll - DoubleQuotes Markup span - Gen - [hi] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 HtmlTokenType.Text;[hi]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [22..38) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [22..38) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly13.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly13.stree.txt index 611bd33126..82f974fd2d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly13.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly13.stree.txt @@ -11,9 +11,10 @@ Markup block - Gen - 58 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (33:0,33) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [33..49) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [33..49) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly18.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly18.stree.txt index b8f52275ec..fe60ec311b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly18.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly18.stree.txt @@ -7,9 +7,10 @@ Markup block - Gen - 51 - (0:0,0) class - DoubleQuotes Markup span - Gen - [btn] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 HtmlTokenType.Text;[btn]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [31..47) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [31..47) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly21.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly21.stree.txt index ae7da8d3bf..d48854c6ca 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly21.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly21.stree.txt @@ -6,9 +6,10 @@ Markup block - Gen - 48 - (0:0,0) class - DoubleQuotes Markup span - Gen - [btn] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 HtmlTokenType.Text;[btn]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [26..42) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [26..42) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly22.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly22.stree.txt index ff1ac587a8..65c77a3afc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly22.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly22.stree.txt @@ -21,9 +21,10 @@ Markup block - Gen - 71 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (49:0,49) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [49..65) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [49..65) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly23.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly23.stree.txt index a3497aefd1..71d15cc105 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly23.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly23.stree.txt @@ -6,20 +6,20 @@ Markup block - Gen - 63 - (0:0,0) class - DoubleQuotes Markup span - Gen - [btn] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 HtmlTokenType.Text;[btn]; - Markup span - Gen - [words] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - HtmlTokenType.Text;[words]; + SyntaxKind.HtmlText - [words] - [26..31) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[words]; Tag block - Gen - 8 - (31:0,31) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:3 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [and] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - HtmlTokenType.Text;[and]; + SyntaxKind.HtmlText - [and] - [39..42) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[and]; Tag block - Gen - 9 - (42:0,42) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (42:0,42) - Tokens:4 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [spaces] - SpanEditHandler;Accepts:Any - (51:0,51) - Tokens:1 - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [spaces] - [51..57) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly25.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly25.stree.txt index afe5f75025..d84ee3a355 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly25.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly25.stree.txt @@ -7,9 +7,10 @@ Markup block - Gen - 49 - (0:0,0) catchAll - DoubleQuotes Markup span - Gen - [hi] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 HtmlTokenType.Text;[hi]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [29..45) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [29..45) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly27.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly27.stree.txt index d26626a437..ce687fa183 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly27.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly27.stree.txt @@ -9,9 +9,10 @@ Markup block - Gen - 63 - (0:0,0) catchAll - DoubleQuotes Markup span - Gen - [hi] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:1 HtmlTokenType.Text;[hi]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (41:0,41) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [41..57) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [41..57) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly28.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly28.stree.txt index 14faf216a7..384a5a66de 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly28.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly28.stree.txt @@ -15,9 +15,10 @@ Markup block - Gen - 65 - (0:0,0) HtmlTokenType.Transition;[@]; Markup span - Gen - [hi] - SpanEditHandler;Accepts:Any - (38:0,38) - Tokens:1 HtmlTokenType.Text;[hi]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [43..59) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [43..59) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly29.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly29.stree.txt index 0ae6065f5e..11b6fc8f3e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly29.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly29.stree.txt @@ -31,9 +31,10 @@ Markup block - Gen - 97 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (75:0,75) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [75..91) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [75..91) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly30.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly30.stree.txt index 91eadbe144..41c7885beb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly30.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly30.stree.txt @@ -9,20 +9,20 @@ Markup block - Gen - 78 - (0:0,0) catchAll - DoubleQuotes Markup span - Gen - [hi] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:1 HtmlTokenType.Text;[hi]; - Markup span - Gen - [words] - SpanEditHandler;Accepts:Any - (41:0,41) - Tokens:1 - HtmlTokenType.Text;[words]; + SyntaxKind.HtmlText - [words] - [41..46) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[words]; Tag block - Gen - 8 - (46:0,46) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (46:0,46) - Tokens:3 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [and] - SpanEditHandler;Accepts:Any - (54:0,54) - Tokens:1 - HtmlTokenType.Text;[and]; + SyntaxKind.HtmlText - [and] - [54..57) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[and]; Tag block - Gen - 9 - (57:0,57) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (57:0,57) - Tokens:4 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [spaces] - SpanEditHandler;Accepts:Any - (66:0,66) - Tokens:1 - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [spaces] - [66..72) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly7.stree.txt index bc8211a69b..9dcffabe84 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly7.stree.txt @@ -4,9 +4,10 @@ Markup block - Gen - 35 - (0:0,0) class - DoubleQuotes Markup span - Gen - [btn] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 HtmlTokenType.Text;[btn]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [15..31) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [15..31) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly8.stree.txt index 88b241fa8d..18416f3cc4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly8.stree.txt @@ -11,9 +11,10 @@ Markup block - Gen - 45 - (0:0,0) CSharpTokenType.Identifier;[DateTime]; CSharpTokenType.Dot;[.]; CSharpTokenType.Identifier;[Now]; - Markup span - Gen - [words and spaces] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:5 - HtmlTokenType.Text;[words]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[and]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [words and spaces] - [25..41) - FullWidth: 16 - Slots: 1 + SyntaxKind.List - [words and spaces] - [25..41) - FullWidth: 16 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[words]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[and]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly9.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly9.stree.txt index 012c1cafd0..3d76bacf64 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly9.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RequiredAttributeDescriptorsCreateTagHelperBlocksCorrectly9.stree.txt @@ -4,20 +4,20 @@ Markup block - Gen - 50 - (0:0,0) class - DoubleQuotes Markup span - Gen - [btn] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 HtmlTokenType.Text;[btn]; - Markup span - Gen - [words] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - HtmlTokenType.Text;[words]; + SyntaxKind.HtmlText - [words] - [15..20) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[words]; Tag block - Gen - 8 - (20:0,20) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:3 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [and] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - HtmlTokenType.Text;[and]; + SyntaxKind.HtmlText - [and] - [28..31) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[and]; Tag block - Gen - 9 - (31:0,31) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:4 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [spaces] - SpanEditHandler;Accepts:Any - (40:0,40) - Tokens:1 - HtmlTokenType.Text;[spaces]; + SyntaxKind.HtmlText - [spaces] - [40..46) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[spaces]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks2.stree.txt index a584ab11d6..81d8a7532f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks2.stree.txt @@ -1,10 +1,11 @@ Markup block - Gen - 30 - (0:0,0) Tag block - Gen - 30 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hello World ] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:4 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Hello World ] - [3..15) - FullWidth: 12 - Slots: 1 + SyntaxKind.List - [Hello World ] - [3..15) - FullWidth: 12 - Slots: 4 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[World]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 11 - (15:0,15) - div - divtaghelper StartTagAndEndTag -
...
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks3.stree.txt index 95f7c3c249..356b41b4fe 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks3.stree.txt @@ -1,17 +1,17 @@ Markup block - Gen - 43 - (0:0,0) Tag block - Gen - 19 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hel] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.Text;[Hel]; + SyntaxKind.HtmlText - [Hel] - [3..6) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hel]; Tag block - Gen - 9 - (6:0,6) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [lo] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:1 - HtmlTokenType.Text;[lo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [lo] - [9..11) - FullWidth: 2 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[lo]; + SyntaxKind.HtmlText - [ ] - [19..20) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 23 - (20:0,20) - p - ptaghelper StartTagAndEndTag -

...

Tag block - Gen - 16 - (23:0,23) - div - divtaghelper StartTagAndEndTag -
...
- Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [28..33) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks4.stree.txt index ae4e2a0c86..323ee1b780 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/RewritesNestedTagHelperTagBlocks4.stree.txt @@ -1,23 +1,23 @@ Markup block - Gen - 55 - (0:0,0) Tag block - Gen - 29 - (0:0,0) - p - ptaghelper StartTagAndEndTag -

...

- Markup span - Gen - [Hel] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.Text;[Hel]; + SyntaxKind.HtmlText - [Hel] - [3..6) - FullWidth: 3 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hel]; Tag block - Gen - 8 - (6:0,6) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:3 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [lo] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Text;[lo]; + SyntaxKind.HtmlText - [lo] - [14..16) - FullWidth: 2 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[lo]; Tag block - Gen - 9 - (16:0,16) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:4 HtmlTokenType.OpenAngle;[<]; HtmlTokenType.ForwardSlash;[/]; HtmlTokenType.Text;[strong]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [29..30) - FullWidth: 1 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 25 - (30:0,30) - p - ptaghelper StartTagAndEndTag -

...

Tag block - Gen - 6 - (33:0,33) @@ -25,8 +25,8 @@ Markup block - Gen - 55 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[span]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [World] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - HtmlTokenType.Text;[World]; + SyntaxKind.HtmlText - [World] - [39..44) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[World]; Tag block - Gen - 7 - (44:0,44) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:0,44) - Tokens:4 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren10.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren10.stree.txt index b2a07fedaf..c10ea3664c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren10.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren10.stree.txt @@ -3,8 +3,8 @@ Markup block - Gen - 69 - (0:0,0) StartTagAndEndTag -

...

Tag block - Gen - 47 - (3:0,3) - strong - StrongTagHelper StartTagAndEndTag - ... - Markup span - Gen - [Title:] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:1 - HtmlTokenType.Text;[Title:]; + SyntaxKind.HtmlText - [Title:] - [11..17) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Title:]; Tag block - Gen - 4 - (17:0,17) - br - BRTagHelper StartTagOnly -
Tag block - Gen - 4 - (21:0,21) @@ -12,12 +12,13 @@ Markup block - Gen - 69 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[em]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [A Very Cool] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:5 - HtmlTokenType.Text;[A]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Very]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Cool]; + SyntaxKind.HtmlText - [A Very Cool] - [25..36) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [A Very Cool] - [25..36) - FullWidth: 11 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[A]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Very]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Cool]; Tag block - Gen - 5 - (36:0,36) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:4 HtmlTokenType.OpenAngle;[<]; @@ -26,5 +27,5 @@ Markup block - Gen - 69 - (0:0,0) HtmlTokenType.CloseAngle;[>]; Tag block - Gen - 6 - (50:0,50) - br - BRTagHelper SelfClosing -
- Markup span - Gen - [Something] - SpanEditHandler;Accepts:Any - (56:0,56) - Tokens:1 - HtmlTokenType.Text;[Something]; + SyntaxKind.HtmlText - [Something] - [56..65) - FullWidth: 9 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Something]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren11.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren11.stree.txt index 240e049f63..27fbb13343 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren11.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren11.stree.txt @@ -6,8 +6,8 @@ Markup block - Gen - 69 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[custom]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Title:] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:1 - HtmlTokenType.Text;[Title:]; + SyntaxKind.HtmlText - [Title:] - [11..17) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Title:]; Tag block - Gen - 4 - (17:0,17) - br - BRTagHelper StartTagOnly -
Tag block - Gen - 4 - (21:0,21) @@ -15,12 +15,13 @@ Markup block - Gen - 69 - (0:0,0) HtmlTokenType.OpenAngle;[<]; HtmlTokenType.Text;[em]; HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [A Very Cool] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:5 - HtmlTokenType.Text;[A]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Very]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Cool]; + SyntaxKind.HtmlText - [A Very Cool] - [25..36) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [A Very Cool] - [25..36) - FullWidth: 11 - Slots: 5 + SyntaxKind.HtmlTextLiteralToken;[A]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Very]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Cool]; Tag block - Gen - 5 - (36:0,36) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:4 HtmlTokenType.OpenAngle;[<]; @@ -35,5 +36,5 @@ Markup block - Gen - 69 - (0:0,0) HtmlTokenType.CloseAngle;[>]; Tag block - Gen - 6 - (50:0,50) - br - BRTagHelper SelfClosing -
- Markup span - Gen - [Something] - SpanEditHandler;Accepts:Any - (56:0,56) - Tokens:1 - HtmlTokenType.Text;[Something]; + SyntaxKind.HtmlText - [Something] - [56..65) - FullWidth: 9 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Something]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren14.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren14.stree.txt index 4751517c44..44b41388f0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren14.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren14.stree.txt @@ -8,16 +8,16 @@ Markup block - Gen - 76 - (0:0,0) HtmlTokenType.CloseAngle;[>]; Tag block - Gen - 4 - (11:0,11) - br - BRTagHelper StartTagOnly -
- Markup span - Gen - [:] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - HtmlTokenType.Text;[:]; + SyntaxKind.HtmlText - [:] - [15..16) - FullWidth: 1 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[:]; Tag block - Gen - 39 - (16:0,16) - strong - StrongTagHelper StartTagAndEndTag - ... Tag block - Gen - 22 - (24:0,24) - strong - StrongTagHelper StartTagAndEndTag - ... - Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 - HtmlTokenType.Text;[Hello]; - Markup span - Gen - [:] - SpanEditHandler;Accepts:Any - (55:0,55) - Tokens:1 - HtmlTokenType.Text;[:]; + SyntaxKind.HtmlText - [Hello] - [32..37) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; + SyntaxKind.HtmlText - [:] - [55..56) - FullWidth: 1 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[:]; Tag block - Gen - 7 - (56:0,56) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (56:0,56) - Tokens:3 HtmlTokenType.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren2.stree.txt index 030417ade1..435494aff1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren2.stree.txt @@ -1,9 +1,9 @@ Markup block - Gen - 17 - (0:0,0) Tag block - Gen - 17 - (0:0,0) - p - PTagHelper StartTagAndEndTag -

...

- Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [LF] - [3..5) - FullWidth: 2 - Slots: 1 + SyntaxKind.NewLine;[LF]; Tag block - Gen - 6 - (5:1,0) - br - BRTagHelper SelfClosing -
- Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (11:1,6) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.HtmlText - [LF] - [11..13) - FullWidth: 2 - Slots: 1 + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren4.stree.txt index 5c64fe7293..80028cb3b4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren4.stree.txt @@ -1,5 +1,5 @@ Markup block - Gen - 12 - (0:0,0) Tag block - Gen - 12 - (0:0,0) - p - PTagHelper StartTagAndEndTag -

...

- Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.Text;[Hello]; + SyntaxKind.HtmlText - [Hello] - [3..8) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren6.stree.txt index 44ab808bfc..5c4530d693 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren6.stree.txt @@ -3,5 +3,5 @@ Markup block - Gen - 16 - (0:0,0) StartTagAndEndTag -

...

Tag block - Gen - 4 - (3:0,3) - br - BRTagHelper StartTagOnly -
- Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (7:0,7) - Tokens:1 - HtmlTokenType.Text;[Hello]; + SyntaxKind.HtmlText - [Hello] - [7..12) - FullWidth: 5 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Hello]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren7.stree.txt index 944b6b2068..35addd3c14 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren7.stree.txt @@ -3,9 +3,9 @@ Markup block - Gen - 45 - (0:0,0) StartTagAndEndTag -

...

Tag block - Gen - 23 - (3:0,3) - strong - StrongTagHelper StartTagAndEndTag - ... - Markup span - Gen - [Title:] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:1 - HtmlTokenType.Text;[Title:]; + SyntaxKind.HtmlText - [Title:] - [11..17) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Title:]; Tag block - Gen - 6 - (26:0,26) - br - BRTagHelper SelfClosing -
- Markup span - Gen - [Something] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 - HtmlTokenType.Text;[Something]; + SyntaxKind.HtmlText - [Something] - [32..41) - FullWidth: 9 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Something]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren8.stree.txt index 944b6b2068..35addd3c14 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren8.stree.txt @@ -3,9 +3,9 @@ Markup block - Gen - 45 - (0:0,0) StartTagAndEndTag -

...

Tag block - Gen - 23 - (3:0,3) - strong - StrongTagHelper StartTagAndEndTag - ... - Markup span - Gen - [Title:] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:1 - HtmlTokenType.Text;[Title:]; + SyntaxKind.HtmlText - [Title:] - [11..17) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Title:]; Tag block - Gen - 6 - (26:0,26) - br - BRTagHelper SelfClosing -
- Markup span - Gen - [Something] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 - HtmlTokenType.Text;[Something]; + SyntaxKind.HtmlText - [Something] - [32..41) - FullWidth: 9 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Something]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren9.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren9.stree.txt index 08853feef9..7ee594fd39 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren9.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/UnderstandsAllowedChildren9.stree.txt @@ -1,16 +1,17 @@ Markup block - Gen - 51 - (0:0,0) Tag block - Gen - 51 - (0:0,0) - p - PTagHelper StartTagAndEndTag -

...

- Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [ ] - [3..5) - FullWidth: 2 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 23 - (5:0,5) - strong - StrongTagHelper StartTagAndEndTag - ... - Markup span - Gen - [Title:] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:1 - HtmlTokenType.Text;[Title:]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlText - [Title:] - [13..19) - FullWidth: 6 - Slots: 1 + SyntaxKind.HtmlTextLiteralToken;[Title:]; + SyntaxKind.HtmlText - [ ] - [28..30) - FullWidth: 2 - Slots: 1 + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 6 - (30:0,30) - br - BRTagHelper SelfClosing -
- Markup span - Gen - [ Something] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[Something]; + SyntaxKind.HtmlText - [ Something] - [36..47) - FullWidth: 11 - Slots: 1 + SyntaxKind.List - [ Something] - [36..47) - FullWidth: 11 - Slots: 2 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteralToken;[Something]; diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/RawTextToken.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/RawTextToken.cs index 943ed7ffce..b1b1452048 100644 --- a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/RawTextToken.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/RawTextToken.cs @@ -1,8 +1,8 @@ // 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.Globalization; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -18,6 +18,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public string Content { get; } public Span Parent { get; set; } + public SyntaxKind SyntaxKind => SyntaxToken.Kind; + + public SyntaxToken SyntaxToken => SyntaxFactory.UnknownToken(Content); + public override bool Equals(object obj) { var other = obj as RawTextToken; diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeWriter.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeWriter.cs index 227c632192..8e4e344730 100644 --- a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeWriter.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeWriter.cs @@ -3,8 +3,10 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -173,6 +175,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected void WriteSpan(Span span) { + if (span.SyntaxNode != null) + { + WriteSyntaxNode(span.SyntaxNode.CreateRed(null, span.Start.AbsoluteIndex)); + return; + } + WriteIndent(); Write($"{span.Kind} span"); WriteSeparator(); @@ -197,6 +205,49 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Depth--; } + private void WriteSyntaxNode(SyntaxNode syntaxNode) + { + WriteIndent(); + Write($"{typeof(SyntaxKind).Name}.{syntaxNode.Kind}"); + WriteSeparator(); + Write($"[{syntaxNode.ToFullString()}]"); + WriteSeparator(); + Write($"[{syntaxNode.Position}..{syntaxNode.EndPosition})"); + WriteSeparator(); + Write($"FullWidth: {syntaxNode.FullWidth}"); + WriteSeparator(); + Write($"Slots: {syntaxNode.SlotCount}"); + + // Write tokens + Depth++; + for (var i = 0; i < syntaxNode.SlotCount; i++) + { + var slot = syntaxNode.GetNodeSlot(i); + if (slot == null) + { + continue; + } + + WriteNewLine(); + if (slot.IsList || !(slot is SyntaxToken syntaxToken)) + { + WriteSyntaxNode(slot); + continue; + } + + WriteSyntaxToken(syntaxToken); + } + Depth--; + } + + protected void WriteSyntaxToken(SyntaxToken syntaxToken) + { + WriteIndent(); + var diagnostics = syntaxToken.GetDiagnostics(); + var tokenString = $"{typeof(SyntaxKind).Name}.{syntaxToken.Kind};[{syntaxToken.Text}];{string.Join(", ", diagnostics.Select(diagnostic => diagnostic.Id + diagnostic.Span))}"; + Write(tokenString); + } + protected void WriteToken(IToken token) { var tokenType = string.Empty; From 13e13d763285e49983d7a8e6413013370ad2749b Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Sat, 19 May 2018 19:11:38 -0700 Subject: [PATCH 19/58] Add generated documents to workspace --- .../Experiment/IDocumentServiceFactory.cs | 12 ++ .../Experiment/ISpanMapper.cs | 12 ++ .../Experiment/SpanMapResult.cs | 19 +++ ...osoft.CodeAnalysis.Razor.Workspaces.csproj | 1 + .../ProjectSystem/DocumentState.cs | 2 + .../ProjectSystem/GeneratedCodeContainer.cs | 143 +++++++++++++++++ .../ProjectSystem/HostDocument.cs | 3 + .../SourceSpanExtensions.cs | 16 ++ ...Microsoft.NET.Sdk.Razor.DesignTime.targets | 3 + .../BackgroundDocumentGenerator.cs | 88 ++++++---- ...VisualStudio.LanguageServices.Razor.csproj | 1 + .../ProjectSystem/DefaultRazorProjectHost.cs | 126 ++++++++++++++- .../DefaultWorkspaceProjectContextFactory.cs | 102 ++++++++++++ .../ProjectSystem/FallbackRazorProjectHost.cs | 2 +- .../ProjectSystem/IWorkspaceProjectContext.cs | 47 ++++++ .../IWorkspaceProjectContextFactory.cs | 23 +++ .../ManagedProjectSystemSchema.cs | 14 ++ .../ProjectExternalErrorReporter.cs | 14 ++ .../ProjectSystem/RazorProjectHostBase.cs | 150 +++++++++++++++++- .../GeneratedCodeContainerTest.cs | 83 ++++++++++ 20 files changed, 829 insertions(+), 32 deletions(-) create mode 100644 src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/IDocumentServiceFactory.cs create mode 100644 src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/ISpanMapper.cs create mode 100644 src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/SpanMapResult.cs create mode 100644 src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/GeneratedCodeContainer.cs create mode 100644 src/Microsoft.CodeAnalysis.Razor/SourceSpanExtensions.cs rename src/{Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator => Microsoft.VisualStudio.LanguageServices.Razor}/BackgroundDocumentGenerator.cs (76%) create mode 100644 src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultWorkspaceProjectContextFactory.cs create mode 100644 src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContext.cs create mode 100644 src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContextFactory.cs create mode 100644 src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ProjectExternalErrorReporter.cs create mode 100644 test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/GeneratedCodeContainerTest.cs diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/IDocumentServiceFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/IDocumentServiceFactory.cs new file mode 100644 index 0000000000..fd8253234c --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/IDocumentServiceFactory.cs @@ -0,0 +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. + +// Temporary code until this gets merged into Roslyn +#if DOCUMENT_SERVICE_FACTORY +namespace Microsoft.CodeAnalysis.Experiment +{ + public interface IDocumentServiceFactory + { + } +} +#endif diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/ISpanMapper.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/ISpanMapper.cs new file mode 100644 index 0000000000..6d3c276116 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/ISpanMapper.cs @@ -0,0 +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. + +// Temporary code until this gets merged into Roslyn +#if DOCUMENT_SERVICE_FACTORY +namespace Microsoft.CodeAnalysis.Experiment +{ + public interface ISpanMapper + { + } +} +#endif diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/SpanMapResult.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/SpanMapResult.cs new file mode 100644 index 0000000000..531f6adead --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Experiment/SpanMapResult.cs @@ -0,0 +1,19 @@ +// 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 this gets merged into Roslyn +#if DOCUMENT_SERVICE_FACTORY +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Experiment +{ + public class SpanMapResult + { + public SpanMapResult(Document document, LinePositionSpan linePositionSpan) + { + + } + + } +} +#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 e7f29a2fb0..03e0c91ef3 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/ProjectSystem/DocumentState.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs index d1fb05b67a..681ce5fd9a 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs @@ -65,6 +65,8 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem public HostWorkspaceServices Services { get; } + public GeneratedCodeContainer GeneratedCodeContainer => HostDocument.GeneratedCodeContainer; + public DocumentGeneratedOutputTracker GeneratedOutput { get 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..342da76b09 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/GeneratedCodeContainer.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 Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Experiment; +using Microsoft.AspNetCore.Razor.Language; +using System.Collections.Immutable; +using System.Threading.Tasks; +using System.Threading; +using System.Collections.Generic; + +namespace Microsoft.CodeAnalysis.Razor.ProjectSystem +{ + internal class GeneratedCodeContainer : IDocumentServiceFactory, ISpanMapper + { + private readonly TextContainer _textContainer; + + public GeneratedCodeContainer() + { + _textContainer = new TextContainer(); + } + + public SourceText Source { get; private set; } + + public VersionStamp SourceVersion { get; private set; } + + public RazorCSharpDocument Output { get; private set; } + + public SourceTextContainer SourceTextContainer => _textContainer; + + public TService GetService() + { + if (this is TService service) + { + return service; + } + + return default(TService); + } + + public void SetOutput(SourceText source, RazorCodeDocument codeDocument) + { + Source = source; + Output = codeDocument.GetCSharpDocument(); + + _textContainer.SetText(SourceText.From(Output.GeneratedCode)); + } + + public Task> MapSpansAsync( + Document document, + IEnumerable spans, + CancellationToken cancellationToken) + { + if (Output == null) + { + return Task.FromResult(ImmutableArray.Empty); + } + + var results = ImmutableArray.CreateBuilder(); + foreach (var span in spans) + { + if (TryGetLinePositionSpan(span, out var linePositionSpan)) + { + results.Add(new SpanMapResult(document, linePositionSpan)); + } + } + + return Task.FromResult(results.ToImmutable()); + } + + // Internal for testing. + internal bool TryGetLinePositionSpan(TextSpan span, out LinePositionSpan linePositionSpan) + { + for (var i = 0; i < Output.SourceMappings.Count; i++) + { + var mapping = Output.SourceMappings[i]; + if (span.Length > mapping.GeneratedSpan.Length) + { + // If the length of the generated span is smaller they can't match. A C# expression + // won't cover multiple generated spans. + // + // This heuristic is useful in the Razor context to filter out zero-length + // spans. + continue; + } + + var original = mapping.OriginalSpan.AsTextSpan(); + var generated = mapping.GeneratedSpan.AsTextSpan(); + + 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; + } + + private class TextContainer : SourceTextContainer + { + public override event EventHandler TextChanged; + + private SourceText _currentText; + + public TextContainer() + : this(SourceText.From(string.Empty)) + { + } + + public TextContainer(SourceText sourceText) + { + if (sourceText == null) + { + throw new ArgumentNullException(nameof(sourceText)); + } + + _currentText = sourceText; + } + + public override SourceText CurrentText => _currentText; + + public void SetText(SourceText sourceText) + { + if (sourceText == null) + { + throw new ArgumentNullException(nameof(sourceText)); + } + + var e = new TextChangeEventArgs(_currentText, sourceText); + _currentText = sourceText; + + TextChanged?.Invoke(this, e); + } + } + } +} 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/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.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.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/BackgroundDocumentGenerator.cs similarity index 76% rename from src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs rename to src/Microsoft.VisualStudio.LanguageServices.Razor/BackgroundDocumentGenerator.cs index 122e577abe..b0a99e8e24 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/BackgroundDocumentGenerator.cs @@ -11,14 +11,13 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; 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] @@ -30,17 +29,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; } } } @@ -134,11 +132,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(); } @@ -165,18 +163,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); @@ -189,14 +187,20 @@ namespace Microsoft.CodeAnalysis.Razor OnCompletingBackgroundWork(); - lock (_files) + await Task.Factory.StartNew( + () => ReportUpdates(work), + CancellationToken.None, + TaskCreationOptions.None, + _foregroundDispatcher.ForegroundScheduler); + + 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(); } @@ -215,6 +219,22 @@ namespace Microsoft.CodeAnalysis.Razor } } + private void ReportUpdates(KeyValuePair[] work) + { + for (var i = 0; i < work.Length; i++) + { + var key = work[i].Key; + var document = work[i].Value; + + if (document.TryGetText(out var source) && + document.TryGetGeneratedOutput(out var output)) + { + var container = ((DefaultDocumentSnapshot)document).State.GeneratedCodeContainer; + container.SetOutput(source, output); + } + } + } + private void ReportError(DocumentSnapshot document, Exception ex) { GC.KeepAlive(Task.Factory.StartNew( @@ -229,22 +249,34 @@ namespace Microsoft.CodeAnalysis.Razor switch (e.Kind) { case ProjectChangeKind.ProjectAdded: + { + var projectSnapshot = _projectManager.GetLoadedProject(e.ProjectFilePath); + 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 = _projectManager.GetLoadedProject(e.ProjectFilePath); + foreach (var documentFilePath in projectSnapshot.DocumentFilePaths) { - Enqueue(project, project.GetDocument(documentFilePath)); + Enqueue(projectSnapshot, projectSnapshot.GetDocument(documentFilePath)); } break; } - case ProjectChangeKind.ProjectRemoved: - // ignore - break; - case ProjectChangeKind.DocumentAdded: + { + var project = _projectManager.GetLoadedProject(e.ProjectFilePath); + Enqueue(project, project.GetDocument(e.DocumentFilePath)); + + break; + } + case ProjectChangeKind.DocumentChanged: { var project = _projectManager.GetLoadedProject(e.ProjectFilePath); @@ -253,10 +285,12 @@ namespace Microsoft.CodeAnalysis.Razor break; } - + case ProjectChangeKind.ProjectRemoved: case ProjectChangeKind.DocumentRemoved: - // ignore - break; + { + // 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..64d66873f8 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj @@ -5,6 +5,7 @@ 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 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..b562bd74c1 --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultWorkspaceProjectContextFactory.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. + +// 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.CodeAnalysis.Experiment; +using Microsoft.CodeAnalysis.Text; +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 AddSourceFile(string filePath, bool isInCurrentContext = true, IEnumerable folderNames = null, SourceCodeKind sourceCodeKind = SourceCodeKind.Regular, IDocumentServiceFactory documentServiceFactory = null) + { + } + + public void AddSourceFile(string filePath, SourceTextContainer container, bool isInCurrentContext = true, IEnumerable folderNames = null, SourceCodeKind sourceCodeKind = SourceCodeKind.Regular, IDocumentServiceFactory documentServiceFactory = 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 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..8b34558d85 --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContext.cs @@ -0,0 +1,47 @@ +// 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.Experiment; +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); // This overload just for binary compat with existing code + void AddSourceFile(string filePath, bool isInCurrentContext = true, IEnumerable folderNames = null, SourceCodeKind sourceCodeKind = SourceCodeKind.Regular, IDocumentServiceFactory documentServiceFactory = null); + void AddSourceFile(string filePath, SourceTextContainer container, bool isInCurrentContext = true, IEnumerable folderNames = null, SourceCodeKind sourceCodeKind = SourceCodeKind.Regular, IDocumentServiceFactory documentServiceFactory = null); + + void RemoveSourceFile(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..930262b57a 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?.AddSourceFile(document.FilePath, document.GeneratedCodeContainer.SourceTextContainer, true, GetFolders(document), SourceCodeKind.Regular, document.GeneratedCodeContainer); _currentDocuments.Add(document.FilePath, document); } @@ -207,6 +310,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { var projectManager = GetProjectManager(); + _projectContext?.RemoveSourceFile(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.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/GeneratedCodeContainerTest.cs b/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/GeneratedCodeContainerTest.cs new file mode 100644 index 0000000000..0f2c03c02e --- /dev/null +++ b/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/GeneratedCodeContainerTest.cs @@ -0,0 +1,83 @@ +// 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; +using Xunit; + +namespace Microsoft.CodeAnalysis.Razor.ProjectSystem +{ + public class GeneratedCodeContainerTest + { + [Fact] + public void TryGetLinePositionSpan_SpanWithinSourceMapping_ReturnsTrue() + { + // Arrange + var content = @" +@{ + var x = SomeClass.SomeProperty; +} +"; + var sourceText = SourceText.From(content); + var codeDocument = GetCodeDocument(content); + var generatedCode = codeDocument.GetCSharpDocument().GeneratedCode; + + var container = new GeneratedCodeContainer(); + container.SetOutput(sourceText, codeDocument); + + // TODO: Make writing these tests a little less manual. + // Position of `SomeProperty` in the generated code. + var symbol = "SomeProperty"; + var span = new TextSpan(generatedCode.IndexOf(symbol), symbol.Length); + + // Position of `SomeProperty` in the source code. + var expectedLineSpan = new LinePositionSpan(new LinePosition(2, 22), new LinePosition(2, 34)); + + // Act + var result = container.TryGetLinePositionSpan(span, out var lineSpan); + + // Assert + Assert.True(result); + Assert.Equal(expectedLineSpan, lineSpan); + } + + [Fact] + public void TryGetLinePositionSpan_SpanOutsideSourceMapping_ReturnsFalse() + { + // Arrange + var content = @" +@{ + var x = SomeClass.SomeProperty; +} +"; + var sourceText = SourceText.From(content); + var codeDocument = GetCodeDocument(content); + var generatedCode = codeDocument.GetCSharpDocument().GeneratedCode; + + var container = new GeneratedCodeContainer(); + container.SetOutput(sourceText, codeDocument); + + // Position of `ExecuteAsync` in the generated code. + var symbol = "ExecuteAsync"; + var span = new TextSpan(generatedCode.IndexOf(symbol), symbol.Length); + + // Act + var result = container.TryGetLinePositionSpan(span, out var lineSpan); + + // Assert + Assert.False(result); + } + + private static RazorCodeDocument GetCodeDocument(string content) + { + var sourceProjectItem = new TestRazorProjectItem("test.cshtml") + { + Content = content, + }; + + var engine = RazorProjectEngine.Create(); + var codeDocument = engine.ProcessDesignTime(sourceProjectItem); + return codeDocument; + } + } +} From e848bb37a34ebf94eaf6af322c119ec0c89ace3a Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Wed, 15 Aug 2018 17:27:26 -0700 Subject: [PATCH 20/58] Update VSIX build langversion to 7.2 (#2541) --- build/VSIX.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/VSIX.targets b/build/VSIX.targets index 5995deeabd..5e3d365380 100644 --- a/build/VSIX.targets +++ b/build/VSIX.targets @@ -104,7 +104,7 @@ /p:Configuration=$(Configuration); /p:FeatureBranchVersionSuffix=$(FeatureBranchVersionSuffix); /p:BuildNumber=$(BuildNumber); - /p:LangVersion=7.1" /> + /p:LangVersion=7.2" /> From 0c25c2958c10a68501cc4d0cef1d6f7002dd5e5d Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Thu, 16 Aug 2018 11:27:33 -0700 Subject: [PATCH 21/58] Update korebuild VS version range (#2542) --- korebuild.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/korebuild.json b/korebuild.json index cb46ef120b..8a69d82513 100644 --- a/korebuild.json +++ b/korebuild.json @@ -5,7 +5,7 @@ "visualstudio": { "required": false, "includePrerelease": true, - "versionRange": "[15.0.26730.03, 15.8)", + "versionRange": "[15.0.26730.03, 15.9)", "requiredWorkloads": [ "Microsoft.VisualStudio.Component.VSSDK" ] From db2a142132e16669046146982c1cc4ba33b6d798 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Thu, 16 Aug 2018 16:11:01 -0700 Subject: [PATCH 22/58] Updated the tokenizer and parser to operate on SyntaxTokens directly (#2540) * Updated the tokenizer and parser to operate on SyntaxTokens directly - The tokenizer and parser now operates directly on SyntaxTokens (Green) - The SyntaxToken(Red) is now created when the Span is built with the correct parent and position - All other passes that run after the parsing is complete(TagHelperRewriter etc) will operate on the Red tokens. - There is now only one type for all SyntaxTokens. They are differentiated by their SyntaxKind. - Added equivalence checking for tokens - Updated test code to react - Regenerated baselines --- ...faultRazorIntermediateNodeLoweringPhase.cs | 4 +- .../DirectiveTokenEditHandler.cs | 3 +- .../Legacy/AutoCompleteEditHandler.cs | 7 +- .../Legacy/CSharpCodeParser.cs | 328 ++++---- .../Legacy/CSharpLanguageCharacteristics.cs | 191 ++--- .../Legacy/CSharpToken.cs | 60 -- .../Legacy/CSharpTokenType.cs | 75 -- .../Legacy/CSharpTokenizer.cs | 260 +++---- .../Legacy/CodeBlockEditHandler.cs | 3 +- .../Legacy/DirectiveCSharpTokenizer.cs | 23 +- .../Legacy/DirectiveHtmlTokenizer.cs | 19 +- .../Legacy/HtmlLanguageCharacteristics.cs | 91 +-- .../Legacy/HtmlMarkupParser.cs | 458 ++++++------ .../Legacy/HtmlToken.cs | 77 -- .../Legacy/HtmlTokenType.cs | 32 - .../Legacy/HtmlTokenizer.cs | 93 +-- .../Legacy/IToken.cs | 20 - .../Legacy/ITokenizer.cs | 4 +- .../Legacy/ImplicitExpressionEditHandler.cs | 37 +- .../Legacy/LanguageCharacteristics.cs | 51 +- .../Legacy/MarkupRewriter.cs | 4 +- .../Legacy/Span.cs | 66 +- .../Legacy/SpanBuilder.cs | 30 +- .../Legacy/SpanEditHandler.cs | 13 +- .../Legacy/TagHelperBlockRewriter.cs | 63 +- .../Legacy/TagHelperParseTreeRewriter.cs | 39 +- .../Legacy/TokenBase.cs | 90 --- .../Legacy/Tokenizer.cs | 59 +- .../Legacy/TokenizerBackedParser.cs | 155 ++-- .../Legacy/TokenizerView.cs | 12 +- .../Syntax/GreenNode.cs | 64 ++ .../Syntax/HtmlTextTokenSyntax.cs | 27 - .../InternalSyntax/HtmlTextTokenSyntax.cs | 53 -- .../InternalSyntax/NewLineTokenSyntax.cs | 50 -- .../InternalSyntax/PunctuationSyntax.cs | 45 -- .../Syntax/InternalSyntax/SyntaxFactory.cs | 26 +- .../Syntax/InternalSyntax/SyntaxToken.cs | 103 ++- .../Syntax/InternalSyntax/SyntaxTrivia.cs | 15 + .../InternalSyntax/UnknownTokenSyntax.cs | 50 -- .../InternalSyntax/WhitespaceTokenSyntax.cs | 50 -- .../Syntax/NewLineTokenSyntax.cs | 27 - .../Syntax/PunctuationSyntax.cs | 27 - .../Syntax/SyntaxFactory.cs | 13 + .../Syntax/SyntaxKind.cs | 85 ++- .../Syntax/SyntaxNode.cs | 15 + .../Syntax/SyntaxToken.cs | 73 +- .../Syntax/UnknownTokenSyntax.cs | 27 - .../Syntax/WhitespaceTokenSyntax.cs | 27 - .../DefaultRazorCompletionFactsService.cs | 12 +- .../DefaultRazorIndentationFactsService.cs | 3 +- .../RazorDirectiveCompletionProvider.cs | 12 - .../Legacy/BlockTest.cs | 5 +- .../CSharpLanguageCharacteristicsTest.cs | 2 +- .../Legacy/CSharpTokenizerCommentTest.cs | 45 +- .../Legacy/CSharpTokenizerIdentifierTest.cs | 27 +- .../Legacy/CSharpTokenizerLiteralTest.cs | 161 ++-- .../Legacy/CSharpTokenizerOperatorsTest.cs | 99 +-- .../Legacy/CSharpTokenizerTest.cs | 39 +- .../Legacy/CSharpTokenizerTestBase.cs | 13 +- .../Legacy/DirectiveCSharpTokenizerTest.cs | 37 +- .../Legacy/DirectiveHtmlTokenizerTest.cs | 25 +- .../Legacy/HtmlMarkupParserTests.cs | 48 +- .../Legacy/HtmlTokenizerTest.cs | 67 +- .../Legacy/HtmlTokenizerTestBase.cs | 13 +- .../ImplicitExpressionEditHandlerTest.cs | 24 +- .../Legacy/SpanTest.cs | 11 +- .../Legacy/TokenizerLookaheadTest.cs | 50 +- .../Legacy/TokenizerTestBase.cs | 13 +- .../SourceChangeTest.cs | 21 +- ...ctionsDirectiveAutoCompleteAtEOF.stree.txt | 8 +- ...rectiveAutoCompleteAtStartOfFile.stree.txt | 10 +- ...ectionDirectiveAutoCompleteAtEOF.stree.txt | 14 +- ...rectiveAutoCompleteAtStartOfFile.stree.txt | 30 +- .../VerbatimBlockAutoCompleteAtEOF.stree.txt | 6 +- ...imBlockAutoCompleteAtStartOfFile.stree.txt | 22 +- .../AcceptsElseIfWithNoCondition.stree.txt | 116 +-- ...icitExpressionWhenEmbeddedInCode.stree.txt | 24 +- .../AllowsEmptyBlockStatement.stree.txt | 16 +- ...ringLiteralCharactersAndBrackets.stree.txt | 34 +- ...rsAndBracketsInsideBlockComments.stree.txt | 38 +- .../CapturesNewlineAfterUsing.stree.txt | 8 +- .../CorrectlyParsesDoWhileBlock.stree.txt | 48 +- ...rsesDoWhileBlockMissingSemicolon.stree.txt | 46 +- ...eBlockMissingWhileClauseEntirely.stree.txt | 28 +- ...oWhileBlockMissingWhileCondition.stree.txt | 32 +- ...ssingWhileConditionWithSemicolon.stree.txt | 34 +- ...rectlyParsesMarkupInDoWhileBlock.stree.txt | 76 +- ...oesNotAllowMultipleFinallyBlocks.stree.txt | 70 +- ...terNotFollowedByOpenAngleOrColon.stree.txt | 30 +- ...oesntCaptureWhitespaceAfterUsing.stree.txt | 6 +- ...IfNamespaceAliasMissingSemicolon.stree.txt | 22 +- ...fNamespaceImportMissingSemicolon.stree.txt | 14 +- ...dCodeBlockWithAtDoesntCauseError.stree.txt | 38 +- .../NestedCodeBlockWithCSharpAt.stree.txt | 74 +- ...deBlockWithMarkupSetsDotAsMarkup.stree.txt | 62 +- .../ParsersCanNestRecursively.stree.txt | 248 +++--- ...arsesElseIfBranchesOfIfStatement.stree.txt | 186 ++--- ...aracterFollowedByIdentifierStart.stree.txt | 36 +- ...itchCharacterFollowedByOpenParen.stree.txt | 34 +- ...tipleElseIfBranchesOfIfStatement.stree.txt | 474 ++++++------ ...StatementFollowedByOneElseBranch.stree.txt | 310 ++++---- ...ForUsingKeywordIfIsInValidFormat.stree.txt | 16 +- ...ForUsingKeywordIfIsInValidFormat.stree.txt | 16 +- ...cesIfFirstIdentifierIsForKeyword.stree.txt | 88 +-- ...fFirstIdentifierIsForeachKeyword.stree.txt | 88 +-- ...ierIsIfKeywordWithNoElseBranches.stree.txt | 88 +-- ...IfFirstIdentifierIsSwitchKeyword.stree.txt | 104 +-- ...sIfFirstIdentifierIsWhileKeyword.stree.txt | 88 +-- ...IdentifierIsUsingFollowedByParen.stree.txt | 88 +-- ...ingCatchClausesAfterFinallyBlock.stree.txt | 70 +- .../StopsParsingCodeAfterElseBranch.stree.txt | 214 +++--- ...ngIfIfStatementNotFollowedByElse.stree.txt | 90 +-- ...mentBetweenCatchAndFinallyClause.stree.txt | 78 +- ...ckCommentBetweenDoAndWhileClause.stree.txt | 48 +- ...ommentBetweenElseIfAndElseClause.stree.txt | 88 +-- ...ockCommentBetweenIfAndElseClause.stree.txt | 56 +- ...kCommentBetweenIfAndElseIfClause.stree.txt | 66 +- ...kCommentBetweenTryAndCatchClause.stree.txt | 56 +- ...ommentBetweenTryAndFinallyClause.stree.txt | 50 +- ...upportsExceptionLessCatchClauses.stree.txt | 70 +- ...mentBetweenCatchAndFinallyClause.stree.txt | 78 +- ...neCommentBetweenDoAndWhileClause.stree.txt | 48 +- ...ommentBetweenElseIfAndElseClause.stree.txt | 88 +-- ...ineCommentBetweenIfAndElseClause.stree.txt | 56 +- ...eCommentBetweenIfAndElseIfClause.stree.txt | 66 +- ...eCommentBetweenTryAndCatchClause.stree.txt | 56 +- ...ommentBetweenTryAndFinallyClause.stree.txt | 50 +- ...rkupWithinAdditionalCatchClauses.stree.txt | 178 ++--- .../SupportsMarkupWithinCatchClause.stree.txt | 78 +- ...upportsMarkupWithinFinallyClause.stree.txt | 64 +- .../SupportsMarkupWithinTryClause.stree.txt | 28 +- ...mentBetweenCatchAndFinallyClause.stree.txt | 94 +-- ...orCommentBetweenDoAndWhileClause.stree.txt | 64 +- ...ommentBetweenElseIfAndElseClause.stree.txt | 104 +-- ...zorCommentBetweenIfAndElseClause.stree.txt | 72 +- ...rCommentBetweenIfAndElseIfClause.stree.txt | 82 +- ...rCommentBetweenTryAndCatchClause.stree.txt | 70 +- ...ommentBetweenTryAndFinallyClause.stree.txt | 66 +- ...rtsTryStatementWithFinallyClause.stree.txt | 70 +- ...StatementWithMultipleCatchClause.stree.txt | 184 ++--- ...StatementWithNoAdditionalClauses.stree.txt | 34 +- ...tsTryStatementWithOneCatchClause.stree.txt | 84 +-- ...rtsUsingsNestedWithinOtherBlocks.stree.txt | 106 +-- ...erminatesBlockCommentAtEndOfFile.stree.txt | 28 +- .../TerminatesParenBalancingAtEOF.stree.txt | 16 +- ...atesSingleLineCommentAtEndOfFile.stree.txt | 28 +- ...TerminatesSingleSlashAtEndOfFile.stree.txt | 40 +- ...wordAtEOFAndOutputsFileCodeBlock.stree.txt | 4 +- ...esIfFirstIdentifierIsLockKeyword.stree.txt | 32 +- ...FirstPairAsPartOfCSharpStatement.stree.txt | 36 +- ...EscapeSequenceIfAtStatementStart.stree.txt | 32 +- ...ingOfAttributeValue_DoesNotThrow.stree.txt | 32 +- ...EndOfAttributeValue_DoesNotThrow.stree.txt | 32 +- ...tweenAttributeValue_DoesNotThrow.stree.txt | 38 +- ...ionInAttributeValue_DoesNotThrow.stree.txt | 30 +- ...leTransitionInEmail_DoesNotThrow.stree.txt | 44 +- ...leTransitionInRegex_DoesNotThrow.stree.txt | 118 +-- ...WithExpressionBlock_DoesNotThrow.stree.txt | 150 ++-- ...oubleTransition_EndOfFile_Throws.stree.txt | 20 +- ...ansitionsInAttributeValue_Throws.stree.txt | 36 +- ...eRequiresDoubleQuotesAroundValue.stree.txt | 10 +- ...tive_InvalidLookupText_AddsError.stree.txt | 8 +- ...gHelperDirective_NoValue_Invalid.stree.txt | 8 +- ...TagHelperDirective_RequiresValue.stree.txt | 8 +- ...Directive_SingleQuotes_AddsError.stree.txt | 8 +- ...eRequiresDoubleQuotesAroundValue.stree.txt | 8 +- ...agHelperDirective_SupportsSpaces.stree.txt | 16 +- ...otes_InvalidLookupText_AddsError.stree.txt | 8 +- ...AtStartOfLineBecauseOfWhitespace.stree.txt | 12 +- ...irectiveErrorsIfNotAtStartOfLine.stree.txt | 16 +- ...veDescriptor_AllowsNullableTypes.stree.txt | 112 +-- ...ctiveDescriptor_AllowsTupleTypes.stree.txt | 280 +++---- ...eTypes_IgnoresTrailingWhitespace.stree.txt | 22 +- ...tor_AllowsWhiteSpaceAroundTokens.stree.txt | 26 +- ...ndleEOFIncompleteNamespaceTokens.stree.txt | 6 +- ...nHandleEOFInvalidNamespaceTokens.stree.txt | 6 +- ...nHandleIncompleteNamespaceTokens.stree.txt | 6 +- ..._CanHandleInvalidNamespaceTokens.stree.txt | 6 +- ...ErrorsExtraContentAfterDirective.stree.txt | 10 +- ...tor_ErrorsForInvalidMemberTokens.stree.txt | 6 +- ...WhenEOFBeforeDirectiveBlockStart.stree.txt | 8 +- ...WhenExtraContentBeforeBlockStart.stree.txt | 10 +- ...riptor_ErrorsWhenMissingEndBrace.stree.txt | 14 +- ...tipleOccurring_CanHaveDuplicates.stree.txt | 48 +- ...inglyOccurring_ErrorsIfDuplicate.stree.txt | 48 +- ...oped_CanBeBeneathOtherDirectives.stree.txt | 36 +- ...rWhiteSpaceCommentsAndDirectives.stree.txt | 70 +- ..._NoErrorsSemicolonAfterDirective.stree.txt | 14 +- ...ken_ParserErrorForNonStringValue.stree.txt | 6 +- ...ParserErrorForPartialQuotedValue.stree.txt | 6 +- ..._ParserErrorForSingleQuotedValue.stree.txt | 6 +- ...oken_ParserErrorForUnquotedValue.stree.txt | 6 +- ...tor_TokensMustBeSeparatedBySpace.stree.txt | 8 +- ...Descriptor_UnderstandsCodeBlocks.stree.txt | 36 +- ...scriptor_UnderstandsMemberTokens.stree.txt | 8 +- ...riptor_UnderstandsMultipleTokens.stree.txt | 28 +- ...escriptor_UnderstandsRazorBlocks.stree.txt | 42 +- ...scriptor_UnderstandsStringTokens.stree.txt | 8 +- ...Descriptor_UnderstandsTypeTokens.stree.txt | 20 +- ...ectives_CanUseReservedWord_Class.stree.txt | 4 +- ...ves_CanUseReservedWord_Namespace.stree.txt | 4 +- .../EmptyFunctionsDirective.stree.txt | 12 +- ...AtStartOfLineBecauseOfWhitespace.stree.txt | 24 +- ...irectiveErrorsIfNotAtStartOfLine.stree.txt | 30 +- .../InheritsDirectiveSupportsArrays.stree.txt | 24 +- ...sDirectiveSupportsNestedGenerics.stree.txt | 44 +- ...itsDirectiveSupportsTypeKeywords.stree.txt | 12 +- ...tionalDirectiveTokens_AreSkipped.stree.txt | 6 +- ...ctiveTokens_WithBraces_AreParsed.stree.txt | 8 +- ...MultipleOptionalTokens_AreParsed.stree.txt | 16 +- ...okens_WithSimpleTokens_AreParsed.stree.txt | 8 +- ...ens_WithMemberSpecified_IsParsed.stree.txt | 8 +- ...okens_WithMissingMember_IsParsed.stree.txt | 8 +- .../Parse_FunctionsDirective.stree.txt | 32 +- .../Parse_SectionDirective.stree.txt | 42 +- ...ectiveToken_WithMultipleSegments.stree.txt | 16 +- ...DirectiveToken_WithSingleSegment.stree.txt | 8 +- ...eRequiresDoubleQuotesAroundValue.stree.txt | 10 +- ...tive_InvalidLookupText_AddsError.stree.txt | 8 +- ...gHelperDirective_NoValue_Invalid.stree.txt | 8 +- ...TagHelperDirective_RequiresValue.stree.txt | 8 +- ...Directive_SingleQuotes_AddsError.stree.txt | 8 +- ...eRequiresDoubleQuotesAroundValue.stree.txt | 8 +- ...agHelperDirective_SupportsSpaces.stree.txt | 16 +- ...otes_InvalidLookupText_AddsError.stree.txt | 8 +- ...eRequiresDoubleQuotesAroundValue.stree.txt | 12 +- ...rPrefixDirective_NoValueSucceeds.stree.txt | 8 +- ...perPrefixDirective_RequiresValue.stree.txt | 8 +- ...eRequiresDoubleQuotesAroundValue.stree.txt | 8 +- ...agHelperPrefixDirective_Succeeds.stree.txt | 8 +- ...fixDirective_WithQuotes_Succeeds.stree.txt | 8 +- ...alidUsingStmtAndTreatsAsFileCode.stree.txt | 6 +- ...ImplicitExpressionParensUnclosed.stree.txt | 6 +- ...ctlyParsesAtSignInDelimitedBlock.stree.txt | 26 +- ...rectyAssumedToBeWithinAStatement.stree.txt | 64 +- ...CloseParenInExpressionWithinCode.stree.txt | 28 +- .../HandlesQuotesAfterTransition.stree.txt | 4 +- ...atementControlFlowStatementError.stree.txt | 36 +- ...panIfEofFoundAfterOpenCurlyBrace.stree.txt | 4 +- ...gthCodeSpanIfStatementBlockEmpty.stree.txt | 6 +- ...NotIdentifierStartOrParenOrBrace.stree.txt | 4 +- ...erTransitionInEmbeddedExpression.stree.txt | 12 +- ...sErrorIfNewlineFollowsTransition.stree.txt | 4 +- ...itionAndBlockStartInEmbeddedExpr.stree.txt | 20 +- ...edByLessThanSignAtStatementStart.stree.txt | 36 +- ...rorIfCatchBlockUnterminatedAtEOF.stree.txt | 90 +-- ...rorIfClassBlockUnterminatedAtEOF.stree.txt | 62 +- ...sErrorIfDoBlockUnterminatedAtEOF.stree.txt | 62 +- ...rrorIfElseBlockUnterminatedAtEOF.stree.txt | 90 +-- ...orIfElseIfBlockUnterminatedAtEOF.stree.txt | 94 +-- ...plicitCodeBlockUnterminatedAtEOF.stree.txt | 58 +- ...rIfFinallyBlockUnterminatedAtEOF.stree.txt | 84 +-- ...ErrorIfForBlockUnterminatedAtEOF.stree.txt | 70 +- ...rIfForeachBlockUnterminatedAtEOF.stree.txt | 70 +- ...sErrorIfIfBlockUnterminatedAtEOF.stree.txt | 70 +- ...rrorIfLockBlockUnterminatedAtEOF.stree.txt | 70 +- ...orIfSwitchBlockUnterminatedAtEOF.stree.txt | 70 +- ...ErrorIfTryBlockUnterminatedAtEOF.stree.txt | 62 +- ...rorIfUsingBlockUnterminatedAtEOF.stree.txt | 70 +- ...rorIfWhileBlockUnterminatedAtEOF.stree.txt | 70 +- ...ontrolFlowStatementsToHaveBraces.stree.txt | 82 +- ...ResumesIfStatementAfterOpenParen.stree.txt | 34 +- ...cketInImplicitExpressionUnclosed.stree.txt | 20 +- ...FIfIfParenInExplicitExprUnclosed.stree.txt | 12 +- ...EOFIfParenInImplicitExprUnclosed.stree.txt | 20 +- ...pIfBracketInImplicitExprUnclosed.stree.txt | 18 +- ...pIfIfParenInExplicitExprUnclosed.stree.txt | 10 +- ...arenInImplicitExpressionUnclosed.stree.txt | 18 +- ...nRecoveringFromMissingCloseParen.stree.txt | 12 +- ...nRecoveringFromMissingCloseParen.stree.txt | 12 +- ...arpStringsAtEOLIfEndQuoteMissing.stree.txt | 38 +- ...erminatesNormalStringAtEndOfFile.stree.txt | 28 +- ...nRecoveringFromMissingCloseParen.stree.txt | 12 +- ...minatesVerbatimStringAtEndOfFile.stree.txt | 28 +- ...nRecoveringFromMissingCloseParen.stree.txt | 24 +- ...WithHelperDirectiveProducesError.stree.txt | 4 +- ...WithNestedCodeBlockProducesError.stree.txt | 22 +- ...scapedQuotesInNonVerbatimStrings.stree.txt | 8 +- ...veEscapedQuotesInVerbatimStrings.stree.txt | 8 +- ...EscapedQuoteInNonVerbatimStrings.stree.txt | 8 +- ...eptEscapedQuoteInVerbatimStrings.stree.txt | 8 +- ...ldAcceptMultiLineVerbatimStrings.stree.txt | 8 +- ...scapedQuotesInNonVerbatimStrings.stree.txt | 8 +- ...leEscapedQuotesInVerbatimStrings.stree.txt | 8 +- ...tedEscapedQuoteInVerbatimStrings.stree.txt | 8 +- ...OFOccursAfterStartOfExplicitExpr.stree.txt | 6 +- ...eSpanIfExplicitExpressionIsEmpty.stree.txt | 8 +- ...haractersThatAreValidIdentifiers.stree.txt | 4 +- ...ExpressionTerminatedByWhitespace.stree.txt | 4 +- ...ludeDotAtEOFInImplicitExpression.stree.txt | 8 +- ...lidIdentifierCharInImplicitExpr1.stree.txt | 8 +- ...lidIdentifierCharInImplicitExpr2.stree.txt | 8 +- .../DoesNotIncludeSemicolonAfterDot.stree.txt | 8 +- ...emicolonAtEndOfDottedIdentifiers.stree.txt | 12 +- ...nAtEndOfSimpleImplicitExpression.stree.txt | 4 +- .../NestedImplicitExpression.stree.txt | 24 +- ...nIfModuleTokenNotFollowedByBrace.stree.txt | 12 +- ...deSpanIfEOFOccursAfterTransition.stree.txt | 4 +- ...nvalidCharacterFollowsTransition.stree.txt | 4 +- ...dIdentifiersAsImplicitExpression.stree.txt | 12 +- ...ratorImplicitExpression_Bracket1.stree.txt | 4 +- ...atorImplicitExpression_Bracket10.stree.txt | 14 +- ...atorImplicitExpression_Bracket11.stree.txt | 18 +- ...atorImplicitExpression_Bracket12.stree.txt | 20 +- ...atorImplicitExpression_Bracket13.stree.txt | 26 +- ...atorImplicitExpression_Bracket14.stree.txt | 24 +- ...atorImplicitExpression_Bracket15.stree.txt | 20 +- ...atorImplicitExpression_Bracket16.stree.txt | 28 +- ...ratorImplicitExpression_Bracket2.stree.txt | 4 +- ...ratorImplicitExpression_Bracket3.stree.txt | 8 +- ...ratorImplicitExpression_Bracket4.stree.txt | 4 +- ...ratorImplicitExpression_Bracket5.stree.txt | 10 +- ...ratorImplicitExpression_Bracket6.stree.txt | 12 +- ...ratorImplicitExpression_Bracket7.stree.txt | 8 +- ...ratorImplicitExpression_Bracket8.stree.txt | 12 +- ...ratorImplicitExpression_Bracket9.stree.txt | 4 +- ...lOperatorImplicitExpression_Dot1.stree.txt | 4 +- ...OperatorImplicitExpression_Dot10.stree.txt | 10 +- ...OperatorImplicitExpression_Dot11.stree.txt | 4 +- ...OperatorImplicitExpression_Dot12.stree.txt | 20 +- ...OperatorImplicitExpression_Dot13.stree.txt | 22 +- ...OperatorImplicitExpression_Dot14.stree.txt | 30 +- ...lOperatorImplicitExpression_Dot2.stree.txt | 4 +- ...lOperatorImplicitExpression_Dot3.stree.txt | 4 +- ...lOperatorImplicitExpression_Dot4.stree.txt | 4 +- ...lOperatorImplicitExpression_Dot5.stree.txt | 8 +- ...lOperatorImplicitExpression_Dot6.stree.txt | 4 +- ...lOperatorImplicitExpression_Dot7.stree.txt | 8 +- ...lOperatorImplicitExpression_Dot8.stree.txt | 8 +- ...lOperatorImplicitExpression_Dot9.stree.txt | 10 +- ...leIdentifierAsImplicitExpression.stree.txt | 4 +- ...BalancesThemInImplicitExpression.stree.txt | 44 +- ...BalancesThemInImplicitExpression.stree.txt | 120 +-- .../StopsBalancingParenthesesAtEOF.stree.txt | 10 +- ...WithinComplexImplicitExpressions.stree.txt | 72 +- ...llowedByDotOrParenInImplicitExpr.stree.txt | 8 +- ...NotFollowedByIdentifierStartChar.stree.txt | 16 +- ...esImplicitExpressionAtHtmlEndTag.stree.txt | 16 +- ...ImplicitExpressionAtHtmlStartTag.stree.txt | 16 +- ...idPointIfDotFollowedByWhitespace.stree.txt | 4 +- ...loseParenFollowedByAnyWhiteSpace.stree.txt | 12 +- ...dentifierFollowedByAnyWhiteSpace.stree.txt | 4 +- .../NestedCodeBlock.stree.txt | 52 +- .../NestedExplicitExpression.stree.txt | 28 +- .../NestedImplicitExpression.stree.txt | 24 +- .../NestedKeywordStatement.stree.txt | 80 +- .../NestedMarkupBlock.stree.txt | 36 +- .../NestedSimpleStatement.stree.txt | 28 +- .../EmptyRazorComment.stree.txt | 14 +- .../MultipleRazorCommentInMarkup.stree.txt | 44 +- ...eRazorCommentsInSameLineInMarkup.stree.txt | 42 +- .../RazorCommentInClosingTagBlock.stree.txt | 26 +- ...ntInImplicitExpressionMethodCall.stree.txt | 22 +- .../RazorCommentInMarkup.stree.txt | 28 +- .../RazorCommentInOpeningTagBlock.stree.txt | 26 +- .../RazorCommentInVerbatimBlock.stree.txt | 32 +- ...rCommentWithExtraNewLineInMarkup.stree.txt | 42 +- .../RazorCommentsSurroundingMarkup.stree.txt | 42 +- .../UnterminatedRazorComment.stree.txt | 8 +- ...ntInImplicitExpressionMethodCall.stree.txt | 14 +- ...natedRazorCommentInVerbatimBlock.stree.txt | 14 +- .../ReservedWord.stree.txt | 2 +- .../ReservedWordIsCaseSensitive.stree.txt | 2 +- ...aceMultipleLinesBelowSectionName.stree.txt | 50 +- .../AllowsBracesInCSharpExpression.stree.txt | 78 +- .../BalancesBraces.stree.txt | 58 +- ...turesNewlineImmediatelyFollowing.stree.txt | 10 +- ...ineInSectionStatementMissingName.stree.txt | 14 +- ...SectionStatementMissingOpenBrace.stree.txt | 18 +- .../CommentRecoversFromUnclosedTag.stree.txt | 50 +- ...oseBraceImmediatelyFollowsMarkup.stree.txt | 20 +- ...ceBetweenSectionNameAndOpenBrace.stree.txt | 36 +- .../HandlesEOFAfterOpenBrace.stree.txt | 16 +- .../HandlesEOFAfterOpenContent1.stree.txt | 16 +- .../HandlesEOFAfterOpenContent2.stree.txt | 16 +- .../HandlesEOFAfterOpenContent3.stree.txt | 16 +- .../HandlesEOFAfterOpenContent4.stree.txt | 20 +- .../HandlesUnterminatedSection.stree.txt | 36 +- ...sUnterminatedSectionWithNestedIf.stree.txt | 64 +- ...IgnoresSectionUnlessAllLowerCase.stree.txt | 10 +- ...rserOutputsErrorOnNestedSections.stree.txt | 56 +- .../CSharpSectionTest/ParsesComment.stree.txt | 32 +- .../ParsesCommentWithDelimiters.stree.txt | 42 +- .../ParsesNamedSectionCorrectly.stree.txt | 38 +- .../ParsesXmlProcessingInstruction.stree.txt | 38 +- ...LIfSectionNotFollowedByOpenBrace.stree.txt | 16 +- ...NotFollowedByIdentifierStartChar.stree.txt | 36 +- ...lockIfNameNotFollowedByOpenBrace.stree.txt | 38 +- ...raceFollowsCodeBlockNoWhitespace.stree.txt | 38 +- ...BraceImmediatelyFollowsCodeBlock.stree.txt | 40 +- .../_WithDoubleTransition1.stree.txt | 42 +- .../_WithDoubleTransition2.stree.txt | 52 +- ...rIsBraceAndReturnsSpanOfTypeCode.stree.txt | 44 +- ...rIsParenAndReturnsSpanOfTypeExpr.stree.txt | 44 +- ...ImportInsideCodeBlockCausesError.stree.txt | 42 +- ...entInCodeBlockIsHandledCorrectly.stree.txt | 44 +- ...seBlockIgnoresSingleSlashAtStart.stree.txt | 4 +- ...atesSingleLineCommentAtEndOfLine.stree.txt | 54 +- ...deCodeBlockIsNotHandledSpecially.stree.txt | 46 +- .../CSharpStatementTest/CatchClause.stree.txt | 86 +-- .../CSharpStatementTest/DoStatement.stree.txt | 34 +- .../CSharpStatementTest/ElseClause.stree.txt | 50 +- .../ElseIfClause.stree.txt | 94 +-- ...rror_TryCatchWhen_InCompleteBody.stree.txt | 48 +- ...TryCatchWhen_InCompleteCondition.stree.txt | 40 +- ...ter_IncompleteTryCatchNoBodyWhen.stree.txt | 54 +- ...ionFilter_IncompleteTryCatchWhen.stree.txt | 36 +- ...r_IncompleteTryCatchWhenNoBodies.stree.txt | 44 +- ...xceptionFilter_IncompleteTryWhen.stree.txt | 22 +- .../ExceptionFilter_MultiLine.stree.txt | 102 +-- ...ceptionFilter_NestedTryCatchWhen.stree.txt | 66 +- ...WhenCatchWhenComplete_SingleLine.stree.txt | 102 +-- ..._TryCatchWhenComplete_SingleLine.stree.txt | 62 +- ...chWhenFinallyComplete_SingleLine.stree.txt | 84 +-- .../FinallyClause.stree.txt | 44 +- .../ForEachStatement.stree.txt | 40 +- .../ForStatement.stree.txt | 62 +- .../CSharpStatementTest/IfStatement.stree.txt | 28 +- .../LockStatement.stree.txt | 28 +- ...ywordTreatedAsImplicitExpression.stree.txt | 4 +- .../StaticUsing_Complete_Spaced.stree.txt | 20 +- .../StaticUsing_GlobalPrefix.stree.txt | 20 +- .../StaticUsing_MultipleIdentifiers.stree.txt | 16 +- .../StaticUsing_NoUsing.stree.txt | 8 +- .../StaticUsing_SingleIdentifier.stree.txt | 12 +- .../SwitchStatement.stree.txt | 28 +- .../TryStatement.stree.txt | 22 +- .../UsingNamespaceImport.stree.txt | 20 +- .../UsingStatement.stree.txt | 52 +- .../UsingTypeAlias.stree.txt | 40 +- .../WhileStatement.stree.txt | 28 +- ...mplateInExplicitExpressionParens.stree.txt | 46 +- ...mplateInImplicitExpressionParens.stree.txt | 42 +- ...mplateInStatementWithinCodeBlock.stree.txt | 70 +- ...eInStatementWithinStatementBlock.stree.txt | 70 +- ...mmediatelyFollowingStatementChar.stree.txt | 18 +- .../HandlesSingleLineTemplate.stree.txt | 32 +- ...platesInImplicitExpressionParens.stree.txt | 72 +- ...platesInStatementWithinCodeBlock.stree.txt | 100 +-- ...sInStatementWithinStatementBlock.stree.txt | 100 +-- ...stedTemplateInImplicitExprParens.stree.txt | 78 +- ...tedTemplateInStmtWithinCodeBlock.stree.txt | 106 +-- ...tedTemplateInStmtWithinStmtBlock.stree.txt | 106 +-- ...ithDoubleTransition_DoesNotThrow.stree.txt | 84 +-- .../AllowsMarkupInIfBodyWithBraces.stree.txt | 104 +-- ...nIfBodyWithBracesWithinCodeBlock.stree.txt | 112 +-- ...urnsFromMarkupBlockWithPseudoTag.stree.txt | 44 +- ...kupBlockWithPseudoTagInCodeBlock.stree.txt | 52 +- ...ineToMarkupExclPreceedingNewline.stree.txt | 106 +-- ...mplateTransitionInDesignTimeMode.stree.txt | 34 +- ...tColonTransitionInDesignTimeMode.stree.txt | 34 +- ...mplateTransitionInDesignTimeMode.stree.txt | 28 +- ...dAtTagTransitionInDesignTimeMode.stree.txt | 30 +- ...eOnTagTransitionInDesignTimeMode.stree.txt | 28 +- ...arkupStatementOnOpenAngleBracket.stree.txt | 68 +- ...entOnOpenAngleBracketInCodeBlock.stree.txt | 76 +- ...OnSwitchCharacterFollowedByColon.stree.txt | 24 +- ...racterFollowedByColonInCodeBlock.stree.txt | 32 +- ...chCharacterFollowedByDoubleColon.stree.txt | 24 +- ...chCharacterFollowedByTripleColon.stree.txt | 24 +- ...arkupWithoutPreceedingWhitespace.stree.txt | 74 +- ...neMarkupContainingStatementBlock.stree.txt | 30 +- ...seSwitchIfOuterBlockIsTerminated.stree.txt | 12 +- ...KindsOfImplicitMarkupInCodeBlock.stree.txt | 186 ++--- ...InCaseAndDefaultBranchesOfSwitch.stree.txt | 188 ++--- ...faultBranchesOfSwitchInCodeBlock.stree.txt | 196 ++--- ...sTrailingNewlineInDesignTimeMode.stree.txt | 14 +- ...licitExprDoesNotAcceptDotAfterAt.stree.txt | 12 +- ...ceptTrailingNewlineInRunTimeMode.stree.txt | 14 +- ...SingleSpaceOrNewlineAtDesignTime.stree.txt | 14 +- ...ingleAtOutputsZeroLengthCodeSpan.stree.txt | 12 +- .../VerbatimBlock.stree.txt | 18 +- ...neIfTheyAreSignificantToAncestor.stree.txt | 28 +- ...DoesNotRewriteEscapedTransitions.stree.txt | 24 +- ...DisabledForDataAttributesInBlock.stree.txt | 28 +- ...abledForDataAttributesInDocument.stree.txt | 28 +- ...taAttributesWithExperimentalFlag.stree.txt | 28 +- ...DisabledForDataAttributesInBlock.stree.txt | 32 +- ...abledForDataAttributesInDocument.stree.txt | 26 +- .../DoubleQuotedLiteralAttribute.stree.txt | 30 +- ...eWithWhitespaceSurroundingEquals.stree.txt | 32 +- .../MultiPartLiteralAttribute.stree.txt | 30 +- .../MultiValueExpressionAttribute.stree.txt | 34 +- .../NewLineBetweenAttributes.stree.txt | 34 +- .../NewLinePrecedingAttribute.stree.txt | 22 +- .../SimpleExpressionAttribute.stree.txt | 24 +- .../SimpleLiteralAttribute.stree.txt | 22 +- ...eWithWhitespaceSurroundingEquals.stree.txt | 30 +- .../SymbolBoundAttributes1.stree.txt | 26 +- .../SymbolBoundAttributes2.stree.txt | 24 +- .../SymbolBoundAttributes3.stree.txt | 22 +- .../SymbolBoundAttributes4.stree.txt | 22 +- .../SymbolBoundAttributes5.stree.txt | 22 +- .../SymbolBoundAttributes6.stree.txt | 22 +- ...ttributes_BeforeEqualWhitespace1.stree.txt | 46 +- ...ttributes_BeforeEqualWhitespace2.stree.txt | 42 +- ...ttributes_BeforeEqualWhitespace3.stree.txt | 38 +- ...ttributes_BeforeEqualWhitespace4.stree.txt | 38 +- ...ttributes_BeforeEqualWhitespace5.stree.txt | 38 +- ...ttributes_BeforeEqualWhitespace6.stree.txt | 38 +- ...ymbolBoundAttributes_Whitespace1.stree.txt | 48 +- ...ymbolBoundAttributes_Whitespace2.stree.txt | 44 +- ...ymbolBoundAttributes_Whitespace3.stree.txt | 40 +- ...ymbolBoundAttributes_Whitespace4.stree.txt | 40 +- ...ymbolBoundAttributes_Whitespace5.stree.txt | 40 +- ...ymbolBoundAttributes_Whitespace6.stree.txt | 40 +- ...tributeWithCodeWithSpacesInBlock.stree.txt | 20 +- ...buteWithCodeWithSpacesInDocument.stree.txt | 20 +- .../UnquotedLiteralAttribute.stree.txt | 26 +- ...tesWorkWithConditionalAttributes.stree.txt | 36 +- ...paceAndNewLinePrecedingAttribute.stree.txt | 24 +- .../AcceptsEmptyTextTag.stree.txt | 8 +- ...extTagAsOuterTagButDoesNotRender.stree.txt | 32 +- ...etInAttributeValueIfDoubleQuoted.stree.txt | 36 +- ...etInAttributeValueIfSingleQuoted.stree.txt | 36 +- ...shInAttributeValueIfDoubleQuoted.stree.txt | 40 +- ...shInAttributeValueIfSingleQuoted.stree.txt | 40 +- ...owsStartAndEndTagsToDifferInCase.stree.txt | 30 +- ...AsItCanRecoverToAnExpectedEndTag.stree.txt | 26 +- ...HandleSelfClosingTagsWithinBlock.stree.txt | 24 +- ...ineOfMarkupWithEmbeddedStatement.stree.txt | 38 +- ...nsiderPsuedoTagWithinMarkupBlock.stree.txt | 34 +- ...gleUnlessPreceededByQuestionMark.stree.txt | 38 +- .../HandlesOpenAngleAtEof.stree.txt | 10 +- ...penAngleWithProperTagFollowingIt.stree.txt | 22 +- ...UnbalancedTripleDashHTMLComments.stree.txt | 72 +- ...tmlCommentSupportsMultipleDashes.stree.txt | 186 ++--- ...IgnoresTagsInContentsOfScriptTag.stree.txt | 36 +- ...rminatesCommentOnFullEndSequence.stree.txt | 26 +- .../ParsesSGMLDeclarationAsEmptyTag.stree.txt | 34 +- ...NonWhitespaceCharacterIsStartTag.stree.txt | 42 +- ...LProcessingInstructionAsEmptyTag.stree.txt | 36 +- ...lyBalancesCommentStartAndEndTags.stree.txt | 24 +- ...tCharacterAfterTransitionIsColon.stree.txt | 22 +- .../RendersLiteralTextTagIfDoubled.stree.txt | 46 +- ...topsAtMatchingCloseTagToStartTag.stree.txt | 28 +- ...psParsingMidEmptyTagIfEOFReached.stree.txt | 6 +- ...ngleLineBlockAtEOFIfNoEOLReached.stree.txt | 10 +- .../SupportsCommentAsBlock.stree.txt | 16 +- ...portsCommentWithExtraDashAsBlock.stree.txt | 18 +- .../SupportsCommentWithinBlock.stree.txt | 34 +- ...criptTagsWithLessThanSignsInThem.stree.txt | 36 +- ...agsWithSpacedLessThanSignsInThem.stree.txt | 40 +- .../SupportsTagsWithAttributes.stree.txt | 56 +- ...tCloseAngleDoesNotTerminateBlock.stree.txt | 8 +- .../HtmlBlockTest/TerminatesAtEOF.stree.txt | 6 +- ...erminatesAtEOFWhenParsingComment.stree.txt | 12 +- ...ntAtFirstOccurrenceOfEndSequence.stree.txt | 40 +- ...SGMLDeclarationAtFirstCloseAngle.stree.txt | 36 +- ...tionAtQuestionMarkCloseAnglePair.stree.txt | 40 +- .../TreatsMalformedTagsAsContent.stree.txt | 24 +- .../WithSelfClosingTagJustEmitsTag.stree.txt | 10 +- ...eptsEndTagWithNoMatchingStartTag.stree.txt | 16 +- ...FileAndOutputsZeroLengthCodeSpan.stree.txt | 8 +- ...lyHandlesOddlySpacedHTMLElements.stree.txt | 50 +- ...ineOfMarkupWithEmbeddedStatement.stree.txt | 36 +- ...noreNewLineAtTheEndOfMarkupBlock.stree.txt | 20 +- ...fVerbatimBlockIfNoNewlinePresent.stree.txt | 20 +- ...raNewLineAtTheEndOfVerbatimBlock.stree.txt | 18 +- ...ndNewLineAtTheEndOfVerbatimBlock.stree.txt | 20 +- ...nVerbatimBlockIfFollowedByCSharp.stree.txt | 34 +- ...esNotReturnErrorOnMismatchedTags.stree.txt | 36 +- ...hToCodeOnEmailAddressInAttribute.stree.txt | 30 +- ...EmitsAtSignAsMarkupIfAtEndOfFile.stree.txt | 10 +- ...kIfFirstCharacterIsSwapCharacter.stree.txt | 8 +- ...NewLineBeforeMarkupInNestedBlock.stree.txt | 48 +- ...lesNewLineAndMarkupInNestedBlock.stree.txt | 40 +- .../HandlesNewLineInNestedBlock.stree.txt | 38 +- ...nAtSignEncounteredAndEmitsOutput.stree.txt | 12 +- ...IgnoresTagsInContentsOfScriptTag.stree.txt | 36 +- ...deBlockWithMarkupSetsDotAsMarkup.stree.txt | 66 +- ...pportsDollarOpenBraceCombination.stree.txt | 16 +- ...MarkupSpanIfContentIsEmptyString.stree.txt | 2 +- ...tentAsSingleWhitespaceMarkupSpan.stree.txt | 2 +- ...SwitchToCodeOnEmailAddressInText.stree.txt | 2 +- ...IgnoresTagsInContentsOfScriptTag.stree.txt | 58 +- ...SpanIfNoSwapCharacterEncountered.stree.txt | 6 +- ...gInVerbatimBlockIfFollowedByHtml.stree.txt | 44 +- ...lockIfFollowedByMarkupTransition.stree.txt | 44 +- .../RendersTextPseudoTagAsMarkup.stree.txt | 20 +- ...SegmentIfNoCodeBlocksEncountered.stree.txt | 34 +- ...ingOfAttributeValue_DoesNotThrow.stree.txt | 30 +- ...EndOfAttributeValue_DoesNotThrow.stree.txt | 30 +- ...tweenAttributeValue_DoesNotThrow.stree.txt | 36 +- ...ionInAttributeValue_DoesNotThrow.stree.txt | 28 +- ...leTransitionInEmail_DoesNotThrow.stree.txt | 42 +- ...leTransitionInRegex_DoesNotThrow.stree.txt | 116 +-- ...WithExpressionBlock_DoesNotThrow.stree.txt | 148 ++-- ...ansitionsInAttributeValue_Throws.stree.txt | 30 +- ...onDoesNotCreateDocumentLevelSpan.stree.txt | 38 +- ...sAsLongAsParserCanIdentifyEndTag.stree.txt | 16 +- ...OutputsMarkupSegmentAndEndsBlock.stree.txt | 10 +- ...fEndTextTagContainsTextAfterName.stree.txt | 22 +- ...tartTextTagContainsTextAfterName.stree.txt | 22 +- ...tEOFThrowsMissingEndTagException.stree.txt | 24 +- ...lTagThrowsOnOutermostUnclosedTag.stree.txt | 20 +- ...tEOFThrowsIncompleteTagException.stree.txt | 12 +- .../HtmlTagsTest/CDataTag.stree.txt | 20 +- .../HtmlTagsTest/CommentTag.stree.txt | 14 +- .../HtmlTagsTest/DocTypeTag.stree.txt | 14 +- .../HtmlTagsTest/ElementTags.stree.txt | 18 +- .../HtmlTagsTest/EmptyTag.stree.txt | 12 +- .../EmptyTagNestsLikeNormalTag.stree.txt | 14 +- .../IncompleteVoidElementEndTag.stree.txt | 386 +++++----- .../ProcessingInstructionTag.stree.txt | 26 +- .../HtmlTagsTest/ScriptTag.stree.txt | 44 +- .../ScriptTag_WithNestedBeginTag.stree.txt | 20 +- .../ScriptTag_WithNestedEndTag.stree.txt | 22 +- ...ScriptTag_WithNestedMalformedTag.stree.txt | 46 +- .../ScriptTag_WithNestedTag.stree.txt | 28 +- .../HtmlTagsTest/TextTags.stree.txt | 16 +- .../VoidElementFollowedByCloseTag.stree.txt | 706 +++++++++--------- .../VoidElementFollowedByContent.stree.txt | 546 +++++++------- .../VoidElementFollowedByOtherTag.stree.txt | 368 ++++----- ...OrTrailingWhitespaceInDesignMode.stree.txt | 86 +-- ...hToCodeOnEmailAddressInAttribute.stree.txt | 32 +- ...oCodeIfThereIsNoMarkupOnThatLine.stree.txt | 86 +-- ...SwitchToCodeOnEmailAddressInText.stree.txt | 16 +- ...oCodeIfThereIsNoMarkupOnThatLine.stree.txt | 84 +-- ...tsPairsOfAtSignsAsEscapeSequence.stree.txt | 26 +- ...TreatsTwoAtSignsAsEscapeSequence.stree.txt | 18 +- ...ParsesCodeWithinSingleLineMarkup.stree.txt | 24 +- ...tsPairsOfAtSignsAsEscapeSequence.stree.txt | 48 +- ...TreatsTwoAtSignsAsEscapeSequence.stree.txt | 40 +- ...oCodeIfThereIsNoMarkupOnThatLine.stree.txt | 106 +-- ...pportsCodeWithinCDataDeclaration.stree.txt | 44 +- .../SupportsCodeWithinComment.stree.txt | 32 +- ...upportsCodeWithinSGMLDeclaration.stree.txt | 36 +- ...deWithinXMLProcessingInstruction.stree.txt | 38 +- ...acterEncounteredInAttributeValue.stree.txt | 24 +- ...CharacterEncounteredInTagContent.stree.txt | 40 +- ...enSwapCharacterEncounteredMidTag.stree.txt | 16 +- ...acterBeforeSwapIsNonAlphanumeric.stree.txt | 20 +- ...tsPairsOfAtSignsAsEscapeSequence.stree.txt | 26 +- ...TreatsTwoAtSignsAsEscapeSequence.stree.txt | 20 +- .../AllowsCompatibleTagStructures3.stree.txt | 2 +- .../AllowsCompatibleTagStructures5.stree.txt | 2 +- .../CanHandleSymbolBoundAttributes1.stree.txt | 2 +- .../CanHandleSymbolBoundAttributes2.stree.txt | 2 +- .../CanHandleSymbolBoundAttributes3.stree.txt | 6 +- .../CanHandleSymbolBoundAttributes4.stree.txt | 6 +- .../CanHandleSymbolBoundAttributes5.stree.txt | 2 +- .../CanHandleSymbolBoundAttributes7.stree.txt | 2 +- ...HandleWithoutEndTagTagStructure2.stree.txt | 2 +- ...HandleWithoutEndTagTagStructure4.stree.txt | 2 +- ...HandleWithoutEndTagTagStructure5.stree.txt | 14 +- ...rEmptyTagHelperBoundAttributes12.stree.txt | 2 +- ...rEmptyTagHelperBoundAttributes13.stree.txt | 8 +- ...rEmptyTagHelperBoundAttributes14.stree.txt | 12 +- ...orEmptyTagHelperBoundAttributes2.stree.txt | 4 +- ...orEmptyTagHelperBoundAttributes3.stree.txt | 2 +- ...orEmptyTagHelperBoundAttributes5.stree.txt | 4 +- ...orEmptyTagHelperBoundAttributes6.stree.txt | 2 +- ...orEmptyTagHelperBoundAttributes8.stree.txt | 2 +- ...orEmptyTagHelperBoundAttributes9.stree.txt | 4 +- ...eatesErrorForMalformedTagHelper6.stree.txt | 14 +- ...eatesErrorForMalformedTagHelper7.stree.txt | 12 +- ...eatesErrorForMalformedTagHelper8.stree.txt | 12 +- ...formedTagHelpersWithAttributes10.stree.txt | 2 +- ...formedTagHelpersWithAttributes11.stree.txt | 8 +- ...formedTagHelpersWithAttributes12.stree.txt | 8 +- ...formedTagHelpersWithAttributes15.stree.txt | 8 +- ...formedTagHelpersWithAttributes16.stree.txt | 8 +- ...formedTagHelpersWithAttributes17.stree.txt | 10 +- ...formedTagHelpersWithAttributes19.stree.txt | 2 +- ...lformedTagHelpersWithAttributes2.stree.txt | 2 +- ...lformedTagHelpersWithAttributes3.stree.txt | 10 +- ...lformedTagHelpersWithAttributes4.stree.txt | 8 +- ...lformedTagHelpersWithAttributes5.stree.txt | 2 +- ...lformedTagHelpersWithAttributes6.stree.txt | 4 +- ...lformedTagHelpersWithAttributes7.stree.txt | 16 +- ...lformedTagHelpersWithAttributes9.stree.txt | 2 +- ...ForNonStringTagHelperAttributes1.stree.txt | 2 +- ...orNonStringTagHelperAttributes10.stree.txt | 10 +- ...orNonStringTagHelperAttributes11.stree.txt | 32 +- ...ForNonStringTagHelperAttributes2.stree.txt | 2 +- ...ForNonStringTagHelperAttributes3.stree.txt | 12 +- ...ForNonStringTagHelperAttributes4.stree.txt | 14 +- ...ForNonStringTagHelperAttributes5.stree.txt | 2 +- ...ForNonStringTagHelperAttributes6.stree.txt | 12 +- ...ForNonStringTagHelperAttributes7.stree.txt | 58 +- ...ForNonStringTagHelperAttributes8.stree.txt | 16 +- ...ForNonStringTagHelperAttributes9.stree.txt | 22 +- ...UnboundDataDashAttributes_Block1.stree.txt | 20 +- ...UnboundDataDashAttributes_Block2.stree.txt | 14 +- ...UnboundDataDashAttributes_Block3.stree.txt | 24 +- ...UnboundDataDashAttributes_Block4.stree.txt | 24 +- ...UnboundDataDashAttributes_Block5.stree.txt | 28 +- ...UnboundDataDashAttributes_Block6.stree.txt | 28 +- ...UnboundDataDashAttributes_Block7.stree.txt | 34 +- ...oundDataDashAttributes_Document1.stree.txt | 8 +- ...oundDataDashAttributes_Document2.stree.txt | 2 +- ...oundDataDashAttributes_Document3.stree.txt | 12 +- ...oundDataDashAttributes_Document4.stree.txt | 12 +- ...oundDataDashAttributes_Document5.stree.txt | 16 +- ...oundDataDashAttributes_Document6.stree.txt | 16 +- ...oundDataDashAttributes_Document7.stree.txt | 22 +- ...eTreeRewriter_AllowsInvalidHtml1.stree.txt | 4 +- ...TreeRewriter_AllowsInvalidHtml10.stree.txt | 30 +- ...eTreeRewriter_AllowsInvalidHtml2.stree.txt | 2 +- ...eTreeRewriter_AllowsInvalidHtml3.stree.txt | 12 +- ...eTreeRewriter_AllowsInvalidHtml4.stree.txt | 6 +- ...eTreeRewriter_AllowsInvalidHtml5.stree.txt | 16 +- ...eTreeRewriter_AllowsInvalidHtml6.stree.txt | 8 +- ...eTreeRewriter_AllowsInvalidHtml7.stree.txt | 14 +- ...eTreeRewriter_AllowsInvalidHtml8.stree.txt | 22 +- ...eTreeRewriter_AllowsInvalidHtml9.stree.txt | 34 +- ...atesErrorForIncompleteTagHelper1.stree.txt | 20 +- ...atesErrorForIncompleteTagHelper2.stree.txt | 18 +- ...atesErrorForIncompleteTagHelper3.stree.txt | 18 +- ...atesErrorForIncompleteTagHelper4.stree.txt | 8 +- ...plexAttributeTagHelperTagBlocks1.stree.txt | 16 +- ...plexAttributeTagHelperTagBlocks2.stree.txt | 152 ++-- ...plexAttributeTagHelperTagBlocks3.stree.txt | 20 +- ...plexAttributeTagHelperTagBlocks4.stree.txt | 156 ++-- ...plexAttributeTagHelperTagBlocks5.stree.txt | 20 +- ...plexAttributeTagHelperTagBlocks6.stree.txt | 156 ++-- ...plexAttributeTagHelperTagBlocks7.stree.txt | 60 +- ...writesComplexTagHelperTagBlocks1.stree.txt | 8 +- ...writesComplexTagHelperTagBlocks2.stree.txt | 62 +- ...writesComplexTagHelperTagBlocks3.stree.txt | 16 +- ...writesComplexTagHelperTagBlocks4.stree.txt | 70 +- ...writesComplexTagHelperTagBlocks5.stree.txt | 16 +- ...writesComplexTagHelperTagBlocks6.stree.txt | 124 +-- ...writesComplexTagHelperTagBlocks7.stree.txt | 46 +- ...writesComplexTagHelperTagBlocks8.stree.txt | 154 ++-- ...esOddlySpacedTagHelperTagBlocks1.stree.txt | 22 +- ...esOddlySpacedTagHelperTagBlocks2.stree.txt | 26 +- ...esOddlySpacedTagHelperTagBlocks3.stree.txt | 16 +- ...RewritesPlainTagHelperTagBlocks2.stree.txt | 4 +- ...RewritesPlainTagHelperTagBlocks3.stree.txt | 4 +- ...RewritesPlainTagHelperTagBlocks4.stree.txt | 26 +- ...writer_RewritesScriptTagHelpers1.stree.txt | 14 +- ...writer_RewritesScriptTagHelpers2.stree.txt | 22 +- ...writer_RewritesScriptTagHelpers3.stree.txt | 20 +- ...writer_RewritesScriptTagHelpers4.stree.txt | 34 +- ...writer_RewritesScriptTagHelpers5.stree.txt | 4 +- ...writer_RewritesScriptTagHelpers6.stree.txt | 8 +- ...writer_RewritesScriptTagHelpers7.stree.txt | 12 +- ...r_RewritesSelfClosingTagHelpers1.stree.txt | 4 +- ...r_RewritesSelfClosingTagHelpers2.stree.txt | 8 +- ...r_RewritesSelfClosingTagHelpers3.stree.txt | 8 +- ...esTagHelpersWithPlainAttributes1.stree.txt | 4 +- ...esTagHelpersWithPlainAttributes2.stree.txt | 8 +- ...esTagHelpersWithPlainAttributes3.stree.txt | 8 +- ...esTagHelpersWithPlainAttributes4.stree.txt | 42 +- ...gHelpersWithQuotelessAttributes1.stree.txt | 12 +- ...gHelpersWithQuotelessAttributes2.stree.txt | 16 +- ...gHelpersWithQuotelessAttributes3.stree.txt | 22 +- ...gHelpersWithQuotelessAttributes4.stree.txt | 24 +- ...gHelpersWithQuotelessAttributes5.stree.txt | 50 +- ...standsMinimizedAttributes_Block1.stree.txt | 12 +- ...tandsMinimizedAttributes_Block10.stree.txt | 12 +- ...tandsMinimizedAttributes_Block11.stree.txt | 12 +- ...tandsMinimizedAttributes_Block12.stree.txt | 12 +- ...tandsMinimizedAttributes_Block13.stree.txt | 12 +- ...tandsMinimizedAttributes_Block14.stree.txt | 14 +- ...tandsMinimizedAttributes_Block15.stree.txt | 18 +- ...tandsMinimizedAttributes_Block16.stree.txt | 12 +- ...tandsMinimizedAttributes_Block17.stree.txt | 12 +- ...tandsMinimizedAttributes_Block18.stree.txt | 12 +- ...tandsMinimizedAttributes_Block19.stree.txt | 12 +- ...standsMinimizedAttributes_Block2.stree.txt | 12 +- ...tandsMinimizedAttributes_Block20.stree.txt | 14 +- ...tandsMinimizedAttributes_Block21.stree.txt | 14 +- ...tandsMinimizedAttributes_Block22.stree.txt | 14 +- ...tandsMinimizedAttributes_Block23.stree.txt | 14 +- ...tandsMinimizedAttributes_Block24.stree.txt | 14 +- ...tandsMinimizedAttributes_Block25.stree.txt | 14 +- ...tandsMinimizedAttributes_Block26.stree.txt | 14 +- ...tandsMinimizedAttributes_Block27.stree.txt | 14 +- ...tandsMinimizedAttributes_Block28.stree.txt | 14 +- ...tandsMinimizedAttributes_Block29.stree.txt | 14 +- ...standsMinimizedAttributes_Block3.stree.txt | 12 +- ...tandsMinimizedAttributes_Block30.stree.txt | 28 +- ...tandsMinimizedAttributes_Block31.stree.txt | 28 +- ...tandsMinimizedAttributes_Block32.stree.txt | 44 +- ...tandsMinimizedAttributes_Block33.stree.txt | 44 +- ...standsMinimizedAttributes_Block4.stree.txt | 12 +- ...standsMinimizedAttributes_Block5.stree.txt | 12 +- ...standsMinimizedAttributes_Block6.stree.txt | 12 +- ...standsMinimizedAttributes_Block7.stree.txt | 12 +- ...standsMinimizedAttributes_Block8.stree.txt | 12 +- ...standsMinimizedAttributes_Block9.stree.txt | 12 +- ...dsMinimizedAttributes_Document14.stree.txt | 2 +- ...dsMinimizedAttributes_Document15.stree.txt | 6 +- ...dsMinimizedAttributes_Document20.stree.txt | 2 +- ...dsMinimizedAttributes_Document21.stree.txt | 2 +- ...dsMinimizedAttributes_Document22.stree.txt | 2 +- ...dsMinimizedAttributes_Document23.stree.txt | 2 +- ...dsMinimizedAttributes_Document24.stree.txt | 2 +- ...dsMinimizedAttributes_Document25.stree.txt | 2 +- ...dsMinimizedAttributes_Document26.stree.txt | 2 +- ...dsMinimizedAttributes_Document27.stree.txt | 2 +- ...dsMinimizedAttributes_Document28.stree.txt | 2 +- ...dsMinimizedAttributes_Document29.stree.txt | 2 +- ...dsMinimizedAttributes_Document30.stree.txt | 16 +- ...dsMinimizedAttributes_Document31.stree.txt | 16 +- ...dsMinimizedAttributes_Document32.stree.txt | 32 +- ...dsMinimizedAttributes_Document33.stree.txt | 32 +- .../AllowsPrefixedTagHelpers1.stree.txt | 10 +- .../AllowsPrefixedTagHelpers10.stree.txt | 8 +- .../AllowsPrefixedTagHelpers11.stree.txt | 8 +- .../AllowsPrefixedTagHelpers2.stree.txt | 20 +- .../AllowsPrefixedTagHelpers5.stree.txt | 14 +- .../AllowsPrefixedTagHelpers6.stree.txt | 12 +- .../AllowsPrefixedTagHelpers7.stree.txt | 18 +- .../AllowsPrefixedTagHelpers8.stree.txt | 2 +- .../AllowsPrefixedTagHelpers9.stree.txt | 2 +- .../AllowsRazorCommentsAsChildren.stree.txt | 26 +- .../AllowsRazorMarkupInHtmlComment.stree.txt | 34 +- ...lowsSimpleHtmlCommentsAsChildren.stree.txt | 32 +- ...agInCSharpBlock_WithAttrTextTag1.stree.txt | 28 +- ...agInCSharpBlock_WithAttrTextTag2.stree.txt | 42 +- ...agInCSharpBlock_WithAttrTextTag3.stree.txt | 52 +- ...agInCSharpBlock_WithAttrTextTag4.stree.txt | 54 +- ...agInCSharpBlock_WithAttrTextTag5.stree.txt | 56 +- ...gInCSharpBlock_WithBlockTextTag1.stree.txt | 16 +- ...gInCSharpBlock_WithBlockTextTag2.stree.txt | 22 +- ...gInCSharpBlock_WithBlockTextTag3.stree.txt | 30 +- ...gInCSharpBlock_WithBlockTextTag4.stree.txt | 40 +- ...gInCSharpBlock_WithBlockTextTag5.stree.txt | 28 +- ...gInCSharpBlock_WithBlockTextTag6.stree.txt | 28 +- ...gInCSharpBlock_WithBlockTextTag7.stree.txt | 30 +- ...gInCSharpBlock_WithBlockTextTag8.stree.txt | 32 +- ...gInCSharpBlock_WithBlockTextTag9.stree.txt | 38 +- ...lperElementOptForIncompleteHTML1.stree.txt | 4 +- ...lperElementOptForIncompleteHTML2.stree.txt | 6 +- ...lperElementOptForIncompleteHTML3.stree.txt | 10 +- ...lperElementOptForIncompleteHTML4.stree.txt | 12 +- ...lperElementOptForIncompleteHTML5.stree.txt | 16 +- ...lperElementOptForIncompleteHTML6.stree.txt | 18 +- ...lperElementOptForIncompleteHTML7.stree.txt | 22 +- ...tForIncompleteHTMLInCSharpBlock1.stree.txt | 12 +- ...tForIncompleteHTMLInCSharpBlock2.stree.txt | 12 +- ...tForIncompleteHTMLInCSharpBlock3.stree.txt | 18 +- ...tForIncompleteHTMLInCSharpBlock4.stree.txt | 20 +- ...tForIncompleteHTMLInCSharpBlock5.stree.txt | 22 +- ...tForIncompleteHTMLInCSharpBlock6.stree.txt | 28 +- ...tForIncompleteHTMLInCSharpBlock7.stree.txt | 26 +- ...tForIncompleteHTMLInCSharpBlock8.stree.txt | 30 +- ...rIncompleteTextTagInCSharpBlock1.stree.txt | 12 +- ...rIncompleteTextTagInCSharpBlock2.stree.txt | 18 +- ...rIncompleteTextTagInCSharpBlock3.stree.txt | 20 +- ...rIncompleteTextTagInCSharpBlock4.stree.txt | 22 +- ...rIncompleteTextTagInCSharpBlock5.stree.txt | 26 +- ...rIncompleteTextTagInCSharpBlock6.stree.txt | 30 +- ...tOptOutCSharp_WithAttributeData1.stree.txt | 28 +- ...tOptOutCSharp_WithAttributeData2.stree.txt | 42 +- ...tOptOutCSharp_WithAttributeData3.stree.txt | 52 +- ...tOptOutCSharp_WithAttributeData4.stree.txt | 54 +- ...tOptOutCSharp_WithAttributeData5.stree.txt | 56 +- ...ementOptOutCSharp_WithBlockData1.stree.txt | 16 +- ...mentOptOutCSharp_WithBlockData10.stree.txt | 30 +- ...mentOptOutCSharp_WithBlockData11.stree.txt | 30 +- ...mentOptOutCSharp_WithBlockData12.stree.txt | 48 +- ...ementOptOutCSharp_WithBlockData2.stree.txt | 22 +- ...ementOptOutCSharp_WithBlockData3.stree.txt | 30 +- ...ementOptOutCSharp_WithBlockData4.stree.txt | 40 +- ...ementOptOutCSharp_WithBlockData5.stree.txt | 28 +- ...ementOptOutCSharp_WithBlockData6.stree.txt | 22 +- ...ementOptOutCSharp_WithBlockData7.stree.txt | 30 +- ...ementOptOutCSharp_WithBlockData8.stree.txt | 26 +- ...ementOptOutCSharp_WithBlockData9.stree.txt | 38 +- ...entOptOutHTML_WithAttributeData1.stree.txt | 20 +- ...entOptOutHTML_WithAttributeData2.stree.txt | 30 +- ...entOptOutHTML_WithAttributeData3.stree.txt | 36 +- ...entOptOutHTML_WithAttributeData4.stree.txt | 42 +- ...entOptOutHTML_WithAttributeData5.stree.txt | 44 +- ...ElementOptOutHTML_WithBlockData1.stree.txt | 8 +- ...lementOptOutHTML_WithBlockData10.stree.txt | 10 +- ...lementOptOutHTML_WithBlockData11.stree.txt | 18 +- ...lementOptOutHTML_WithBlockData12.stree.txt | 28 +- ...ElementOptOutHTML_WithBlockData2.stree.txt | 10 +- ...ElementOptOutHTML_WithBlockData3.stree.txt | 18 +- ...ElementOptOutHTML_WithBlockData4.stree.txt | 24 +- ...ElementOptOutHTML_WithBlockData5.stree.txt | 16 +- ...ElementOptOutHTML_WithBlockData6.stree.txt | 10 +- ...ElementOptOutHTML_WithBlockData7.stree.txt | 18 +- ...ElementOptOutHTML_WithBlockData8.stree.txt | 18 +- ...ElementOptOutHTML_WithBlockData9.stree.txt | 26 +- ...dleInvalidChildrenWithWhitespace.stree.txt | 16 +- ...pleTagHelpersWithAllowedChildren.stree.txt | 4 +- ...lpersWithAllowedChildren_OneNull.stree.txt | 4 +- ...houtEndTagTagStructureForEndTags.stree.txt | 8 +- ...sNotRewriteSpecialTagTagHelpers1.stree.txt | 34 +- ...sNotRewriteSpecialTagTagHelpers2.stree.txt | 32 +- ...sNotRewriteSpecialTagTagHelpers3.stree.txt | 20 +- ...sNotRewriteSpecialTagTagHelpers4.stree.txt | 26 +- ...sNotRewriteSpecialTagTagHelpers5.stree.txt | 26 +- ...sNotRewriteSpecialTagTagHelpers6.stree.txt | 20 +- ...sNotRewriteSpecialTagTagHelpers7.stree.txt | 20 +- ...sNotRewriteSpecialTagTagHelpers8.stree.txt | 30 +- ...riteTextTagTransitionTagHelpers1.stree.txt | 4 +- ...riteTextTagTransitionTagHelpers2.stree.txt | 32 +- ...riteTextTagTransitionTagHelpers3.stree.txt | 32 +- ...riteTextTagTransitionTagHelpers4.stree.txt | 18 +- ...ersInInvalidHtmlTypedScriptTags1.stree.txt | 28 +- ...ersInInvalidHtmlTypedScriptTags2.stree.txt | 40 +- ...ersInInvalidHtmlTypedScriptTags3.stree.txt | 44 +- ...ersInInvalidHtmlTypedScriptTags4.stree.txt | 56 +- ...tsAsChildrenWhenFeatureFlagIsOff.stree.txt | 12 +- ...ForContentWithCommentsAsChildren.stree.txt | 26 +- ...NestedNonTagHelperTags_Correctly.stree.txt | 24 +- ...dAllowedChildrenAndRequireParent.stree.txt | 8 +- ...sCreateTagHelperBlocksCorrectly1.stree.txt | 16 +- ...CreateTagHelperBlocksCorrectly10.stree.txt | 46 +- ...sCreateTagHelperBlocksCorrectly2.stree.txt | 16 +- ...sCreateTagHelperBlocksCorrectly3.stree.txt | 30 +- ...sCreateTagHelperBlocksCorrectly4.stree.txt | 30 +- ...sCreateTagHelperBlocksCorrectly5.stree.txt | 18 +- ...sCreateTagHelperBlocksCorrectly6.stree.txt | 18 +- ...sCreateTagHelperBlocksCorrectly7.stree.txt | 18 +- ...sCreateTagHelperBlocksCorrectly8.stree.txt | 18 +- ...sCreateTagHelperBlocksCorrectly9.stree.txt | 46 +- ...agHelperPrefixAndAllowedChildren.stree.txt | 14 +- ...uteMismatchAndRestrictedChildren.stree.txt | 14 +- ...lformedTagHelperBlocksCorrectly1.stree.txt | 4 +- ...formedTagHelperBlocksCorrectly10.stree.txt | 4 +- ...lformedTagHelperBlocksCorrectly2.stree.txt | 2 +- ...lformedTagHelperBlocksCorrectly3.stree.txt | 4 +- ...lformedTagHelperBlocksCorrectly4.stree.txt | 12 +- ...lformedTagHelperBlocksCorrectly5.stree.txt | 2 +- ...lformedTagHelperBlocksCorrectly6.stree.txt | 4 +- ...lformedTagHelperBlocksCorrectly7.stree.txt | 8 +- ...lformedTagHelperBlocksCorrectly8.stree.txt | 10 +- ...lformedTagHelperBlocksCorrectly9.stree.txt | 2 +- ...sCreateTagHelperBlocksCorrectly1.stree.txt | 10 +- ...CreateTagHelperBlocksCorrectly10.stree.txt | 2 +- ...CreateTagHelperBlocksCorrectly11.stree.txt | 8 +- ...CreateTagHelperBlocksCorrectly12.stree.txt | 8 +- ...CreateTagHelperBlocksCorrectly13.stree.txt | 14 +- ...CreateTagHelperBlocksCorrectly14.stree.txt | 22 +- ...CreateTagHelperBlocksCorrectly15.stree.txt | 26 +- ...CreateTagHelperBlocksCorrectly16.stree.txt | 4 +- ...CreateTagHelperBlocksCorrectly17.stree.txt | 10 +- ...CreateTagHelperBlocksCorrectly18.stree.txt | 10 +- ...CreateTagHelperBlocksCorrectly19.stree.txt | 2 +- ...sCreateTagHelperBlocksCorrectly2.stree.txt | 14 +- ...CreateTagHelperBlocksCorrectly20.stree.txt | 10 +- ...CreateTagHelperBlocksCorrectly21.stree.txt | 8 +- ...CreateTagHelperBlocksCorrectly22.stree.txt | 22 +- ...CreateTagHelperBlocksCorrectly23.stree.txt | 22 +- ...CreateTagHelperBlocksCorrectly24.stree.txt | 4 +- ...CreateTagHelperBlocksCorrectly25.stree.txt | 10 +- ...CreateTagHelperBlocksCorrectly26.stree.txt | 4 +- ...CreateTagHelperBlocksCorrectly27.stree.txt | 10 +- ...CreateTagHelperBlocksCorrectly28.stree.txt | 14 +- ...CreateTagHelperBlocksCorrectly29.stree.txt | 30 +- ...sCreateTagHelperBlocksCorrectly3.stree.txt | 10 +- ...CreateTagHelperBlocksCorrectly30.stree.txt | 24 +- ...sCreateTagHelperBlocksCorrectly4.stree.txt | 14 +- ...sCreateTagHelperBlocksCorrectly5.stree.txt | 2 +- ...sCreateTagHelperBlocksCorrectly6.stree.txt | 8 +- ...sCreateTagHelperBlocksCorrectly7.stree.txt | 8 +- ...sCreateTagHelperBlocksCorrectly8.stree.txt | 14 +- ...sCreateTagHelperBlocksCorrectly9.stree.txt | 22 +- ...ewritesNestedTagHelperTagBlocks2.stree.txt | 4 +- ...ewritesNestedTagHelperTagBlocks3.stree.txt | 6 +- ...ewritesNestedTagHelperTagBlocks4.stree.txt | 34 +- .../UnderstandsAllowedChildren10.stree.txt | 24 +- .../UnderstandsAllowedChildren11.stree.txt | 38 +- .../UnderstandsAllowedChildren12.stree.txt | 4 +- .../UnderstandsAllowedChildren13.stree.txt | 2 +- .../UnderstandsAllowedChildren14.stree.txt | 26 +- .../UnderstandsAllowedChildren4.stree.txt | 2 +- .../UnderstandsAllowedChildren5.stree.txt | 10 +- .../UnderstandsAllowedChildren6.stree.txt | 2 +- .../UnderstandsAllowedChildren7.stree.txt | 4 +- .../UnderstandsAllowedChildren8.stree.txt | 4 +- .../UnderstandsAllowedChildren9.stree.txt | 4 +- ...UnderstandsNestedRequiredParent1.stree.txt | 14 +- ...UnderstandsNestedRequiredParent3.stree.txt | 14 +- ...UnderstandsNestedRequiredParent4.stree.txt | 28 +- ...UnderstandsNestedRequiredParent5.stree.txt | 14 +- ...edVoidSelfClosingRequiredParent1.stree.txt | 14 +- ...edVoidSelfClosingRequiredParent3.stree.txt | 6 +- ...edVoidSelfClosingRequiredParent4.stree.txt | 6 +- ...edVoidSelfClosingRequiredParent5.stree.txt | 14 +- ...edVoidSelfClosingRequiredParent7.stree.txt | 10 +- ...edVoidSelfClosingRequiredParent8.stree.txt | 10 +- ...meWithAllowedChildrenForCatchAll.stree.txt | 4 +- ...wedChildrenForCatchAllWithPrefix.stree.txt | 4 +- ...standsPartialRequiredParentTags4.stree.txt | 16 +- ...standsPartialRequiredParentTags5.stree.txt | 16 +- ...standsPartialRequiredParentTags6.stree.txt | 18 +- ...TagHelpersInHtmlTypedScriptTags1.stree.txt | 30 +- ...TagHelpersInHtmlTypedScriptTags2.stree.txt | 54 +- ...TagHelpersInHtmlTypedScriptTags3.stree.txt | 60 +- ...TagHelpersInHtmlTypedScriptTags4.stree.txt | 72 +- ..._ExpressionBlock_To_Parent_Block.stree.txt | 12 +- .../Language/Legacy/RawTextToken.cs | 59 -- .../Language/Legacy/SyntaxTreeNodeWriter.cs | 27 +- .../Language/Legacy/TestSpanBuilder.cs | 57 +- .../DefaultRazorCompletionFactsServiceTest.cs | 9 +- ...DefaultRazorIndentationFactsServiceTest.cs | 21 +- 996 files changed, 16796 insertions(+), 17288 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenType.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlTokenType.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenBase.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextTokenSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextTokenSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/NewLineTokenSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/PunctuationSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/UnknownTokenSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/WhitespaceTokenSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/NewLineTokenSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/PunctuationSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/UnknownTokenSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/WhitespaceTokenSyntax.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/RawTextToken.cs 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/DirectiveTokenEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs index 308c274518..b6e2c5f2cd 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs @@ -4,12 +4,13 @@ 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) { } 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..73bd432faf 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; @@ -339,7 +342,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { 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; } @@ -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( @@ -1664,7 +1669,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Span.ChunkGenerator = SpanChunkGenerator.Null; 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(); @@ -1679,7 +1684,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy 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(); } @@ -1759,13 +1764,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy case DirectiveKind.SingleLine: Output(SpanKindInternal.None, AcceptedCharactersInternal.WhiteSpace); - Optional(CSharpTokenType.Semicolon); + Optional(SyntaxKind.Semicolon); Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.WhiteSpace); AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - if (At(CSharpTokenType.NewLine)) + if (At(SyntaxKind.NewLine)) { AcceptAndMoveNext(); } @@ -1816,7 +1821,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy 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..f0d38acfd6 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.RazorComment; 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 02428c2691..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs +++ /dev/null @@ -1,60 +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.Linq; -using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; - -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; } - - protected override SyntaxToken GetSyntaxToken() - { - switch (Type) - { - default: - return SyntaxFactory.UnknownToken(Content, Errors.ToArray()); - } - } - - 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/CSharpTokenType.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenType.cs deleted file mode 100644 index 10f3478d6d..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenType.cs +++ /dev/null @@ -1,75 +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 enum CSharpTokenType - { - Unknown, - Identifier, - Keyword, - IntegerLiteral, - NewLine, - WhiteSpace, - Comment, - RealLiteral, - CharacterLiteral, - StringLiteral, - - // Operators - Arrow, - Minus, - Decrement, - MinusAssign, - NotEqual, - Not, - Modulo, - ModuloAssign, - AndAssign, - And, - DoubleAnd, - LeftParenthesis, - RightParenthesis, - Star, - MultiplyAssign, - Comma, - Dot, - Slash, - DivideAssign, - DoubleColon, - Colon, - Semicolon, - QuestionMark, - NullCoalesce, - RightBracket, - LeftBracket, - XorAssign, - Xor, - LeftBrace, - OrAssign, - DoubleOr, - Or, - RightBrace, - Tilde, - Plus, - PlusAssign, - Increment, - LessThan, - LessThanEqual, - LeftShift, - LeftShiftAssign, - Assign, - Equals, - GreaterThan, - GreaterThanEqual, - RightShift, - RightShiftAssign, - Hash, - Transition, - - // Razor specific - RazorCommentTransition, - RazorCommentStar, - RazorComment - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs index f819e98a3a..af20a51dfe 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.RazorComment; - 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..4b63b47a03 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.RazorComment && + 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..7d39ebbe0a 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.RazorComment && + 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..40a1dd9b39 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.HtmlTextLiteral: 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.RazorComment: 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.RazorComment; case KnownTokenType.Identifier: - return HtmlTokenType.Text; + return SyntaxKind.HtmlTextLiteral; case KnownTokenType.Keyword: - return HtmlTokenType.Text; + return SyntaxKind.HtmlTextLiteral; 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 fdb94014dc..d3679ce664 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.HtmlTextLiteral, "-"), + SyntaxFactory.Token(SyntaxKind.Bang, "!"), + SyntaxFactory.Token(SyntaxKind.OpenAngle, "<"), + }; + private static readonly SyntaxToken[] singleHyphenArray = new[] + { + SyntaxFactory.Token(SyntaxKind.HtmlTextLiteral, "-") + }; 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.HtmlTextLiteral && !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.HtmlTextLiteral && 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()) { @@ -506,10 +515,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy 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); @@ -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.HtmlTextLiteral) && 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.HtmlTextLiteral && 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.HtmlTextLiteral && 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.HtmlTextLiteral) { tagName = "!" + nextToken.Content; } } - else if (At(HtmlTokenType.Text)) + else if (At(SyntaxKind.HtmlTextLiteral)) { 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.HtmlTextLiteral); 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) || At(HtmlTokenType.RazorCommentTransition)) + 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,9 +931,9 @@ 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)); @@ -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.HtmlTextLiteral) { - 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.HtmlTextLiteral, "!" + 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.HtmlTextLiteral); 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.HtmlTextLiteral); 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.HtmlTextLiteral) && 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.HtmlTextLiteral) && 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() @@ -1591,7 +1600,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy NextToken(); while (!EndOfFile) { - SkipToAndParseCode(HtmlTokenType.OpenAngle); + SkipToAndParseCode(SyntaxKind.OpenAngle); ScanTagInDocumentContext(); } AddMarkerTokenIfNecessary(); @@ -1606,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: ' or '

' etc. ParserState = ParserState.EndTag; - Optional(HtmlTokenType.ForwardSlash); + Optional(SyntaxKind.ForwardSlash); // Whitespace here is invalid (according to the spec) OptionalBangEscape(); - Optional(HtmlTokenType.Text); - Optional(HtmlTokenType.WhiteSpace); - Optional(HtmlTokenType.CloseAngle); + Optional(SyntaxKind.HtmlTextLiteral); + Optional(SyntaxKind.Whitespace); + Optional(SyntaxKind.CloseAngle); ParserState = ParserState.Content; } @@ -1727,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; } @@ -1778,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)) { @@ -1796,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.HtmlTextLiteral || + token.Kind == SyntaxKind.OpenAngle); + if (At(SyntaxKind.HtmlTextLiteral)) { nesting += ProcessTextToken(nestingSequences, nesting); if (CurrentToken != null) @@ -1825,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)) { @@ -1850,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) @@ -1881,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.HtmlTextLiteral); 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.HtmlTextLiteral); 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 9659d85360..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs +++ /dev/null @@ -1,77 +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.Linq; -using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; - -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)); - } - } - - protected override SyntaxToken GetSyntaxToken() - { - switch (Type) - { - case HtmlTokenType.Text: - return SyntaxFactory.HtmlTextToken(Content, Errors.ToArray()); - case HtmlTokenType.WhiteSpace: - return SyntaxFactory.WhitespaceToken(Content, Errors.ToArray()); - case HtmlTokenType.NewLine: - return SyntaxFactory.NewLineToken(Content, Errors.ToArray()); - case HtmlTokenType.OpenAngle: - return SyntaxFactory.Punctuation(SyntaxKind.OpenAngle, Content, Errors.ToArray()); - case HtmlTokenType.Bang: - return SyntaxFactory.Punctuation(SyntaxKind.Bang, Content, Errors.ToArray()); - case HtmlTokenType.ForwardSlash: - return SyntaxFactory.Punctuation(SyntaxKind.ForwardSlash, Content, Errors.ToArray()); - case HtmlTokenType.QuestionMark: - return SyntaxFactory.Punctuation(SyntaxKind.QuestionMark, Content, Errors.ToArray()); - case HtmlTokenType.DoubleHyphen: - return SyntaxFactory.Punctuation(SyntaxKind.DoubleHyphen, Content, Errors.ToArray()); - case HtmlTokenType.LeftBracket: - return SyntaxFactory.Punctuation(SyntaxKind.LeftBracket, Content, Errors.ToArray()); - case HtmlTokenType.CloseAngle: - return SyntaxFactory.Punctuation(SyntaxKind.CloseAngle, Content, Errors.ToArray()); - case HtmlTokenType.RightBracket: - return SyntaxFactory.Punctuation(SyntaxKind.RightBracket, Content, Errors.ToArray()); - case HtmlTokenType.Equals: - return SyntaxFactory.Punctuation(SyntaxKind.Equals, Content, Errors.ToArray()); - case HtmlTokenType.DoubleQuote: - return SyntaxFactory.Punctuation(SyntaxKind.DoubleQuote, Content, Errors.ToArray()); - case HtmlTokenType.SingleQuote: - return SyntaxFactory.Punctuation(SyntaxKind.SingleQuote, Content, Errors.ToArray()); - case HtmlTokenType.Transition: - return SyntaxFactory.Punctuation(SyntaxKind.Transition, Content, Errors.ToArray()); - case HtmlTokenType.Colon: - return SyntaxFactory.Punctuation(SyntaxKind.Colon, Content, Errors.ToArray()); - default: - return SyntaxFactory.UnknownToken(Content, Errors.ToArray()); - } - } - } -} 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..e804eb3114 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.RazorComment; } } - 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.HtmlTextLiteral)); } - 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 a57f9dbf4d..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs +++ /dev/null @@ -1,20 +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 Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal interface IToken - { - Span Parent { get; set; } - - string Content { get; } - - SourceLocation Start { get; } - - SyntaxKind SyntaxKind { get; } - - SyntaxToken SyntaxToken { 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 ec448d0dc4..b9147e8dac 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs @@ -5,13 +5,16 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; +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; @@ -24,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; } @@ -32,7 +36,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public SpanEditHandler EditHandler { get; private set; } - public HtmlNodeSyntax SyntaxNode { get; private set; } + public SyntaxNode SyntaxNode { get; private set; } public override bool IsBlock => false; @@ -96,20 +100,29 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void ReplaceWith(SpanBuilder builder) { Kind = builder.Kind; - Tokens = builder.Tokens; - SyntaxNode = builder.SyntaxNode; - - 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 @@ -149,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) && @@ -165,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() @@ -189,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 09396a10be..229f5da627 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanBuilder.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanBuilder.cs @@ -12,7 +12,7 @@ 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) @@ -22,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); } @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Start = location; } - public HtmlNodeSyntax SyntaxNode { get; private set; } + public Syntax.GreenNode SyntaxNode { get; private set; } public ISpanChunkGenerator ChunkGenerator { get; set; } @@ -53,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; @@ -73,9 +73,9 @@ 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; } @@ -85,12 +85,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy 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; } @@ -100,7 +94,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy _tokens?.Clear(); } - public void Accept(IToken token) + public void Accept(SyntaxToken token) { if (token == null) { @@ -116,20 +110,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy _tracker.UpdateLocation(token.Content); } - private HtmlNodeSyntax GetSyntaxNode(SyntaxKind syntaxKind) + private Syntax.GreenNode GetSyntaxNode(SyntaxKind syntaxKind) { if (syntaxKind == SyntaxKind.HtmlText) { var textTokens = new SyntaxListBuilder(SyntaxListBuilder.Create()); foreach (var token in Tokens) { - if (token.SyntaxKind == SyntaxKind.Unknown) + if (token.Kind == SyntaxKind.Unknown) { - Debug.Assert(false, $"Unexpected html token {((HtmlToken)token).Type}"); + Debug.Assert(false, $"Unexpected token {token.Kind}"); continue; } - textTokens.Add(token.SyntaxToken); + textTokens.Add(token); } var textResult = textTokens.ToList(); return SyntaxFactory.HtmlText(new SyntaxList(textResult.Node)); 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 f7b054ecff..5168dbe79c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs @@ -9,20 +9,18 @@ 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); } @@ -32,14 +30,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected Action SpanConfig { get; set; } - protected TToken CurrentToken + protected SyntaxToken CurrentToken { get { return _tokenizer.Current; } } - protected SyntaxToken CurrentSyntaxToken => CurrentToken?.SyntaxToken; - - protected TToken PreviousToken { get; private set; } + protected SyntaxToken PreviousToken { get; private set; } protected SourceLocation CurrentLocation => _tokenizer.Tokenizer.CurrentLocation; @@ -50,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() { @@ -63,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) { @@ -89,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; @@ -120,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) { @@ -129,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) @@ -168,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) { @@ -185,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 @@ -194,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); } @@ -212,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(); @@ -228,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. @@ -258,7 +251,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } if (nesting > 0) { - syms.Add(CurrentToken); + tokens.Add(CurrentToken); } } while (nesting > 0 && NextToken()); @@ -280,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()) @@ -322,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() @@ -338,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(); @@ -351,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); } @@ -372,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; } @@ -442,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); } @@ -455,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; @@ -472,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(); } @@ -483,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)) { @@ -503,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 @@ -591,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/Syntax/GreenNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs index e90374ad2b..e14cbc0594 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs @@ -377,6 +377,70 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax } #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) { diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextTokenSyntax.cs deleted file mode 100644 index 9130b5c5d4..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/HtmlTextTokenSyntax.cs +++ /dev/null @@ -1,27 +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.Syntax -{ - internal class HtmlTextTokenSyntax : SyntaxToken - { - internal HtmlTextTokenSyntax(GreenNode green, SyntaxNode parent, int position) - : base(green, parent, position) - { - } - - internal new InternalSyntax.HtmlTextTokenSyntax Green => (InternalSyntax.HtmlTextTokenSyntax)base.Green; - - public string Value => Text; - - internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.HtmlTextTokenSyntax(Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as HtmlTextTokenSyntax; - } - - internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.HtmlTextTokenSyntax(Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as HtmlTextTokenSyntax; - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextTokenSyntax.cs deleted file mode 100644 index 68d6eecd97..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/HtmlTextTokenSyntax.cs +++ /dev/null @@ -1,53 +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.Syntax.InternalSyntax -{ - internal class HtmlTextTokenSyntax : SyntaxToken - { - internal HtmlTextTokenSyntax(string text, params RazorDiagnostic[] diagnostics) - : base(SyntaxKind.HtmlTextLiteralToken, text, null, null, diagnostics, null) - { - } - - internal HtmlTextTokenSyntax(string text, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(SyntaxKind.HtmlTextLiteralToken, text, leadingTrivia, trailingTrivia) - { - } - - protected HtmlTextTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(kind, name, leadingTrivia, trailingTrivia) - { - } - - protected HtmlTextTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) - : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) - { - } - - internal override SyntaxNode CreateRed(SyntaxNode parent, int position) - { - return new Syntax.HtmlTextTokenSyntax(this, parent, position); - } - - public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) - { - return new HtmlTextTokenSyntax(Kind, Text, trivia, TrailingTrivia); - } - - public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) - { - return new HtmlTextTokenSyntax(Kind, Text, LeadingTrivia, trivia); - } - - internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) - { - return new HtmlTextTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); - } - - internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) - { - return new HtmlTextTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/NewLineTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/NewLineTokenSyntax.cs deleted file mode 100644 index 97d47e9fb9..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/NewLineTokenSyntax.cs +++ /dev/null @@ -1,50 +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.Syntax.InternalSyntax -{ - internal class NewLineTokenSyntax : SyntaxToken - { - internal NewLineTokenSyntax(string text, params RazorDiagnostic[] diagnostics) - : base(SyntaxKind.NewLine, text, null, null, diagnostics, null) - { - } - - internal NewLineTokenSyntax(string text, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(SyntaxKind.NewLine, text, leadingTrivia, trailingTrivia) - { - } - - protected NewLineTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(kind, name, leadingTrivia, trailingTrivia) - { - } - - protected NewLineTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) - : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) - { - } - - internal override SyntaxNode CreateRed(SyntaxNode parent, int position) => new Syntax.NewLineTokenSyntax(this, parent, position); - - public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) - { - return new NewLineTokenSyntax(Kind, Text, trivia, TrailingTrivia); - } - - public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) - { - return new NewLineTokenSyntax(Kind, Text, LeadingTrivia, trivia); - } - - internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) - { - return new NewLineTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); - } - - internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) - { - return new NewLineTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/PunctuationSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/PunctuationSyntax.cs deleted file mode 100644 index 0c2bb06b61..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/PunctuationSyntax.cs +++ /dev/null @@ -1,45 +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.Syntax.InternalSyntax -{ - internal class PunctuationSyntax : SyntaxToken - { - internal PunctuationSyntax(SyntaxKind kind, string name, RazorDiagnostic[] diagnostics) - : this(kind, name, null, null, diagnostics, null) - { - } - - internal PunctuationSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) - : this(kind, name, leadingTrivia, trailingTrivia, null, null) - { - } - - internal PunctuationSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) - : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) - { - } - - internal override SyntaxNode CreateRed(SyntaxNode parent, int position) => new Syntax.PunctuationSyntax(this, parent, position); - - public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) - { - return new PunctuationSyntax(Kind, Text, trivia, TrailingTrivia); - } - - public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) - { - return new PunctuationSyntax(Kind, Text, LeadingTrivia, trivia); - } - - internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) - { - return new PunctuationSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); - } - - internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) - { - return new PunctuationSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs index a6f5ce2e1f..78b7f447d2 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs @@ -1,6 +1,9 @@ // 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 class SyntaxFactory @@ -10,29 +13,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax return new HtmlTextSyntax(textTokens.Node); } - internal static HtmlTextTokenSyntax HtmlTextToken(string text, params RazorDiagnostic[] diagnostics) + internal static SyntaxToken Token(SyntaxKind kind, string content, IEnumerable diagnostics) { - return new HtmlTextTokenSyntax(text, diagnostics); + return Token(kind, content, diagnostics.ToArray()); } - internal static WhitespaceTokenSyntax WhitespaceToken(string text, params RazorDiagnostic[] diagnostics) + internal static SyntaxToken Token(SyntaxKind kind, string content, params RazorDiagnostic[] diagnostics) { - return new WhitespaceTokenSyntax(text, diagnostics); - } - - internal static NewLineTokenSyntax NewLineToken(string text, params RazorDiagnostic[] diagnostics) - { - return new NewLineTokenSyntax(text, diagnostics); - } - - internal static PunctuationSyntax Punctuation(SyntaxKind syntaxKind, string text, params RazorDiagnostic[] diagnostics) - { - return new PunctuationSyntax(syntaxKind, text, diagnostics); - } - - internal static UnknownTokenSyntax UnknownToken(string text, params RazorDiagnostic[] diagnostics) - { - return new UnknownTokenSyntax(text, diagnostics); + return new SyntaxToken(kind, content, diagnostics); } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.cs index d9167704b5..b7471591c8 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.cs @@ -4,32 +4,39 @@ using System; using System.Collections.Generic; using System.IO; +using Microsoft.AspNetCore.Razor.Language.Legacy; namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax { - internal abstract class SyntaxToken : GreenNode + internal class SyntaxToken : GreenNode { - internal SyntaxToken(SyntaxKind tokenKind, string text, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(tokenKind, text.Length) + internal SyntaxToken(SyntaxKind kind, string content, RazorDiagnostic[] diagnostics) + : base(kind, content.Length, diagnostics, annotations: null) { - Text = text; + 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 tokenKind, string text, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) - : base(tokenKind, text.Length, diagnostics, annotations) + internal SyntaxToken(SyntaxKind kind, string content, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, content.Length, diagnostics, annotations) { - Text = text; + Content = content; LeadingTrivia = leadingTrivia; AdjustFlagsAndWidth(leadingTrivia); TrailingTrivia = trailingTrivia; AdjustFlagsAndWidth(trailingTrivia); } - public string Text { get; } + public string Content { get; } public GreenNode LeadingTrivia { get; } @@ -37,7 +44,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax internal override bool IsToken => true; - public override int Width => Text.Length; + 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) { @@ -50,7 +62,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax } } - writer.Write(Text); + writer.Write(Content); if (trailing) { @@ -87,14 +99,30 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax return TokenWithLeadingTrivia(trivia); } - public abstract SyntaxToken TokenWithLeadingTrivia(GreenNode 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 abstract SyntaxToken TokenWithTrailingTrivia(GreenNode 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() { @@ -103,7 +131,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax internal override sealed GreenNode GetSlot(int index) { - throw new InvalidOperationException(); + throw new InvalidOperationException("Tokens don't have slots."); } internal override GreenNode Accept(SyntaxVisitor visitor) @@ -111,9 +139,56 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax return visitor.VisitSyntaxToken(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 Text; + return Content; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs index 6618b20c69..53867dc274 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs @@ -76,5 +76,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax { 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/UnknownTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/UnknownTokenSyntax.cs deleted file mode 100644 index 4c6cd4608b..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/UnknownTokenSyntax.cs +++ /dev/null @@ -1,50 +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.Syntax.InternalSyntax -{ - internal class UnknownTokenSyntax : SyntaxToken - { - internal UnknownTokenSyntax(string text, params RazorDiagnostic[] diagnostics) - : base(SyntaxKind.Unknown, text, null, null, diagnostics, null) - { - } - - internal UnknownTokenSyntax(string text, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(SyntaxKind.Unknown, text, leadingTrivia, trailingTrivia) - { - } - - protected UnknownTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(kind, name, leadingTrivia, trailingTrivia) - { - } - - protected UnknownTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) - : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) - { - } - - internal override SyntaxNode CreateRed(SyntaxNode parent, int position) => new Syntax.UnknownTokenSyntax(this, parent, position); - - public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) - { - return new UnknownTokenSyntax(Kind, Text, trivia, TrailingTrivia); - } - - public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) - { - return new UnknownTokenSyntax(Kind, Text, LeadingTrivia, trivia); - } - - internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) - { - return new UnknownTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); - } - - internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) - { - return new UnknownTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/WhitespaceTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/WhitespaceTokenSyntax.cs deleted file mode 100644 index b576b60e3a..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/WhitespaceTokenSyntax.cs +++ /dev/null @@ -1,50 +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.Syntax.InternalSyntax -{ - internal class WhitespaceTokenSyntax : SyntaxToken - { - internal WhitespaceTokenSyntax(string text, params RazorDiagnostic[] diagnostics) - : base(SyntaxKind.Whitespace, text, null, null, diagnostics, null) - { - } - - internal WhitespaceTokenSyntax(string text, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(SyntaxKind.Whitespace, text, leadingTrivia, trailingTrivia) - { - } - - protected WhitespaceTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia) - : base(kind, name, leadingTrivia, trailingTrivia) - { - } - - protected WhitespaceTokenSyntax(SyntaxKind kind, string name, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) - : base(kind, name, leadingTrivia, trailingTrivia, diagnostics, annotations) - { - } - - internal override SyntaxNode CreateRed(SyntaxNode parent, int position) => new Syntax.WhitespaceTokenSyntax(this, parent, position); - - public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) - { - return new WhitespaceTokenSyntax(Kind, Text, trivia, TrailingTrivia); - } - - public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) - { - return new WhitespaceTokenSyntax(Kind, Text, LeadingTrivia, trivia); - } - - internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) - { - return new WhitespaceTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); - } - - internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) - { - return new WhitespaceTokenSyntax(Kind, Text, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/NewLineTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/NewLineTokenSyntax.cs deleted file mode 100644 index d164f069e9..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/NewLineTokenSyntax.cs +++ /dev/null @@ -1,27 +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.Syntax -{ - internal class NewLineTokenSyntax : SyntaxToken - { - internal NewLineTokenSyntax(GreenNode green, SyntaxNode parent, int position) - : base(green, parent, position) - { - } - - internal new InternalSyntax.NewLineTokenSyntax Green => (InternalSyntax.NewLineTokenSyntax)base.Green; - - public string Value => Text; - - internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.NewLineTokenSyntax(Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as NewLineTokenSyntax; - } - - internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.NewLineTokenSyntax(Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as NewLineTokenSyntax; - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/PunctuationSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/PunctuationSyntax.cs deleted file mode 100644 index 0f25740ecd..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/PunctuationSyntax.cs +++ /dev/null @@ -1,27 +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.Syntax -{ - internal class PunctuationSyntax : SyntaxToken - { - internal PunctuationSyntax(GreenNode green, SyntaxNode parent, int position) - : base(green, parent, position) - { - } - - internal new InternalSyntax.PunctuationSyntax Green => (InternalSyntax.PunctuationSyntax)base.Green; - - public string Punctuation => Text; - - internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.PunctuationSyntax(Kind, Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as PunctuationSyntax; - } - - internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.PunctuationSyntax(Kind, Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as PunctuationSyntax; - } - } -} 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..46bfd219dc --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.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 SyntaxFactory + { + internal 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/Syntax/SyntaxKind.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs index 46dad28dee..1cad1ed9f2 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs @@ -5,28 +5,93 @@ namespace Microsoft.AspNetCore.Razor.Language { internal enum SyntaxKind : byte { + #region Nodes + HtmlText, + HtmlDocument, + HtmlDeclaration, + #endregion + + #region Tokens + // Common Unknown, List, Whitespace, NewLine, + Colon, + QuestionMark, + RightBracket, + LeftBracket, + Equals, + Transition, // HTML - HtmlText, - HtmlDocument, - HtmlDeclaration, - HtmlTextLiteralToken, + HtmlTextLiteral, OpenAngle, Bang, ForwardSlash, - QuestionMark, DoubleHyphen, - LeftBracket, CloseAngle, - RightBracket, - Equals, DoubleQuote, SingleQuote, - Transition, - Colon, + + // CSharp literals + Identifier, + Keyword, + IntegerLiteral, + CSharpComment, + RealLiteral, + CharacterLiteral, + StringLiteral, + + // CSharp operators + Arrow, + Minus, + Decrement, + MinusAssign, + NotEqual, + Not, + Modulo, + ModuloAssign, + AndAssign, + And, + DoubleAnd, + LeftParenthesis, + RightParenthesis, + Star, + MultiplyAssign, + Comma, + Dot, + Slash, + DivideAssign, + DoubleColon, + Semicolon, + NullCoalesce, + XorAssign, + Xor, + LeftBrace, + OrAssign, + DoubleOr, + Or, + RightBrace, + Tilde, + Plus, + PlusAssign, + Increment, + LessThan, + LessThanEqual, + LeftShift, + LeftShiftAssign, + Assign, + GreaterThan, + GreaterThanEqual, + RightShift, + RightShiftAssign, + Hash, + + // Razor specific + RazorComment, + RazorCommentStar, + RazorCommentTransition, + #endregion } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs index d55504d46e..f0634d10d3 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs @@ -239,6 +239,21 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax 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(); diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs index d3ffa0096c..c022f3634b 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs @@ -3,29 +3,70 @@ 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 abstract class SyntaxToken : SyntaxNode + 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 Text => Green.Text; + public string Content => Green.Content; internal override sealed SyntaxNode GetCachedSlot(int index) { - throw new InvalidOperationException(); + throw new InvalidOperationException("Tokens can't have slots."); } internal override sealed SyntaxNode GetNodeSlot(int slot) { - throw new InvalidOperationException(); + throw new InvalidOperationException("Tokens can't have slots."); } internal override SyntaxNode Accept(SyntaxVisitor visitor) @@ -33,24 +74,30 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax return visitor.VisitSyntaxToken(this); } - internal abstract SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia); + public SyntaxToken WithLeadingTrivia(SyntaxNode trivia) + { + return Green != null + ? new SyntaxToken(Green.WithLeadingTrivia(trivia.Green), parent: null, position: 0) + : default(SyntaxToken); + } - internal abstract SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia); - - public SyntaxToken WithLeadingTrivia(SyntaxNode trivia) => WithLeadingTriviaCore(trivia); - - public SyntaxToken WithTrailingTrivia(SyntaxNode trivia) => WithTrailingTriviaCore(trivia); + 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 WithLeadingTriviaCore(Green.CreateList(greenList)?.CreateRed()); + return WithLeadingTrivia(Green.CreateList(greenList)?.CreateRed()); } public SyntaxToken WithTrailingTrivia(IEnumerable trivia) { var greenList = trivia?.Select(t => t.Green); - return WithTrailingTriviaCore(Green.CreateList(greenList)?.CreateRed()); + return WithTrailingTrivia(Green.CreateList(greenList)?.CreateRed()); } public override SyntaxTriviaList GetLeadingTrivia() @@ -85,7 +132,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax public override string ToString() { - return Text; + return Content; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/UnknownTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/UnknownTokenSyntax.cs deleted file mode 100644 index 238b36d1af..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/UnknownTokenSyntax.cs +++ /dev/null @@ -1,27 +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.Syntax -{ - internal class UnknownTokenSyntax : SyntaxToken - { - internal UnknownTokenSyntax(GreenNode green, SyntaxNode parent, int position) - : base(green, parent, position) - { - } - - internal new InternalSyntax.UnknownTokenSyntax Green => (InternalSyntax.UnknownTokenSyntax)base.Green; - - public string Value => Text; - - internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.UnknownTokenSyntax(Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as UnknownTokenSyntax; - } - - internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.UnknownTokenSyntax(Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as UnknownTokenSyntax; - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/WhitespaceTokenSyntax.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/WhitespaceTokenSyntax.cs deleted file mode 100644 index 5a8222f802..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/WhitespaceTokenSyntax.cs +++ /dev/null @@ -1,27 +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.Syntax -{ - internal class WhitespaceTokenSyntax : SyntaxToken - { - internal WhitespaceTokenSyntax(GreenNode green, SyntaxNode parent, int position) - : base(green, parent, position) - { - } - - internal new InternalSyntax.WhitespaceTokenSyntax Green => (InternalSyntax.WhitespaceTokenSyntax)base.Green; - - public string Value => Text; - - internal override SyntaxToken WithLeadingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.WhitespaceTokenSyntax(Text, trivia?.Green, GetTrailingTrivia().Node?.Green).CreateRed(Parent, Position) as WhitespaceTokenSyntax; - } - - internal override SyntaxToken WithTrailingTriviaCore(SyntaxNode trivia) - { - return new InternalSyntax.WhitespaceTokenSyntax(Text, GetLeadingTrivia().Node?.Green, trivia?.Green).CreateRed(Parent, Position) as WhitespaceTokenSyntax; - } - } -} diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorCompletionFactsService.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorCompletionFactsService.cs index 57ac8ddb8d..2f9146eab2 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorCompletionFactsService.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorCompletionFactsService.cs @@ -7,6 +7,7 @@ using System.ComponentModel.Composition; using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.VisualStudio.Editor.Razor { @@ -83,16 +84,11 @@ namespace Microsoft.VisualStudio.Editor.Razor } // Internal for testing - internal static bool IsDirectiveCompletableToken(IToken token) + internal static bool IsDirectiveCompletableToken(SyntaxToken token) { - if (!(token is CSharpToken csharpToken)) - { - return false; - } - - return csharpToken.Type == CSharpTokenType.Identifier || + return token.Kind == SyntaxKind.Identifier || // Marker symbol - csharpToken.Type == CSharpTokenType.Unknown; + token.Kind == SyntaxKind.Unknown; } } } 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/RazorDirectiveCompletionProvider.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs index 607270c978..2b4788dad9 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs @@ -206,17 +206,5 @@ namespace Microsoft.VisualStudio.Editor.Razor return false; } - - private static bool IsDirectiveCompletableSymbol(AspNetCore.Razor.Language.Legacy.IToken symbol) - { - if (!(symbol is CSharpToken csharpSymbol)) - { - return false; - } - - return csharpSymbol.Type == CSharpTokenType.Identifier || - // Marker symbol - csharpSymbol.Type == CSharpTokenType.Unknown; - } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs index d54ef401df..643c8d54fc 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.HtmlTextLiteral, "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.HtmlTextLiteral, "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/CSharpTokenizerCommentTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerCommentTest.cs index 64dafafa16..4abaea783f 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.RazorComment, " 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.RazorComment, " 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.RazorComment, " 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/DirectiveCSharpTokenizerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveCSharpTokenizerTest.cs index 7a1e0c070a..55f2626925 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.RazorComment, "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..0df36e7a81 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.RazorComment, "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..7a08ee0e0f 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.HtmlTextLiteral, "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.HtmlTextLiteral, "-"); // 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.HtmlTextLiteral, "a"); + var sequence = Enumerable.Range((int)'a', 26).Select(item => SyntaxFactory.Token(SyntaxKind.HtmlTextLiteral, ((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.HtmlTextLiteral, "a"); + var sequence = new[] + { + SyntaxFactory.Token(SyntaxKind.OpenAngle, "<"), + SyntaxFactory.Token(SyntaxKind.Bang, "!"), + SyntaxFactory.Token(SyntaxKind.HtmlTextLiteral, "-") + }; // 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.HtmlTextLiteral, "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..472e64e28e 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.HtmlTextLiteral, "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.HtmlTextLiteral); } [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.HtmlTextLiteral); } [Fact] public void SingleHyphen_Mid_Text_Is_Not_Recognized_As_Separate_Token() { - TestSingleToken("foo-bar", HtmlTokenType.Text); + TestSingleToken("foo-bar", SyntaxKind.HtmlTextLiteral); } [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.RazorComment, " 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.RazorComment, " 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.RazorComment, " 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/SpanTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs index 96c856848c..c9c4a6493f 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.HtmlTextLiteral, "hello")); var span = builder.Build(); var newBuilder = new SpanBuilder(SourceLocation.Zero); - newBuilder.Accept(new HtmlToken("hi", HtmlTokenType.Text)); + newBuilder.Accept(SyntaxFactory.Token(SyntaxKind.HtmlTextLiteral, "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.HtmlTextLiteral, "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.HtmlTextLiteral, "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..fda3b93565 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.HtmlTextLiteral, "asdf"), previousTokens.ElementAt(orderIndex++)); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.DoubleHyphen, "--"), previousTokens.ElementAt(orderIndex++)); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.HtmlTextLiteral, "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.HtmlTextLiteral, "fvd"), tokens.Pop()); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.DoubleHyphen, "--"), tokens.Pop()); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.HtmlTextLiteral, "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.HtmlTextLiteral, "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/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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt index 25e7638666..2fa1260312 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Header]; + SyntaxKind.Identifier;[Header]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt index d59300fc29..b72e31e696 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Header]; + SyntaxKind.Identifier;[Header]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [Foo] - [22..25) - FullWidth: 3 - Slots: 1 - SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..c1da7bb08d 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.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt index a32c45341c..5ea684fd05 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (11:0,11) - Tokens:2 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; + 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..0a727dbe47 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt index 28fa9d02af..01014abcd4 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.HtmlTextLiteral;[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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [something] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (31:0,31) - Tokens:1 - CSharpTokenType.Identifier;[something]; + SyntaxKind.Identifier;[something]; Markup span - Gen - [.] - SpanEditHandler;Accepts:Any - (40:0,40) - Tokens:1 - HtmlTokenType.Text;[.]; + SyntaxKind.HtmlTextLiteral;[.]; 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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt index 13ca10275e..065a7b6352 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.HtmlTextLiteral;[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.HtmlTextLiteral;[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;[@]; + SyntaxKind.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.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.HtmlTextLiteral;[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.HtmlTextLiteral;[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.HtmlTextLiteral;[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.HtmlTextLiteral;[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;[@]; + SyntaxKind.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.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;[@]; + SyntaxKind.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.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.HtmlTextLiteral;[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.HtmlTextLiteral;[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.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt index 45b2fc09d2..5cdffb390c 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;[@]; + SyntaxKind.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.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..429002de25 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (132:0,132) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..a80e22267b 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (50:0,50) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..7703a2d780 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..252ca0317a 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..4fc3ef825f 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.RazorComment;[ 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.RazorComment;[ 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..7c172925ca 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.RazorComment;[ 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.RazorComment;[ 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..ad49650008 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.RazorComment;[ 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.RazorComment;[ 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..713331f34e 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.RazorComment;[ 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.RazorComment;[ 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..ec29570e46 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.RazorComment;[ 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.RazorComment;[ 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..2fb8732823 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.RazorComment;[ 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.RazorComment;[ 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..73825a078d 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.RazorComment;[ 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.RazorComment;[ 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..10465beb7d 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.HtmlTextLiteral;[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.HtmlTextLiteral;[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..66603539f8 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.HtmlTextLiteral;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [abc] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - HtmlTokenType.Text;[abc]; + SyntaxKind.HtmlTextLiteral;[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..29e255ef10 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.HtmlTextLiteral;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [abc] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - HtmlTokenType.Text;[abc]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..c20d7906bc 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.HtmlTextLiteral;[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..3974665864 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.HtmlTextLiteral;[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.HtmlTextLiteral;[abc@def.com]; Markup span - Gen - [ abc] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[abc]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..65eb01c19f 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.HtmlTextLiteral;[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.HtmlTextLiteral;[^]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.HtmlTextLiteral;[a-z0-9]; + SyntaxKind.Bang;[!]; + SyntaxKind.HtmlTextLiteral;[#$%&]; + SyntaxKind.SingleQuote;[']; + SyntaxKind.HtmlTextLiteral;[*+\]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Equals;[=]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.HtmlTextLiteral;[^_`{|}~.-]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.HtmlTextLiteral;[+]; 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.HtmlTextLiteral;[a-z0-9]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.HtmlTextLiteral;[(]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.HtmlTextLiteral;[a-z0-9-]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.HtmlTextLiteral;[*]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.HtmlTextLiteral;[a-z0-9]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.HtmlTextLiteral;[)]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.HtmlTextLiteral;[\.(]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.HtmlTextLiteral;[a-z0-9]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.HtmlTextLiteral;[(]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.HtmlTextLiteral;[a-z0-9-]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.HtmlTextLiteral;[*]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.HtmlTextLiteral;[a-z0-9]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.HtmlTextLiteral;[)]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.HtmlTextLiteral;[)*$]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt index c50182aa59..2e6538a248 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.HtmlTextLiteral;[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.HtmlTextLiteral;[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;[@]; + SyntaxKind.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.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.HtmlTextLiteral;[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;[@]; + SyntaxKind.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.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.HtmlTextLiteral;[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;[@]; + SyntaxKind.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.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.HtmlTextLiteral;[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;[@]; + SyntaxKind.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.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..a7c10778ad 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt index cfd73bfa96..a843664279 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.HtmlTextLiteral;[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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (13:0,13) - Tokens:1 - CSharpTokenType.Unknown;[]; + 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (15:0,15) - Tokens:1 - CSharpTokenType.Unknown;[]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt index 0b3a224f4b..91b0beabbc 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,10 @@ Directive block - Gen - 18 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:2 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.StringLiteral;["];RZ1000(17:0,17 [1] ) + SyntaxKind.Identifier;[Foo]; + SyntaxKind.StringLiteral;["];RZ1000(17:0,17 [1] ) 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..977061be03 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,9 @@ 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 - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; + SyntaxKind.Identifier;[Foo]; 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..db3e274bec 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,9 @@ 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 - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.StringLiteral;[""]; + SyntaxKind.StringLiteral;[""]; 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..9d3d11160a 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,9 @@ 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 - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..8651e23015 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,9 @@ 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 - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ['*, Foo'] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.CharacterLiteral;['*, Foo']; + SyntaxKind.CharacterLiteral;['*, Foo']; 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..7f43ee1408 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,9 @@ Directive block - Gen - 18 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo];RZ1000(14:0,14 [1] ) + SyntaxKind.StringLiteral;["Foo];RZ1000(14:0,14 [1] ) 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..5e446716ca 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,13 @@ Directive block - Gen - 32 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; 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..b575e68b24 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,9 @@ Directive block - Gen - 19 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo"]; + SyntaxKind.StringLiteral;["Foo"]; 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..6743a54535 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,12 @@ Directive block - Gen - 26 - (0:0,0) Code span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (4:1,2) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (5:1,3) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (17:1,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["*, Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (18:1,16) - Tokens:1 - CSharpTokenType.StringLiteral;["*, Foo"]; + SyntaxKind.StringLiteral;["*, Foo"]; 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..0c436551de 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,18 @@ Statement block - Gen - 28 - (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.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Directive block - Gen - 22 - (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;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["*, Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["*, Foo"]; + SyntaxKind.StringLiteral;["*, Foo"]; Code span - Gen - [LF] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (27:1,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; 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..e796a38187 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,71 @@ Directive block - Gen - 176 - (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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [string?] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:2 - CSharpTokenType.Keyword;[string]; - CSharpTokenType.QuestionMark;[?]; + SyntaxKind.Keyword;[string]; + SyntaxKind.QuestionMark;[?]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [string?[]] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (16:0,16) - Tokens:4 - CSharpTokenType.Keyword;[string]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.RightBracket;[]]; + SyntaxKind.Keyword;[string]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.RightBracket;[]]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (25:0,25) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[?]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[?]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[]]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[]]; + 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;[]]; 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..e348f65d1c 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,155 @@ Directive block - Gen - 246 - (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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[)]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[?]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[)]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[?]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[)]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + 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 - 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;[)]; + 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;[)]; 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..1288ab0423 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,17 @@ Directive block - Gen - 23 - (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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[)]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..3fc7f067ed 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,21 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (52:0,52) - Tokens:1 - CSharpTokenType.Identifier;[Some_Member]; + SyntaxKind.Identifier;[Some_Member]; None span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (63:0,63) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..3b99d640e7 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..3b99d640e7 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..3b99d640e7 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..3b99d640e7 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsExtraContentAfterDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsExtraContentAfterDirective.stree.txt index b108f825f7..e0ec07d042 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsExtraContentAfterDirective.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsExtraContentAfterDirective.stree.txt @@ -1,11 +1,11 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["hello"]; + SyntaxKind.StringLiteral;["hello"]; None span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..65702b1dfe 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..2980c189a7 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,9 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Hello"]; + SyntaxKind.StringLiteral;["Hello"]; 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..3d1c39c455 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,11 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Hello"]; + SyntaxKind.StringLiteral;["Hello"]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..23bf6be939 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,15 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Hello"]; + SyntaxKind.StringLiteral;["Hello"]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (16:0,16) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (17:0,17) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..1eb4ae5fe3 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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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 - CSharpTokenType.NewLine;[LF]; + 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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (51:1,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt index ed97532104..a2b52e60ef 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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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 - CSharpTokenType.NewLine;[LF]; + 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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (51:1,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt index dabeb41382..fb7061d0b7 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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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 - CSharpTokenType.NewLine;[LF]; + 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]; + SyntaxKind.Identifier;[something]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (54:1,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Else] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (55:1,11) - Tokens:1 - CSharpTokenType.Identifier;[Else]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt index 15bd38868f..bf5881b70d 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,66 +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.RazorComment;[ 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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (52:1,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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 - CSharpTokenType.NewLine;[LF]; + 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]; + SyntaxKind.Identifier;[something]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (101:3,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Else] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (102:3,11) - Tokens:1 - CSharpTokenType.Identifier;[Else]; + SyntaxKind.Identifier;[Else]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:WhiteSpace - (106:3,15) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [This is extra] - [113..126) - FullWidth: 13 - Slots: 1 SyntaxKind.List - [This is extra] - [113..126) - FullWidth: 13 - Slots: 5 - SyntaxKind.HtmlTextLiteralToken;[This]; + SyntaxKind.HtmlTextLiteral;[This]; SyntaxKind.Whitespace;[ ]; - SyntaxKind.HtmlTextLiteralToken;[is]; + SyntaxKind.HtmlTextLiteral;[is]; SyntaxKind.Whitespace;[ ]; - SyntaxKind.HtmlTextLiteralToken;[extra]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; 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..d28485d535 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,15 @@ Directive block - Gen - 19 - (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]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["hello"]; + SyntaxKind.StringLiteral;["hello"]; None span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [;] - SpanEditHandler;Accepts:WhiteSpace - (16:0,16) - Tokens:1 - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Semicolon;[;]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (17:0,17) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..af13378283 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..b106f203a3 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..ca27834a84 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..b106f203a3 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..43d2b27721 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,9 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["string1"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["string1"]; + SyntaxKind.StringLiteral;["string1"]; 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..faf3b4f685 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,27 @@ Directive block - Gen - 32 - (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]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Name"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Name"]; + SyntaxKind.StringLiteral;["Name"]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (14:0,14) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (15:0,15) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.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;[ ]; + 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 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; 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..e63d0ff801 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,9 @@ Directive block - Gen - 19 - (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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.Identifier;[Some_Member]; + SyntaxKind.Identifier;[Some_Member]; 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..83fb1047bc 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,23 @@ Directive block - Gen - 64 - (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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (43:0,43) - Tokens:1 - CSharpTokenType.Identifier;[Some_Member]; + SyntaxKind.Identifier;[Some_Member]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (54:0,54) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["AString"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (55:0,55) - Tokens:1 - CSharpTokenType.StringLiteral;["AString"]; + SyntaxKind.StringLiteral;["AString"]; 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 fad1a9c949..61aa78cef2 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,38 +1,38 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Header"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Header"]; + SyntaxKind.StringLiteral;["Header"]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (17:0,17) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 14 - (18:0,18) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [F{o}o] - [22..27) - FullWidth: 5 - Slots: 1 SyntaxKind.List - [F{o}o] - [22..27) - FullWidth: 5 - Slots: 5 - SyntaxKind.HtmlTextLiteralToken;[F]; - SyntaxKind.HtmlTextLiteralToken;[{]; - SyntaxKind.HtmlTextLiteralToken;[o]; - SyntaxKind.HtmlTextLiteralToken;[}]; - SyntaxKind.HtmlTextLiteralToken;[o]; + SyntaxKind.HtmlTextLiteral;[F]; + SyntaxKind.HtmlTextLiteral;[{]; + SyntaxKind.HtmlTextLiteral;[o]; + SyntaxKind.HtmlTextLiteral;[}]; + SyntaxKind.HtmlTextLiteral;[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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; 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..d94bfcdf22 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,9 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["AString"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["AString"]; + SyntaxKind.StringLiteral;["AString"]; 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..7c8000d42a 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,15 @@ Directive block - Gen - 42 - (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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt index 32fae95183..d11826133f 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,5 @@ Directive block - Gen - 6 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [class] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Keyword;[class]; + SyntaxKind.Keyword;[class]; 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..a947b9a3ba 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,5 @@ Directive block - Gen - 10 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [namespace] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Keyword;[namespace]; + SyntaxKind.Keyword;[namespace]; 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..01ec82ec2f 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,13 @@ 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 - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[functions]; + SyntaxKind.Identifier;[functions]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [ ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; 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..31df6e1a99 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,18 @@ Directive block - Gen - 46 - (0:0,0) Code span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (4:1,2) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (5:1,3) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (11:1,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt index ceac2d5c09..c56f5bd7c2 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,26 @@ Statement block - Gen - 48 - (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.WhiteSpace;[ ]; + 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]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + 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 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (47:1,0) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (47:1,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; 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..0c45193f60 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]; + SyntaxKind.Identifier;[inherits]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt index 598a5043f8..e82761c275 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]; + SyntaxKind.Identifier;[inherits]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt index a65a1bba4c..8df8ddbc06 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]; + SyntaxKind.Identifier;[inherits]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [string] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.Keyword;[string]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt index 5b7ca1b209..ad6b300588 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,7 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; 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..1c4a2b4b21 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,9 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["{formaction}?/{id}?"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["{formaction}?/{id}?"]; + SyntaxKind.StringLiteral;["{formaction}?/{id}?"]; 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..7a68703a63 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,15 @@ Directive block - Gen - 43 - (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]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["{formaction}?/{id}?"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["{formaction}?/{id}?"]; + SyntaxKind.StringLiteral;["{formaction}?/{id}?"]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (29:0,29) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [System.String] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (30:0,30) - Tokens:3 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[String]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[String]; 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..685bc237dc 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,9 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["simple-value"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["simple-value"]; + SyntaxKind.StringLiteral;["simple-value"]; 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..7c888f9b50 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,9 @@ 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 - [TestDirective] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[TestDirective]; + SyntaxKind.Identifier;[TestDirective]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (14:0,14) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [PropertyName] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.Identifier;[PropertyName]; + SyntaxKind.Identifier;[PropertyName]; 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..b30717580f 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,9 @@ 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 - [TestDirective] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[TestDirective]; + SyntaxKind.Identifier;[TestDirective]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (14:0,14) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..b37799f88c 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,23 @@ 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 - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[functions]; + SyntaxKind.Identifier;[functions]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.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;[ ]; + 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 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; 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 77d3e85124..a2e285f4e8 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,38 +1,38 @@ Directive block - Gen - 32 - (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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Header]; + SyntaxKind.Identifier;[Header]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (16:0,16) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 14 - (17:0,17) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [F{o}o] - [21..26) - FullWidth: 5 - Slots: 1 SyntaxKind.List - [F{o}o] - [21..26) - FullWidth: 5 - Slots: 5 - SyntaxKind.HtmlTextLiteralToken;[F]; - SyntaxKind.HtmlTextLiteralToken;[{]; - SyntaxKind.HtmlTextLiteralToken;[o]; - SyntaxKind.HtmlTextLiteralToken;[}]; - SyntaxKind.HtmlTextLiteralToken;[o]; + SyntaxKind.HtmlTextLiteral;[F]; + SyntaxKind.HtmlTextLiteral;[{]; + SyntaxKind.HtmlTextLiteral;[o]; + SyntaxKind.HtmlTextLiteral;[}]; + SyntaxKind.HtmlTextLiteral;[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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; 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..a07dd55b60 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,13 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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]; + SyntaxKind.Identifier;[BaseNamespace]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Bar]; 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..7599942a0e 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,9 @@ 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 - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; + SyntaxKind.Identifier;[custom]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [BaseNamespace] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.Identifier;[BaseNamespace]; + SyntaxKind.Identifier;[BaseNamespace]; 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..fa786c89b2 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,10 @@ 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 - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; + SyntaxKind.Identifier;[removeTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:2 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.StringLiteral;["];RZ1000(20:0,20 [1] ) + SyntaxKind.Identifier;[Foo]; + SyntaxKind.StringLiteral;["];RZ1000(20:0,20 [1] ) 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..52f4bbd066 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,9 @@ 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 - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; + SyntaxKind.Identifier;[removeTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; + SyntaxKind.Identifier;[Foo]; 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..9de0dc9204 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,9 @@ Directive block - Gen - 19 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; + SyntaxKind.Identifier;[removeTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;[""]; + SyntaxKind.StringLiteral;[""]; 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..f1360457eb 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,9 @@ 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 - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; + SyntaxKind.Identifier;[removeTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..621303f00f 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,9 @@ Directive block - Gen - 25 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; + SyntaxKind.Identifier;[removeTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ['*, Foo'] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.CharacterLiteral;['*, Foo']; + SyntaxKind.CharacterLiteral;['*, Foo']; 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..71e71a706d 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,9 @@ 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 - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; + SyntaxKind.Identifier;[removeTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) + SyntaxKind.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) 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..0caf7acefa 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,13 @@ Directive block - Gen - 35 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; + SyntaxKind.Identifier;[removeTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; 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..990c68d908 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,9 @@ 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 - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; + SyntaxKind.Identifier;[removeTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo"]; + SyntaxKind.StringLiteral;["Foo"]; 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..a867381f99 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,11 @@ 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 - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; + SyntaxKind.Identifier;[tagHelperPrefix]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.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] ) + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["];RZ1000(23:0,23 [1] ) 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..98001f302e 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,9 @@ Directive block - Gen - 19 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; + SyntaxKind.Identifier;[tagHelperPrefix]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;[""]; + SyntaxKind.StringLiteral;[""]; 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..72ad65f693 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,9 @@ 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 - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; + SyntaxKind.Identifier;[tagHelperPrefix]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..f0fcdb64d6 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,9 @@ 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 - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; + SyntaxKind.Identifier;[tagHelperPrefix]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) + SyntaxKind.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) 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..cf01151baf 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,9 @@ 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 - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; + SyntaxKind.Identifier;[tagHelperPrefix]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; + SyntaxKind.Identifier;[Foo]; 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..c1e856bde9 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,9 @@ 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 - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; + SyntaxKind.Identifier;[tagHelperPrefix]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo"]; + SyntaxKind.StringLiteral;["Foo"]; 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt index 5f1e30a96d..4871aac162 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.HtmlTextLiteral;[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.HtmlTextLiteral;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[is]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 4 - (53:2,14) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (53:2,14) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (54:2,15) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + 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.HtmlTextLiteral;[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..0cf4859a3d 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.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt index 8f8de632d0..7eb747e6cd 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt index 8f8de632d0..7eb747e6cd 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..ec0a48c2ac 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (8:1,5) - Tokens:1 - CSharpTokenType.Unknown;[]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt index 8f8de632d0..7eb747e6cd 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..806ac87b47 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (8:1,5) - Tokens:1 - CSharpTokenType.Unknown;[]; + 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..4ebf09e732 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Bar] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Text;[Bar]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt index 08147658a8..e16058b434 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]; + SyntaxKind.Identifier;[functions]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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..03c1ddc544 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Bar] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:1 - HtmlTokenType.Text;[Bar]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Baz] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 - HtmlTokenType.Text;[Baz]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Boz] - SpanEditHandler;Accepts:Any - (51:0,51) - Tokens:1 - HtmlTokenType.Text;[Boz]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..f1685dc452 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (15:1,10) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt index 1454016ba1..e9fc23c08a 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [helper] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[helper]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt index 7d0e4caeab..d441e4c205 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [हळूँजद॔] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[हळूँजद॔]; + SyntaxKind.Identifier;[हळूँजद॔]; 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..725e28d010 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; 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..b8261129c1 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;[@]; + SyntaxKind.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.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; 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..b8261129c1 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;[@]; + SyntaxKind.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.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; 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..b8261129c1 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;[@]; + SyntaxKind.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.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; 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..b8261129c1 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;[@]; + SyntaxKind.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.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; 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..060942ec7d 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt index 8967206fd1..725e28d010 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; 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..5da270085a 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (13:0,13) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt index e32608be70..e92c3fce23 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;[@]; + SyntaxKind.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.Identifier;[module]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; 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..7eb747e6cd 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..7eb747e6cd 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; 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..060942ec7d 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt index d0922098d3..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Identifier;[val]; 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..b75c89c993 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt index fcfaadd462..bbad538e45 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt index 3c1fe5005f..dcf3351109 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt index 24b8db6eaf..0ab6dbedb2 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt index d8b3eb81dd..862674dabb 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt index 6cef2a04b9..24550faa6d 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt index d0922098d3..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt index d0922098d3..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt index b57c6e2517..bdadd39b5e 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt index d0922098d3..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Identifier;[val]; 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..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Identifier;[val]; 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..f67c21be69 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;[@]; + SyntaxKind.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.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; 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..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Identifier;[val]; 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..1bdaa5ec4a 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt index 8f54d19b74..c3f560c41f 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt index bfb8b54625..b205008652 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt index d0922098d3..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Identifier;[val]; 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..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Identifier;[val]; 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..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Identifier;[val]; 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..82907ca1e1 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; 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..9e2bfc0869 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Identifier;[val]; 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..82907ca1e1 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; 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..82907ca1e1 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; 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..f67c21be69 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;[@]; + SyntaxKind.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.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; 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..725e28d010 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; 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..8631741216 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt index 860b824f83..ad8aad0d56 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;[@]; + 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 - 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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt index 00f9a55723..e6d5d2ef7c 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;[@]; + 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 - 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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt index a319543617..b8261129c1 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;[@]; + SyntaxKind.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.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; 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..198a6f8da7 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt index 505ddd1f05..198a6f8da7 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt index 505ddd1f05..198a6f8da7 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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt index 8967206fd1..725e28d010 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; 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..da76ba6424 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;[@]; + SyntaxKind.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.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; 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..725e28d010 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt index 2f0e49b1ad..90eb32855a 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (16:0,16) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + 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..c5121d3905 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - HtmlTokenType.Text;[Hello]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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..8916eb268a 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.HtmlTextLiteral;[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.HtmlTextLiteral;[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..20ca27d14b 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.HtmlTextLiteral;[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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; 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 index 4ac1dd74e2..313e55405c 100644 --- 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 @@ -1,25 +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 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[text]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[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 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ razor comment ] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - HtmlTokenType.RazorComment;[ razor comment ]; + SyntaxKind.RazorComment;[ razor comment ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 - HtmlTokenType.CloseAngle;[>]; + 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..9c04d664e6 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.HtmlTextLiteral;[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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; 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 index 2b80249ac8..21593eddb8 100644 --- 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 @@ -1,25 +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 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (7:0,7) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ razor comment ] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - HtmlTokenType.RazorComment;[ razor comment ]; + SyntaxKind.RazorComment;[ razor comment ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (24:0,24) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 7 - (26:0,26) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[text]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.HtmlTextLiteral;[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..96f45bcfe1 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.HtmlTextLiteral;[}]; 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 45a7650f51..ec7b5e245e 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.HtmlTextLiteral;[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.RazorComment;[ 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.RazorComment;[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]; + SyntaxKind.NewLine;[LF]; SyntaxKind.HtmlText - [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.HtmlTextLiteral;[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 c9889ac49d..ac2c6e2c12 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.HtmlTextLiteral;[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.RazorComment;[ 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.HtmlTextLiteral;[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.RazorComment;[ 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;[@]; + SyntaxKind.RazorCommentTransition;[@]; SyntaxKind.HtmlText - [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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt index 3c97840031..f66318d5de 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]; + SyntaxKind.Identifier;[NameSpace]; 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 fbbb614257..97a70123ac 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.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.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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [Foo] - [36..39) - FullWidth: 3 - Slots: 1 - SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt index f0c43e199a..c9635e460b 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.HtmlTextLiteral;[I]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[really]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[want]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[to]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[render]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[a]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[close]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[brace,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[so]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[here]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[I]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt index 60d6671298..a7f5e46da6 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt index 689b12e4aa..773bd27d47 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.Unknown;[]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt index 0fde9614d9..0e1ed2ea4a 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (17:0,17) - Tokens:1 - CSharpTokenType.Unknown;[]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt index 3a2c1106da..e871be5838 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; + SyntaxKind.Identifier;[Foo]; Markup span - Gen - [ LF ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:3 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt index e764c527f3..d25db521ac 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; + SyntaxKind.Identifier;[s]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt index 6bc6ea89b2..d8a9fdf84e 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt index 9935f5f1ed..9d69e9b31d 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [Foo] - [17..20) - FullWidth: 3 - Slots: 1 - SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt index 19018c5dbe..a3c1d179c7 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt index 134177d6a6..2024350f59 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt index 0a934073ea..3a36530dcd 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt index d828a581f0..13889d0ff4 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.HtmlTextLiteral;[abc]; 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..e24347ad5e 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.HtmlTextLiteral;[abc]; 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 98086ac2d7..57e3288513 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,35 +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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [Foo{}] - [18..23) - FullWidth: 5 - Slots: 1 SyntaxKind.List - [Foo{}] - [18..23) - FullWidth: 5 - Slots: 3 - SyntaxKind.HtmlTextLiteralToken;[Foo]; - SyntaxKind.HtmlTextLiteralToken;[{]; - SyntaxKind.HtmlTextLiteralToken;[}]; + SyntaxKind.HtmlTextLiteral;[Foo]; + SyntaxKind.HtmlTextLiteral;[{]; + SyntaxKind.HtmlTextLiteral;[}]; 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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; 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..bd47c3b67f 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Test] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Test]; + SyntaxKind.Identifier;[Test]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:AllWhiteSpace - (13:0,13) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + 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.HtmlTextLiteral;[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.HtmlTextLiteral;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt index 59d3f3e25a..bebf1f49a4 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [Section] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K15 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[Section]; + SyntaxKind.Identifier;[Section]; Markup span - Gen - [ foo] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[foo]; 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 d7963d4182..d8b00a24ca 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (23:0,23) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [bar] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (24:0,24) - Tokens:1 - CSharpTokenType.Identifier;[bar]; + SyntaxKind.Identifier;[bar]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (27:0,27) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [Foo] - [33..36) - FullWidth: 3 - Slots: 1 - SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt index 4bdbe3877f..1396ff051b 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; + SyntaxKind.Identifier;[s]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt index 86e6444d85..6098f81494 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; + SyntaxKind.Identifier;[s]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt index 7832e92bdc..b9cbf826bb 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [Foo] - [18..21) - FullWidth: 3 - Slots: 1 - SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt index 92cd8e4296..9f190fe767 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; + SyntaxKind.Identifier;[s]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.HtmlTextLiteral;[xml]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt index f0c5008e10..17a9d246ef 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; Markup span - Gen - [ LF] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NewLine;[LF]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt index 67fadc74d1..44d97d6953 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Markup span - Gen - [9 { ] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:4 - HtmlTokenType.Text;[9]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[{]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.HtmlTextLiteral;[9]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[{]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [Foo] - [16..19) - FullWidth: 3 - Slots: 1 - SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ }] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[}]; 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 ba78c51800..30f5958806 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + 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.HtmlTextLiteral;[-bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[{]; + 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;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; SyntaxKind.HtmlText - [Foo] - [22..25) - FullWidth: 3 - Slots: 1 - SyntaxKind.HtmlTextLiteralToken;[Foo]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ }] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[}]; 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..5bb963ab5b 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; + SyntaxKind.Identifier;[Foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt index 5b549fd8de..4aca5715f8 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; + SyntaxKind.Identifier;[Foo]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt index 5be347d4cf..adc2ab82e9 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; + SyntaxKind.Identifier;[s]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt index 062a860adb..dc4dc041bb 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]; + SyntaxKind.Identifier;[section]; Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; + SyntaxKind.Identifier;[s]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + 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.HtmlTextLiteral;[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;[@]; + SyntaxKind.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.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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt index 8f8de632d0..7eb747e6cd 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + 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..239f899366 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.HtmlTextLiteral;[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.HtmlTextLiteral;[A]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[real]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.HtmlTextLiteral;[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.HtmlTextLiteral;[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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt index 7b1d379e7d..d1b98e7428 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;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [is] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Keyword;[is]; + 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.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt index bdcccbd8c2..ab9d143f35 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