diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt index 24d84bf975..eb3470593e 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt @@ -53,7 +53,8 @@ Document - IntermediateToken - (153:7,30 [3] Basic.cshtml) - CSharp - cls IntermediateToken - (156:7,33 [2] Basic.cshtml) - CSharp - } HtmlContent - (159:7,36 [5] Basic.cshtml) - IntermediateToken - (159:7,36 [3] Basic.cshtml) - Html - /> + IntermediateToken - (159:7,36 [1] Basic.cshtml) - Html - + IntermediateToken - (160:7,37 [2] Basic.cshtml) - Html - /> IntermediateToken - (162:7,39 [2] Basic.cshtml) - Html - \n Inject - Inject - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt index 515e48bee6..35c27f4abb 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt @@ -41,14 +41,16 @@ Document - IntermediateToken - (68:4,2 [46] Sections.cshtml) - CSharp - \n Layout = "_SectionTestLayout.cshtml";\n HtmlContent - (117:7,0 [26] Sections.cshtml) IntermediateToken - (117:7,0 [2] Sections.cshtml) - Html - \n - IntermediateToken - (119:8,0 [5] Sections.cshtml) - Html -
+ IntermediateToken - (119:8,0 [4] Sections.cshtml) - Html -
IntermediateToken - (124:8,5 [9] Sections.cshtml) - Html - Some body IntermediateToken - (133:8,14 [6] Sections.cshtml) - Html -
IntermediateToken - (139:8,20 [4] Sections.cshtml) - Html - \n\n Section - - Section1 HtmlContent - (162:10,19 [43] Sections.cshtml) IntermediateToken - (162:10,19 [6] Sections.cshtml) - Html - \n - IntermediateToken - (168:11,4 [5] Sections.cshtml) - Html -
+ IntermediateToken - (168:11,4 [4] Sections.cshtml) - Html -
IntermediateToken - (173:11,9 [20] Sections.cshtml) - Html - This is in Section 1 IntermediateToken - (193:11,29 [6] Sections.cshtml) - Html -
IntermediateToken - (199:11,35 [6] Sections.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt index 4074239b9f..959329c714 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt @@ -55,7 +55,8 @@ Document - IntermediateToken - (153:7,30 [3] Basic.cshtml) - CSharp - cls IntermediateToken - (156:7,33 [2] Basic.cshtml) - CSharp - } HtmlContent - (159:7,36 [5] Basic.cshtml) - IntermediateToken - (159:7,36 [3] Basic.cshtml) - Html - /> + IntermediateToken - (159:7,36 [1] Basic.cshtml) - Html - + IntermediateToken - (160:7,37 [2] Basic.cshtml) - Html - /> IntermediateToken - (162:7,39 [2] Basic.cshtml) - Html - \n Inject - Inject - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt index 9173f6251b..1341da69cb 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt @@ -65,7 +65,8 @@ Document - CSharpCode - IntermediateToken - - CSharp - BeginContext(159, 5, true); HtmlContent - (159:7,36 [5] Basic.cshtml) - IntermediateToken - (159:7,36 [3] Basic.cshtml) - Html - /> + IntermediateToken - (159:7,36 [1] Basic.cshtml) - Html - + IntermediateToken - (160:7,37 [2] Basic.cshtml) - Html - /> IntermediateToken - (162:7,39 [2] Basic.cshtml) - Html - \n CSharpCode - IntermediateToken - - CSharp - EndContext(); diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt index c3fbc6082e..8db9133a4a 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt @@ -33,11 +33,13 @@ Document - MalformedDirective - (0:0,0 [6] MalformedPageDirective.cshtml) - page HtmlContent - (6:0,6 [49] MalformedPageDirective.cshtml) IntermediateToken - (6:0,6 [8] MalformedPageDirective.cshtml) - Html - "foo\n\n - IntermediateToken - (14:2,0 [4] MalformedPageDirective.cshtml) - Html -

+ IntermediateToken - (14:2,0 [3] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (18:2,4 [8] MalformedPageDirective.cshtml) - Html - About Us IntermediateToken - (26:2,12 [5] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (31:2,17 [2] MalformedPageDirective.cshtml) - Html - \n - IntermediateToken - (33:3,0 [3] MalformedPageDirective.cshtml) - Html -

+ IntermediateToken - (33:3,0 [2] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (36:3,3 [15] MalformedPageDirective.cshtml) - Html - We are awesome. IntermediateToken - (51:3,18 [4] MalformedPageDirective.cshtml) - Html -

Inject - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt index 0692442d42..d98f501792 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt @@ -18,11 +18,13 @@ Document - IntermediateToken - - CSharp - BeginContext(6, 49, true); HtmlContent - (6:0,6 [49] MalformedPageDirective.cshtml) IntermediateToken - (6:0,6 [8] MalformedPageDirective.cshtml) - Html - "foo\n\n - IntermediateToken - (14:2,0 [4] MalformedPageDirective.cshtml) - Html -

+ IntermediateToken - (14:2,0 [3] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (18:2,4 [8] MalformedPageDirective.cshtml) - Html - About Us IntermediateToken - (26:2,12 [5] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (31:2,17 [2] MalformedPageDirective.cshtml) - Html - \n - IntermediateToken - (33:3,0 [3] MalformedPageDirective.cshtml) - Html -

+ IntermediateToken - (33:3,0 [2] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (36:3,3 [15] MalformedPageDirective.cshtml) - Html - We are awesome. IntermediateToken - (51:3,18 [4] MalformedPageDirective.cshtml) - Html -

CSharpCode - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt index 9238a0a419..099c37355f 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt @@ -32,7 +32,8 @@ Document - IntermediateToken - - CSharp - #pragma warning restore 0414 MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (34:2,0 [20] PageWithNamespace.cshtml) - IntermediateToken - (34:2,0 [4] PageWithNamespace.cshtml) - Html -

+ IntermediateToken - (34:2,0 [3] PageWithNamespace.cshtml) - Html -

IntermediateToken - (38:2,4 [9] PageWithNamespace.cshtml) - Html - Hi There! IntermediateToken - (47:2,13 [5] PageWithNamespace.cshtml) - Html -

IntermediateToken - (52:2,18 [2] PageWithNamespace.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt index 53b89427ee..4d26b5c3fb 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt @@ -16,7 +16,8 @@ Document - CSharpCode - IntermediateToken - - CSharp - BeginContext(34, 20, true); HtmlContent - (34:2,0 [20] PageWithNamespace.cshtml) - IntermediateToken - (34:2,0 [4] PageWithNamespace.cshtml) - Html -

+ IntermediateToken - (34:2,0 [3] PageWithNamespace.cshtml) - Html -

IntermediateToken - (38:2,4 [9] PageWithNamespace.cshtml) - Html - Hi There! IntermediateToken - (47:2,13 [5] PageWithNamespace.cshtml) - Html -

IntermediateToken - (52:2,18 [2] PageWithNamespace.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt index c21d9fc82c..6139c62c14 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt @@ -31,7 +31,8 @@ Document - IntermediateToken - - CSharp - #pragma warning restore 0414 MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [28] RazorPageWithNoLeadingPageDirective.cshtml) - IntermediateToken - (0:0,0 [5] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
+ IntermediateToken - (0:0,0 [4] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
IntermediateToken - (5:0,5 [15] RazorPageWithNoLeadingPageDirective.cshtml) - Html - Some text here. IntermediateToken - (20:0,20 [6] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
IntermediateToken - (26:0,26 [2] RazorPageWithNoLeadingPageDirective.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt index 764b704909..c4ad8ed82d 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt @@ -16,7 +16,8 @@ Document - CSharpCode - IntermediateToken - - CSharp - BeginContext(0, 28, true); HtmlContent - (0:0,0 [28] RazorPageWithNoLeadingPageDirective.cshtml) - IntermediateToken - (0:0,0 [5] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
+ IntermediateToken - (0:0,0 [4] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
IntermediateToken - (5:0,5 [15] RazorPageWithNoLeadingPageDirective.cshtml) - Html - Some text here. IntermediateToken - (20:0,20 [6] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
IntermediateToken - (26:0,26 [2] RazorPageWithNoLeadingPageDirective.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt index c71b835bf9..721dfa649d 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt @@ -40,7 +40,8 @@ Document - IntermediateToken - (77:3,42 [4] RazorPagesWithRouteTemplate.cshtml) - Html - \n\n HtmlContent - (191:10,1 [21] RazorPagesWithRouteTemplate.cshtml) IntermediateToken - (191:10,1 [4] RazorPagesWithRouteTemplate.cshtml) - Html - \n\n - IntermediateToken - (195:12,0 [4] RazorPagesWithRouteTemplate.cshtml) - Html -

+ IntermediateToken - (195:12,0 [3] RazorPagesWithRouteTemplate.cshtml) - Html -

IntermediateToken - (199:12,4 [13] RazorPagesWithRouteTemplate.cshtml) - Html - New Customer CSharpExpression - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml) IntermediateToken - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml) - CSharp - Model.Name diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt index 5d54680b90..86990e5de4 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt @@ -31,7 +31,8 @@ Document - IntermediateToken - - CSharp - BeginContext(193, 19, true); HtmlContent - (193:11,0 [19] RazorPagesWithRouteTemplate.cshtml) IntermediateToken - (193:11,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n - IntermediateToken - (195:12,0 [4] RazorPagesWithRouteTemplate.cshtml) - Html -

+ IntermediateToken - (195:12,0 [3] RazorPagesWithRouteTemplate.cshtml) - Html -

IntermediateToken - (199:12,4 [13] RazorPagesWithRouteTemplate.cshtml) - Html - New Customer CSharpCode - IntermediateToken - - CSharp - EndContext(); diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt index 913b80d2aa..de7cd9dd4f 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt @@ -42,7 +42,8 @@ Document - IntermediateToken - (79:3,42 [4] RazorPagesWithoutModel.cshtml) - Html - \n\n HtmlContent - (379:18,1 [77] RazorPagesWithoutModel.cshtml) IntermediateToken - (379:18,1 [4] RazorPagesWithoutModel.cshtml) - Html - \n\n - IntermediateToken - (383:20,0 [4] RazorPagesWithoutModel.cshtml) - Html -

+ IntermediateToken - (383:20,0 [3] RazorPagesWithoutModel.cshtml) - Html -

IntermediateToken - (387:20,4 [12] RazorPagesWithoutModel.cshtml) - Html - New Customer IntermediateToken - (399:20,16 [5] RazorPagesWithoutModel.cshtml) - Html -

IntermediateToken - (404:20,21 [2] RazorPagesWithoutModel.cshtml) - Html - \n @@ -78,7 +79,8 @@ Document - IntermediateToken - (611:25,31 [14] RazorPagesWithoutModel.cshtml) - Html - \n IntermediateToken - (625:26,12 [6] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (652:26,39 [1] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (653:26,40 [2] RazorPagesWithoutModel.cshtml) - Html - /> IntermediateToken - (655:26,42 [14] RazorPagesWithoutModel.cshtml) - Html - \n IntermediateToken - (669:27,12 [5] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (383:20,0 [3] RazorPagesWithoutModel.cshtml) - Html -

IntermediateToken - (387:20,4 [12] RazorPagesWithoutModel.cshtml) - Html - New Customer IntermediateToken - (399:20,16 [5] RazorPagesWithoutModel.cshtml) - Html -

IntermediateToken - (404:20,21 [2] RazorPagesWithoutModel.cshtml) - Html - \n @@ -98,7 +99,8 @@ Document - IntermediateToken - (611:25,31 [14] RazorPagesWithoutModel.cshtml) - Html - \n IntermediateToken - (625:26,12 [6] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (652:26,39 [1] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (653:26,40 [2] RazorPagesWithoutModel.cshtml) - Html - /> IntermediateToken - (655:26,42 [14] RazorPagesWithoutModel.cshtml) - Html - \n IntermediateToken - (669:27,12 [5] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (477:24,0 [3] RazorPages.cshtml) - Html -

IntermediateToken - (481:24,4 [12] RazorPages.cshtml) - Html - New Customer IntermediateToken - (493:24,16 [5] RazorPages.cshtml) - Html -

IntermediateToken - (498:24,21 [2] RazorPages.cshtml) - Html - \n IntermediateToken - (500:25,0 [5] RazorPages.cshtml) - Html -
+ IntermediateToken - (543:25,43 [1] RazorPages.cshtml) - Html - + IntermediateToken - (544:25,44 [1] RazorPages.cshtml) - Html - > IntermediateToken - (545:25,45 [6] RazorPages.cshtml) - Html - \n TagHelper - (551:26,4 [31] RazorPages.cshtml) - div - TagMode.StartTagAndEndTag DefaultTagHelperBody - @@ -79,7 +81,8 @@ Document - IntermediateToken - (712:29,31 [14] RazorPages.cshtml) - Html - \n IntermediateToken - (726:30,12 [6] RazorPages.cshtml) - Html - + IntermediateToken - (753:30,39 [1] RazorPages.cshtml) - Html - + IntermediateToken - (754:30,40 [2] RazorPages.cshtml) - Html - /> IntermediateToken - (756:30,42 [14] RazorPages.cshtml) - Html - \n IntermediateToken - (770:31,12 [5] RazorPages.cshtml) - Html - + IntermediateToken - (477:24,0 [3] RazorPages.cshtml) - Html -

IntermediateToken - (481:24,4 [12] RazorPages.cshtml) - Html - New Customer IntermediateToken - (493:24,16 [5] RazorPages.cshtml) - Html -

IntermediateToken - (498:24,21 [2] RazorPages.cshtml) - Html - \n IntermediateToken - (500:25,0 [5] RazorPages.cshtml) - Html - + IntermediateToken - (543:25,43 [1] RazorPages.cshtml) - Html - + IntermediateToken - (544:25,44 [1] RazorPages.cshtml) - Html - > IntermediateToken - (545:25,45 [6] RazorPages.cshtml) - Html - \n CSharpCode - IntermediateToken - - CSharp - EndContext(); @@ -98,7 +100,8 @@ Document - IntermediateToken - (712:29,31 [14] RazorPages.cshtml) - Html - \n IntermediateToken - (726:30,12 [6] RazorPages.cshtml) - Html - + IntermediateToken - (753:30,39 [1] RazorPages.cshtml) - Html - + IntermediateToken - (754:30,40 [2] RazorPages.cshtml) - Html - /> IntermediateToken - (756:30,42 [14] RazorPages.cshtml) - Html - \n IntermediateToken - (770:31,12 [5] RazorPages.cshtml) - Html - + IntermediateToken - (119:8,0 [4] Sections.cshtml) - Html -
IntermediateToken - (124:8,5 [9] Sections.cshtml) - Html - Some body IntermediateToken - (133:8,14 [6] Sections.cshtml) - Html -
IntermediateToken - (139:8,20 [4] Sections.cshtml) - Html - \n\n Section - - Section1 HtmlContent - (162:10,19 [43] Sections.cshtml) IntermediateToken - (162:10,19 [6] Sections.cshtml) - Html - \n - IntermediateToken - (168:11,4 [5] Sections.cshtml) - Html -
+ IntermediateToken - (168:11,4 [4] Sections.cshtml) - Html -
IntermediateToken - (173:11,9 [20] Sections.cshtml) - Html - This is in Section 1 IntermediateToken - (193:11,29 [6] Sections.cshtml) - Html -
IntermediateToken - (199:11,35 [6] Sections.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt index 8a5b810749..eca96a425a 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt @@ -33,7 +33,8 @@ Document - IntermediateToken - - CSharp - BeginContext(117, 26, true); HtmlContent - (117:7,0 [26] Sections.cshtml) IntermediateToken - (117:7,0 [2] Sections.cshtml) - Html - \n - IntermediateToken - (119:8,0 [5] Sections.cshtml) - Html -
+ IntermediateToken - (119:8,0 [4] Sections.cshtml) - Html -
IntermediateToken - (124:8,5 [9] Sections.cshtml) - Html - Some body IntermediateToken - (133:8,14 [6] Sections.cshtml) - Html -
IntermediateToken - (139:8,20 [4] Sections.cshtml) - Html - \n\n @@ -44,7 +45,8 @@ Document - IntermediateToken - - CSharp - BeginContext(162, 43, true); HtmlContent - (162:10,19 [43] Sections.cshtml) IntermediateToken - (162:10,19 [6] Sections.cshtml) - Html - \n - IntermediateToken - (168:11,4 [5] Sections.cshtml) - Html -
+ IntermediateToken - (168:11,4 [4] Sections.cshtml) - Html -
IntermediateToken - (173:11,9 [20] Sections.cshtml) - Html - This is in Section 1 IntermediateToken - (193:11,29 [6] Sections.cshtml) - Html -
IntermediateToken - (199:11,35 [6] Sections.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt index 42d53bcd1b..0af8488598 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt @@ -32,7 +32,8 @@ Document - IntermediateToken - - CSharp - #pragma warning restore 0414 MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (27:1,0 [20] ViewWithNamespace.cshtml) - IntermediateToken - (27:1,0 [4] ViewWithNamespace.cshtml) - Html -

+ IntermediateToken - (27:1,0 [3] ViewWithNamespace.cshtml) - Html -

IntermediateToken - (31:1,4 [9] ViewWithNamespace.cshtml) - Html - Hi There! IntermediateToken - (40:1,13 [5] ViewWithNamespace.cshtml) - Html -

IntermediateToken - (45:1,18 [2] ViewWithNamespace.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt index 471464c580..5a45f13f76 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt @@ -16,7 +16,8 @@ Document - CSharpCode - IntermediateToken - - CSharp - BeginContext(27, 20, true); HtmlContent - (27:1,0 [20] ViewWithNamespace.cshtml) - IntermediateToken - (27:1,0 [4] ViewWithNamespace.cshtml) - Html -

+ IntermediateToken - (27:1,0 [3] ViewWithNamespace.cshtml) - Html -

IntermediateToken - (31:1,4 [9] ViewWithNamespace.cshtml) - Html - Hi There! IntermediateToken - (40:1,13 [5] ViewWithNamespace.cshtml) - Html -

IntermediateToken - (45:1,18 [2] ViewWithNamespace.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt index c4ba72abd9..6ac51fb0e8 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt @@ -71,7 +71,8 @@ Document - IntermediateToken - - CSharp - BeginContext(158, 31, true); HtmlContent - (158:5,7 [31] BasicTest.cshtml) IntermediateToken - (158:5,7 [4] BasicTest.cshtml) - Html - \n\n - IntermediateToken - (162:7,0 [6] BasicTest.cshtml) - Html - + IntermediateToken - (162:7,0 [5] BasicTest.cshtml) - Html - IntermediateToken - (168:7,6 [21] BasicTest.cshtml) - Html - Here is some content CSharpCode - IntermediateToken - - CSharp - EndContext(); @@ -90,7 +91,8 @@ Document - CSharpCode - IntermediateToken - - CSharp - BeginContext(222, 24, true); HtmlContent - (222:8,6 [24] BasicTest.cshtml) - IntermediateToken - (222:8,6 [6] BasicTest.cshtml) - Html - + IntermediateToken - (222:8,6 [5] BasicTest.cshtml) - Html - IntermediateToken - (228:8,12 [11] BasicTest.cshtml) - Html - Hello world IntermediateToken - (239:8,23 [7] BasicTest.cshtml) - Html - CSharpCode - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt index 4074239b9f..959329c714 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt @@ -55,7 +55,8 @@ Document - IntermediateToken - (153:7,30 [3] Basic.cshtml) - CSharp - cls IntermediateToken - (156:7,33 [2] Basic.cshtml) - CSharp - } HtmlContent - (159:7,36 [5] Basic.cshtml) - IntermediateToken - (159:7,36 [3] Basic.cshtml) - Html - /> + IntermediateToken - (159:7,36 [1] Basic.cshtml) - Html - + IntermediateToken - (160:7,37 [2] Basic.cshtml) - Html - /> IntermediateToken - (162:7,39 [2] Basic.cshtml) - Html - \n Inject - Inject - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt index 8ed7912b0a..e33f48cfef 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt @@ -39,7 +39,8 @@ Document - IntermediateToken - (153:7,30 [3] Basic.cshtml) - CSharp - cls IntermediateToken - (156:7,33 [2] Basic.cshtml) - CSharp - } HtmlContent - (159:7,36 [5] Basic.cshtml) - IntermediateToken - (159:7,36 [3] Basic.cshtml) - Html - /> + IntermediateToken - (159:7,36 [1] Basic.cshtml) - Html - + IntermediateToken - (160:7,37 [2] Basic.cshtml) - Html - /> IntermediateToken - (162:7,39 [2] Basic.cshtml) - Html - \n Inject - Inject - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt index c3fbc6082e..8db9133a4a 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt @@ -33,11 +33,13 @@ Document - MalformedDirective - (0:0,0 [6] MalformedPageDirective.cshtml) - page HtmlContent - (6:0,6 [49] MalformedPageDirective.cshtml) IntermediateToken - (6:0,6 [8] MalformedPageDirective.cshtml) - Html - "foo\n\n - IntermediateToken - (14:2,0 [4] MalformedPageDirective.cshtml) - Html -

+ IntermediateToken - (14:2,0 [3] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (18:2,4 [8] MalformedPageDirective.cshtml) - Html - About Us IntermediateToken - (26:2,12 [5] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (31:2,17 [2] MalformedPageDirective.cshtml) - Html - \n - IntermediateToken - (33:3,0 [3] MalformedPageDirective.cshtml) - Html -

+ IntermediateToken - (33:3,0 [2] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (36:3,3 [15] MalformedPageDirective.cshtml) - Html - We are awesome. IntermediateToken - (51:3,18 [4] MalformedPageDirective.cshtml) - Html -

Inject - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt index 7a04b0051a..077b331edd 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt @@ -16,11 +16,13 @@ Document - MalformedDirective - (0:0,0 [6] MalformedPageDirective.cshtml) - page HtmlContent - (6:0,6 [49] MalformedPageDirective.cshtml) IntermediateToken - (6:0,6 [8] MalformedPageDirective.cshtml) - Html - "foo\n\n - IntermediateToken - (14:2,0 [4] MalformedPageDirective.cshtml) - Html -

+ IntermediateToken - (14:2,0 [3] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (18:2,4 [8] MalformedPageDirective.cshtml) - Html - About Us IntermediateToken - (26:2,12 [5] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (31:2,17 [2] MalformedPageDirective.cshtml) - Html - \n - IntermediateToken - (33:3,0 [3] MalformedPageDirective.cshtml) - Html -

+ IntermediateToken - (33:3,0 [2] MalformedPageDirective.cshtml) - Html -

IntermediateToken - (36:3,3 [15] MalformedPageDirective.cshtml) - Html - We are awesome. IntermediateToken - (51:3,18 [4] MalformedPageDirective.cshtml) - Html -

Inject - diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt index 9238a0a419..099c37355f 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt @@ -32,7 +32,8 @@ Document - IntermediateToken - - CSharp - #pragma warning restore 0414 MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (34:2,0 [20] PageWithNamespace.cshtml) - IntermediateToken - (34:2,0 [4] PageWithNamespace.cshtml) - Html -

+ IntermediateToken - (34:2,0 [3] PageWithNamespace.cshtml) - Html -

IntermediateToken - (38:2,4 [9] PageWithNamespace.cshtml) - Html - Hi There! IntermediateToken - (47:2,13 [5] PageWithNamespace.cshtml) - Html -

IntermediateToken - (52:2,18 [2] PageWithNamespace.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt index 5be907ee1d..5a8cf210d2 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt @@ -14,7 +14,8 @@ Document - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (34:2,0 [20] PageWithNamespace.cshtml) - IntermediateToken - (34:2,0 [4] PageWithNamespace.cshtml) - Html -

+ IntermediateToken - (34:2,0 [3] PageWithNamespace.cshtml) - Html -

IntermediateToken - (38:2,4 [9] PageWithNamespace.cshtml) - Html - Hi There! IntermediateToken - (47:2,13 [5] PageWithNamespace.cshtml) - Html -

IntermediateToken - (52:2,18 [2] PageWithNamespace.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt index c21d9fc82c..6139c62c14 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt @@ -31,7 +31,8 @@ Document - IntermediateToken - - CSharp - #pragma warning restore 0414 MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [28] RazorPageWithNoLeadingPageDirective.cshtml) - IntermediateToken - (0:0,0 [5] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
+ IntermediateToken - (0:0,0 [4] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
IntermediateToken - (5:0,5 [15] RazorPageWithNoLeadingPageDirective.cshtml) - Html - Some text here. IntermediateToken - (20:0,20 [6] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
IntermediateToken - (26:0,26 [2] RazorPageWithNoLeadingPageDirective.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt index 42eb920742..ebd8d792ae 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt @@ -14,7 +14,8 @@ Document - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [28] RazorPageWithNoLeadingPageDirective.cshtml) - IntermediateToken - (0:0,0 [5] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
+ IntermediateToken - (0:0,0 [4] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
IntermediateToken - (5:0,5 [15] RazorPageWithNoLeadingPageDirective.cshtml) - Html - Some text here. IntermediateToken - (20:0,20 [6] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
IntermediateToken - (26:0,26 [2] RazorPageWithNoLeadingPageDirective.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt index c71b835bf9..721dfa649d 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt @@ -40,7 +40,8 @@ Document - IntermediateToken - (77:3,42 [4] RazorPagesWithRouteTemplate.cshtml) - Html - \n\n HtmlContent - (191:10,1 [21] RazorPagesWithRouteTemplate.cshtml) IntermediateToken - (191:10,1 [4] RazorPagesWithRouteTemplate.cshtml) - Html - \n\n - IntermediateToken - (195:12,0 [4] RazorPagesWithRouteTemplate.cshtml) - Html -

+ IntermediateToken - (195:12,0 [3] RazorPagesWithRouteTemplate.cshtml) - Html -

IntermediateToken - (199:12,4 [13] RazorPagesWithRouteTemplate.cshtml) - Html - New Customer CSharpExpression - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml) IntermediateToken - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml) - CSharp - Model.Name diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt index c8fbdea2cc..c51a1fd492 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt @@ -21,7 +21,8 @@ Document - IntermediateToken - (79:4,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n HtmlContent - (193:11,0 [19] RazorPagesWithRouteTemplate.cshtml) IntermediateToken - (193:11,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n - IntermediateToken - (195:12,0 [4] RazorPagesWithRouteTemplate.cshtml) - Html -

+ IntermediateToken - (195:12,0 [3] RazorPagesWithRouteTemplate.cshtml) - Html -

IntermediateToken - (199:12,4 [13] RazorPagesWithRouteTemplate.cshtml) - Html - New Customer CSharpExpression - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml) IntermediateToken - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml) - CSharp - Model.Name diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt index 913b80d2aa..de7cd9dd4f 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt @@ -42,7 +42,8 @@ Document - IntermediateToken - (79:3,42 [4] RazorPagesWithoutModel.cshtml) - Html - \n\n HtmlContent - (379:18,1 [77] RazorPagesWithoutModel.cshtml) IntermediateToken - (379:18,1 [4] RazorPagesWithoutModel.cshtml) - Html - \n\n - IntermediateToken - (383:20,0 [4] RazorPagesWithoutModel.cshtml) - Html -

+ IntermediateToken - (383:20,0 [3] RazorPagesWithoutModel.cshtml) - Html -

IntermediateToken - (387:20,4 [12] RazorPagesWithoutModel.cshtml) - Html - New Customer IntermediateToken - (399:20,16 [5] RazorPagesWithoutModel.cshtml) - Html -

IntermediateToken - (404:20,21 [2] RazorPagesWithoutModel.cshtml) - Html - \n @@ -78,7 +79,8 @@ Document - IntermediateToken - (611:25,31 [14] RazorPagesWithoutModel.cshtml) - Html - \n IntermediateToken - (625:26,12 [6] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (652:26,39 [1] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (653:26,40 [2] RazorPagesWithoutModel.cshtml) - Html - /> IntermediateToken - (655:26,42 [14] RazorPagesWithoutModel.cshtml) - Html - \n IntermediateToken - (669:27,12 [5] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (383:20,0 [3] RazorPagesWithoutModel.cshtml) - Html -

IntermediateToken - (387:20,4 [12] RazorPagesWithoutModel.cshtml) - Html - New Customer IntermediateToken - (399:20,16 [5] RazorPagesWithoutModel.cshtml) - Html -

IntermediateToken - (404:20,21 [2] RazorPagesWithoutModel.cshtml) - Html - \n @@ -60,7 +61,8 @@ Document - IntermediateToken - (611:25,31 [14] RazorPagesWithoutModel.cshtml) - Html - \n IntermediateToken - (625:26,12 [6] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (652:26,39 [1] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (653:26,40 [2] RazorPagesWithoutModel.cshtml) - Html - /> IntermediateToken - (655:26,42 [14] RazorPagesWithoutModel.cshtml) - Html - \n IntermediateToken - (669:27,12 [5] RazorPagesWithoutModel.cshtml) - Html - + IntermediateToken - (477:24,0 [3] RazorPages.cshtml) - Html -

IntermediateToken - (481:24,4 [12] RazorPages.cshtml) - Html - New Customer IntermediateToken - (493:24,16 [5] RazorPages.cshtml) - Html -

IntermediateToken - (498:24,21 [2] RazorPages.cshtml) - Html - \n IntermediateToken - (500:25,0 [5] RazorPages.cshtml) - Html - + IntermediateToken - (543:25,43 [1] RazorPages.cshtml) - Html - + IntermediateToken - (544:25,44 [1] RazorPages.cshtml) - Html - > IntermediateToken - (545:25,45 [6] RazorPages.cshtml) - Html - \n TagHelper - (551:26,4 [31] RazorPages.cshtml) - div - TagMode.StartTagAndEndTag DefaultTagHelperBody - @@ -79,7 +81,8 @@ Document - IntermediateToken - (712:29,31 [14] RazorPages.cshtml) - Html - \n IntermediateToken - (726:30,12 [6] RazorPages.cshtml) - Html - + IntermediateToken - (753:30,39 [1] RazorPages.cshtml) - Html - + IntermediateToken - (754:30,40 [2] RazorPages.cshtml) - Html - /> IntermediateToken - (756:30,42 [14] RazorPages.cshtml) - Html - \n IntermediateToken - (770:31,12 [5] RazorPages.cshtml) - Html - + IntermediateToken - (477:24,0 [3] RazorPages.cshtml) - Html -

IntermediateToken - (481:24,4 [12] RazorPages.cshtml) - Html - New Customer IntermediateToken - (493:24,16 [5] RazorPages.cshtml) - Html -

IntermediateToken - (498:24,21 [2] RazorPages.cshtml) - Html - \n IntermediateToken - (500:25,0 [5] RazorPages.cshtml) - Html - + IntermediateToken - (543:25,43 [1] RazorPages.cshtml) - Html - + IntermediateToken - (544:25,44 [1] RazorPages.cshtml) - Html - > IntermediateToken - (545:25,45 [6] RazorPages.cshtml) - Html - \n TagHelper - (551:26,4 [31] RazorPages.cshtml) - div - TagMode.StartTagAndEndTag DefaultTagHelperBody - @@ -60,7 +62,8 @@ Document - IntermediateToken - (712:29,31 [14] RazorPages.cshtml) - Html - \n IntermediateToken - (726:30,12 [6] RazorPages.cshtml) - Html - + IntermediateToken - (753:30,39 [1] RazorPages.cshtml) - Html - + IntermediateToken - (754:30,40 [2] RazorPages.cshtml) - Html - /> IntermediateToken - (756:30,42 [14] RazorPages.cshtml) - Html - \n IntermediateToken - (770:31,12 [5] RazorPages.cshtml) - Html - + IntermediateToken - (119:8,0 [4] Sections.cshtml) - Html -
IntermediateToken - (124:8,5 [9] Sections.cshtml) - Html - Some body IntermediateToken - (133:8,14 [6] Sections.cshtml) - Html -
IntermediateToken - (139:8,20 [4] Sections.cshtml) - Html - \n\n Section - - Section1 HtmlContent - (162:10,19 [43] Sections.cshtml) IntermediateToken - (162:10,19 [6] Sections.cshtml) - Html - \n - IntermediateToken - (168:11,4 [5] Sections.cshtml) - Html -
+ IntermediateToken - (168:11,4 [4] Sections.cshtml) - Html -
IntermediateToken - (173:11,9 [20] Sections.cshtml) - Html - This is in Section 1 IntermediateToken - (193:11,29 [6] Sections.cshtml) - Html -
IntermediateToken - (199:11,35 [6] Sections.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt index 1309bc9423..1fe445a31e 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt @@ -23,14 +23,16 @@ Document - IntermediateToken - (68:4,2 [46] Sections.cshtml) - CSharp - \n Layout = "_SectionTestLayout.cshtml";\n HtmlContent - (117:7,0 [26] Sections.cshtml) IntermediateToken - (117:7,0 [2] Sections.cshtml) - Html - \n - IntermediateToken - (119:8,0 [5] Sections.cshtml) - Html -
+ IntermediateToken - (119:8,0 [4] Sections.cshtml) - Html -
IntermediateToken - (124:8,5 [9] Sections.cshtml) - Html - Some body IntermediateToken - (133:8,14 [6] Sections.cshtml) - Html -
IntermediateToken - (139:8,20 [4] Sections.cshtml) - Html - \n\n Section - - Section1 HtmlContent - (162:10,19 [43] Sections.cshtml) IntermediateToken - (162:10,19 [6] Sections.cshtml) - Html - \n - IntermediateToken - (168:11,4 [5] Sections.cshtml) - Html -
+ IntermediateToken - (168:11,4 [4] Sections.cshtml) - Html -
IntermediateToken - (173:11,9 [20] Sections.cshtml) - Html - This is in Section 1 IntermediateToken - (193:11,29 [6] Sections.cshtml) - Html -
IntermediateToken - (199:11,35 [6] Sections.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt index 42d53bcd1b..0af8488598 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt @@ -32,7 +32,8 @@ Document - IntermediateToken - - CSharp - #pragma warning restore 0414 MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (27:1,0 [20] ViewWithNamespace.cshtml) - IntermediateToken - (27:1,0 [4] ViewWithNamespace.cshtml) - Html -

+ IntermediateToken - (27:1,0 [3] ViewWithNamespace.cshtml) - Html -

IntermediateToken - (31:1,4 [9] ViewWithNamespace.cshtml) - Html - Hi There! IntermediateToken - (40:1,13 [5] ViewWithNamespace.cshtml) - Html -

IntermediateToken - (45:1,18 [2] ViewWithNamespace.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt index 17f6801a03..f507dfd9ca 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt @@ -14,7 +14,8 @@ Document - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (27:1,0 [20] ViewWithNamespace.cshtml) - IntermediateToken - (27:1,0 [4] ViewWithNamespace.cshtml) - Html -

+ IntermediateToken - (27:1,0 [3] ViewWithNamespace.cshtml) - Html -

IntermediateToken - (31:1,4 [9] ViewWithNamespace.cshtml) - Html - Hi There! IntermediateToken - (40:1,13 [5] ViewWithNamespace.cshtml) - Html -

IntermediateToken - (45:1,18 [2] ViewWithNamespace.cshtml) - Html - \n diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanRewriter.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanRewriter.cs new file mode 100644 index 0000000000..dedb8c22fd --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanRewriter.cs @@ -0,0 +1,65 @@ +// 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.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; + +namespace Microsoft.AspNetCore.Razor.Language +{ + internal class ClassifiedSpanRewriter : SyntaxRewriter + { + public override SyntaxNode VisitMarkupTagBlock(MarkupTagBlockSyntax node) + { + SpanContext latestSpanContext = null; + var newChildren = SyntaxListBuilder.Create(); + var literals = new List(); + foreach (var child in node.Children) + { + if (child is MarkupTextLiteralSyntax literal) + { + literals.Add(literal); + latestSpanContext = literal.GetSpanContext() ?? latestSpanContext; + } + else if (child is MarkupMiscAttributeContentSyntax miscContent) + { + foreach (var contentChild in miscContent.Children) + { + if (contentChild is MarkupTextLiteralSyntax contentLiteral) + { + literals.Add(contentLiteral); + latestSpanContext = contentLiteral.GetSpanContext() ?? latestSpanContext; + } + else + { + // Pop stack + AddLiteralIfExists(); + newChildren.Add(contentChild); + } + } + } + else + { + AddLiteralIfExists(); + newChildren.Add(child); + } + } + + AddLiteralIfExists(); + + return SyntaxFactory.MarkupTagBlock(newChildren.ToList()).Green.CreateRed(node.Parent, node.Position); + + void AddLiteralIfExists() + { + if (literals.Count > 0) + { + var mergedLiteral = SyntaxUtilities.MergeTextLiterals(literals.ToArray()); + mergedLiteral = mergedLiteral.WithSpanContext(latestSpanContext); + literals.Clear(); + latestSpanContext = null; + newChildren.Add(mergedLiteral); + } + } + } + } +} diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanVisitor.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanVisitor.cs index ec0e7977d0..416765c992 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanVisitor.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ClassifiedSpanVisitor.cs @@ -137,7 +137,7 @@ namespace Microsoft.AspNetCore.Razor.Language WriteBlock(node, BlockKindInternal.Markup, n => { var equalsSyntax = SyntaxFactory.MarkupTextLiteral(new SyntaxList(node.EqualsToken)); - var mergedAttributePrefix = MergeTextLiteralSpans(node.NamePrefix, node.Name, node.NameSuffix, equalsSyntax, node.ValuePrefix); + var mergedAttributePrefix = SyntaxUtilities.MergeTextLiterals(node.NamePrefix, node.Name, node.NameSuffix, equalsSyntax, node.ValuePrefix); Visit(mergedAttributePrefix); Visit(node.Value); Visit(node.ValueSuffix); @@ -153,7 +153,7 @@ namespace Microsoft.AspNetCore.Razor.Language { WriteBlock(node, BlockKindInternal.Markup, n => { - var mergedAttributePrefix = MergeTextLiteralSpans(node.NamePrefix, node.Name); + var mergedAttributePrefix = SyntaxUtilities.MergeTextLiterals(node.NamePrefix, node.Name); Visit(mergedAttributePrefix); }); } @@ -270,43 +270,5 @@ namespace Microsoft.AspNetCore.Razor.Language var span = new ClassifiedSpanInternal(spanSource, blockSource, kind, _currentBlockKind, acceptedCharacters.Value); _spans.Add(span); } - - private MarkupTextLiteralSyntax MergeTextLiteralSpans(params MarkupTextLiteralSyntax[] literalSyntaxes) - { - if (literalSyntaxes == null || literalSyntaxes.Length == 0) - { - return null; - } - - SyntaxNode parent = null; - var position = 0; - var seenFirstLiteral = false; - var builder = Syntax.InternalSyntax.SyntaxListBuilder.Create(); - - foreach (var syntax in literalSyntaxes) - { - if (syntax == null) - { - continue; - } - else if (!seenFirstLiteral) - { - // Set the parent and position of the merged literal to the value of the first non-null literal. - parent = syntax.Parent; - position = syntax.Position; - seenFirstLiteral = true; - } - - foreach (var token in syntax.LiteralTokens) - { - builder.Add(token.Green); - } - } - - var mergedLiteralSyntax = Syntax.InternalSyntax.SyntaxFactory.MarkupTextLiteral( - builder.ToList()); - - return (MarkupTextLiteralSyntax)mergedLiteralSyntax.CreateRed(parent, position); - } } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/HtmlMarkupParser.Legacy.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/HtmlMarkupParser.Legacy.cs index ac7b174c7f..e858000fac 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/HtmlMarkupParser.Legacy.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/HtmlMarkupParser.Legacy.cs @@ -240,7 +240,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var scriptTag = At(SyntaxKind.Text) && string.Equals(CurrentToken.Content, "script", StringComparison.OrdinalIgnoreCase); TryAccept(SyntaxKind.Text); - LegacyParseTagContent(tagBuilder); // Parse the tag, don't care about the content + // Output open angle and tag name + tagBuilder.Add(OutputAsMarkupLiteral()); + ParseAttributes(tagBuilder); // Parse the tag, don't care about the content TryAccept(SyntaxKind.ForwardSlash); TryAccept(SyntaxKind.CloseAngle); @@ -278,372 +280,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - private void LegacyParseTagContent(in SyntaxListBuilder builder) - { - 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(builder); - } - else - { - // We are here ($): - while (!EndOfFile && !IsEndOfTag()) - { - BeforeAttribute(builder); - } - } - } - - private bool IsEndOfTag() - { - if (At(SyntaxKind.ForwardSlash)) - { - if (NextIs(SyntaxKind.CloseAngle)) - { - return true; - } - else - { - AcceptAndMoveNext(); - } - } - return At(SyntaxKind.CloseAngle) || At(SyntaxKind.OpenAngle); - } - - private void BeforeAttribute(in SyntaxListBuilder builder) - { - // http://dev.w3.org/html5/spec/tokenization.html#before-attribute-name-state - // Capture whitespace - var whitespace = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); - - if (At(SyntaxKind.Transition) || At(SyntaxKind.RazorCommentTransition)) - { - // Transition outside of attribute value => Switch to recovery mode - Accept(whitespace); - RecoverToEndOfTag(builder); - return; - } - - // http://dev.w3.org/html5/spec/tokenization.html#attribute-name-state - // Read the 'name' (i.e. read until the '=' or whitespace/newline) - var nameTokens = Enumerable.Empty(); - var whitespaceAfterAttributeName = Enumerable.Empty(); - if (IsValidAttributeNameToken(CurrentToken)) - { - nameTokens = ReadWhile(token => - 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.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); - } - else - { - // Unexpected character in tag, enter recovery - Accept(whitespace); - RecoverToEndOfTag(builder); - return; - } - - if (!At(SyntaxKind.Equals)) - { - // Minimized attribute - - // We are at the prefix of the next attribute or the end of tag. Put it back so it is parsed later. - PutCurrentBack(); - PutBack(whitespaceAfterAttributeName); - - // Output anything prior to the attribute, in most cases this will be the tag name: - // |. If in-between other attributes this will noop or output malformed attribute - // content (if the previous attribute was malformed). - builder.Add(OutputAsMarkupLiteral()); - - Accept(whitespace); - var namePrefix = OutputAsMarkupLiteral(); - Accept(nameTokens); - var name = OutputAsMarkupLiteral(); - - var minimizedAttributeBlock = SyntaxFactory.MarkupMinimizedAttributeBlock(namePrefix, name); - builder.Add(minimizedAttributeBlock); - - return; - } - - // Not a minimized attribute, parse as if it were well-formed (if attribute turns out to be malformed we - // will go into recovery). - builder.Add(OutputAsMarkupLiteral()); - - var attributeBlock = ParseAttributePrefix(whitespace, nameTokens, whitespaceAfterAttributeName); - - builder.Add(attributeBlock); - } - - private MarkupAttributeBlockSyntax ParseAttributePrefix( - IEnumerable whitespace, - IEnumerable nameTokens, - IEnumerable whitespaceAfterAttributeName) - { - // First, determine if this is a 'data-' attribute (since those can't use conditional attributes) - var nameContent = string.Concat(nameTokens.Select(s => s.Content)); - var attributeCanBeConditional = - Context.FeatureFlags.EXPERIMENTAL_AllowConditionalDataDashAttributes || - !nameContent.StartsWith("data-", StringComparison.OrdinalIgnoreCase); - - // Accept the whitespace and name - Accept(whitespace); - var namePrefix = OutputAsMarkupLiteral(); - Accept(nameTokens); - var name = OutputAsMarkupLiteral(); - - // Since this is not a minimized attribute, the whitespace after attribute name belongs to this attribute. - Accept(whitespaceAfterAttributeName); - var nameSuffix = OutputAsMarkupLiteral(); - Assert(SyntaxKind.Equals); // We should be at "=" - var equalsToken = EatCurrentToken(); - - var whitespaceAfterEquals = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); - var quote = SyntaxKind.Marker; - if (At(SyntaxKind.SingleQuote) || At(SyntaxKind.DoubleQuote)) - { - // Found a quote, the whitespace belongs to this attribute. - Accept(whitespaceAfterEquals); - quote = CurrentToken.Kind; - AcceptAndMoveNext(); - } - else if (whitespaceAfterEquals.Any()) - { - // No quotes found after the whitespace. Put it back so that it can be parsed later. - PutCurrentBack(); - PutBack(whitespaceAfterEquals); - } - - MarkupTextLiteralSyntax valuePrefix = null; - RazorBlockSyntax attributeValue = null; - MarkupTextLiteralSyntax valueSuffix = null; - - if (attributeCanBeConditional) - { - SpanContext.ChunkGenerator = SpanChunkGenerator.Null; // The block chunk generator will render the prefix - - // We now have the value prefix which is usually whitespace and/or a quote - valuePrefix = OutputAsMarkupLiteral(); - - // Read the attribute value only if the value is quoted - // or if there is no whitespace between '=' and the unquoted value. - if (quote != SyntaxKind.Marker || !whitespaceAfterEquals.Any()) - { - using (var pooledResult = Pool.Allocate()) - { - var attributeValueBuilder = pooledResult.Builder; - // Read the attribute value. - while (!EndOfFile && !IsEndOfAttributeValue(quote, CurrentToken)) - { - ParseAttributeValue(attributeValueBuilder, quote); - } - - if (attributeValueBuilder.Count > 0) - { - attributeValue = SyntaxFactory.GenericBlock(attributeValueBuilder.ToList()); - } - } - } - - // Capture the suffix - if (quote != SyntaxKind.Marker && At(quote)) - { - AcceptAndMoveNext(); - // Again, block chunk generator will render the suffix - SpanContext.ChunkGenerator = SpanChunkGenerator.Null; - valueSuffix = OutputAsMarkupLiteral(); - } - } - else if (quote != SyntaxKind.Marker || !whitespaceAfterEquals.Any()) - { - valuePrefix = OutputAsMarkupLiteral(); - - using (var pooledResult = Pool.Allocate()) - { - var attributeValueBuilder = pooledResult.Builder; - // Not a "conditional" attribute, so just read the value - SkipToAndParseCode(attributeValueBuilder, token => IsEndOfAttributeValue(quote, token)); - - // Output already accepted tokens if any as markup literal - var literalValue = OutputAsMarkupLiteral(); - attributeValueBuilder.Add(literalValue); - - // Capture the attribute value (will include everything in-between the attribute's quotes). - attributeValue = SyntaxFactory.GenericBlock(attributeValueBuilder.ToList()); - } - - if (quote != SyntaxKind.Marker) - { - TryAccept(quote); - valueSuffix = OutputAsMarkupLiteral(); - } - } - else - { - // There is no quote and there is whitespace after equals. There is no attribute value. - } - - return SyntaxFactory.MarkupAttributeBlock(namePrefix, name, nameSuffix, equalsToken, valuePrefix, attributeValue, valueSuffix); - } - - private void ParseAttributeValue(in SyntaxListBuilder builder, SyntaxKind quote) - { - var prefixStart = CurrentStart; - var prefixTokens = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); - - if (At(SyntaxKind.Transition)) - { - if (NextIs(SyntaxKind.Transition)) - { - // Wrapping this in a block so that the ConditionalAttributeCollapser doesn't rewrite it. - using (var pooledResult = Pool.Allocate()) - { - var markupBuilder = pooledResult.Builder; - Accept(prefixTokens); - - // Render a single "@" in place of "@@". - SpanContext.ChunkGenerator = new LiteralAttributeChunkGenerator( - new LocationTagged(string.Concat(prefixTokens.Select(s => s.Content)), prefixStart), - new LocationTagged(CurrentToken.Content, CurrentStart)); - AcceptAndMoveNext(); - SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - markupBuilder.Add(OutputAsMarkupLiteral()); - - SpanContext.ChunkGenerator = SpanChunkGenerator.Null; - AcceptAndMoveNext(); - SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - markupBuilder.Add(OutputAsMarkupEphemeralLiteral()); - - var markupBlock = SyntaxFactory.MarkupBlock(markupBuilder.ToList()); - builder.Add(markupBlock); - } - } - else - { - Accept(prefixTokens); - var valueStart = CurrentStart; - PutCurrentBack(); - - var prefix = OutputAsMarkupLiteral(); - - // Dynamic value, start a new block and set the chunk generator - using (var pooledResult = Pool.Allocate()) - { - var dynamicAttributeValueBuilder = pooledResult.Builder; - - OtherParserBlock(dynamicAttributeValueBuilder); - var value = SyntaxFactory.MarkupDynamicAttributeValue(prefix, SyntaxFactory.GenericBlock(dynamicAttributeValueBuilder.ToList())); - builder.Add(value); - } - } - } - else - { - Accept(prefixTokens); - var prefix = OutputAsMarkupLiteral(); - - // Literal value - // 'quote' should be "Unknown" if not quoted and tokens coming from the tokenizer should never have - // "Unknown" type. - var valueTokens = ReadWhile(token => - // These three conditions find separators which break the attribute value into portions - 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)); - Accept(valueTokens); - var value = OutputAsMarkupLiteral(); - - var literalAttributeValue = SyntaxFactory.MarkupLiteralAttributeValue(prefix, value); - builder.Add(literalAttributeValue); - } - } - - private void RecoverToEndOfTag(in SyntaxListBuilder builder) - { - // Accept until ">", "/" or "<", but parse code - while (!EndOfFile) - { - SkipToAndParseCode(builder, IsTagRecoveryStopPoint); - if (!EndOfFile) - { - EnsureCurrent(); - switch (CurrentToken.Kind) - { - case SyntaxKind.SingleQuote: - case SyntaxKind.DoubleQuote: - ParseQuoted(builder); - break; - case SyntaxKind.OpenAngle: - // Another "<" means this tag is invalid. - case SyntaxKind.ForwardSlash: - // Empty tag - case SyntaxKind.CloseAngle: - // End of tag - return; - default: - AcceptAndMoveNext(); - break; - } - } - } - } - - private bool IsTagRecoveryStopPoint(SyntaxToken token) - { - return token.Kind == SyntaxKind.CloseAngle || - token.Kind == SyntaxKind.ForwardSlash || - token.Kind == SyntaxKind.OpenAngle || - token.Kind == SyntaxKind.SingleQuote || - token.Kind == SyntaxKind.DoubleQuote; - } - - private bool IsEndOfAttributeValue(SyntaxKind quote, SyntaxToken token) - { - return EndOfFile || token == null || - (quote != SyntaxKind.Marker - ? token.Kind == quote // If quoted, just wait for the quote - : IsUnquotedEndOfAttributeValue(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.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 ParseQuoted(in SyntaxListBuilder builder) - { - var type = CurrentToken.Kind; - AcceptAndMoveNext(); - SkipToAndParseCode(builder, type); - if (!EndOfFile) - { - Assert(type); - AcceptAndMoveNext(); - } - } - private bool ParseBangTag(in SyntaxListBuilder builder) { // Accept "!" @@ -1240,6 +876,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Accept(_bufferedOpenAngle); TryParseBangEscape(builder); TryAccept(SyntaxKind.Text); + + if (At(SyntaxKind.CloseAngle)) + { + // Completed tags have no accepted characters inside of blocks. + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + } + // Output open angle and tag name + builder.Add(OutputAsMarkupLiteral()); return ParseRestOfTag(builder, parentBuilder, tag, tags); } @@ -1250,7 +894,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Stack> tags) { var blockAlreadyBuilt = false; - LegacyParseTagContent(builder); + ParseAttributes(builder); // We are now at a possible end of the tag // Found '<', so we just abort this tag. @@ -1718,28 +1362,5 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return last.Green; } - - internal static bool IsValidAttributeNameToken(SyntaxToken token) - { - if (token == null) - { - return false; - } - - // These restrictions cover most of the spec defined: http://www.w3.org/TR/html5/syntax.html#attributes-0 - // 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.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.Marker; - } } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/HtmlMarkupParser.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/HtmlMarkupParser.cs index 89b844c769..a30d5b2de1 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/HtmlMarkupParser.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/HtmlMarkupParser.cs @@ -174,8 +174,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } TryAccept(SyntaxKind.Text); + // Output open angle and tag name + tagBuilder.Add(OutputAsMarkupLiteral()); + // Parse the contents of a tag like attributes. - ParseTagContent(tagBuilder); + ParseAttributes(tagBuilder); if (TryAccept(SyntaxKind.ForwardSlash)) { @@ -233,10 +236,366 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return null; } - private void ParseTagContent(in SyntaxListBuilder builder) + private void ParseAttributes(in SyntaxListBuilder builder) { - // Calling to legacy code for now. - LegacyParseTagContent(builder); + 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 + ParseMiscAttribute(builder); + return; + } + + // We are here ($): + + while (!EndOfFile && !IsEndOfTag()) + { + if (At(SyntaxKind.ForwardSlash)) + { + // This means we're at a '/' but it's not considered end of tag. E.g.

+ // We are at the '/' but the tag isn't closed. Accept and continue parsing the next attribute. + AcceptAndMoveNext(); + } + + ParseAttribute(builder); + } + } + + private bool IsEndOfTag() + { + if (At(SyntaxKind.ForwardSlash)) + { + if (NextIs(SyntaxKind.CloseAngle) || NextIs(SyntaxKind.OpenAngle)) + { + return true; + } + } + + return At(SyntaxKind.CloseAngle) || At(SyntaxKind.OpenAngle); + } + + private void ParseMiscAttribute(in SyntaxListBuilder builder) + { + using (var pooledResult = Pool.Allocate()) + { + var miscAttributeContentBuilder = pooledResult.Builder; + while (!EndOfFile) + { + ParseMarkupNodes(miscAttributeContentBuilder, ParseMode.Text, IsTagRecoveryStopPoint); + if (!EndOfFile) + { + EnsureCurrent(); + switch (CurrentToken.Kind) + { + case SyntaxKind.SingleQuote: + case SyntaxKind.DoubleQuote: + // We should parse until we reach a matching quote. + var openQuoteKind = CurrentToken.Kind; + AcceptAndMoveNext(); + ParseMarkupNodes(miscAttributeContentBuilder, ParseMode.Text, token => token.Kind == openQuoteKind); + if (!EndOfFile) + { + Assert(openQuoteKind); + AcceptAndMoveNext(); + } + break; + case SyntaxKind.OpenAngle: // Another "<" means this tag is invalid. + case SyntaxKind.ForwardSlash: // Empty tag + case SyntaxKind.CloseAngle: // End of tag + miscAttributeContentBuilder.Add(OutputAsMarkupLiteral()); + if (miscAttributeContentBuilder.Count > 0) + { + var miscAttributeContent = SyntaxFactory.MarkupMiscAttributeContent(miscAttributeContentBuilder.ToList()); + builder.Add(miscAttributeContent); + } + return; + default: + AcceptAndMoveNext(); + break; + } + } + } + + miscAttributeContentBuilder.Add(OutputAsMarkupLiteral()); + if (miscAttributeContentBuilder.Count > 0) + { + var miscAttributeContent = SyntaxFactory.MarkupMiscAttributeContent(miscAttributeContentBuilder.ToList()); + builder.Add(miscAttributeContent); + } + } + } + + private void ParseAttribute(in SyntaxListBuilder builder) + { + // Output anything prior to the attribute, in most cases this will be any invalid content after the tag name or a previous attribute: + // . If there is nothing in-between other attributes this will noop. + using (var pooledResult = Pool.Allocate()) + { + var miscAttributeContentBuilder = pooledResult.Builder; + miscAttributeContentBuilder.Add(OutputAsMarkupLiteral()); + if (miscAttributeContentBuilder.Count > 0) + { + var invalidAttributeBlock = SyntaxFactory.MarkupMiscAttributeContent(miscAttributeContentBuilder.ToList()); + builder.Add(invalidAttributeBlock); + } + } + + // http://dev.w3.org/html5/spec/tokenization.html#before-attribute-name-state + // Capture whitespace + var attributePrefixWhitespace = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); + + // http://dev.w3.org/html5/spec/tokenization.html#attribute-name-state + // Read the 'name' (i.e. read until the '=' or whitespace/newline) + if (!TryParseAttributeName(out var nameTokens)) + { + // Unexpected character in tag, enter recovery + Accept(attributePrefixWhitespace); + ParseMiscAttribute(builder); + return; + } + + Accept(attributePrefixWhitespace); // Whitespace before attribute name + var namePrefix = OutputAsMarkupLiteral(); + Accept(nameTokens); // Attribute name + var name = OutputAsMarkupLiteral(); + + var atMinimizedAttribute = !TokenExistsAfterWhitespace(SyntaxKind.Equals); + if (atMinimizedAttribute) + { + // Minimized attribute + var minimizedAttributeBlock = SyntaxFactory.MarkupMinimizedAttributeBlock(namePrefix, name); + builder.Add(minimizedAttributeBlock); + } + else + { + // Not a minimized attribute + var attributeBlock = ParseRemainingAttribute(namePrefix, name); + builder.Add(attributeBlock); + } + } + + private bool TryParseAttributeName(out IEnumerable nameTokens) + { + nameTokens = Enumerable.Empty(); + if (At(SyntaxKind.Transition) || At(SyntaxKind.RazorCommentTransition)) + { + return false; + } + + if (IsValidAttributeNameToken(CurrentToken)) + { + nameTokens = ReadWhile(token => + 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))); + + return true; + } + + return false; + } + + private MarkupAttributeBlockSyntax ParseRemainingAttribute(MarkupTextLiteralSyntax namePrefix, MarkupTextLiteralSyntax name) + { + // Since this is not a minimized attribute, the whitespace after attribute name belongs to this attribute. + AcceptWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); + var nameSuffix = OutputAsMarkupLiteral(); + + Assert(SyntaxKind.Equals); // We should be at "=" + var equalsToken = EatCurrentToken(); + + var whitespaceAfterEquals = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); + var quote = SyntaxKind.Marker; + if (At(SyntaxKind.SingleQuote) || At(SyntaxKind.DoubleQuote)) + { + // Found a quote, the whitespace belongs to this attribute. + Accept(whitespaceAfterEquals); + quote = CurrentToken.Kind; + AcceptAndMoveNext(); + } + else if (whitespaceAfterEquals.Any()) + { + // No quotes found after the whitespace. Put it back so that it can be parsed later. + PutCurrentBack(); + PutBack(whitespaceAfterEquals); + } + + MarkupTextLiteralSyntax valuePrefix = null; + RazorBlockSyntax attributeValue = null; + MarkupTextLiteralSyntax valueSuffix = null; + + // First, determine if this is a 'data-' attribute (since those can't use conditional attributes) + var nameContent = string.Concat(name.LiteralTokens.Nodes.Select(s => s.Content)); + if (IsConditionalAttributeName(nameContent)) + { + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; // The block chunk generator will render the prefix + + // We now have the value prefix which is usually whitespace and/or a quote + valuePrefix = OutputAsMarkupLiteral(); + + // Read the attribute value only if the value is quoted + // or if there is no whitespace between '=' and the unquoted value. + if (quote != SyntaxKind.Marker || !whitespaceAfterEquals.Any()) + { + using (var pooledResult = Pool.Allocate()) + { + var attributeValueBuilder = pooledResult.Builder; + // Read the attribute value. + while (!EndOfFile && !IsEndOfAttributeValue(quote, CurrentToken)) + { + ParseConditionalAttributeValue(attributeValueBuilder, quote); + } + + if (attributeValueBuilder.Count > 0) + { + attributeValue = SyntaxFactory.GenericBlock(attributeValueBuilder.ToList()); + } + } + } + + // Capture the suffix + if (quote != SyntaxKind.Marker && At(quote)) + { + AcceptAndMoveNext(); + // Again, block chunk generator will render the suffix + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + valueSuffix = OutputAsMarkupLiteral(); + } + } + else if (quote != SyntaxKind.Marker || !whitespaceAfterEquals.Any()) + { + valuePrefix = OutputAsMarkupLiteral(); + + attributeValue = ParseNonConditionalAttributeValue(quote); + + if (quote != SyntaxKind.Marker) + { + TryAccept(quote); + valueSuffix = OutputAsMarkupLiteral(); + } + } + else + { + // There is no quote and there is whitespace after equals. There is no attribute value. + } + + return SyntaxFactory.MarkupAttributeBlock(namePrefix, name, nameSuffix, equalsToken, valuePrefix, attributeValue, valueSuffix); + } + + private RazorBlockSyntax ParseNonConditionalAttributeValue(SyntaxKind quote) + { + using (var pooledResult = Pool.Allocate()) + { + var attributeValueBuilder = pooledResult.Builder; + // Not a "conditional" attribute, so just read the value + ParseMarkupNodes(attributeValueBuilder, ParseMode.Text, token => IsEndOfAttributeValue(quote, token)); + + // Output already accepted tokens if any as markup literal + var literalValue = OutputAsMarkupLiteral(); + attributeValueBuilder.Add(literalValue); + + // Capture the attribute value (will include everything in-between the attribute's quotes). + return SyntaxFactory.GenericBlock(attributeValueBuilder.ToList()); + } + } + + private void ParseConditionalAttributeValue(in SyntaxListBuilder builder, SyntaxKind quote) + { + var prefixStart = CurrentStart; + var prefixTokens = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); + + if (At(SyntaxKind.Transition)) + { + if (NextIs(SyntaxKind.Transition)) + { + using (var pooledResult = Pool.Allocate()) + { + var markupBuilder = pooledResult.Builder; + Accept(prefixTokens); + + // Render a single "@" in place of "@@". + SpanContext.ChunkGenerator = new LiteralAttributeChunkGenerator( + new LocationTagged(string.Concat(prefixTokens.Select(s => s.Content)), prefixStart), + new LocationTagged(CurrentToken.Content, CurrentStart)); + AcceptAndMoveNext(); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + markupBuilder.Add(OutputAsMarkupLiteral()); + + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + AcceptAndMoveNext(); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + markupBuilder.Add(OutputAsMarkupEphemeralLiteral()); + + var markupBlock = SyntaxFactory.MarkupBlock(markupBuilder.ToList()); + builder.Add(markupBlock); + } + } + else + { + Accept(prefixTokens); + var valueStart = CurrentStart; + PutCurrentBack(); + + var prefix = OutputAsMarkupLiteral(); + + // Dynamic value, start a new block and set the chunk generator + using (var pooledResult = Pool.Allocate()) + { + var dynamicAttributeValueBuilder = pooledResult.Builder; + + OtherParserBlock(dynamicAttributeValueBuilder); + var value = SyntaxFactory.MarkupDynamicAttributeValue(prefix, SyntaxFactory.GenericBlock(dynamicAttributeValueBuilder.ToList())); + builder.Add(value); + } + } + } + else + { + Accept(prefixTokens); + var prefix = OutputAsMarkupLiteral(); + + // Literal value + // 'quote' should be "Unknown" if not quoted and tokens coming from the tokenizer should never have + // "Unknown" type. + var valueTokens = ReadWhile(token => + // These three conditions find separators which break the attribute value into portions + 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)); + Accept(valueTokens); + var value = OutputAsMarkupLiteral(); + + var literalAttributeValue = SyntaxFactory.MarkupLiteralAttributeValue(prefix, value); + builder.Add(literalAttributeValue); + } + } + + private bool IsEndOfAttributeValue(SyntaxKind quote, SyntaxToken token) + { + return EndOfFile || token == null || + (quote != SyntaxKind.Marker + ? token.Kind == quote // If quoted, just wait for the quote + : IsUnquotedEndOfAttributeValue(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.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 ParseJavascriptAndEndScriptTag(in SyntaxListBuilder builder, AcceptedCharactersInternal endTagAcceptedCharacters = AcceptedCharactersInternal.Any) @@ -811,6 +1170,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } + private bool IsConditionalAttributeName(string name) + { + var attributeCanBeConditional = + Context.FeatureFlags.EXPERIMENTAL_AllowConditionalDataDashAttributes || + !name.StartsWith("data-", StringComparison.OrdinalIgnoreCase); + return attributeCanBeConditional; + } + private void OtherParserBlock(in SyntaxListBuilder builder) { AcceptMarkerTokenIfNecessary(); @@ -860,6 +1227,38 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return token.Kind == SyntaxKind.Text && token.Content == "-"; } + internal static bool IsValidAttributeNameToken(SyntaxToken token) + { + if (token == null) + { + return false; + } + + // These restrictions cover most of the spec defined: http://www.w3.org/TR/html5/syntax.html#attributes-0 + // 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.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.Marker; + } + + private static bool IsTagRecoveryStopPoint(SyntaxToken token) + { + return token.Kind == SyntaxKind.CloseAngle || + token.Kind == SyntaxKind.ForwardSlash || + token.Kind == SyntaxKind.OpenAngle || + token.Kind == SyntaxKind.SingleQuote || + token.Kind == SyntaxKind.DoubleQuote; + } + private void DefaultMarkupSpanContext(SpanContextBuilder spanContext) { spanContext.ChunkGenerator = new MarkupChunkGenerator(); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/RazorSyntaxTreeExtensions.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/RazorSyntaxTreeExtensions.cs index 2a3d016224..de1945316e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/RazorSyntaxTreeExtensions.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/RazorSyntaxTreeExtensions.cs @@ -16,8 +16,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy throw new ArgumentNullException(nameof(syntaxTree)); } + var rewriter = new ClassifiedSpanRewriter(); + var rewritten = rewriter.Visit(syntaxTree.Root); var visitor = new ClassifiedSpanVisitor(syntaxTree.Source); - visitor.Visit(syntaxTree.Root); + visitor.Visit(rewritten); return visitor.ClassifiedSpans; } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/TagHelperBlockRewriter.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/TagHelperBlockRewriter.cs index 421485fdcc..4c11269695 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/TagHelperBlockRewriter.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/TagHelperBlockRewriter.cs @@ -107,29 +107,36 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy processedBoundAttributeNames); tagHelperBuilder.Add(result.RewrittenAttribute); } - else if (child is CSharpCodeBlockSyntax) + else if (child is MarkupMiscAttributeContentSyntax miscContent) { - // TODO: Accept more than just Markup attributes: https://github.com/aspnet/Razor/issues/96. - // Something like: - // - var location = new SourceSpan(child.GetSourceLocation(source), child.FullWidth); - var diagnostic = RazorDiagnosticFactory.CreateParsing_TagHelpersCannotHaveCSharpInTagDeclaration(location, tagName); - errorSink.OnError(diagnostic); - - result = null; - } - else if (child is MarkupTextLiteralSyntax) - { - // If the original span content was whitespace it ultimately means the tag - // that owns this "attribute" is malformed and is expecting a user to type a new attribute. - // ex: + var location = new SourceSpan(codeBlock.GetSourceLocation(source), codeBlock.FullWidth); + var diagnostic = RazorDiagnosticFactory.CreateParsing_TagHelpersCannotHaveCSharpInTagDeclaration(location, tagName); + errorSink.OnError(diagnostic); + break; + } + else + { + // If the original span content was whitespace it ultimately means the tag + // that owns this "attribute" is malformed and is expecting a user to type a new attribute. + // ex: + token.Kind == SyntaxKind.Whitespace || + (includeNewLines && token.Kind == SyntaxKind.NewLine)); + tokenFound = At(kind); + + PutCurrentBack(); + PutBack(whitespace); + EnsureCurrent(); + + return tokenFound; + } + protected bool EnsureCurrent() { if (CurrentToken == null) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Internal.Generated.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Internal.Generated.cs index 1849a7b410..b495c48787 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Internal.Generated.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Internal.Generated.cs @@ -1176,6 +1176,87 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax } } + internal sealed partial class MarkupMiscAttributeContentSyntax : MarkupSyntaxNode + { + private readonly GreenNode _children; + + internal MarkupMiscAttributeContentSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 1; + if (children != null) + { + AdjustFlagsAndWidth(children); + _children = children; + } + } + + + internal MarkupMiscAttributeContentSyntax(SyntaxKind kind, GreenNode children) + : base(kind) + { + SlotCount = 1; + if (children != null) + { + AdjustFlagsAndWidth(children); + _children = children; + } + } + + public SyntaxList Children { get { return new SyntaxList(_children); } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _children; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.MarkupMiscAttributeContentSyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitMarkupMiscAttributeContent(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitMarkupMiscAttributeContent(this); + } + + public MarkupMiscAttributeContentSyntax Update(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList children) + { + if (children != Children) + { + var newNode = SyntaxFactory.MarkupMiscAttributeContent(children); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new MarkupMiscAttributeContentSyntax(Kind, _children, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new MarkupMiscAttributeContentSyntax(Kind, _children, GetDiagnostics(), annotations); + } + } + internal sealed partial class MarkupLiteralAttributeValueSyntax : MarkupSyntaxNode { private readonly MarkupTextLiteralSyntax _prefix; @@ -3282,6 +3363,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax return DefaultVisit(node); } + public virtual TResult VisitMarkupMiscAttributeContent(MarkupMiscAttributeContentSyntax node) + { + return DefaultVisit(node); + } + public virtual TResult VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) { return DefaultVisit(node); @@ -3466,6 +3552,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax DefaultVisit(node); } + public virtual void VisitMarkupMiscAttributeContent(MarkupMiscAttributeContentSyntax node) + { + DefaultVisit(node); + } + public virtual void VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) { DefaultVisit(node); @@ -3673,6 +3764,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax return node.Update(namePrefix, name, nameSuffix, equalsToken, valuePrefix, value, valueSuffix); } + public override GreenNode VisitMarkupMiscAttributeContent(MarkupMiscAttributeContentSyntax node) + { + var children = VisitList(node.Children); + return node.Update(children); + } + public override GreenNode VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) { var prefix = (MarkupTextLiteralSyntax)Visit(node.Prefix); @@ -3987,6 +4084,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax return new MarkupAttributeBlockSyntax(SyntaxKind.MarkupAttributeBlock, namePrefix, name, nameSuffix, equalsToken, valuePrefix, value, valueSuffix); } + public static MarkupMiscAttributeContentSyntax MarkupMiscAttributeContent(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList children) + { + var result = new MarkupMiscAttributeContentSyntax(SyntaxKind.MarkupMiscAttributeContent, children.Node); + + return result; + } + public static MarkupLiteralAttributeValueSyntax MarkupLiteralAttributeValue(MarkupTextLiteralSyntax prefix, MarkupTextLiteralSyntax value) { var result = new MarkupLiteralAttributeValueSyntax(SyntaxKind.MarkupLiteralAttributeValue, prefix, value); @@ -4235,6 +4339,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax typeof(MarkupTagBlockSyntax), typeof(MarkupMinimizedAttributeBlockSyntax), typeof(MarkupAttributeBlockSyntax), + typeof(MarkupMiscAttributeContentSyntax), typeof(MarkupLiteralAttributeValueSyntax), typeof(MarkupDynamicAttributeValueSyntax), typeof(MarkupElementSyntax), diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Main.Generated.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Main.Generated.cs index b3c122bb05..019d64dc8d 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Main.Generated.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Main.Generated.cs @@ -89,6 +89,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax return DefaultVisit(node); } + ///

Called when the visitor visits a MarkupMiscAttributeContentSyntax node. + public virtual TResult VisitMarkupMiscAttributeContent(MarkupMiscAttributeContentSyntax node) + { + return DefaultVisit(node); + } + /// Called when the visitor visits a MarkupLiteralAttributeValueSyntax node. public virtual TResult VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) { @@ -308,6 +314,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax DefaultVisit(node); } + /// Called when the visitor visits a MarkupMiscAttributeContentSyntax node. + public virtual void VisitMarkupMiscAttributeContent(MarkupMiscAttributeContentSyntax node) + { + DefaultVisit(node); + } + /// Called when the visitor visits a MarkupLiteralAttributeValueSyntax node. public virtual void VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) { @@ -538,6 +550,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax return node.Update(namePrefix, name, nameSuffix, equalsToken, valuePrefix, value, valueSuffix); } + public override SyntaxNode VisitMarkupMiscAttributeContent(MarkupMiscAttributeContentSyntax node) + { + var children = VisitList(node.Children); + return node.Update(children); + } + public override SyntaxNode VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) { var prefix = (MarkupTextLiteralSyntax)Visit(node.Prefix); @@ -905,6 +923,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax return SyntaxFactory.MarkupAttributeBlock(default(MarkupTextLiteralSyntax), SyntaxFactory.MarkupTextLiteral(), default(MarkupTextLiteralSyntax), SyntaxFactory.Token(SyntaxKind.Equals), default(MarkupTextLiteralSyntax), default(RazorBlockSyntax), default(MarkupTextLiteralSyntax)); } + /// Creates a new MarkupMiscAttributeContentSyntax instance. + public static MarkupMiscAttributeContentSyntax MarkupMiscAttributeContent(SyntaxList children) + { + return (MarkupMiscAttributeContentSyntax)InternalSyntax.SyntaxFactory.MarkupMiscAttributeContent(children.Node.ToGreenList()).CreateRed(); + } + + /// Creates a new MarkupMiscAttributeContentSyntax instance. + public static MarkupMiscAttributeContentSyntax MarkupMiscAttributeContent() + { + return SyntaxFactory.MarkupMiscAttributeContent(default(SyntaxList)); + } + /// Creates a new MarkupLiteralAttributeValueSyntax instance. public static MarkupLiteralAttributeValueSyntax MarkupLiteralAttributeValue(MarkupTextLiteralSyntax prefix, MarkupTextLiteralSyntax value) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Syntax.Generated.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Syntax.Generated.cs index 8196bdb0ea..4c0878d99f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Syntax.Generated.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Generated/Syntax.xml.Syntax.Generated.cs @@ -1133,6 +1133,75 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax } } + internal sealed partial class MarkupMiscAttributeContentSyntax : MarkupSyntaxNode + { + private SyntaxNode _children; + + internal MarkupMiscAttributeContentSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public SyntaxList Children + { + get + { + return new SyntaxList(GetRed(ref _children, 0)); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _children); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _children; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitMarkupMiscAttributeContent(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitMarkupMiscAttributeContent(this); + } + + public MarkupMiscAttributeContentSyntax Update(SyntaxList children) + { + if (children != Children) + { + var newNode = SyntaxFactory.MarkupMiscAttributeContent(children); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public MarkupMiscAttributeContentSyntax WithChildren(SyntaxList children) + { + return Update(children); + } + + public MarkupMiscAttributeContentSyntax AddChildren(params RazorSyntaxNode[] items) + { + return WithChildren(this.Children.AddRange(items)); + } + } + internal sealed partial class MarkupLiteralAttributeValueSyntax : MarkupSyntaxNode { private MarkupTextLiteralSyntax _prefix; diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Syntax.xml b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Syntax.xml index 7880c49622..bb0ae07673 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Syntax.xml +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/Syntax.xml @@ -86,6 +86,10 @@ + + + + @@ -99,7 +103,7 @@ - + diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxKind.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxKind.cs index 75dd554ab6..d8c68ec77e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxKind.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxKind.cs @@ -25,6 +25,7 @@ namespace Microsoft.AspNetCore.Razor.Language MarkupCommentBlock, MarkupAttributeBlock, MarkupMinimizedAttributeBlock, + MarkupMiscAttributeContent, MarkupLiteralAttributeValue, MarkupDynamicAttributeValue, MarkupTagHelperElement, diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxUtilities.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxUtilities.cs new file mode 100644 index 0000000000..e308c92934 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxUtilities.cs @@ -0,0 +1,46 @@ +// 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 SyntaxUtilities + { + public static MarkupTextLiteralSyntax MergeTextLiterals(params MarkupTextLiteralSyntax[] literalSyntaxes) + { + if (literalSyntaxes == null || literalSyntaxes.Length == 0) + { + return null; + } + + SyntaxNode parent = null; + var position = 0; + var seenFirstLiteral = false; + var builder = Syntax.InternalSyntax.SyntaxListBuilder.Create(); + + foreach (var syntax in literalSyntaxes) + { + if (syntax == null) + { + continue; + } + else if (!seenFirstLiteral) + { + // Set the parent and position of the merged literal to the value of the first non-null literal. + parent = syntax.Parent; + position = syntax.Position; + seenFirstLiteral = true; + } + + foreach (var token in syntax.LiteralTokens) + { + builder.Add(token.Green); + } + } + + var mergedLiteralSyntax = Syntax.InternalSyntax.SyntaxFactory.MarkupTextLiteral( + builder.ToList()); + + return (MarkupTextLiteralSyntax)mergedLiteralSyntax.CreateRed(parent, position); + } + } +}