Handle skipped trivia in the C# tokenizer (#11207)

* Handle skipped trivia in the C# tokenizer

Reaction to https://github.com/dotnet/roslyn/pull/75724. Will need to update to a version of Roslyn with this change to be able to test.

* Account for included newline

* Update versions

* Report an error when encountering a `#` in skipped tokens, new tests/update baselines

* More baselines

* Add test example
This commit is contained in:
Fred Silberberg 2024-11-16 08:35:12 -08:00 коммит произвёл GitHub
Родитель 1676deca77
Коммит 4d7ed74cf4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
53 изменённых файлов: 989 добавлений и 147 удалений

Просмотреть файл

@ -6,8 +6,8 @@
-->
<PropertyGroup>
<_MicrosoftWebToolsPackageVersion>17.11.11-preview-0001</_MicrosoftWebToolsPackageVersion>
<_MicrosoftVisualStudioShellPackagesVersion>17.11.39721</_MicrosoftVisualStudioShellPackagesVersion>
<_MicrosoftVisualStudioPackagesVersion>17.11.191</_MicrosoftVisualStudioPackagesVersion>
<_MicrosoftVisualStudioShellPackagesVersion>17.12.39557-preview.2.1</_MicrosoftVisualStudioShellPackagesVersion>
<_MicrosoftVisualStudioPackagesVersion>17.12.145-preview</_MicrosoftVisualStudioPackagesVersion>
<_VisualStudioLanguageServerProtocolVersion>17.12.1-preview</_VisualStudioLanguageServerProtocolVersion>
<_MicrosoftExtensionsPackageVersion>8.0.0</_MicrosoftExtensionsPackageVersion>
<_BasicReferenceAssembliesVersion>1.7.2</_BasicReferenceAssembliesVersion>
@ -17,7 +17,7 @@
<_RoslynDiagnosticAnalyzersPackageVersion>3.11.0-beta1.24508.2</_RoslynDiagnosticAnalyzersPackageVersion>
<_MicrosoftVisualStudioLanguageServicesPackageVersion>$(MicrosoftVisualStudioLanguageServicesPackageVersion)</_MicrosoftVisualStudioLanguageServicesPackageVersion>
<_XunitPackageVersion>2.6.6</_XunitPackageVersion>
<_MicrosoftBuildPackageVersion>17.11.0-preview-24309-01</_MicrosoftBuildPackageVersion>
<_MicrosoftBuildPackageVersion>17.12.0-preview-24426-07</_MicrosoftBuildPackageVersion>
</PropertyGroup>
<ItemGroup>
@ -85,14 +85,14 @@
<PackageVersion Include="Microsoft.VisualStudio.LanguageServices.Implementation.Symbols" Version="$(_MicrosoftVisualStudioLanguageServicesPackageVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.LiveShare" Version="0.3.1074" />
<PackageVersion Include="Microsoft.VisualStudio.ProjectSystem.SDK" Version="17.7.294-pre" />
<PackageVersion Include="Microsoft.VisualStudio.RpcContracts" Version="17.11.8" />
<PackageVersion Include="Microsoft.VisualStudio.RpcContracts" Version="17.12.11-preview" />
<PackageVersion Include="Microsoft.VisualStudio.Shell.Framework" Version="$(_MicrosoftVisualStudioShellPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Shell.15.0" Version="$(_MicrosoftVisualStudioShellPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Telemetry" Version="17.13.14" />
<PackageVersion Include="Microsoft.VisualStudio.Text.Data" Version="$(_MicrosoftVisualStudioPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Text.Implementation" Version="$(_MicrosoftVisualStudioPackagesVersion)" NoWarn="NU1701" />
<PackageVersion Include="Microsoft.VisualStudio.Text.Logic" Version="$(_MicrosoftVisualStudioPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.11.20" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.12.13-preview" />
<PackageVersion Include="Microsoft.VisualStudio.Validation" Version="17.8.8" />
<PackageVersion Include="Microsoft.VisualStudio.Web" Version="16.10.0-preview-1-31008-014" />
<PackageVersion Include="Microsoft.WebTools.Languages.Html" Version="$(_MicrosoftWebToolsPackageVersion)" />
@ -104,12 +104,12 @@
<PackageVersion Include="Microsoft.WebTools.Shared" Version="$(_MicrosoftWebToolsPackageVersion)" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Nerdbank.Streams" Version="2.11.74" />
<PackageVersion Include="Nerdbank.Streams" Version="2.11.79" />
<PackageVersion Include="NuGet.VisualStudio" Version="17.9.1" />
<PackageVersion Include="Roslyn.Diagnostics.Analyzers" Version="$(_RoslynDiagnosticAnalyzersPackageVersion)" />
<PackageVersion Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutablePackageVersion)" />
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataPackageVersion)" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="7.0.1" />

Просмотреть файл

@ -11,82 +11,82 @@
<Sha>1ebd9ce245112164207d961c0d2faea741c7c489</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CommonLanguageServerProtocol.Framework" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CommonLanguageServerProtocol.Framework" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.Razor" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.Razor" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Common" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.Common" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.EditorFeatures" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.EditorFeatures" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Features" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Features" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Common" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Common" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Wpf" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Wpf" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Remote.ServiceHub" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.Remote.ServiceHub" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.VisualStudio.LanguageServices" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.VisualStudio.LanguageServices" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Test.Utilities" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.CodeAnalysis.Test.Utilities" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-2.24554.8">
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-2.24564.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>8fc87e00bbe35131f7d3707621ae18e1af1aae55</Sha>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
</ProductDependencies>

Просмотреть файл

@ -53,25 +53,25 @@
<MicrosoftSourceBuildIntermediatearcadePackageVersion>9.0.0-beta.24562.13</MicrosoftSourceBuildIntermediatearcadePackageVersion>
<MicrosoftDotNetXliffTasksPackageVersion>1.0.0-beta.23475.1</MicrosoftDotNetXliffTasksPackageVersion>
<MicrosoftSourceBuildIntermediatexlifftasksPackageVersion>1.0.0-beta.23475.1</MicrosoftSourceBuildIntermediatexlifftasksPackageVersion>
<MicrosoftNetCompilersToolsetPackageVersion>4.13.0-2.24554.8</MicrosoftNetCompilersToolsetPackageVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>4.13.0-2.24554.8</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
<MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>
<MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>
<MicrosoftCodeAnalysisTestUtilitiesPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisTestUtilitiesPackageVersion>
<MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.13.0-2.24554.8</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftSourceBuildIntermediateroslynPackageVersion>4.13.0-2.24554.8</MicrosoftSourceBuildIntermediateroslynPackageVersion>
<MicrosoftVisualStudioLanguageServicesPackageVersion>4.13.0-2.24554.8</MicrosoftVisualStudioLanguageServicesPackageVersion>
<MicrosoftNetCompilersToolsetPackageVersion>4.13.0-2.24564.3</MicrosoftNetCompilersToolsetPackageVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>4.13.0-2.24564.3</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
<MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>
<MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>
<MicrosoftCodeAnalysisTestUtilitiesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisTestUtilitiesPackageVersion>
<MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftSourceBuildIntermediateroslynPackageVersion>4.13.0-2.24564.3</MicrosoftSourceBuildIntermediateroslynPackageVersion>
<MicrosoftVisualStudioLanguageServicesPackageVersion>4.13.0-2.24564.3</MicrosoftVisualStudioLanguageServicesPackageVersion>
<!--
Exception - Microsoft.Extensions.ObjectPool and System.Collections.Immutable packages are not updated by automation,
but are present in Version.Details.xml for source-build PVP flow. See the comment in Version.Details.xml for more information.

Просмотреть файл

@ -221,24 +221,18 @@ public class ComponentPreprocessorDirectiveTest(bool designTime = false)
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated,
// x:\dir\subdir\Test\TestComponent.cshtml(2,9): error CS1040: Preprocessor directives must appear as the first non-whitespace character on a line
// x:\dir\subdir\Test\TestComponent.razor(2,9): error CS1040: Preprocessor directives must appear as the first non-whitespace character on a line
// var x = #if true;
Diagnostic(ErrorCode.ERR_BadDirectivePlacement, "#").WithLocation(2, 9),
// x:\dir\subdir\Test\TestComponent.cshtml(2,17): error CS1025: Single-line comment or end-of-line expected
// var x = #if true;
Diagnostic(ErrorCode.ERR_EndOfPPLineExpected, ";").WithLocation(2, 17),
// x:\dir\subdir\Test\TestComponent.cshtml(5,1): error CS0841: Cannot use local variable 'x' before it is declared
// x:\dir\subdir\Test\TestComponent.razor(5,1): error CS0841: Cannot use local variable 'x' before it is declared
// x #endif;
Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x").WithArguments("x").WithLocation(5, 1),
// x:\dir\subdir\Test\TestComponent.cshtml(5,2): error CS1002: ; expected
// x:\dir\subdir\Test\TestComponent.razor(5,2): error CS1002: ; expected
// x #endif;
Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(5, 2),
// x:\dir\subdir\Test\TestComponent.cshtml(5,3): error CS1040: Preprocessor directives must appear as the first non-whitespace character on a line
// x:\dir\subdir\Test\TestComponent.razor(5,3): error CS1040: Preprocessor directives must appear as the first non-whitespace character on a line
// x #endif;
Diagnostic(ErrorCode.ERR_BadDirectivePlacement, "#").WithLocation(5, 3),
// x:\dir\subdir\Test\TestComponent.cshtml(5,9): error CS1025: Single-line comment or end-of-line expected
// x #endif;
Diagnostic(ErrorCode.ERR_EndOfPPLineExpected, ";").WithLocation(5, 9));
Diagnostic(ErrorCode.ERR_BadDirectivePlacement, "#").WithLocation(5, 3));
}
[IntegrationTestFact]
@ -365,6 +359,25 @@ public class ComponentPreprocessorDirectiveTest(bool designTime = false)
CompileToAssembly(generated);
}
[IntegrationTestFact]
public void StartOfLine_12()
{
var generated = CompileToCSharp("""
@{ #if true
var x = 1;
#endif
}
""");
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated,
// x:\dir\subdir\Test\TestComponent.razor(2,9): warning CS0219: The variable 'x' is assigned but its value is never used
// var x = 1;
Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "x").WithArguments("x").WithLocation(2, 9)
);
}
[IntegrationTestFact]
public void MisplacedEndingDirective_01()
{

Просмотреть файл

@ -396,4 +396,92 @@ public class CSharpPreprocessorTest() : ParserTestBase(layer: TestProject.Layer.
}
""");
}
[Fact]
public void DirectiveAfterCSharpCode_01()
{
ParseDocumentTest("""
@{
var x = #if true
var y = 1;
}
""");
}
[Fact]
public void DirectiveAfterCSharpCode_02()
{
ParseDocumentTest("""
@{
var x = #if true
<div>Test</div>
}
""");
}
[Fact]
public void DirectiveAfterCSharpCode_03()
{
ParseDocumentTest("""
@{
var x = #if true;
var y = 1;
}
""");
}
[Fact]
public void DirectiveAfterCSharpCode_04()
{
ParseDocumentTest("""
@{
var x = #if true;
<div>Test</div>
}
""");
}
[Fact]
public void DirectiveAfterCSharpCode_05()
{
ParseDocumentTest("""
@{
if (true) #if true
var y = 1;
}
""");
}
[Fact]
public void DirectiveAfterCSharpCode_06()
{
ParseDocumentTest("""
@{
if (true) #if true
<div>Test</div>
}
""");
}
[Fact]
public void DirectiveAfterCSharpCode_07()
{
ParseDocumentTest("""
@{
if (true #if true)
var y = 1;
}
""");
}
[Fact]
public void DirectiveAfterCSharpCode_08()
{
ParseDocumentTest("""
@{
if (true #if true)
<div>Test</div>
}
""");
}
}

Просмотреть файл

@ -1,18 +1,18 @@
Source Location: (2:0,2 [13] x:\dir\subdir\Test\TestComponent.razor)
Source Location: (2:0,2 [13] x:\dir\subdir\Test\TestComponent.razor)
|
#if true
|
Generated Location: (986:28,2 [13] )
|
Generated Location: (986:28,2 [13] )
|
#if true
|
Source Location: (20:3,2 [11] x:\dir\subdir\Test\TestComponent.razor)
|
Source Location: (20:3,2 [11] x:\dir\subdir\Test\TestComponent.razor)
|
#endif
|
Generated Location: (1120:36,2 [11] )
|
Generated Location: (1120:36,2 [11] )
|
#endif
|
|

Просмотреть файл

@ -0,0 +1,40 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line default
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.Threading.Tasks;
using global::Microsoft.AspNetCore.Components;
#line default
#line hidden
#nullable restore
public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase
#nullable disable
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.razor"
#if true
var x = 1;
#endif
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
}
}
#pragma warning restore 1591

Просмотреть файл

@ -0,0 +1 @@
x:\dir\subdir\Test\TestComponent.razor(1,4): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,18 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [20] ) - global::System
UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic
UsingDirective - (69:3,1 [25] ) - global::System.Linq
UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks
UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components
ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode - (2:0,2 [39] x:\dir\subdir\Test\TestComponent.razor)
LazyIntermediateToken - (2:0,2 [39] x:\dir\subdir\Test\TestComponent.razor) - CSharp - #if true\n var x = 1;\n #endif\n

Просмотреть файл

@ -0,0 +1,11 @@
Source Location: (2:0,2 [39] x:\dir\subdir\Test\TestComponent.razor)
| #if true
var x = 1;
#endif
|
Generated Location: (986:28,2 [39] )
| #if true
var x = 1;
#endif
|

Просмотреть файл

@ -1,18 +1,18 @@
Source Location: (2:0,2 [13] x:\dir\subdir\Test\TestComponent.razor)
Source Location: (2:0,2 [13] x:\dir\subdir\Test\TestComponent.razor)
|
#if true
|
Generated Location: (733:21,0 [13] )
|
Generated Location: (733:21,0 [13] )
|
#if true
|
Source Location: (20:3,2 [11] x:\dir\subdir\Test\TestComponent.razor)
|
Source Location: (20:3,2 [11] x:\dir\subdir\Test\TestComponent.razor)
|
#endif
|
Generated Location: (877:30,0 [11] )
|
Generated Location: (877:30,0 [11] )
|
#endif
|
|

Просмотреть файл

@ -0,0 +1,34 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line default
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.Threading.Tasks;
using global::Microsoft.AspNetCore.Components;
#line default
#line hidden
#nullable restore
public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase
#nullable disable
{
#pragma warning disable 1998
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
#nullable restore
#line (1,3)-(4,1) "x:\dir\subdir\Test\TestComponent.razor"
#if true
var x = 1;
#endif
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
}
}
#pragma warning restore 1591

Просмотреть файл

@ -0,0 +1 @@
x:\dir\subdir\Test\TestComponent.razor(1,4): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,11 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [20] ) - global::System
UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic
UsingDirective - (69:3,1 [25] ) - global::System.Linq
UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks
UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components
ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode - (2:0,2 [39] x:\dir\subdir\Test\TestComponent.razor)
LazyIntermediateToken - (2:0,2 [39] x:\dir\subdir\Test\TestComponent.razor) - CSharp - #if true\n var x = 1;\n #endif\n

Просмотреть файл

@ -0,0 +1,11 @@
Source Location: (2:0,2 [39] x:\dir\subdir\Test\TestComponent.razor)
| #if true
var x = 1;
#endif
|
Generated Location: (733:21,0 [39] )
| #if true
var x = 1;
#endif
|

Просмотреть файл

@ -0,0 +1,6 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [43] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [43] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [43] )
Code span at (2:0,2 [40] ) - Parent: Statement block at (0:0,0 [43] )
MetaCode span at (42:3,0 [1] ) - Parent: Statement block at (0:0,0 [43] )
Markup span at (43:3,1 [0] ) - Parent: Markup block at (0:0,0 [43] )

Просмотреть файл

@ -0,0 +1 @@
(2,13): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,37 @@
RazorDocument - [0..43)::43 - [@{LF var x = #if trueLF var y = 1;LF}]
MarkupBlock - [0..43)::43
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..43)::43
CSharpStatement - [0..43)::43
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..43)::42
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..42)::40
CSharpStatementLiteral - [2..42)::40 - [LF var x = #if trueLF var y = 1;LF] - Gen<Stmt>
NewLine;[LF];
Whitespace;[ ];
Keyword;[var];
Whitespace;[ ];
Identifier;[x];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
CSharpComment;[#if trueLF];RZ1043(16:1,12 [10] )
Whitespace;[ ];
Keyword;[var];
Whitespace;[ ];
Identifier;[y];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
NumericLiteral;[1];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [42..43)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [43..43)::0 - [] - Gen<Markup>
Marker;[];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1,6 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [48] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [48] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [48] )
Code span at (2:0,2 [45] ) - Parent: Statement block at (0:0,0 [48] )
MetaCode span at (47:3,0 [1] ) - Parent: Statement block at (0:0,0 [48] )
Markup span at (48:3,1 [0] ) - Parent: Markup block at (0:0,0 [48] )

Просмотреть файл

@ -0,0 +1 @@
(2,13): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,37 @@
RazorDocument - [0..48)::48 - [@{LF var x = #if trueLF <div>Test</div>LF}]
MarkupBlock - [0..48)::48
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..48)::48
CSharpStatement - [0..48)::48
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..48)::47
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..47)::45
CSharpStatementLiteral - [2..47)::45 - [LF var x = #if trueLF <div>Test</div>LF] - Gen<Stmt>
NewLine;[LF];
Whitespace;[ ];
Keyword;[var];
Whitespace;[ ];
Identifier;[x];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
CSharpComment;[#if trueLF];RZ1043(16:1,12 [10] )
Whitespace;[ ];
LessThan;[<];
Identifier;[div];
GreaterThan;[>];
Identifier;[Test];
LessThan;[<];
CSharpOperator;[/];
Identifier;[div];
GreaterThan;[>];
NewLine;[LF];
RazorMetaCode - [47..48)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [48..48)::0 - [] - Gen<Markup>
Marker;[];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1,6 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [44] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [44] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [44] )
Code span at (2:0,2 [41] ) - Parent: Statement block at (0:0,0 [44] )
MetaCode span at (43:3,0 [1] ) - Parent: Statement block at (0:0,0 [44] )
Markup span at (44:3,1 [0] ) - Parent: Markup block at (0:0,0 [44] )

Просмотреть файл

@ -0,0 +1 @@
(2,13): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,37 @@
RazorDocument - [0..44)::44 - [@{LF var x = #if true;LF var y = 1;LF}]
MarkupBlock - [0..44)::44
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..44)::44
CSharpStatement - [0..44)::44
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..44)::43
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..43)::41
CSharpStatementLiteral - [2..43)::41 - [LF var x = #if true;LF var y = 1;LF] - Gen<Stmt>
NewLine;[LF];
Whitespace;[ ];
Keyword;[var];
Whitespace;[ ];
Identifier;[x];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
CSharpComment;[#if true;LF];RZ1043(16:1,12 [11] )
Whitespace;[ ];
Keyword;[var];
Whitespace;[ ];
Identifier;[y];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
NumericLiteral;[1];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [43..44)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [44..44)::0 - [] - Gen<Markup>
Marker;[];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1,6 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [49] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [49] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [49] )
Code span at (2:0,2 [46] ) - Parent: Statement block at (0:0,0 [49] )
MetaCode span at (48:3,0 [1] ) - Parent: Statement block at (0:0,0 [49] )
Markup span at (49:3,1 [0] ) - Parent: Markup block at (0:0,0 [49] )

Просмотреть файл

@ -0,0 +1 @@
(2,13): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,37 @@
RazorDocument - [0..49)::49 - [@{LF var x = #if true;LF <div>Test</div>LF}]
MarkupBlock - [0..49)::49
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..49)::49
CSharpStatement - [0..49)::49
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..49)::48
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..48)::46
CSharpStatementLiteral - [2..48)::46 - [LF var x = #if true;LF <div>Test</div>LF] - Gen<Stmt>
NewLine;[LF];
Whitespace;[ ];
Keyword;[var];
Whitespace;[ ];
Identifier;[x];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
CSharpComment;[#if true;LF];RZ1043(16:1,12 [11] )
Whitespace;[ ];
LessThan;[<];
Identifier;[div];
GreaterThan;[>];
Identifier;[Test];
LessThan;[<];
CSharpOperator;[/];
Identifier;[div];
GreaterThan;[>];
NewLine;[LF];
RazorMetaCode - [48..49)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [49..49)::0 - [] - Gen<Markup>
Marker;[];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1,6 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [49] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [49] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [49] )
Code span at (2:0,2 [46] ) - Parent: Statement block at (0:0,0 [49] )
MetaCode span at (48:3,0 [1] ) - Parent: Statement block at (0:0,0 [49] )
Markup span at (49:3,1 [0] ) - Parent: Markup block at (0:0,0 [49] )

Просмотреть файл

@ -0,0 +1 @@
(2,15): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,37 @@
RazorDocument - [0..49)::49 - [@{LF if (true) #if trueLF var y = 1;LF}]
MarkupBlock - [0..49)::49
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..49)::49
CSharpStatement - [0..49)::49
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..49)::48
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..48)::46
CSharpStatementLiteral - [2..48)::46 - [LF if (true) #if trueLF var y = 1;LF] - Gen<Stmt>
NewLine;[LF];
Whitespace;[ ];
Keyword;[if];
Whitespace;[ ];
LeftParenthesis;[(];
Keyword;[true];
RightParenthesis;[)];
Whitespace;[ ];
CSharpComment;[#if trueLF];RZ1043(18:1,14 [10] )
Whitespace;[ ];
Keyword;[var];
Whitespace;[ ];
Identifier;[y];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
NumericLiteral;[1];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [48..49)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [49..49)::0 - [] - Gen<Markup>
Marker;[];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1,11 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [54] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [54] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [54] )
Code span at (2:0,2 [34] ) - Parent: Statement block at (0:0,0 [54] )
Markup span at (36:2,8 [5] ) - Parent: Tag block at (36:2,8 [5] )
Markup span at (41:2,13 [4] ) - Parent: Markup block at (36:2,8 [17] )
Markup span at (45:2,17 [6] ) - Parent: Tag block at (45:2,17 [6] )
Markup span at (51:2,23 [2] ) - Parent: Markup block at (36:2,8 [17] )
Code span at (53:3,0 [0] ) - Parent: Statement block at (0:0,0 [54] )
MetaCode span at (53:3,0 [1] ) - Parent: Statement block at (0:0,0 [54] )
Markup span at (54:3,1 [0] ) - Parent: Markup block at (0:0,0 [54] )

Просмотреть файл

@ -0,0 +1,2 @@
(2,15): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(3,9): Error RZ1008: Single-statement control-flow statements in Razor documents statements cannot contain markup. Markup should be enclosed in "{" and "}".

Просмотреть файл

@ -0,0 +1,45 @@
RazorDocument - [0..54)::54 - [@{LF if (true) #if trueLF <div>Test</div>LF}]
MarkupBlock - [0..54)::54
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..54)::54
CSharpStatement - [0..54)::54
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..54)::53
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..53)::51
CSharpStatementLiteral - [2..36)::34 - [LF if (true) #if trueLF ] - Gen<Stmt>
NewLine;[LF];
Whitespace;[ ];
Keyword;[if];
Whitespace;[ ];
LeftParenthesis;[(];
Keyword;[true];
RightParenthesis;[)];
Whitespace;[ ];
CSharpComment;[#if trueLF];RZ1043(18:1,14 [10] )
Whitespace;[ ];
MarkupBlock - [36..53)::17
MarkupElement - [36..51)::15
MarkupStartTag - [36..41)::5 - [<div>] - Gen<Markup>
OpenAngle;[<];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [41..45)::4 - [Test] - Gen<Markup>
Text;[Test];
MarkupEndTag - [45..51)::6 - [</div>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [51..53)::2 - [LF] - Gen<Markup>
NewLine;[LF];
CSharpStatementLiteral - [53..53)::0 - [] - Gen<Stmt>
Marker;[];
RazorMetaCode - [53..54)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [54..54)::0 - [] - Gen<Markup>
Marker;[];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1,6 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [49] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [49] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [49] )
Code span at (2:0,2 [46] ) - Parent: Statement block at (0:0,0 [49] )
MetaCode span at (48:3,0 [1] ) - Parent: Statement block at (0:0,0 [49] )
Markup span at (49:3,1 [0] ) - Parent: Markup block at (0:0,0 [49] )

Просмотреть файл

@ -0,0 +1,2 @@
(2,8): Error RZ1027: An opening "(" is missing the corresponding closing ")".
(2,14): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,36 @@
RazorDocument - [0..49)::49 - [@{LF if (true #if true)LF var y = 1;LF}]
MarkupBlock - [0..49)::49
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..49)::49
CSharpStatement - [0..49)::49
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..49)::48
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..48)::46
CSharpStatementLiteral - [2..48)::46 - [LF if (true #if true)LF var y = 1;LF] - Gen<Stmt>
NewLine;[LF];
Whitespace;[ ];
Keyword;[if];
Whitespace;[ ];
LeftParenthesis;[(];
Keyword;[true];
Whitespace;[ ];
CSharpComment;[#if true)LF];RZ1043(17:1,13 [11] )
Whitespace;[ ];
Keyword;[var];
Whitespace;[ ];
Identifier;[y];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
NumericLiteral;[1];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [48..49)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [49..49)::0 - [] - Gen<Markup>
Marker;[];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1,6 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [54] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [54] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [54] )
Code span at (2:0,2 [51] ) - Parent: Statement block at (0:0,0 [54] )
MetaCode span at (53:3,0 [1] ) - Parent: Statement block at (0:0,0 [54] )
Markup span at (54:3,1 [0] ) - Parent: Markup block at (0:0,0 [54] )

Просмотреть файл

@ -0,0 +1,2 @@
(2,8): Error RZ1027: An opening "(" is missing the corresponding closing ")".
(2,14): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.

Просмотреть файл

@ -0,0 +1,36 @@
RazorDocument - [0..54)::54 - [@{LF if (true #if true)LF <div>Test</div>LF}]
MarkupBlock - [0..54)::54
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..54)::54
CSharpStatement - [0..54)::54
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..54)::53
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..53)::51
CSharpStatementLiteral - [2..53)::51 - [LF if (true #if true)LF <div>Test</div>LF] - Gen<Stmt>
NewLine;[LF];
Whitespace;[ ];
Keyword;[if];
Whitespace;[ ];
LeftParenthesis;[(];
Keyword;[true];
Whitespace;[ ];
CSharpComment;[#if true)LF];RZ1043(17:1,13 [11] )
Whitespace;[ ];
LessThan;[<];
Identifier;[div];
GreaterThan;[>];
Identifier;[Test];
LessThan;[<];
CSharpOperator;[/];
Identifier;[div];
GreaterThan;[>];
NewLine;[LF];
RazorMetaCode - [53..54)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [54..54)::0 - [] - Gen<Markup>
Marker;[];
EndOfFile;[];

Просмотреть файл

@ -14,6 +14,18 @@ Markup span at (44:5,0 [6] ) - Parent: Tag block at (44:5,0 [6] )
Markup span at (50:5,6 [2] ) - Parent: Markup block at (0:0,0 [119] )
Transition span at (52:6,0 [1] ) - Parent: Statement block at (52:6,0 [67] )
MetaCode span at (53:6,1 [1] ) - Parent: Statement block at (52:6,0 [67] )
Code span at (54:6,2 [64] ) - Parent: Statement block at (52:6,0 [67] )
MetaCode span at (118:12,0 [1] ) - Parent: Statement block at (52:6,0 [67] )
Markup span at (119:12,1 [0] ) - Parent: Markup block at (0:0,0 [119] )
Code span at (54:6,2 [16] ) - Parent: Statement block at (52:6,0 [67] )
Markup span at (70:7,0 [5] ) - Parent: Tag block at (70:7,0 [5] )
Markup span at (75:7,5 [6] ) - Parent: Markup block at (70:7,0 [36] )
Markup span at (81:8,4 [3] ) - Parent: Tag block at (81:8,4 [3] )
Markup span at (84:8,7 [8] ) - Parent: Markup block at (70:7,0 [36] )
Markup span at (92:8,15 [4] ) - Parent: Tag block at (92:8,15 [4] )
Markup span at (96:8,19 [2] ) - Parent: Markup block at (70:7,0 [36] )
Markup span at (98:9,0 [6] ) - Parent: Tag block at (98:9,0 [6] )
Markup span at (104:9,6 [2] ) - Parent: Markup block at (70:7,0 [36] )
Code span at (106:10,0 [0] ) - Parent: Statement block at (52:6,0 [67] )
Transition span at (106:10,0 [1] ) - Parent: Statement block at (106:10,0 [13] )
MetaCode span at (107:10,1 [1] ) - Parent: Statement block at (106:10,0 [13] )
Code span at (108:10,2 [10] ) - Parent: Statement block at (106:10,0 [13] )
MetaCode span at (118:12,0 [1] ) - Parent: Statement block at (106:10,0 [13] )
Code span at (119:12,1 [0] ) - Parent: Statement block at (52:6,0 [67] )

Просмотреть файл

@ -1 +1,3 @@
(7,4): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(7,2): Error RZ1006: The code block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
(7,4): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(11,2): Error RZ1010: Unexpected "{" after "@" character. Once inside the body of a code block (@if {}, @{}, etc.) you do not need to use "@{" to switch to code.

Просмотреть файл

@ -53,14 +53,57 @@
CSharpStatementBody - [53..119)::66
RazorMetaCode - [53..54)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [54..118)::64
CSharpStatementLiteral - [54..118)::64 - [ #elif false }LF<div>LF <p>Content2</p>LF</div>LF@{LF#endifLF] - Gen<Stmt>
CSharpCodeBlock - [54..119)::65
CSharpStatementLiteral - [54..70)::16 - [ #elif false }LF] - Gen<Stmt>
Whitespace;[ ];
CSharpDirective;[#elif false }LF];RZ1043(55:6,3 [15] )
CSharpDisabledText;[<div>LF <p>Content2</p>LF</div>LF@{LF];
CSharpDirective;[#endifLF];
RazorMetaCode - [118..119)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [119..119)::0 - [] - Gen<Markup>
Marker;[];
CSharpComment;[#elif false }LF];RZ1043(55:6,3 [15] )
MarkupBlock - [70..106)::36
MarkupElement - [70..104)::34
MarkupStartTag - [70..75)::5 - [<div>] - Gen<Markup>
OpenAngle;[<];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [75..81)::6 - [LF ] - Gen<Markup>
NewLine;[LF];
Whitespace;[ ];
MarkupElement - [81..96)::15
MarkupStartTag - [81..84)::3 - [<p>] - Gen<Markup>
OpenAngle;[<];
Text;[p];
CloseAngle;[>];
MarkupTextLiteral - [84..92)::8 - [Content2] - Gen<Markup>
Text;[Content2];
MarkupEndTag - [92..96)::4 - [</p>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[p];
CloseAngle;[>];
MarkupTextLiteral - [96..98)::2 - [LF] - Gen<Markup>
NewLine;[LF];
MarkupEndTag - [98..104)::6 - [</div>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [104..106)::2 - [LF] - Gen<Markup>
NewLine;[LF];
CSharpStatementLiteral - [106..106)::0 - [] - Gen<Stmt>
Marker;[];
CSharpCodeBlock - [106..119)::13
CSharpStatement - [106..119)::13
CSharpTransition - [106..107)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [107..119)::12
RazorMetaCode - [107..108)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [108..118)::10
CSharpStatementLiteral - [108..118)::10 - [LF#endifLF] - Gen<Stmt>
NewLine;[LF];
CSharpDirective;[#endifLF];
RazorMetaCode - [118..119)::1 - Gen<None>
RightBrace;[}];
CSharpStatementLiteral - [119..119)::0 - [] - Gen<Stmt>
Marker;[];
RazorMetaCode - [119..119)::0 - Gen<None>
RightBrace;[<Missing>];
EndOfFile;[];

Просмотреть файл

@ -14,6 +14,18 @@ Markup span at (44:5,0 [6] ) - Parent: Tag block at (44:5,0 [6] )
Markup span at (50:5,6 [2] ) - Parent: Markup block at (0:0,0 [113] )
Transition span at (52:6,0 [1] ) - Parent: Statement block at (52:6,0 [61] )
MetaCode span at (53:6,1 [1] ) - Parent: Statement block at (52:6,0 [61] )
Code span at (54:6,2 [58] ) - Parent: Statement block at (52:6,0 [61] )
MetaCode span at (112:12,0 [1] ) - Parent: Statement block at (52:6,0 [61] )
Markup span at (113:12,1 [0] ) - Parent: Markup block at (0:0,0 [113] )
Code span at (54:6,2 [10] ) - Parent: Statement block at (52:6,0 [61] )
Markup span at (64:7,0 [5] ) - Parent: Tag block at (64:7,0 [5] )
Markup span at (69:7,5 [6] ) - Parent: Markup block at (64:7,0 [36] )
Markup span at (75:8,4 [3] ) - Parent: Tag block at (75:8,4 [3] )
Markup span at (78:8,7 [8] ) - Parent: Markup block at (64:7,0 [36] )
Markup span at (86:8,15 [4] ) - Parent: Tag block at (86:8,15 [4] )
Markup span at (90:8,19 [2] ) - Parent: Markup block at (64:7,0 [36] )
Markup span at (92:9,0 [6] ) - Parent: Tag block at (92:9,0 [6] )
Markup span at (98:9,6 [2] ) - Parent: Markup block at (64:7,0 [36] )
Code span at (100:10,0 [0] ) - Parent: Statement block at (52:6,0 [61] )
Transition span at (100:10,0 [1] ) - Parent: Statement block at (100:10,0 [13] )
MetaCode span at (101:10,1 [1] ) - Parent: Statement block at (100:10,0 [13] )
Code span at (102:10,2 [10] ) - Parent: Statement block at (100:10,0 [13] )
MetaCode span at (112:12,0 [1] ) - Parent: Statement block at (100:10,0 [13] )
Code span at (113:12,1 [0] ) - Parent: Statement block at (52:6,0 [61] )

Просмотреть файл

@ -1 +1,3 @@
(7,4): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(7,2): Error RZ1006: The code block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
(7,4): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(11,2): Error RZ1010: Unexpected "{" after "@" character. Once inside the body of a code block (@if {}, @{}, etc.) you do not need to use "@{" to switch to code.

Просмотреть файл

@ -53,14 +53,57 @@
CSharpStatementBody - [53..113)::60
RazorMetaCode - [53..54)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [54..112)::58
CSharpStatementLiteral - [54..112)::58 - [ #else }LF<div>LF <p>Content2</p>LF</div>LF@{LF#endifLF] - Gen<Stmt>
CSharpCodeBlock - [54..113)::59
CSharpStatementLiteral - [54..64)::10 - [ #else }LF] - Gen<Stmt>
Whitespace;[ ];
CSharpDirective;[#else }LF];RZ1043(55:6,3 [9] )
CSharpDisabledText;[<div>LF <p>Content2</p>LF</div>LF@{LF];
CSharpDirective;[#endifLF];
RazorMetaCode - [112..113)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [113..113)::0 - [] - Gen<Markup>
Marker;[];
CSharpComment;[#else }LF];RZ1043(55:6,3 [9] )
MarkupBlock - [64..100)::36
MarkupElement - [64..98)::34
MarkupStartTag - [64..69)::5 - [<div>] - Gen<Markup>
OpenAngle;[<];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [69..75)::6 - [LF ] - Gen<Markup>
NewLine;[LF];
Whitespace;[ ];
MarkupElement - [75..90)::15
MarkupStartTag - [75..78)::3 - [<p>] - Gen<Markup>
OpenAngle;[<];
Text;[p];
CloseAngle;[>];
MarkupTextLiteral - [78..86)::8 - [Content2] - Gen<Markup>
Text;[Content2];
MarkupEndTag - [86..90)::4 - [</p>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[p];
CloseAngle;[>];
MarkupTextLiteral - [90..92)::2 - [LF] - Gen<Markup>
NewLine;[LF];
MarkupEndTag - [92..98)::6 - [</div>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [98..100)::2 - [LF] - Gen<Markup>
NewLine;[LF];
CSharpStatementLiteral - [100..100)::0 - [] - Gen<Stmt>
Marker;[];
CSharpCodeBlock - [100..113)::13
CSharpStatement - [100..113)::13
CSharpTransition - [100..101)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [101..113)::12
RazorMetaCode - [101..102)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [102..112)::10
CSharpStatementLiteral - [102..112)::10 - [LF#endifLF] - Gen<Stmt>
NewLine;[LF];
CSharpDirective;[#endifLF];
RazorMetaCode - [112..113)::1 - Gen<None>
RightBrace;[}];
CSharpStatementLiteral - [113..113)::0 - [] - Gen<Stmt>
Marker;[];
RazorMetaCode - [113..113)::0 - Gen<None>
RightBrace;[<Missing>];
EndOfFile;[];

Просмотреть файл

@ -1,6 +1,18 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [64] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [64] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [64] )
Code span at (2:0,2 [61] ) - Parent: Statement block at (0:0,0 [64] )
MetaCode span at (63:6,0 [1] ) - Parent: Statement block at (0:0,0 [64] )
Markup span at (64:6,1 [0] ) - Parent: Markup block at (0:0,0 [64] )
Code span at (2:0,2 [14] ) - Parent: Statement block at (0:0,0 [64] )
Markup span at (16:1,0 [5] ) - Parent: Tag block at (16:1,0 [5] )
Markup span at (21:1,5 [6] ) - Parent: Markup block at (16:1,0 [35] )
Markup span at (27:2,4 [3] ) - Parent: Tag block at (27:2,4 [3] )
Markup span at (30:2,7 [7] ) - Parent: Markup block at (16:1,0 [35] )
Markup span at (37:2,14 [4] ) - Parent: Tag block at (37:2,14 [4] )
Markup span at (41:2,18 [2] ) - Parent: Markup block at (16:1,0 [35] )
Markup span at (43:3,0 [6] ) - Parent: Tag block at (43:3,0 [6] )
Markup span at (49:3,6 [2] ) - Parent: Markup block at (16:1,0 [35] )
Code span at (51:4,0 [0] ) - Parent: Statement block at (0:0,0 [64] )
Transition span at (51:4,0 [1] ) - Parent: Statement block at (51:4,0 [13] )
MetaCode span at (52:4,1 [1] ) - Parent: Statement block at (51:4,0 [13] )
Code span at (53:4,2 [10] ) - Parent: Statement block at (51:4,0 [13] )
MetaCode span at (63:6,0 [1] ) - Parent: Statement block at (51:4,0 [13] )
Code span at (64:6,1 [0] ) - Parent: Statement block at (0:0,0 [64] )

Просмотреть файл

@ -1 +1,3 @@
(1,4): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(1,2): Error RZ1006: The code block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
(1,4): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(5,2): Error RZ1010: Unexpected "{" after "@" character. Once inside the body of a code block (@if {}, @{}, etc.) you do not need to use "@{" to switch to code.

Просмотреть файл

@ -9,14 +9,57 @@
CSharpStatementBody - [1..64)::63
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..63)::61
CSharpStatementLiteral - [2..63)::61 - [ #if false }LF<div>LF <p>Content</p>LF</div>LF@{LF#endifLF] - Gen<Stmt>
CSharpCodeBlock - [2..64)::62
CSharpStatementLiteral - [2..16)::14 - [ #if false }LF] - Gen<Stmt>
Whitespace;[ ];
CSharpDirective;[#if false }LF];RZ1043(3:0,3 [13] )
CSharpDisabledText;[<div>LF <p>Content</p>LF</div>LF@{LF];
CSharpDirective;[#endifLF];
RazorMetaCode - [63..64)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [64..64)::0 - [] - Gen<Markup>
Marker;[];
CSharpComment;[#if false }LF];RZ1043(3:0,3 [13] )
MarkupBlock - [16..51)::35
MarkupElement - [16..49)::33
MarkupStartTag - [16..21)::5 - [<div>] - Gen<Markup>
OpenAngle;[<];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [21..27)::6 - [LF ] - Gen<Markup>
NewLine;[LF];
Whitespace;[ ];
MarkupElement - [27..41)::14
MarkupStartTag - [27..30)::3 - [<p>] - Gen<Markup>
OpenAngle;[<];
Text;[p];
CloseAngle;[>];
MarkupTextLiteral - [30..37)::7 - [Content] - Gen<Markup>
Text;[Content];
MarkupEndTag - [37..41)::4 - [</p>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[p];
CloseAngle;[>];
MarkupTextLiteral - [41..43)::2 - [LF] - Gen<Markup>
NewLine;[LF];
MarkupEndTag - [43..49)::6 - [</div>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [49..51)::2 - [LF] - Gen<Markup>
NewLine;[LF];
CSharpStatementLiteral - [51..51)::0 - [] - Gen<Stmt>
Marker;[];
CSharpCodeBlock - [51..64)::13
CSharpStatement - [51..64)::13
CSharpTransition - [51..52)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [52..64)::12
RazorMetaCode - [52..53)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [53..63)::10
CSharpStatementLiteral - [53..63)::10 - [LF#endifLF] - Gen<Stmt>
NewLine;[LF];
CSharpDirective;[#endifLF];
RazorMetaCode - [63..64)::1 - Gen<None>
RightBrace;[}];
CSharpStatementLiteral - [64..64)::0 - [] - Gen<Stmt>
Marker;[];
RazorMetaCode - [64..64)::0 - Gen<None>
RightBrace;[<Missing>];
EndOfFile;[];

Просмотреть файл

@ -1,6 +1,18 @@
Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [63] )
Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [63] )
MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [63] )
Code span at (2:0,2 [60] ) - Parent: Statement block at (0:0,0 [63] )
MetaCode span at (62:6,0 [1] ) - Parent: Statement block at (0:0,0 [63] )
Markup span at (63:6,1 [0] ) - Parent: Markup block at (0:0,0 [63] )
Code span at (2:0,2 [13] ) - Parent: Statement block at (0:0,0 [63] )
Markup span at (15:1,0 [5] ) - Parent: Tag block at (15:1,0 [5] )
Markup span at (20:1,5 [6] ) - Parent: Markup block at (15:1,0 [35] )
Markup span at (26:2,4 [3] ) - Parent: Tag block at (26:2,4 [3] )
Markup span at (29:2,7 [7] ) - Parent: Markup block at (15:1,0 [35] )
Markup span at (36:2,14 [4] ) - Parent: Tag block at (36:2,14 [4] )
Markup span at (40:2,18 [2] ) - Parent: Markup block at (15:1,0 [35] )
Markup span at (42:3,0 [6] ) - Parent: Tag block at (42:3,0 [6] )
Markup span at (48:3,6 [2] ) - Parent: Markup block at (15:1,0 [35] )
Code span at (50:4,0 [0] ) - Parent: Statement block at (0:0,0 [63] )
Transition span at (50:4,0 [1] ) - Parent: Statement block at (50:4,0 [13] )
MetaCode span at (51:4,1 [1] ) - Parent: Statement block at (50:4,0 [13] )
Code span at (52:4,2 [10] ) - Parent: Statement block at (50:4,0 [13] )
MetaCode span at (62:6,0 [1] ) - Parent: Statement block at (50:4,0 [13] )
Code span at (63:6,1 [0] ) - Parent: Statement block at (0:0,0 [63] )

Просмотреть файл

@ -1 +1,3 @@
(1,3): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(1,2): Error RZ1006: The code block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
(1,3): Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
(5,2): Error RZ1010: Unexpected "{" after "@" character. Once inside the body of a code block (@if {}, @{}, etc.) you do not need to use "@{" to switch to code.

Просмотреть файл

@ -9,13 +9,56 @@
CSharpStatementBody - [1..63)::62
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..62)::60
CSharpStatementLiteral - [2..62)::60 - [#if false }LF<div>LF <p>Content</p>LF</div>LF@{LF#endifLF] - Gen<Stmt>
CSharpDirective;[#if false }LF];RZ1043(2:0,2 [13] )
CSharpDisabledText;[<div>LF <p>Content</p>LF</div>LF@{LF];
CSharpDirective;[#endifLF];
RazorMetaCode - [62..63)::1 - Gen<None>
RightBrace;[}];
MarkupTextLiteral - [63..63)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [2..63)::61
CSharpStatementLiteral - [2..15)::13 - [#if false }LF] - Gen<Stmt>
CSharpComment;[#if false }LF];RZ1043(2:0,2 [13] )
MarkupBlock - [15..50)::35
MarkupElement - [15..48)::33
MarkupStartTag - [15..20)::5 - [<div>] - Gen<Markup>
OpenAngle;[<];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [20..26)::6 - [LF ] - Gen<Markup>
NewLine;[LF];
Whitespace;[ ];
MarkupElement - [26..40)::14
MarkupStartTag - [26..29)::3 - [<p>] - Gen<Markup>
OpenAngle;[<];
Text;[p];
CloseAngle;[>];
MarkupTextLiteral - [29..36)::7 - [Content] - Gen<Markup>
Text;[Content];
MarkupEndTag - [36..40)::4 - [</p>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[p];
CloseAngle;[>];
MarkupTextLiteral - [40..42)::2 - [LF] - Gen<Markup>
NewLine;[LF];
MarkupEndTag - [42..48)::6 - [</div>] - Gen<Markup>
OpenAngle;[<];
ForwardSlash;[/];
Text;[div];
CloseAngle;[>];
MarkupTextLiteral - [48..50)::2 - [LF] - Gen<Markup>
NewLine;[LF];
CSharpStatementLiteral - [50..50)::0 - [] - Gen<Stmt>
Marker;[];
CSharpCodeBlock - [50..63)::13
CSharpStatement - [50..63)::13
CSharpTransition - [50..51)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [51..63)::12
RazorMetaCode - [51..52)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [52..62)::10
CSharpStatementLiteral - [52..62)::10 - [LF#endifLF] - Gen<Stmt>
NewLine;[LF];
CSharpDirective;[#endifLF];
RazorMetaCode - [62..63)::1 - Gen<None>
RightBrace;[}];
CSharpStatementLiteral - [63..63)::0 - [] - Gen<Stmt>
Marker;[];
RazorMetaCode - [63..63)::0 - Gen<None>
RightBrace;[<Missing>];
EndOfFile;[];

Просмотреть файл

@ -508,6 +508,25 @@ internal sealed class RoslynCSharpTokenizer : CSharpTokenizer
case CSharpSyntaxKind.EndOfLineTrivia:
tokenType = SyntaxKind.NewLine;
_isOnlyWhitespaceOnLine = true;
break;
case CSharpSyntaxKind.SkippedTokensTrivia:
// We treat skipped tokens as comments because they're tokens that were skipped over by roslyn,
// and we want to keep them in the output so that the final C# ends up failing due to their presence.
// We also don't want them to cause loops over comments and other trivia to break.
tokenType = SyntaxKind.CSharpComment;
// SkippedTokenTrivia is used for trailing directives; they can consume the trailing newline, so we need to reset _isOnlyWhitespaceOnLine if the trivia ends with one
_isOnlyWhitespaceOnLine = triviaString.EndsWith('\n');
// Look for any misplaced directives in the skipped tokens and error if we find them
if (triviaString.Contains('#'))
{
CurrentErrors.Add(
RazorDiagnosticFactory.CreateParsing_PreprocessorDirectivesMustBeAtTheStartOfLine(
// Won't be quite precise, but it's close enough
new SourceSpan(CurrentStart, contentLength: trivia.FullSpan.Length)));
}
break;
case CSharpSyntaxKind.SingleLineCommentTrivia or
CSharpSyntaxKind.MultiLineCommentTrivia or

Просмотреть файл

@ -15,6 +15,7 @@ public enum ErrorCode
ERR_ObjectRequired = 120,
WRN_UnreferencedField = 169,
ERR_IllegalStatement = 201,
WRN_UnreferencedVarAssg = 219,
ERR_DottedTypeNameNotFoundInNS = 234,
ERR_SingleTypeNameNotFound = 246,
ERR_CantInferMethTypeArgs = 411,