diff --git a/src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs b/src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs new file mode 100644 index 000000000..ec0e7977d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs @@ -0,0 +1,312 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; + +namespace Microsoft.AspNetCore.Razor.Language +{ + internal class ClassifiedSpanVisitor : SyntaxWalker + { + private RazorSourceDocument _source; + private List _spans; + private BlockKindInternal _currentBlockKind; + private SyntaxNode _currentBlock; + + public ClassifiedSpanVisitor(RazorSourceDocument source) + { + _source = source; + _spans = new List(); + _currentBlockKind = BlockKindInternal.Markup; + } + + public IReadOnlyList ClassifiedSpans => _spans; + + public override void VisitRazorCommentBlock(RazorCommentBlockSyntax node) + { + WriteBlock(node, BlockKindInternal.Comment, razorCommentSyntax => + { + WriteSpan(razorCommentSyntax.StartCommentTransition, SpanKindInternal.Transition, AcceptedCharactersInternal.None); + WriteSpan(razorCommentSyntax.StartCommentStar, SpanKindInternal.MetaCode, AcceptedCharactersInternal.None); + + var comment = razorCommentSyntax.Comment; + if (comment.IsMissing) + { + // We need to generate a classified span at this position. So insert a marker in its place. + comment = (SyntaxToken)SyntaxFactory.Token(SyntaxKind.Marker, string.Empty).Green.CreateRed(razorCommentSyntax, razorCommentSyntax.StartCommentStar.EndPosition); + } + WriteSpan(comment, SpanKindInternal.Comment, AcceptedCharactersInternal.Any); + + WriteSpan(razorCommentSyntax.EndCommentStar, SpanKindInternal.MetaCode, AcceptedCharactersInternal.None); + WriteSpan(razorCommentSyntax.EndCommentTransition, SpanKindInternal.Transition, AcceptedCharactersInternal.None); + }); + } + + public override void VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) + { + if (node.Parent is CSharpStatementBodySyntax || + node.Parent is CSharpExplicitExpressionBodySyntax || + node.Parent is CSharpImplicitExpressionBodySyntax || + node.Parent is RazorDirectiveBodySyntax || + (_currentBlockKind == BlockKindInternal.Directive && + node.Children.Count == 1 && + node.Children[0] is CSharpStatementLiteralSyntax)) + { + base.VisitCSharpCodeBlock(node); + return; + } + + WriteBlock(node, BlockKindInternal.Statement, base.VisitCSharpCodeBlock); + } + + public override void VisitCSharpStatement(CSharpStatementSyntax node) + { + WriteBlock(node, BlockKindInternal.Statement, base.VisitCSharpStatement); + } + + public override void VisitCSharpExplicitExpression(CSharpExplicitExpressionSyntax node) + { + WriteBlock(node, BlockKindInternal.Expression, base.VisitCSharpExplicitExpression); + } + + public override void VisitCSharpImplicitExpression(CSharpImplicitExpressionSyntax node) + { + WriteBlock(node, BlockKindInternal.Expression, base.VisitCSharpImplicitExpression); + } + + public override void VisitRazorDirective(RazorDirectiveSyntax node) + { + WriteBlock(node, BlockKindInternal.Directive, base.VisitRazorDirective); + } + + public override void VisitCSharpTemplateBlock(CSharpTemplateBlockSyntax node) + { + WriteBlock(node, BlockKindInternal.Template, base.VisitCSharpTemplateBlock); + } + + public override void VisitMarkupBlock(MarkupBlockSyntax node) + { + WriteBlock(node, BlockKindInternal.Markup, base.VisitMarkupBlock); + } + + public override void VisitMarkupTagHelperAttributeValue(MarkupTagHelperAttributeValueSyntax node) + { + // We don't generate a classified span when the attribute value is a simple literal value. + // This is done so we maintain the classified spans generated in 2.x which + // used ConditionalAttributeCollapser (combines markup literal attribute values into one span with no block parent). + if (node.Children.Count > 1 || + (node.Children.Count == 1 && node.Children[0] is MarkupDynamicAttributeValueSyntax)) + { + WriteBlock(node, BlockKindInternal.Markup, base.VisitMarkupTagHelperAttributeValue); + return; + } + + base.VisitMarkupTagHelperAttributeValue(node); + } + + public override void VisitMarkupTagBlock(MarkupTagBlockSyntax node) + { + WriteBlock(node, BlockKindInternal.Tag, base.VisitMarkupTagBlock); + } + + public override void VisitMarkupTagHelperElement(MarkupTagHelperElementSyntax node) + { + WriteBlock(node, BlockKindInternal.Tag, base.VisitMarkupTagHelperElement); + } + + public override void VisitMarkupTagHelperStartTag(MarkupTagHelperStartTagSyntax node) + { + foreach (var child in node.Children) + { + if (child is MarkupTagHelperAttributeSyntax attribute) + { + Visit(attribute); + } + } + } + + public override void VisitMarkupTagHelperEndTag(MarkupTagHelperEndTagSyntax node) + { + // We don't want to generate a classified span for a tag helper end tag. Do nothing. + } + + public override void VisitMarkupAttributeBlock(MarkupAttributeBlockSyntax node) + { + 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); + Visit(mergedAttributePrefix); + Visit(node.Value); + Visit(node.ValueSuffix); + }); + } + + public override void VisitMarkupTagHelperAttribute(MarkupTagHelperAttributeSyntax node) + { + Visit(node.Value); + } + + public override void VisitMarkupMinimizedAttributeBlock(MarkupMinimizedAttributeBlockSyntax node) + { + WriteBlock(node, BlockKindInternal.Markup, n => + { + var mergedAttributePrefix = MergeTextLiteralSpans(node.NamePrefix, node.Name); + Visit(mergedAttributePrefix); + }); + } + + public override void VisitMarkupCommentBlock(MarkupCommentBlockSyntax node) + { + WriteBlock(node, BlockKindInternal.HtmlComment, base.VisitMarkupCommentBlock); + } + + public override void VisitMarkupDynamicAttributeValue(MarkupDynamicAttributeValueSyntax node) + { + WriteBlock(node, BlockKindInternal.Markup, base.VisitMarkupDynamicAttributeValue); + } + + public override void VisitRazorMetaCode(RazorMetaCodeSyntax node) + { + WriteSpan(node, SpanKindInternal.MetaCode); + base.VisitRazorMetaCode(node); + } + + public override void VisitCSharpTransition(CSharpTransitionSyntax node) + { + WriteSpan(node, SpanKindInternal.Transition); + base.VisitCSharpTransition(node); + } + + public override void VisitMarkupTransition(MarkupTransitionSyntax node) + { + WriteSpan(node, SpanKindInternal.Transition); + base.VisitMarkupTransition(node); + } + + public override void VisitCSharpStatementLiteral(CSharpStatementLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.Code); + base.VisitCSharpStatementLiteral(node); + } + + public override void VisitCSharpExpressionLiteral(CSharpExpressionLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.Code); + base.VisitCSharpExpressionLiteral(node); + } + + public override void VisitCSharpEphemeralTextLiteral(CSharpEphemeralTextLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.Code); + base.VisitCSharpEphemeralTextLiteral(node); + } + + public override void VisitUnclassifiedTextLiteral(UnclassifiedTextLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.None); + base.VisitUnclassifiedTextLiteral(node); + } + + public override void VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) + { + WriteSpan(node, SpanKindInternal.Markup); + base.VisitMarkupLiteralAttributeValue(node); + } + + public override void VisitMarkupTextLiteral(MarkupTextLiteralSyntax node) + { + if (node.Parent is MarkupLiteralAttributeValueSyntax) + { + base.VisitMarkupTextLiteral(node); + return; + } + + WriteSpan(node, SpanKindInternal.Markup); + base.VisitMarkupTextLiteral(node); + } + + public override void VisitMarkupEphemeralTextLiteral(MarkupEphemeralTextLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.Markup); + base.VisitMarkupEphemeralTextLiteral(node); + } + + private void WriteBlock(TNode node, BlockKindInternal kind, Action handler) where TNode : SyntaxNode + { + var previousBlock = _currentBlock; + var previousKind = _currentBlockKind; + + _currentBlock = node; + _currentBlockKind = kind; + + handler(node); + + _currentBlock = previousBlock; + _currentBlockKind = previousKind; + } + + private void WriteSpan(SyntaxNode node, SpanKindInternal kind, AcceptedCharactersInternal? acceptedCharacters = null) + { + if (node.IsMissing) + { + return; + } + + var spanSource = node.GetSourceSpan(_source); + var blockSource = _currentBlock.GetSourceSpan(_source); + if (!acceptedCharacters.HasValue) + { + acceptedCharacters = AcceptedCharactersInternal.Any; + var context = node.GetSpanContext(); + if (context != null) + { + acceptedCharacters = context.EditHandler.AcceptedCharacters; + } + } + + 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/Microsoft.AspNetCore.Razor.Language/DefaultDirectiveSyntaxTreePass.cs b/src/Microsoft.AspNetCore.Razor.Language/DefaultDirectiveSyntaxTreePass.cs index 54c733e0f..65e578b5c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DefaultDirectiveSyntaxTreePass.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DefaultDirectiveSyntaxTreePass.cs @@ -5,6 +5,7 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language { @@ -23,37 +24,42 @@ public RazorSyntaxTree Execute(RazorCodeDocument codeDocument, RazorSyntaxTree s { throw new ArgumentNullException(nameof(syntaxTree)); } - - var sectionVerifier = new NestedSectionVerifier(); - sectionVerifier.Verify(syntaxTree); - - return syntaxTree; + + var sectionVerifier = new NestedSectionVerifier(syntaxTree); + return sectionVerifier.Verify(); } - private class NestedSectionVerifier : ParserVisitor + private class NestedSectionVerifier : SyntaxRewriter { private int _nestedLevel; + private RazorSyntaxTree _syntaxTree; + + public NestedSectionVerifier(RazorSyntaxTree syntaxTree) + { + _syntaxTree = syntaxTree; + } - public void Verify(RazorSyntaxTree tree) + public RazorSyntaxTree Verify() { - tree.Root.Accept(this); + var root = Visit(_syntaxTree.Root); + var rewrittenTree = new DefaultRazorSyntaxTree(root, _syntaxTree.Source, _syntaxTree.Diagnostics, _syntaxTree.Options); + return rewrittenTree; } - public override void VisitDirectiveBlock(DirectiveChunkGenerator chunkGenerator, Block block) + public override SyntaxNode VisitRazorDirective(RazorDirectiveSyntax node) { if (_nestedLevel > 0) { - var directiveStart = block.Children.First(child => !child.IsBlock && ((Span)child).Kind == SpanKindInternal.Transition).Start; + var directiveStart = node.Transition.GetSourceLocation(_syntaxTree.Source); var errorLength = /* @ */ 1 + SectionDirective.Directive.Directive.Length; var error = RazorDiagnosticFactory.CreateParsing_SectionsCannotBeNested(new SourceSpan(directiveStart, errorLength)); - chunkGenerator.Diagnostics.Add(error); + node = node.AppendDiagnostic(error); } - _nestedLevel++; - - VisitDefault(block); - + var result = base.VisitRazorDirective(node); _nestedLevel--; + + return result; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs index 762fd61d6..07e1ad44c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Intermediate; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language { @@ -46,8 +47,8 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument) { var import = imports[j]; - importsVisitor.FilePath = import.Source.FilePath; - importsVisitor.VisitBlock(import.Root); + importsVisitor.SourceDocument = import.Source; + importsVisitor.Visit(import.Root); } importedUsings = importsVisitor.Usings; @@ -56,10 +57,10 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument) var tagHelperPrefix = tagHelperContext?.Prefix; var visitor = new MainSourceVisitor(document, builder, tagHelperPrefix, syntaxTree.Options.FeatureFlags) { - FilePath = syntaxTree.Source.FilePath, + SourceDocument = syntaxTree.Source, }; - visitor.VisitBlock(syntaxTree.Root); + visitor.Visit(syntaxTree.Root); // 1. Prioritize non-imported usings over imported ones. // 2. Don't import usings that already exist in primary document. @@ -189,7 +190,7 @@ public bool Equals(UsingReference other) public override int GetHashCode() => Namespace.GetHashCode(); } - private class LoweringVisitor : ParserVisitor + private class LoweringVisitor : SyntaxWalker { protected readonly IntermediateNodeBuilder _builder; protected readonly DocumentIntermediateNode _document; @@ -206,195 +207,208 @@ public LoweringVisitor(DocumentIntermediateNode document, IntermediateNodeBuilde public IReadOnlyList Usings => _usings; - public string FilePath { get; set; } + public RazorSourceDocument SourceDocument { get; set; } - public override void VisitDirectiveToken(DirectiveTokenChunkGenerator chunkGenerator, Span span) - { - _builder.Add(new DirectiveTokenIntermediateNode() - { - Content = span.Content, - DirectiveToken = chunkGenerator.Descriptor, - Source = BuildSourceSpanFromNode(span), - }); - } - - public override void VisitDirectiveBlock(DirectiveChunkGenerator chunkGenerator, Block block) + public override void VisitRazorDirective(RazorDirectiveSyntax node) { IntermediateNode directiveNode; - if (IsMalformed(chunkGenerator.Diagnostics)) + var descriptor = node.DirectiveDescriptor; + + if (descriptor != null) { - directiveNode = new MalformedDirectiveIntermediateNode() + var diagnostics = node.GetDiagnostics(); + + // This is an extensible directive. + if (IsMalformed(diagnostics)) { - DirectiveName = chunkGenerator.Descriptor.Directive, - Directive = chunkGenerator.Descriptor, - Source = BuildSourceSpanFromNode(block), - }; - } - else - { - directiveNode = new DirectiveIntermediateNode() + directiveNode = new MalformedDirectiveIntermediateNode() + { + DirectiveName = descriptor.Directive, + Directive = descriptor, + Source = BuildSourceSpanFromNode(node), + }; + } + else { - DirectiveName = chunkGenerator.Descriptor.Directive, - Directive = chunkGenerator.Descriptor, - Source = BuildSourceSpanFromNode(block), - }; - } - - for (var i = 0; i < chunkGenerator.Diagnostics.Count; i++) - { - directiveNode.Diagnostics.Add(chunkGenerator.Diagnostics[i]); - } + directiveNode = new DirectiveIntermediateNode() + { + DirectiveName = descriptor.Directive, + Directive = descriptor, + Source = BuildSourceSpanFromNode(node), + }; + } - _builder.Push(directiveNode); + for (var i = 0; i < diagnostics.Length; i++) + { + directiveNode.Diagnostics.Add(diagnostics[i]); + } - VisitDefault(block); + _builder.Push(directiveNode); + } - _builder.Pop(); - } + Visit(node.Body); - public override void VisitImportSpan(AddImportChunkGenerator chunkGenerator, Span span) - { - var namespaceImport = chunkGenerator.Namespace.Trim(); - var namespaceSpan = BuildSourceSpanFromNode(span); - _usings.Add(new UsingReference(namespaceImport, namespaceSpan)); + if (descriptor != null) + { + _builder.Pop(); + } } - public override void VisitAddTagHelperSpan(AddTagHelperChunkGenerator chunkGenerator, Span span) + public override void VisitCSharpStatementLiteral(CSharpStatementLiteralSyntax node) { - IntermediateNode directiveNode; - if (IsMalformed(chunkGenerator.Diagnostics)) + var context = node.GetSpanContext(); + if (context == null) { - directiveNode = new MalformedDirectiveIntermediateNode() - { - DirectiveName = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Directive, - Directive = CSharpCodeParser.AddTagHelperDirectiveDescriptor, - Source = BuildSourceSpanFromNode(span), - }; + base.VisitCSharpStatementLiteral(node); + return; } - else + else if (context.ChunkGenerator is DirectiveTokenChunkGenerator tokenChunkGenerator) { - directiveNode = new DirectiveIntermediateNode() + _builder.Add(new DirectiveTokenIntermediateNode() { - DirectiveName = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Directive, - Directive = CSharpCodeParser.AddTagHelperDirectiveDescriptor, - Source = BuildSourceSpanFromNode(span), - }; + Content = node.GetContent(), + DirectiveToken = tokenChunkGenerator.Descriptor, + Source = BuildSourceSpanFromNode(node), + }); } - - for (var i = 0; i < chunkGenerator.Diagnostics.Count; i++) + else if (context.ChunkGenerator is AddImportChunkGenerator importChunkGenerator) { - directiveNode.Diagnostics.Add(chunkGenerator.Diagnostics[i]); + var namespaceImport = importChunkGenerator.Namespace.Trim(); + var namespaceSpan = BuildSourceSpanFromNode(node); + _usings.Add(new UsingReference(namespaceImport, namespaceSpan)); } - - _builder.Push(directiveNode); - - _builder.Add(new DirectiveTokenIntermediateNode() + else if (context.ChunkGenerator is AddTagHelperChunkGenerator addTagHelperChunkGenerator) { - Content = chunkGenerator.LookupText, - DirectiveToken = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Tokens.First(), - Source = BuildSourceSpanFromNode(span), - }); + IntermediateNode directiveNode; + if (IsMalformed(addTagHelperChunkGenerator.Diagnostics)) + { + directiveNode = new MalformedDirectiveIntermediateNode() + { + DirectiveName = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Directive, + Directive = CSharpCodeParser.AddTagHelperDirectiveDescriptor, + Source = BuildSourceSpanFromNode(node), + }; + } + else + { + directiveNode = new DirectiveIntermediateNode() + { + DirectiveName = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Directive, + Directive = CSharpCodeParser.AddTagHelperDirectiveDescriptor, + Source = BuildSourceSpanFromNode(node), + }; + } - _builder.Pop(); - } + for (var i = 0; i < addTagHelperChunkGenerator.Diagnostics.Count; i++) + { + directiveNode.Diagnostics.Add(addTagHelperChunkGenerator.Diagnostics[i]); + } - public override void VisitRemoveTagHelperSpan(RemoveTagHelperChunkGenerator chunkGenerator, Span span) - { - IntermediateNode directiveNode; - if (IsMalformed(chunkGenerator.Diagnostics)) - { - directiveNode = new MalformedDirectiveIntermediateNode() + _builder.Push(directiveNode); + + _builder.Add(new DirectiveTokenIntermediateNode() { - DirectiveName = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Directive, - Directive = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, - Source = BuildSourceSpanFromNode(span), - }; + Content = addTagHelperChunkGenerator.LookupText, + DirectiveToken = CSharpCodeParser.AddTagHelperDirectiveDescriptor.Tokens.First(), + Source = BuildSourceSpanFromNode(node), + }); + + _builder.Pop(); } - else + else if (context.ChunkGenerator is RemoveTagHelperChunkGenerator removeTagHelperChunkGenerator) { - directiveNode = new DirectiveIntermediateNode() + IntermediateNode directiveNode; + if (IsMalformed(removeTagHelperChunkGenerator.Diagnostics)) { - DirectiveName = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Directive, - Directive = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, - Source = BuildSourceSpanFromNode(span), - }; - } - - for (var i = 0; i < chunkGenerator.Diagnostics.Count; i++) - { - directiveNode.Diagnostics.Add(chunkGenerator.Diagnostics[i]); - } - - _builder.Push(directiveNode); + directiveNode = new MalformedDirectiveIntermediateNode() + { + DirectiveName = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Directive, + Directive = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, + Source = BuildSourceSpanFromNode(node), + }; + } + else + { + directiveNode = new DirectiveIntermediateNode() + { + DirectiveName = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Directive, + Directive = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, + Source = BuildSourceSpanFromNode(node), + }; + } - _builder.Add(new DirectiveTokenIntermediateNode() - { - Content = chunkGenerator.LookupText, - DirectiveToken = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Tokens.First(), - Source = BuildSourceSpanFromNode(span), - }); + for (var i = 0; i < removeTagHelperChunkGenerator.Diagnostics.Count; i++) + { + directiveNode.Diagnostics.Add(removeTagHelperChunkGenerator.Diagnostics[i]); + } - _builder.Pop(); - } + _builder.Push(directiveNode); - public override void VisitTagHelperPrefixDirectiveSpan(TagHelperPrefixDirectiveChunkGenerator chunkGenerator, Span span) - { - IntermediateNode directiveNode; - if (IsMalformed(chunkGenerator.Diagnostics)) - { - directiveNode = new MalformedDirectiveIntermediateNode() + _builder.Add(new DirectiveTokenIntermediateNode() { - DirectiveName = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Directive, - Directive = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, - Source = BuildSourceSpanFromNode(span), - }; + Content = removeTagHelperChunkGenerator.LookupText, + DirectiveToken = CSharpCodeParser.RemoveTagHelperDirectiveDescriptor.Tokens.First(), + Source = BuildSourceSpanFromNode(node), + }); + + _builder.Pop(); } - else + else if (context.ChunkGenerator is TagHelperPrefixDirectiveChunkGenerator tagHelperPrefixChunkGenerator) { - directiveNode = new DirectiveIntermediateNode() + IntermediateNode directiveNode; + if (IsMalformed(tagHelperPrefixChunkGenerator.Diagnostics)) { - DirectiveName = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Directive, - Directive = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, - Source = BuildSourceSpanFromNode(span), - }; - } + directiveNode = new MalformedDirectiveIntermediateNode() + { + DirectiveName = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Directive, + Directive = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, + Source = BuildSourceSpanFromNode(node), + }; + } + else + { + directiveNode = new DirectiveIntermediateNode() + { + DirectiveName = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Directive, + Directive = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, + Source = BuildSourceSpanFromNode(node), + }; + } - for (var i = 0; i < chunkGenerator.Diagnostics.Count; i++) - { - directiveNode.Diagnostics.Add(chunkGenerator.Diagnostics[i]); - } + for (var i = 0; i < tagHelperPrefixChunkGenerator.Diagnostics.Count; i++) + { + directiveNode.Diagnostics.Add(tagHelperPrefixChunkGenerator.Diagnostics[i]); + } - _builder.Push(directiveNode); + _builder.Push(directiveNode); - _builder.Add(new DirectiveTokenIntermediateNode() - { - Content = chunkGenerator.Prefix, - DirectiveToken = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Tokens.First(), - Source = BuildSourceSpanFromNode(span), - }); + _builder.Add(new DirectiveTokenIntermediateNode() + { + Content = tagHelperPrefixChunkGenerator.Prefix, + DirectiveToken = CSharpCodeParser.TagHelperPrefixDirectiveDescriptor.Tokens.First(), + Source = BuildSourceSpanFromNode(node), + }); - _builder.Pop(); + _builder.Pop(); + } + + base.VisitCSharpStatementLiteral(node); } - protected SourceSpan? BuildSourceSpanFromNode(SyntaxTreeNode node) + protected SourceSpan? BuildSourceSpanFromNode(SyntaxNode node) { - if (node == null || node.Start == SourceLocation.Undefined) + if (node == null) { return null; } - var span = new SourceSpan( - node.Start.FilePath ?? FilePath, - node.Start.AbsoluteIndex, - node.Start.LineIndex, - node.Start.CharacterIndex, - node.Length); - return span; + return node.GetSourceSpan(SourceDocument); } } private class MainSourceVisitor : LoweringVisitor { + private readonly HashSet _renderedBoundAttributeNames = new HashSet(StringComparer.OrdinalIgnoreCase); private readonly string _tagHelperPrefix; public MainSourceVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, string tagHelperPrefix, RazorParserFeatureFlags featureFlags) @@ -408,86 +422,144 @@ public MainSourceVisitor(DocumentIntermediateNode document, IntermediateNodeBuil // Name=checked // Prefix= checked=" // Suffix=" - public override void VisitAttributeBlock(AttributeBlockChunkGenerator chunkGenerator, Block block) + public override void VisitMarkupAttributeBlock(MarkupAttributeBlockSyntax node) { - _builder.Push(new HtmlAttributeIntermediateNode() + var prefixTokens = MergeLiterals( + node.NamePrefix?.LiteralTokens, + node.Name.LiteralTokens, + node.NameSuffix?.LiteralTokens, + node.EqualsToken == null ? new SyntaxList() : new SyntaxList(node.EqualsToken), + node.ValuePrefix?.LiteralTokens); + var prefix = (MarkupTextLiteralSyntax)SyntaxFactory.MarkupTextLiteral(prefixTokens).Green.CreateRed(node, node.NamePrefix?.Position ?? node.Name.Position); + + var name = node.Name.GetContent(); + if (name.StartsWith("data-", StringComparison.OrdinalIgnoreCase) && + !_featureFlags.EXPERIMENTAL_AllowConditionalDataDashAttributes) { - AttributeName = chunkGenerator.Name, - Prefix = chunkGenerator.Prefix, - Suffix = chunkGenerator.Suffix, - Source = BuildSourceSpanFromNode(block), - }); + Visit(prefix); + Visit(node.Value); + Visit(node.ValueSuffix); + } + else + { + if (node.Value != null && node.Value.ChildNodes().All(c => c is MarkupLiteralAttributeValueSyntax)) + { + // We need to do what ConditionalAttributeCollapser used to do. + var literalAttributeValueNodes = node.Value.ChildNodes().Cast().ToArray(); + var valueTokens = SyntaxListBuilder.Create(); + for (var i = 0; i < literalAttributeValueNodes.Length; i++) + { + var mergedValue = MergeAttributeValue(literalAttributeValueNodes[i]); + valueTokens.AddRange(mergedValue.LiteralTokens); + } + var rewritten = SyntaxFactory.MarkupTextLiteral(valueTokens.ToList()); + + var mergedLiterals = MergeLiterals(prefix?.LiteralTokens, rewritten.LiteralTokens, node.ValueSuffix?.LiteralTokens); + var mergedAttribute = SyntaxFactory.MarkupTextLiteral(mergedLiterals).Green.CreateRed(node.Parent, node.Position); + Visit(mergedAttribute); + } + else + { + _builder.Push(new HtmlAttributeIntermediateNode() + { + AttributeName = node.Name.GetContent(), + Prefix = prefix.GetContent(), + Suffix = node.ValueSuffix?.GetContent() ?? string.Empty, + Source = BuildSourceSpanFromNode(node), + }); - VisitDefault(block); + VisitAttributeValue(node.Value); - _builder.Pop(); + _builder.Pop(); + } + } + } + + public override void VisitMarkupMinimizedAttributeBlock(MarkupMinimizedAttributeBlockSyntax node) + { + var name = node.Name.GetContent(); + if (name.StartsWith("data-", StringComparison.OrdinalIgnoreCase) && + !_featureFlags.EXPERIMENTAL_AllowConditionalDataDashAttributes) + { + base.VisitMarkupMinimizedAttributeBlock(node); + return; + } + + // Minimized attributes are just html content. + var literals = MergeLiterals( + node.NamePrefix?.LiteralTokens, + node.Name?.LiteralTokens); + var literal = SyntaxFactory.MarkupTextLiteral(literals).Green.CreateRed(node.Parent, node.Position); + + Visit(literal); } // Example // // Prefix= (space) // Children will contain a token for @false. - public override void VisitDynamicAttributeBlock(DynamicAttributeBlockChunkGenerator chunkGenerator, Block block) + public override void VisitMarkupDynamicAttributeValue(MarkupDynamicAttributeValueSyntax node) { - var firstChild = block.Children.FirstOrDefault(c => c.IsBlock) as Block; - if (firstChild == null || firstChild.Type == BlockKindInternal.Expression) + var containsExpression = false; + var descendantNodes = node.DescendantNodes(n => + { + // Don't go into sub block. They may contain expressions but we only care about the top level. + return !(n.Parent is CSharpCodeBlockSyntax); + }); + foreach (var child in descendantNodes) + { + if (child is CSharpImplicitExpressionSyntax || child is CSharpExplicitExpressionSyntax) + { + containsExpression = true; + } + } + + if (containsExpression) { _builder.Push(new CSharpExpressionAttributeValueIntermediateNode() { - Prefix = chunkGenerator.Prefix, - Source = BuildSourceSpanFromNode(block), + Prefix = node.Prefix?.GetContent() ?? string.Empty, + Source = BuildSourceSpanFromNode(node), }); } else { _builder.Push(new CSharpCodeAttributeValueIntermediateNode() { - Prefix = chunkGenerator.Prefix, - Source = BuildSourceSpanFromNode(block), + Prefix = node.Prefix?.GetContent() ?? string.Empty, + Source = BuildSourceSpanFromNode(node), }); } - VisitDefault(block); + Visit(node.Value); _builder.Pop(); } - public override void VisitLiteralAttributeSpan(LiteralAttributeChunkGenerator chunkGenerator, Span span) + public override void VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) { _builder.Push(new HtmlAttributeValueIntermediateNode() { - Prefix = chunkGenerator.Prefix, - Source = BuildSourceSpanFromNode(span), + Prefix = node.Prefix?.GetContent() ?? string.Empty, + Source = BuildSourceSpanFromNode(node), }); - var location = chunkGenerator.Value.Location; - SourceSpan? valueSpan = null; - if (location != SourceLocation.Undefined) - { - valueSpan = new SourceSpan( - location.FilePath ?? FilePath, - location.AbsoluteIndex, - location.LineIndex, - location.CharacterIndex, - chunkGenerator.Value.Value.Length); - } - _builder.Add(new IntermediateToken() { - Content = chunkGenerator.Value, + Content = node.Value?.GetContent() ?? string.Empty, Kind = TokenKind.Html, - Source = valueSpan + Source = BuildSourceSpanFromNode(node.Value) }); _builder.Pop(); } - public override void VisitTemplateBlock(TemplateBlockChunkGenerator chunkGenerator, Block block) + public override void VisitCSharpTemplateBlock(CSharpTemplateBlockSyntax node) { var templateNode = new TemplateIntermediateNode(); _builder.Push(templateNode); - VisitDefault(block); + base.VisitCSharpTemplateBlock(node); _builder.Pop(); @@ -503,7 +575,7 @@ public override void VisitTemplateBlock(TemplateBlockChunkGenerator chunkGenerat var contentLength = templateNode.Children.Sum(child => child.Source?.Length ?? 0); templateNode.Source = new SourceSpan( - sourceRangeStart.Value.FilePath ?? FilePath, + sourceRangeStart.Value.FilePath ?? SourceDocument.FilePath, sourceRangeStart.Value.AbsoluteIndex, sourceRangeStart.Value.LineIndex, sourceRangeStart.Value.CharacterIndex, @@ -518,11 +590,11 @@ public override void VisitTemplateBlock(TemplateBlockChunkGenerator chunkGenerat // @DateTime.@*This is a comment*@Now // // We need to capture this in the IR so that we can give each piece the correct source mappings - public override void VisitExpressionBlock(ExpressionChunkGenerator chunkGenerator, Block block) + public override void VisitCSharpExplicitExpression(CSharpExplicitExpressionSyntax node) { if (_builder.Current is CSharpExpressionAttributeValueIntermediateNode) { - VisitDefault(block); + base.VisitCSharpExplicitExpression(node); return; } @@ -530,7 +602,7 @@ public override void VisitExpressionBlock(ExpressionChunkGenerator chunkGenerato _builder.Push(expressionNode); - VisitDefault(block); + base.VisitCSharpExplicitExpression(node); _builder.Pop(); @@ -546,7 +618,7 @@ public override void VisitExpressionBlock(ExpressionChunkGenerator chunkGenerato var contentLength = expressionNode.Children.Sum(child => child.Source?.Length ?? 0); expressionNode.Source = new SourceSpan( - sourceRangeStart.Value.FilePath ?? FilePath, + sourceRangeStart.Value.FilePath ?? SourceDocument.FilePath, sourceRangeStart.Value.AbsoluteIndex, sourceRangeStart.Value.LineIndex, sourceRangeStart.Value.CharacterIndex, @@ -555,57 +627,120 @@ public override void VisitExpressionBlock(ExpressionChunkGenerator chunkGenerato } } - public override void VisitExpressionSpan(ExpressionChunkGenerator chunkGenerator, Span span) + public override void VisitCSharpImplicitExpression(CSharpImplicitExpressionSyntax node) { - _builder.Add(new IntermediateToken() + if (_builder.Current is CSharpExpressionAttributeValueIntermediateNode) { - Content = span.Content, - Kind = TokenKind.CSharp, - Source = BuildSourceSpanFromNode(span), - }); - } + base.VisitCSharpImplicitExpression(node); + return; + } - public override void VisitStatementSpan(StatementChunkGenerator chunkGenerator, Span span) - { - var isAttributeValue = _builder.Current is CSharpCodeAttributeValueIntermediateNode; + var expressionNode = new CSharpExpressionIntermediateNode(); - if (!isAttributeValue) + _builder.Push(expressionNode); + + base.VisitCSharpImplicitExpression(node); + + _builder.Pop(); + + if (expressionNode.Children.Count > 0) { - var statementNode = new CSharpCodeIntermediateNode() + var sourceRangeStart = expressionNode + .Children + .FirstOrDefault(child => child.Source != null) + ?.Source; + + if (sourceRangeStart != null) { - Source = BuildSourceSpanFromNode(span) - }; - _builder.Push(statementNode); + var contentLength = expressionNode.Children.Sum(child => child.Source?.Length ?? 0); + + expressionNode.Source = new SourceSpan( + sourceRangeStart.Value.FilePath ?? SourceDocument.FilePath, + sourceRangeStart.Value.AbsoluteIndex, + sourceRangeStart.Value.LineIndex, + sourceRangeStart.Value.CharacterIndex, + contentLength); + } + } + } + + public override void VisitCSharpExpressionLiteral(CSharpExpressionLiteralSyntax node) + { + if (_builder.Current is TagHelperHtmlAttributeIntermediateNode) + { + // If we are top level in a tag helper HTML attribute, we want to be rendered as markup. + // This case happens for duplicate non-string bound attributes. They would be initially be categorized as + // CSharp but since they are duplicate, they should just be markup. + var markupLiteral = SyntaxFactory.MarkupTextLiteral(node.LiteralTokens).Green.CreateRed(node.Parent, node.Position); + Visit(markupLiteral); + return; } _builder.Add(new IntermediateToken() { - Content = span.Content, + Content = node.GetContent(), Kind = TokenKind.CSharp, - Source = BuildSourceSpanFromNode(span), + Source = BuildSourceSpanFromNode(node), }); - if (!isAttributeValue) + base.VisitCSharpExpressionLiteral(node); + } + + public override void VisitCSharpStatementLiteral(CSharpStatementLiteralSyntax node) + { + var context = node.GetSpanContext(); + if (context == null || context.ChunkGenerator is StatementChunkGenerator) { - _builder.Pop(); + var isAttributeValue = _builder.Current is CSharpCodeAttributeValueIntermediateNode; + + if (!isAttributeValue) + { + var statementNode = new CSharpCodeIntermediateNode() + { + Source = BuildSourceSpanFromNode(node) + }; + _builder.Push(statementNode); + } + + _builder.Add(new IntermediateToken() + { + Content = node.GetContent(), + Kind = TokenKind.CSharp, + Source = BuildSourceSpanFromNode(node), + }); + + if (!isAttributeValue) + { + _builder.Pop(); + } } + + base.VisitCSharpStatementLiteral(node); } - public override void VisitMarkupSpan(MarkupChunkGenerator chunkGenerator, Span span) + public override void VisitMarkupTextLiteral(MarkupTextLiteralSyntax node) { - if (span.Tokens.Count == 1) + var context = node.GetSpanContext(); + if (context != null && context.ChunkGenerator == SpanChunkGenerator.Null) + { + base.VisitMarkupTextLiteral(node); + return; + } + + if (node.LiteralTokens.Count == 1) { - var token = span.Tokens[0]; + var token = node.LiteralTokens[0]; if (token != null && - token.Kind == SyntaxKind.Unknown && + token.Kind == SyntaxKind.Marker && token.Content.Length == 0) { // We don't want to create IR nodes for marker tokens. + base.VisitMarkupTextLiteral(node); return; } } - var source = BuildSourceSpanFromNode(span); + var source = BuildSourceSpanFromNode(node); var currentChildren = _builder.Current.Children; if (currentChildren.Count > 0 && currentChildren[currentChildren.Count - 1] is HtmlContentIntermediateNode) { @@ -613,7 +748,8 @@ public override void VisitMarkupSpan(MarkupChunkGenerator chunkGenerator, Span s if (existingHtmlContent.Source == null && source == null) { - Combine(existingHtmlContent, span); + Combine(existingHtmlContent, node); + base.VisitMarkupTextLiteral(node); return; } @@ -622,7 +758,8 @@ public override void VisitMarkupSpan(MarkupChunkGenerator chunkGenerator, Span s existingHtmlContent.Source.Value.FilePath == source.Value.FilePath && existingHtmlContent.Source.Value.AbsoluteIndex + existingHtmlContent.Source.Value.Length == source.Value.AbsoluteIndex) { - Combine(existingHtmlContent, span); + Combine(existingHtmlContent, node); + base.VisitMarkupTextLiteral(node); return; } } @@ -635,23 +772,20 @@ public override void VisitMarkupSpan(MarkupChunkGenerator chunkGenerator, Span s _builder.Add(new IntermediateToken() { - Content = span.Content, + Content = node.GetContent(), Kind = TokenKind.Html, Source = source, }); _builder.Pop(); + + base.VisitMarkupTextLiteral(node); } - public override void VisitTagHelperBlock(TagHelperChunkGenerator chunkGenerator, Block block) + public override void VisitMarkupTagHelperElement(MarkupTagHelperElementSyntax node) { - var tagHelperBlock = block as TagHelperBlock; - if (tagHelperBlock == null) - { - return; - } - - var tagName = tagHelperBlock.TagName; + var info = node.TagHelperInfo; + var tagName = info.TagName; if (_tagHelperPrefix != null) { tagName = tagName.Substring(_tagHelperPrefix.Length); @@ -660,11 +794,11 @@ public override void VisitTagHelperBlock(TagHelperChunkGenerator chunkGenerator, var tagHelperNode = new TagHelperIntermediateNode() { TagName = tagName, - TagMode = tagHelperBlock.TagMode, - Source = BuildSourceSpanFromNode(block) + TagMode = info.TagMode, + Source = BuildSourceSpanFromNode(node) }; - foreach (var tagHelper in tagHelperBlock.Binding.Descriptors) + foreach (var tagHelper in info.BindingResult.Descriptors) { tagHelperNode.TagHelpers.Add(tagHelper); } @@ -673,22 +807,223 @@ public override void VisitTagHelperBlock(TagHelperChunkGenerator chunkGenerator, _builder.Push(new TagHelperBodyIntermediateNode()); - VisitDefault(block); + foreach (var item in node.Body) + { + Visit(item); + } _builder.Pop(); // Pop InitializeTagHelperStructureIntermediateNode - AddTagHelperAttributes(tagHelperBlock.Attributes, tagHelperBlock.Binding); + Visit(node.StartTag); _builder.Pop(); // Pop TagHelperIntermediateNode + + // No need to visit the end tag because we don't write any IR for it. + + // We don't want to track attributes from a previous tag helper element. + _renderedBoundAttributeNames.Clear(); + } + + public override void VisitMarkupTagHelperStartTag(MarkupTagHelperStartTagSyntax node) + { + foreach (var child in node.Children) + { + if (child is MarkupTagHelperAttributeSyntax || child is MarkupMinimizedTagHelperAttributeSyntax) + { + Visit(child); + } + } + } + + public override void VisitMarkupMinimizedTagHelperAttribute(MarkupMinimizedTagHelperAttributeSyntax node) + { + if (!_featureFlags.AllowMinimizedBooleanTagHelperAttributes) + { + // Minimized attributes are not valid for non-boolean bound attributes. TagHelperBlockRewriter + // has already logged an error if it was a non-boolean bound attribute; so we can skip. + return; + } + + var element = node.FirstAncestorOrSelf(); + var descriptors = element.TagHelperInfo.BindingResult.Descriptors; + var attributeName = node.Name.GetContent(); + var associatedDescriptors = descriptors.Where(descriptor => + descriptor.BoundAttributes.Any(attributeDescriptor => TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, attributeDescriptor))); + + if (associatedDescriptors.Any() && _renderedBoundAttributeNames.Add(attributeName)) + { + foreach (var associatedDescriptor in associatedDescriptors) + { + var associatedAttributeDescriptor = associatedDescriptor.BoundAttributes.First(a => + { + return TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, a); + }); + + var expectsBooleanValue = associatedAttributeDescriptor.ExpectsBooleanValue(attributeName); + + if (!expectsBooleanValue) + { + // We do not allow minimized non-boolean bound attributes. + return; + } + + var setTagHelperProperty = new TagHelperPropertyIntermediateNode() + { + AttributeName = attributeName, + BoundAttribute = associatedAttributeDescriptor, + TagHelper = associatedDescriptor, + AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure, + Source = null, + IsIndexerNameMatch = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(attributeName, associatedAttributeDescriptor), + }; + + _builder.Add(setTagHelperProperty); + } + } + else + { + var addHtmlAttribute = new TagHelperHtmlAttributeIntermediateNode() + { + AttributeName = attributeName, + AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure + }; + + _builder.Add(addHtmlAttribute); + } + } + + public override void VisitMarkupTagHelperAttribute(MarkupTagHelperAttributeSyntax node) + { + var element = node.FirstAncestorOrSelf(); + var descriptors = element.TagHelperInfo.BindingResult.Descriptors; + var attributeName = node.Name.GetContent(); + var attributeValueNode = node.Value; + var associatedDescriptors = descriptors.Where(descriptor => + descriptor.BoundAttributes.Any(attributeDescriptor => TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, attributeDescriptor))); + + if (associatedDescriptors.Any() && _renderedBoundAttributeNames.Add(attributeName)) + { + foreach (var associatedDescriptor in associatedDescriptors) + { + var associatedAttributeDescriptor = associatedDescriptor.BoundAttributes.First(a => + { + return TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, a); + }); + + var setTagHelperProperty = new TagHelperPropertyIntermediateNode() + { + AttributeName = attributeName, + BoundAttribute = associatedAttributeDescriptor, + TagHelper = associatedDescriptor, + AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure, + Source = BuildSourceSpanFromNode(attributeValueNode), + IsIndexerNameMatch = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(attributeName, associatedAttributeDescriptor), + }; + + _builder.Push(setTagHelperProperty); + VisitAttributeValue(attributeValueNode); + _builder.Pop(); + } + } + else + { + var addHtmlAttribute = new TagHelperHtmlAttributeIntermediateNode() + { + AttributeName = attributeName, + AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure + }; + + _builder.Push(addHtmlAttribute); + VisitAttributeValue(attributeValueNode); + _builder.Pop(); + } } - private void Combine(HtmlContentIntermediateNode node, Span span) + private void VisitAttributeValue(SyntaxNode node) + { + if (node == null) + { + return; + } + + IReadOnlyList children = node.ChildNodes(); + var position = node.Position; + if (children.First() is MarkupBlockSyntax markupBlock && + markupBlock.Children.Count == 2 && + markupBlock.Children[0] is MarkupTextLiteralSyntax && + markupBlock.Children[1] is MarkupEphemeralTextLiteralSyntax) + { + // This is a special case when we have an attribute like attr="@@foo". + // In this case, we want the foo to be written out as HtmlContent and not HtmlAttributeValue. + Visit(markupBlock); + children = children.Skip(1).ToList(); + position = children.Count > 0 ? children[0].Position : position; + } + + if (children.All(c => c is MarkupLiteralAttributeValueSyntax)) + { + var literalAttributeValueNodes = children.Cast().ToArray(); + var valueTokens = SyntaxListBuilder.Create(); + for (var i = 0; i < literalAttributeValueNodes.Length; i++) + { + var mergedValue = MergeAttributeValue(literalAttributeValueNodes[i]); + valueTokens.AddRange(mergedValue.LiteralTokens); + } + var rewritten = SyntaxFactory.MarkupTextLiteral(valueTokens.ToList()).Green.CreateRed(node.Parent, position); + Visit(rewritten); + } + else if (children.All(c => c is MarkupTextLiteralSyntax)) + { + var builder = SyntaxListBuilder.Create(); + var markupLiteralArray = children.Cast(); + foreach (var literal in markupLiteralArray) + { + builder.AddRange(literal.LiteralTokens); + } + var rewritten = SyntaxFactory.MarkupTextLiteral(builder.ToList()).Green.CreateRed(node.Parent, position); + Visit(rewritten); + } + else if (children.All(c => c is CSharpExpressionLiteralSyntax)) + { + var builder = SyntaxListBuilder.Create(); + var expressionLiteralArray = children.Cast(); + SpanContext context = null; + foreach (var literal in expressionLiteralArray) + { + context = literal.GetSpanContext(); + builder.AddRange(literal.LiteralTokens); + } + var rewritten = SyntaxFactory.CSharpExpressionLiteral(builder.ToList()).Green.CreateRed(node.Parent, position); + rewritten = context != null ? rewritten.WithSpanContext(context) : rewritten; + Visit(rewritten); + } + else + { + Visit(node); + } + } + + private MarkupTextLiteralSyntax MergeAttributeValue(MarkupLiteralAttributeValueSyntax node) + { + var valueTokens = MergeLiterals(node.Prefix?.LiteralTokens, node.Value?.LiteralTokens); + var rewritten = node.Prefix?.Update(valueTokens) ?? node.Value?.Update(valueTokens); + rewritten = (MarkupTextLiteralSyntax)rewritten?.Green.CreateRed(node, node.Position); + var originalContext = rewritten.GetSpanContext(); + if (originalContext != null) + { + rewritten = rewritten.WithSpanContext(new SpanContext(new MarkupChunkGenerator(), originalContext.EditHandler)); + } + + return rewritten; + } + + private void Combine(HtmlContentIntermediateNode node, SyntaxNode item) { node.Children.Add(new IntermediateToken() { - Content = span.Content, + Content = item.GetContent(), Kind = TokenKind.Html, - Source = BuildSourceSpanFromNode(span), + Source = BuildSourceSpanFromNode(item), }); if (node.Source != null) @@ -700,76 +1035,25 @@ private void Combine(HtmlContentIntermediateNode node, Span span) node.Source.Value.AbsoluteIndex, node.Source.Value.LineIndex, node.Source.Value.CharacterIndex, - node.Source.Value.Length + span.Content.Length); + node.Source.Value.Length + item.FullWidth); } } - private void AddTagHelperAttributes(IList attributes, TagHelperBinding tagHelperBinding) + private SyntaxList MergeLiterals(params SyntaxList?[] literals) { - var descriptors = tagHelperBinding.Descriptors; - var renderedBoundAttributeNames = new HashSet(StringComparer.OrdinalIgnoreCase); - foreach (var attribute in attributes) + var builder = SyntaxListBuilder.Create(); + for (var i = 0; i < literals.Length; i++) { - var attributeValueNode = attribute.Value; - var associatedDescriptors = descriptors.Where(descriptor => - descriptor.BoundAttributes.Any(attributeDescriptor => TagHelperMatchingConventions.CanSatisfyBoundAttribute(attribute.Name, attributeDescriptor))); - - if (associatedDescriptors.Any() && renderedBoundAttributeNames.Add(attribute.Name)) + var literal = literals[i]; + if (!literal.HasValue) { - var isMinimizedAttribute = attributeValueNode == null; - if (isMinimizedAttribute && !_featureFlags.AllowMinimizedBooleanTagHelperAttributes) - { - // Minimized attributes are not valid for non-boolean bound attributes. TagHelperBlockRewriter - // has already logged an error if it was a non-boolean bound attribute; so we can skip. - continue; - } - - foreach (var associatedDescriptor in associatedDescriptors) - { - var associatedAttributeDescriptor = associatedDescriptor.BoundAttributes.First(a => - { - return TagHelperMatchingConventions.CanSatisfyBoundAttribute(attribute.Name, a); - }); - - var expectsBooleanValue = associatedAttributeDescriptor.ExpectsBooleanValue(attribute.Name); - - if (isMinimizedAttribute && !expectsBooleanValue) - { - // We do not allow minimized non-boolean bound attributes. - continue; - } - - var setTagHelperProperty = new TagHelperPropertyIntermediateNode() - { - AttributeName = attribute.Name, - BoundAttribute = associatedAttributeDescriptor, - TagHelper = associatedDescriptor, - AttributeStructure = attribute.AttributeStructure, - Source = BuildSourceSpanFromNode(attributeValueNode), - IsIndexerNameMatch = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(attribute.Name, associatedAttributeDescriptor), - }; - - _builder.Push(setTagHelperProperty); - attributeValueNode?.Accept(this); - _builder.Pop(); - } + continue; } - else - { - var addHtmlAttribute = new TagHelperHtmlAttributeIntermediateNode() - { - AttributeName = attribute.Name, - AttributeStructure = attribute.AttributeStructure - }; - _builder.Push(addHtmlAttribute); - if (attributeValueNode != null) - { - attributeValueNode.Accept(this); - } - _builder.Pop(); - } + builder.AddRange(literal.Value); } + + return builder.ToList(); } } @@ -827,8 +1111,8 @@ public override void VisitDirective(DirectiveIntermediateNode node) } } - private static bool IsMalformed(List diagnostics) - => diagnostics.Count > 0 && diagnostics.Any(diagnostic => diagnostic.Severity == RazorDiagnosticSeverity.Error); + private static bool IsMalformed(IEnumerable diagnostics) + => diagnostics.Any(diagnostic => diagnostic.Severity == RazorDiagnosticSeverity.Error); } #pragma warning restore CS0618 // Type or member is obsolete } diff --git a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorSyntaxTree.cs b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorSyntaxTree.cs index 4b6d43fe0..018dbfe5f 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorSyntaxTree.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorSyntaxTree.cs @@ -1,15 +1,17 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language { internal class DefaultRazorSyntaxTree : RazorSyntaxTree { public DefaultRazorSyntaxTree( - Block root, + SyntaxNode root, RazorSourceDocument source, IReadOnlyList diagnostics, RazorParserOptions options) @@ -24,7 +26,7 @@ public DefaultRazorSyntaxTree( public override RazorParserOptions Options { get; } - internal override Block Root { get; } + internal override SyntaxNode Root { get; } public override RazorSourceDocument Source { get; } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorTagHelperBinderPhase.cs b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorTagHelperBinderPhase.cs index aa0668a53..c15aaff04 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorTagHelperBinderPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorTagHelperBinderPhase.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language { @@ -39,11 +40,11 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument) for (var i = 0; i < imports.Count; i++) { var import = imports[i]; - visitor.VisitBlock(import.Root); + visitor.Visit(import.Root); } } - visitor.VisitBlock(syntaxTree.Root); + visitor.Visit(syntaxTree.Root); var tagHelperPrefix = visitor.TagHelperPrefix; descriptors = visitor.Matches.ToArray(); @@ -57,21 +58,9 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument) return; } - var errorSink = new ErrorSink(); - var rewriter = new TagHelperParseTreeRewriter(tagHelperPrefix, descriptors, syntaxTree.Options.FeatureFlags); - - var root = syntaxTree.Root; - root = rewriter.Rewrite(root, errorSink); - - var errorList = new List(); - errorList.AddRange(errorSink.Errors); - - errorList.AddRange(descriptors.SelectMany(d => d.GetAllDiagnostics())); - - var diagnostics = CombineErrors(syntaxTree.Diagnostics, errorList); - - var newSyntaxTree = RazorSyntaxTree.Create(root, syntaxTree.Source, diagnostics, syntaxTree.Options); - codeDocument.SetSyntaxTree(newSyntaxTree); + var rewrittenSyntaxTree = TagHelperParseTreeRewriter.Rewrite(syntaxTree, tagHelperPrefix, descriptors); + + codeDocument.SetSyntaxTree(rewrittenSyntaxTree); } private static bool MatchesDirective(TagHelperDescriptor descriptor, string typePattern, string assemblyName) @@ -97,25 +86,7 @@ private static bool MatchesDirective(TagHelperDescriptor descriptor, string type return string.Equals(descriptor.Name, typePattern, StringComparison.Ordinal); } - private static int GetErrorLength(string directiveText) - { - var nonNullLength = directiveText == null ? 1 : directiveText.Length; - var normalizeEmptyStringLength = Math.Max(nonNullLength, 1); - - return normalizeEmptyStringLength; - } - - private IReadOnlyList CombineErrors(IReadOnlyList errors1, IReadOnlyList errors2) - { - var combinedErrors = new List(errors1.Count + errors2.Count); - combinedErrors.AddRange(errors1); - combinedErrors.AddRange(errors2); - - return combinedErrors; - } - - // Internal for testing. - internal class DirectiveVisitor : ParserVisitor + internal class DirectiveVisitor : SyntaxRewriter { private IReadOnlyList _tagHelpers; @@ -128,62 +99,80 @@ public DirectiveVisitor(IReadOnlyList tagHelpers) public HashSet Matches { get; } = new HashSet(); - public override void VisitAddTagHelperSpan(AddTagHelperChunkGenerator chunkGenerator, Span span) + public override SyntaxNode VisitRazorDirective(RazorDirectiveSyntax node) { - if (chunkGenerator.AssemblyName == null) - { - // Skip this one, it's an error - return; - } - - if (!AssemblyContainsTagHelpers(chunkGenerator.AssemblyName, _tagHelpers)) + var descendantLiterals = node.DescendantNodes(); + foreach (var child in descendantLiterals) { - // No tag helpers in the assembly. - return; - } - - for (var i = 0; i < _tagHelpers.Count; i++) - { - var tagHelper = _tagHelpers[i]; - if (MatchesDirective(tagHelper, chunkGenerator.TypePattern, chunkGenerator.AssemblyName)) + if (!(child is CSharpStatementLiteralSyntax literal)) { - Matches.Add(tagHelper); + continue; } - } - } - - public override void VisitRemoveTagHelperSpan(RemoveTagHelperChunkGenerator chunkGenerator, Span span) - { - if (chunkGenerator.AssemblyName == null) - { - // Skip this one, it's an error - return; - } - - - if (!AssemblyContainsTagHelpers(chunkGenerator.AssemblyName, _tagHelpers)) - { - // No tag helpers in the assembly. - return; - } - for (var i = 0; i < _tagHelpers.Count; i++) - { - var tagHelper = _tagHelpers[i]; - if (MatchesDirective(tagHelper, chunkGenerator.TypePattern, chunkGenerator.AssemblyName)) + var context = literal.GetSpanContext(); + if (context == null) + { + // We can't find a chunk generator. + continue; + } + else if (context.ChunkGenerator is AddTagHelperChunkGenerator addTagHelper) { - Matches.Remove(tagHelper); + if (addTagHelper.AssemblyName == null) + { + // Skip this one, it's an error + continue; + } + + if (!AssemblyContainsTagHelpers(addTagHelper.AssemblyName, _tagHelpers)) + { + // No tag helpers in the assembly. + continue; + } + + for (var i = 0; i < _tagHelpers.Count; i++) + { + var tagHelper = _tagHelpers[i]; + if (MatchesDirective(tagHelper, addTagHelper.TypePattern, addTagHelper.AssemblyName)) + { + Matches.Add(tagHelper); + } + } + } + else if (context.ChunkGenerator is RemoveTagHelperChunkGenerator removeTagHelper) + { + if (removeTagHelper.AssemblyName == null) + { + // Skip this one, it's an error + continue; + } + + + if (!AssemblyContainsTagHelpers(removeTagHelper.AssemblyName, _tagHelpers)) + { + // No tag helpers in the assembly. + continue; + } + + for (var i = 0; i < _tagHelpers.Count; i++) + { + var tagHelper = _tagHelpers[i]; + if (MatchesDirective(tagHelper, removeTagHelper.TypePattern, removeTagHelper.AssemblyName)) + { + Matches.Remove(tagHelper); + } + } + } + else if (context.ChunkGenerator is TagHelperPrefixDirectiveChunkGenerator tagHelperPrefix) + { + if (!string.IsNullOrEmpty(tagHelperPrefix.DirectiveText)) + { + // We only expect to see a single one of these per file, but that's enforced at another level. + TagHelperPrefix = tagHelperPrefix.DirectiveText; + } } } - } - public override void VisitTagHelperPrefixDirectiveSpan(TagHelperPrefixDirectiveChunkGenerator chunkGenerator, Span span) - { - if (!string.IsNullOrEmpty(chunkGenerator.DirectiveText)) - { - // We only expect to see a single one of these per file, but that's enforced at another level. - TagHelperPrefix = chunkGenerator.DirectiveText; - } + return base.VisitRazorDirective(node); } private bool AssemblyContainsTagHelpers(string assemblyName, IReadOnlyList tagHelpers) diff --git a/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs index b4edccf63..c84d8b0c6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs @@ -4,17 +4,17 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language { internal class DirectiveTokenEditHandler : SpanEditHandler { - public DirectiveTokenEditHandler(Func> tokenizer) : base(tokenizer) + public DirectiveTokenEditHandler(Func> tokenizer) : base(tokenizer) { } - protected override PartialParseResultInternal CanAcceptChange(Span target, SourceChange change) + protected override PartialParseResultInternal CanAcceptChange(SyntaxNode target, SourceChange change) { if (AcceptedCharacters == AcceptedCharactersInternal.NonWhitespace) { @@ -31,7 +31,6 @@ protected override PartialParseResultInternal CanAcceptChange(Span target, Sourc } return PartialParseResultInternal.Rejected; - } private static bool ContainsWhitespace(string content) diff --git a/src/Microsoft.AspNetCore.Razor.Language/HtmlNodeOptimizationPass.cs b/src/Microsoft.AspNetCore.Razor.Language/HtmlNodeOptimizationPass.cs index ea3d75455..1b327aa03 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/HtmlNodeOptimizationPass.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/HtmlNodeOptimizationPass.cs @@ -22,14 +22,11 @@ public RazorSyntaxTree Execute(RazorCodeDocument codeDocument, RazorSyntaxTree s throw new ArgumentNullException(nameof(syntaxTree)); } - var conditionalAttributeCollapser = new ConditionalAttributeCollapser(); - var rewritten = conditionalAttributeCollapser.Rewrite(syntaxTree.Root); - - var whitespaceRewriter = new WhiteSpaceRewriter(); - rewritten = whitespaceRewriter.Rewrite(rewritten); + var whitespaceRewriter = new WhitespaceRewriter(); + var rewritten = whitespaceRewriter.Visit(syntaxTree.Root); var rewrittenSyntaxTree = RazorSyntaxTree.Create(rewritten, syntaxTree.Source, syntaxTree.Diagnostics, syntaxTree.Options); return rewrittenSyntaxTree; } } -} +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AddImportChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AddImportChunkGenerator.cs index 0d7b9de15..4cee1abe3 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AddImportChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AddImportChunkGenerator.cs @@ -14,23 +14,6 @@ public AddImportChunkGenerator(string ns) public string Namespace { get; } - public override void Accept(ParserVisitor visitor, Span span) - { - visitor.VisitImportSpan(this, span); - } - - public override void GenerateChunk(Span target, ChunkGeneratorContext context) - { - var ns = Namespace; - - if (!string.IsNullOrEmpty(ns) && char.IsWhiteSpace(ns[0])) - { - ns = ns.Substring(1); - } - - //context.ChunkTreeBuilder.AddUsingChunk(ns, target); - } - public override string ToString() { return "Import:" + Namespace + ";"; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AddTagHelperChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AddTagHelperChunkGenerator.cs index f446be12c..2df86b32d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AddTagHelperChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AddTagHelperChunkGenerator.cs @@ -35,11 +35,6 @@ public AddTagHelperChunkGenerator( public List Diagnostics { get; } - public override void Accept(ParserVisitor visitor, Span span) - { - visitor.VisitAddTagHelperSpan(this, span); - } - /// public override bool Equals(object obj) { diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AttributeBlockChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AttributeBlockChunkGenerator.cs deleted file mode 100644 index de77a1746..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AttributeBlockChunkGenerator.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Globalization; -using Microsoft.Extensions.Internal; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class AttributeBlockChunkGenerator : ParentChunkGenerator - { - public AttributeBlockChunkGenerator(string name, LocationTagged prefix, LocationTagged suffix) - { - Name = name; - Prefix = prefix; - Suffix = suffix; - } - - public string Name { get; } - - public LocationTagged Prefix { get; } - - public LocationTagged Suffix { get; } - - public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) - { - //var chunk = context.ChunkTreeBuilder.StartParentChunk(target); - - //chunk.Attribute = Name; - //chunk.Prefix = Prefix; - //chunk.Suffix = Suffix; - } - - public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) - { - //context.ChunkTreeBuilder.EndParentChunk(); - } - - public override void Accept(ParserVisitor visitor, Block block) - { - visitor.VisitAttributeBlock(this, block); - } - - public override string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "Attr:{0},{1:F},{2:F}", Name, Prefix, Suffix); - } - - public override bool Equals(object obj) - { - var other = obj as AttributeBlockChunkGenerator; - return other != null && - string.Equals(other.Name, Name, StringComparison.Ordinal) && - Equals(other.Prefix, Prefix) && - Equals(other.Suffix, Suffix); - } - - public override int GetHashCode() - { - var hashCodeCombiner = HashCodeCombiner.Start(); - hashCodeCombiner.Add(Name, StringComparer.Ordinal); - hashCodeCombiner.Add(Prefix); - hashCodeCombiner.Add(Suffix); - - return hashCodeCombiner; - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AutoCompleteEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AutoCompleteEditHandler.cs index a20dbddfb..251437778 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AutoCompleteEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AutoCompleteEditHandler.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -12,18 +12,18 @@ internal class AutoCompleteEditHandler : SpanEditHandler { private static readonly int TypeHashCode = typeof(AutoCompleteEditHandler).GetHashCode(); - public AutoCompleteEditHandler(Func> tokenizer) + public AutoCompleteEditHandler(Func> tokenizer) : base(tokenizer) { } - public AutoCompleteEditHandler(Func> tokenizer, bool autoCompleteAtEndOfSpan) + public AutoCompleteEditHandler(Func> tokenizer, bool autoCompleteAtEndOfSpan) : this(tokenizer) { AutoCompleteAtEndOfSpan = autoCompleteAtEndOfSpan; } - public AutoCompleteEditHandler(Func> tokenizer, AcceptedCharactersInternal accepted) + public AutoCompleteEditHandler(Func> tokenizer, AcceptedCharactersInternal accepted) : base(tokenizer, accepted) { } @@ -32,7 +32,7 @@ public AutoCompleteEditHandler(Func> tokenizer, public string AutoCompleteString { get; set; } - protected override PartialParseResultInternal CanAcceptChange(Span target, SourceChange change) + protected override PartialParseResultInternal CanAcceptChange(SyntaxNode target, SourceChange change) { if (((AutoCompleteAtEndOfSpan && IsAtEndOfSpan(target, change)) || IsAtEndOfFirstLine(target, change)) && change.IsInsert && diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/Block.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/Block.cs deleted file mode 100644 index ee7cc135f..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/Block.cs +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using Microsoft.Extensions.Internal; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class Block : SyntaxTreeNode - { - private int? _length; - - public Block(BlockBuilder source) - : this(source.Type, source.Children, source.ChunkGenerator) - { - source.Reset(); - } - - protected Block(BlockKindInternal? type, IReadOnlyList children, IParentChunkGenerator generator) - { - if (type == null) - { - throw new InvalidOperationException(Resources.Block_Type_Not_Specified); - } - - Type = type.Value; - Children = children; - ChunkGenerator = generator; - - // Perf: Avoid allocating an enumerator. - for (var i = 0; i < Children.Count; i++) - { - Children[i].Parent = this; - } - } - public IParentChunkGenerator ChunkGenerator { get; } - - public BlockKindInternal Type { get; } - - public IReadOnlyList Children { get; } - - public override bool IsBlock => true; - - public override SourceLocation Start - { - get - { - var child = Children.FirstOrDefault(); - if (child == null) - { - return SourceLocation.Zero; - } - else - { - return child.Start; - } - } - } - - public override int Length - { - get - { - if (_length == null) - { - var length = 0; - for (var i = 0; i < Children.Count; i++) - { - length += Children[i].Length; - } - - _length = length; - } - - return _length.Value; - } - } - - - public virtual IEnumerable Flatten() - { - // Perf: Avoid allocating an enumerator. - for (var i = 0; i < Children.Count; i++) - { - var element = Children[i]; - var span = element as Span; - if (span != null) - { - yield return span; - } - else - { - var block = element as Block; - foreach (Span childSpan in block.Flatten()) - { - yield return childSpan; - } - } - } - } - - public Span FindFirstDescendentSpan() - { - SyntaxTreeNode current = this; - while (current != null && current.IsBlock) - { - current = ((Block)current).Children.FirstOrDefault(); - } - return current as Span; - } - - public Span FindLastDescendentSpan() - { - SyntaxTreeNode current = this; - while (current != null && current.IsBlock) - { - current = ((Block)current).Children.LastOrDefault(); - } - return current as Span; - } - - public virtual Span LocateOwner(SourceChange change) => LocateOwner(change, Children); - - protected static Span LocateOwner(SourceChange change, IEnumerable elements) - { - // Ask each child recursively - Span owner = null; - foreach (var element in elements) - { - var span = element as Span; - if (span == null) - { - owner = ((Block)element).LocateOwner(change); - } - else - { - if (change.Span.AbsoluteIndex < span.Start.AbsoluteIndex) - { - // Early escape for cases where changes overlap multiple spans - // In those cases, the span will return false, and we don't want to search the whole tree - // So if the current span starts after the change, we know we've searched as far as we need to - break; - } - owner = span.EditHandler.OwnsChange(span, change) ? span : owner; - } - - if (owner != null) - { - break; - } - } - return owner; - } - - public override string ToString() - { - return string.Format( - CultureInfo.CurrentCulture, - "{0} Block at {1}::{2} (Gen:{3})", - Type, - Start, - Length, - ChunkGenerator); - } - - public override bool Equals(object obj) - { - var other = obj as Block; - return other != null && - Type == other.Type && - Equals(ChunkGenerator, other.ChunkGenerator) && - ChildrenEqual(Children, other.Children); - } - - public override int GetHashCode() - { - var hashCodeCombiner = HashCodeCombiner.Start(); - hashCodeCombiner.Add(Type); - hashCodeCombiner.Add(ChunkGenerator); - hashCodeCombiner.Add(Children); - - return hashCodeCombiner; - } - - private static bool ChildrenEqual(IEnumerable left, IEnumerable right) - { - IEnumerator leftEnum = left.GetEnumerator(); - IEnumerator rightEnum = right.GetEnumerator(); - while (leftEnum.MoveNext()) - { - if (!rightEnum.MoveNext() || // More items in left than in right - !Equals(leftEnum.Current, rightEnum.Current)) - { - // Nodes are not equal - return false; - } - } - if (rightEnum.MoveNext()) - { - // More items in right than left - return false; - } - return true; - } - - public override bool EquivalentTo(SyntaxTreeNode node) - { - var other = node as Block; - if (other == null || other.Type != Type) - { - return false; - } - - return Enumerable.SequenceEqual(Children, other.Children, EquivalenceComparer.Default); - } - - public override int GetEquivalenceHash() - { - var hashCodeCombiner = HashCodeCombiner.Start(); - hashCodeCombiner.Add(Type); - foreach (var child in Children) - { - hashCodeCombiner.Add(child.GetEquivalenceHash()); - } - - return hashCodeCombiner.CombinedHash; - } - - public override void Accept(ParserVisitor visitor) - { - visitor.VisitBlock(this); - } - - public override SyntaxTreeNode Clone() - { - var blockBuilder = new BlockBuilder(this); - - blockBuilder.Children.Clear(); - for (var i = 0; i < Children.Count; i++) - { - var clonedChild = Children[i].Clone(); - blockBuilder.Children.Add(clonedChild); - } - - return blockBuilder.Build(); - } - - internal void ChildChanged() - { - // A node in our graph has changed. We'll need to recompute our length the next time we're asked for it. - _length = null; - - Parent?.ChildChanged(); - } - - private class EquivalenceComparer : IEqualityComparer - { - public static readonly EquivalenceComparer Default = new EquivalenceComparer(); - - private EquivalenceComparer() - { - } - - public bool Equals(SyntaxTreeNode nodeX, SyntaxTreeNode nodeY) - { - if (nodeX == nodeY) - { - return true; - } - - return nodeX != null && nodeX.EquivalentTo(nodeY); - } - - public int GetHashCode(SyntaxTreeNode node) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - return node.GetEquivalenceHash(); - } - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/BlockBuilder.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/BlockBuilder.cs deleted file mode 100644 index 3e3905c4a..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/BlockBuilder.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class BlockBuilder - { - public BlockBuilder() - { - Reset(); - } - - public BlockBuilder(Block original) - { - Type = original.Type; - Children = new List(original.Children); - ChunkGenerator = original.ChunkGenerator; - } - - public IParentChunkGenerator ChunkGenerator { get; set; } - - public BlockKindInternal? Type { get; set; } - - public List Children { get; private set; } - - public virtual Block Build() - { - return new Block(this); - } - - public virtual void Reset() - { - Type = null; - Children = new List(); - ChunkGenerator = ParentChunkGenerator.Null; - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/BlockExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/BlockExtensions.cs deleted file mode 100644 index 232baf7ee..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/BlockExtensions.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal static class BlockExtensions - { - public static void LinkNodes(this Block self) - { - Span first = null; - Span previous = null; - foreach (Span span in self.Flatten()) - { - if (first == null) - { - first = span; - } - span.Previous = previous; - - if (previous != null) - { - previous.Next = span; - } - previous = span; - } - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs index 126970945..44612ee18 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs @@ -70,8 +70,8 @@ internal class CSharpCodeParser : TokenizerBackedParser private readonly ISet CurrentKeywords = new HashSet(DefaultKeywords); - private Dictionary _directiveParsers = new Dictionary(StringComparer.Ordinal); - private Dictionary> _keywordParsers = new Dictionary>(); + private Dictionary, CSharpTransitionSyntax>> _keywordParserMap = new Dictionary, CSharpTransitionSyntax>>(); + private Dictionary, CSharpTransitionSyntax>> _directiveParserMap = new Dictionary, CSharpTransitionSyntax>>(StringComparer.Ordinal); public CSharpCodeParser(ParserContext context) : this(directives: Enumerable.Empty(), context: context) @@ -92,9 +92,9 @@ public CSharpCodeParser(IEnumerable directives, ParserConte } Keywords = new HashSet(); - SetUpKeywords(); - SetupDirectives(directives); - SetUpExpressions(); + SetupKeywordParsers(); + SetupExpressionParsers(); + SetupDirectiveParsers(directives); } public HtmlMarkupParser HtmlParser { get; set; } @@ -103,121 +103,39 @@ public CSharpCodeParser(IEnumerable directives, ParserConte public bool IsNested { get; set; } - protected override bool TokenKindEquals(SyntaxKind x, SyntaxKind y) => x == y; - - protected void MapDirectives(Action handler, params string[] directives) - { - foreach (var directive in directives) - { - _directiveParsers.Add(directive, () => - { - handler(); - Context.SeenDirectives.Add(directive); - }); - - Keywords.Add(directive); - - // These C# keywords are reserved for use in directives. It's an error to use them outside of - // a directive. This code removes the error generation if the directive *is* registered. - if (string.Equals(directive, "class", StringComparison.OrdinalIgnoreCase)) - { - _keywordParsers.Remove(CSharpKeyword.Class); - } - else if (string.Equals(directive, "namespace", StringComparison.OrdinalIgnoreCase)) - { - _keywordParsers.Remove(CSharpKeyword.Namespace); - } - } - } - - protected bool TryGetDirectiveHandler(string directive, out Action handler) - { - return _directiveParsers.TryGetValue(directive, out handler); - } - - private void MapExpressionKeyword(Action handler, CSharpKeyword keyword) - { - _keywordParsers.Add(keyword, handler); - - // Expression keywords don't belong in the regular keyword list - } - - private void MapKeywords(Action handler, params CSharpKeyword[] keywords) - { - MapKeywords(handler, topLevel: true, keywords: keywords); - } - - private void MapKeywords(Action handler, bool topLevel, params CSharpKeyword[] keywords) + public CSharpCodeBlockSyntax ParseBlock() { - foreach (var keyword in keywords) + if (Context == null) { - _keywordParsers.Add(keyword, handler); - if (topLevel) - { - Keywords.Add(CSharpLanguageCharacteristics.GetKeyword(keyword)); - } + throw new InvalidOperationException(Resources.Parser_Context_Not_Set); } - } - - [Conditional("DEBUG")] - internal void Assert(CSharpKeyword expectedKeyword) - { - var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); - Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && - result.HasValue && - result.Value == expectedKeyword); - } - protected internal bool At(CSharpKeyword keyword) - { - var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); - return At(SyntaxKind.Keyword) && - result.HasValue && - result.Value == keyword; - } - - protected internal bool AcceptIf(CSharpKeyword keyword) - { - if (At(keyword)) + if (EndOfFile) { - AcceptAndMoveNext(); - return true; + // Nothing to parse. + return null; } - return false; - } - - protected static Func IsSpacingToken(bool includeNewLines, bool includeComments) - { - return token => token.Kind == SyntaxKind.Whitespace || - (includeNewLines && token.Kind == SyntaxKind.NewLine) || - (includeComments && token.Kind == SyntaxKind.CSharpComment); - } - public override void ParseBlock() - { - using (PushSpanConfig(DefaultSpanConfig)) + using (var pooledResult = Pool.Allocate()) + using (PushSpanContextConfig(DefaultSpanContextConfig)) { - if (Context == null) - { - throw new InvalidOperationException(Resources.Parser_Context_Not_Set); - } - - Span.Start = CurrentLocation; - - // Unless changed, the block is a statement block - using (Context.Builder.StartBlock(BlockKindInternal.Statement)) + var builder = pooledResult.Builder; + try { NextToken(); + // Unless changed, the block is a statement block AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + builder.Add(OutputTokensAsStatementLiteral()); - var current = CurrentToken; + // We are usually called when the other parser sees a transition '@'. Look for it. + SyntaxToken transitionToken = null; if (At(SyntaxKind.StringLiteral) && CurrentToken.Content.Length > 0 && CurrentToken.Content[0] == SyntaxConstants.TransitionCharacter) { var split = Language.SplitToken(CurrentToken, 1, SyntaxKind.Transition); - current = split.Item1; + transitionToken = split.Item1; // Back up to the end of the transition Context.Source.Position -= split.Item2.Content.Length; @@ -225,142 +143,106 @@ public override void ParseBlock() } else if (At(SyntaxKind.Transition)) { - NextToken(); + transitionToken = EatCurrentToken(); } - // Accept "@" if we see it, but if we don't, that's OK. We assume we were started for a good reason - if (current.Kind == SyntaxKind.Transition) - { - if (Span.Tokens.Count > 0) - { - Output(SpanKindInternal.Code); - } - AtTransition(current); - } - else + if (transitionToken == null) { - // No "@" => Jump straight to AfterTransition - AfterTransition(); + transitionToken = SyntaxFactory.MissingToken(SyntaxKind.Transition); } - Output(SpanKindInternal.Code); - } - } - } - - private void DefaultSpanConfig(SpanBuilder span) - { - span.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); - span.ChunkGenerator = new StatementChunkGenerator(); - } - - private void AtTransition(SyntaxToken current) - { - Debug.Assert(current.Kind == SyntaxKind.Transition); - Accept(current); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - Span.ChunkGenerator = SpanChunkGenerator.Null; - - // Output the "@" span and continue here - Output(SpanKindInternal.Transition); - AfterTransition(); - } + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + var transition = GetNodeWithSpanContext(SyntaxFactory.CSharpTransition(transitionToken)); - private void AfterTransition() - { - using (PushSpanConfig(DefaultSpanConfig)) - { - EnsureCurrent(); - try - { - // What type of block is this? - if (!EndOfFile) + if (At(SyntaxKind.LeftBrace)) { - if (CurrentToken.Kind == SyntaxKind.LeftParenthesis) - { - Context.Builder.CurrentBlock.Type = BlockKindInternal.Expression; - Context.Builder.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); - ExplicitExpression(); - return; - } - else if (CurrentToken.Kind == SyntaxKind.Identifier) + var statementBody = ParseStatementBody(); + var statement = SyntaxFactory.CSharpStatement(transition, statementBody); + builder.Add(statement); + } + else if (At(SyntaxKind.LeftParenthesis)) + { + var expressionBody = ParseExplicitExpressionBody(); + var expression = SyntaxFactory.CSharpExplicitExpression(transition, expressionBody); + builder.Add(expression); + } + else if (At(SyntaxKind.Identifier)) + { + if (!TryParseDirective(builder, transition, CurrentToken.Content)) { - if (TryGetDirectiveHandler(CurrentToken.Content, out var handler)) + if (string.Equals( + CurrentToken.Content, + SyntaxConstants.CSharp.HelperKeyword, + StringComparison.Ordinal)) { - Span.ChunkGenerator = SpanChunkGenerator.Null; - handler(); - return; + var diagnostic = RazorDiagnosticFactory.CreateParsing_HelperDirectiveNotAvailable( + new SourceSpan(CurrentStart, CurrentToken.Content.Length)); + CurrentToken.SetDiagnostics(new[] { diagnostic }); + Context.ErrorSink.OnError(diagnostic); } - else - { - if (string.Equals( - CurrentToken.Content, - SyntaxConstants.CSharp.HelperKeyword, - StringComparison.Ordinal)) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_HelperDirectiveNotAvailable( - new SourceSpan(CurrentStart, CurrentToken.Content.Length))); - } - Context.Builder.CurrentBlock.Type = BlockKindInternal.Expression; - Context.Builder.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); - ImplicitExpression(); - return; - } - } - else if (CurrentToken.Kind == SyntaxKind.Keyword) - { - if (TryGetDirectiveHandler(CurrentToken.Content, out var handler)) - { - Span.ChunkGenerator = SpanChunkGenerator.Null; - handler(); - return; - } - else - { - KeywordBlock(topLevel: true); - return; - } + var implicitExpressionBody = ParseImplicitExpressionBody(); + var implicitExpression = SyntaxFactory.CSharpImplicitExpression(transition, implicitExpressionBody); + builder.Add(implicitExpression); } - else if (CurrentToken.Kind == SyntaxKind.LeftBrace) + } + else if (At(SyntaxKind.Keyword)) + { + if (!TryParseDirective(builder, transition, CurrentToken.Content) && + !TryParseKeyword(builder, transition)) { - VerbatimBlock(); - return; + // Not a directive or a special keyword. Just parse as an implicit expression. + var implicitExpressionBody = ParseImplicitExpressionBody(); + var implicitExpression = SyntaxFactory.CSharpImplicitExpression(transition, implicitExpressionBody); + builder.Add(implicitExpression); } - } - // Invalid character - Context.Builder.CurrentBlock.Type = BlockKindInternal.Expression; - Context.Builder.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); - AddMarkerTokenIfNecessary(); - Span.ChunkGenerator = new ExpressionChunkGenerator(); - Span.EditHandler = new ImplicitExpressionEditHandler( - Language.TokenizeString, - CurrentKeywords, - acceptTrailingDot: IsNested) - { - AcceptedCharacters = AcceptedCharactersInternal.NonWhitespace - }; - if (At(SyntaxKind.Whitespace) || At(SyntaxKind.NewLine)) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock( - new SourceSpan(CurrentStart, CurrentToken.Content.Length))); - } - else if (EndOfFile) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedEndOfFileAtStartOfCodeBlock( - new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); + builder.Add(OutputTokensAsStatementLiteral()); } else { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedCharacterAtStartOfCodeBlock( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), - CurrentToken.Content)); + // Invalid character + SpanContext.ChunkGenerator = new ExpressionChunkGenerator(); + SpanContext.EditHandler = new ImplicitExpressionEditHandler( + Language.TokenizeString, + CurrentKeywords, + acceptTrailingDot: IsNested) + { + AcceptedCharacters = AcceptedCharactersInternal.NonWhitespace + }; + + AcceptMarkerTokenIfNecessary(); + var expressionLiteral = SyntaxFactory.CSharpCodeBlock(OutputTokensAsExpressionLiteral()); + var expressionBody = SyntaxFactory.CSharpImplicitExpressionBody(expressionLiteral); + var expressionBlock = SyntaxFactory.CSharpImplicitExpression(transition, expressionBody); + builder.Add(expressionBlock); + + if (At(SyntaxKind.Whitespace) || At(SyntaxKind.NewLine)) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock( + new SourceSpan(CurrentStart, CurrentToken.Content.Length))); + } + else if (EndOfFile) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedEndOfFileAtStartOfCodeBlock( + new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); + } + else + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedCharacterAtStartOfCodeBlock( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), + CurrentToken.Content)); + } } + + Debug.Assert(TokenBuilder.Count == 0, "We should not have any tokens left."); + + var codeBlock = SyntaxFactory.CSharpCodeBlock(builder.ToList()); + return codeBlock; } finally { @@ -370,75 +252,90 @@ private void AfterTransition() } } - private void VerbatimBlock() + private CSharpExplicitExpressionBodySyntax ParseExplicitExpressionBody() { - Assert(SyntaxKind.LeftBrace); - var block = new Block(Resources.BlockName_Code, CurrentStart); - AcceptAndMoveNext(); + var block = new Block(Resources.BlockName_ExplicitExpression, CurrentStart); + Assert(SyntaxKind.LeftParenthesis); + var leftParenToken = EatCurrentToken(); + var leftParen = OutputAsMetaCode(leftParenToken); - // Set up the "{" span and output - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.MetaCode); + using (var pooledResult = Pool.Allocate()) + { + var expressionBuilder = pooledResult.Builder; + using (PushSpanContextConfig(ExplicitExpressionSpanContextConfig)) + { + var success = Balance( + expressionBuilder, + BalancingModes.BacktrackOnFailure | + BalancingModes.NoErrorOnFailure | + BalancingModes.AllowCommentsAndTemplates, + SyntaxKind.LeftParenthesis, + SyntaxKind.RightParenthesis, + block.Start); - // Set up auto-complete and parse the code block - var editHandler = new AutoCompleteEditHandler(Language.TokenizeString); - Span.EditHandler = editHandler; - CodeBlock(false, block); + if (!success) + { + AcceptUntil(SyntaxKind.LessThan); + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( + new SourceSpan(block.Start, contentLength: 1 /* ( */), block.Name, ")", "(")); + } - Span.ChunkGenerator = new StatementChunkGenerator(); - AddMarkerTokenIfNecessary(); - if (!At(SyntaxKind.RightBrace)) - { - editHandler.AutoCompleteString = "}"; - } - Output(SpanKindInternal.Code); + // If necessary, put an empty-content marker token here + AcceptMarkerTokenIfNecessary(); + expressionBuilder.Add(OutputTokensAsExpressionLiteral()); + } - if (Optional(SyntaxKind.RightBrace)) - { - // Set up the "}" span - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - Span.ChunkGenerator = SpanChunkGenerator.Null; - } + var expressionBlock = SyntaxFactory.CSharpCodeBlock(expressionBuilder.ToList()); - if (!IsNested) - { - EnsureCurrent(); - if (At(SyntaxKind.NewLine) || - (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.NewLine))) + RazorMetaCodeSyntax rightParen = null; + if (At(SyntaxKind.RightParenthesis)) { - Context.NullGenerateWhitespaceAndNewLine = true; + rightParen = OutputAsMetaCode(EatCurrentToken()); + } + else + { + var missingToken = SyntaxFactory.MissingToken(SyntaxKind.RightParenthesis); + rightParen = OutputAsMetaCode(missingToken, SpanContext.EditHandler.AcceptedCharacters); + } + if (!EndOfFile) + { + PutCurrentBack(); } - } - Output(SpanKindInternal.MetaCode); + return SyntaxFactory.CSharpExplicitExpressionBody(leftParen, expressionBlock, rightParen); + } } - private void ImplicitExpression() + private CSharpImplicitExpressionBodySyntax ParseImplicitExpressionBody(bool async = false) { - ImplicitExpression(AcceptedCharactersInternal.NonWhitespace); - } + var accepted = AcceptedCharactersInternal.NonWhitespace; + if (async) + { + // Async implicit expressions include the "await" keyword and therefore need to allow spaces to + // separate the "await" and the following code. + accepted = AcceptedCharactersInternal.AnyExceptNewline; + } - // Async implicit expressions include the "await" keyword and therefore need to allow spaces to - // separate the "await" and the following code. - private void AsyncImplicitExpression() - { - ImplicitExpression(AcceptedCharactersInternal.AnyExceptNewline); + using (var pooledResult = Pool.Allocate()) + { + var expressionBuilder = pooledResult.Builder; + ParseImplicitExpression(expressionBuilder, accepted); + var codeBlock = SyntaxFactory.CSharpCodeBlock(expressionBuilder.ToList()); + return SyntaxFactory.CSharpImplicitExpressionBody(codeBlock); + } } - private void ImplicitExpression(AcceptedCharactersInternal acceptedCharacters) + private void ParseImplicitExpression(in SyntaxListBuilder builder, AcceptedCharactersInternal acceptedCharacters) { - Context.Builder.CurrentBlock.Type = BlockKindInternal.Expression; - Context.Builder.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); - - using (PushSpanConfig(span => + using (PushSpanContextConfig(spanContext => { - span.EditHandler = new ImplicitExpressionEditHandler( + spanContext.EditHandler = new ImplicitExpressionEditHandler( Language.TokenizeString, Keywords, acceptTrailingDot: IsNested); - span.EditHandler.AcceptedCharacters = acceptedCharacters; - span.ChunkGenerator = new ExpressionChunkGenerator(); + spanContext.EditHandler.AcceptedCharacters = acceptedCharacters; + spanContext.ChunkGenerator = new ExpressionChunkGenerator(); })) { do @@ -448,14 +345,14 @@ private void ImplicitExpression(AcceptedCharactersInternal acceptedCharacters) AcceptAndMoveNext(); } } - while (MethodCallOrArrayIndex(acceptedCharacters)); + while (ParseMethodCallOrArrayIndex(builder, acceptedCharacters)); PutCurrentBack(); - Output(SpanKindInternal.Code); + builder.Add(OutputTokensAsExpressionLiteral()); } } - private bool MethodCallOrArrayIndex(AcceptedCharactersInternal acceptedCharacters) + private bool ParseMethodCallOrArrayIndex(in SyntaxListBuilder builder, AcceptedCharactersInternal acceptedCharacters) { if (!EndOfFile) { @@ -463,19 +360,19 @@ private bool MethodCallOrArrayIndex(AcceptedCharactersInternal acceptedCharacter CurrentToken.Kind == SyntaxKind.LeftBracket) { // If we end within "(", whitespace is fine - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; SyntaxKind right; bool success; - using (PushSpanConfig((span, prev) => + using (PushSpanContextConfig((spanContext, prev) => { - prev(span); - span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; + prev(spanContext); + spanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; })) { right = Language.FlipBracket(CurrentToken.Kind); - success = Balance(BalancingModes.BacktrackOnFailure | BalancingModes.AllowCommentsAndTemplates); + success = Balance(builder, BalancingModes.BacktrackOnFailure | BalancingModes.AllowCommentsAndTemplates); } if (!success) @@ -487,9 +384,9 @@ private bool MethodCallOrArrayIndex(AcceptedCharactersInternal acceptedCharacter AcceptAndMoveNext(); // At the ending brace, restore the initial accepted characters. - Span.EditHandler.AcceptedCharacters = acceptedCharacters; + SpanContext.EditHandler.AcceptedCharacters = acceptedCharacters; } - return MethodCallOrArrayIndex(acceptedCharacters); + return ParseMethodCallOrArrayIndex(builder, acceptedCharacters); } if (At(SyntaxKind.QuestionMark)) { @@ -512,7 +409,7 @@ private bool MethodCallOrArrayIndex(AcceptedCharactersInternal acceptedCharacter AcceptAndMoveNext(); // Accept the [ and any content inside (it will attempt to balance). - return MethodCallOrArrayIndex(acceptedCharacters); + return ParseMethodCallOrArrayIndex(builder, acceptedCharacters); } } } @@ -553,362 +450,990 @@ private bool MethodCallOrArrayIndex(AcceptedCharactersInternal acceptedCharacter return false; } - protected void CompleteBlock() + private CSharpStatementBodySyntax ParseStatementBody(Block block = null) { - CompleteBlock(insertMarkerIfNecessary: true); - } + Assert(SyntaxKind.LeftBrace); + block = block ?? new Block(Resources.BlockName_Code, CurrentStart); + var leftBrace = OutputAsMetaCode(EatExpectedToken(SyntaxKind.LeftBrace)); + CSharpCodeBlockSyntax codeBlock = null; + using (var pooledResult = Pool.Allocate()) + { + var builder = pooledResult.Builder; + // Set up auto-complete and parse the code block + var editHandler = new AutoCompleteEditHandler(Language.TokenizeString); + SpanContext.EditHandler = editHandler; + ParseCodeBlock(builder, block, acceptTerminatingBrace: false); - protected void CompleteBlock(bool insertMarkerIfNecessary) - { - CompleteBlock(insertMarkerIfNecessary, captureWhitespaceToEndOfLine: insertMarkerIfNecessary); - } + EnsureCurrent(); + SpanContext.ChunkGenerator = new StatementChunkGenerator(); + AcceptMarkerTokenIfNecessary(); + if (!At(SyntaxKind.RightBrace)) + { + editHandler.AutoCompleteString = "}"; + } + builder.Add(OutputTokensAsStatementLiteral()); - protected void CompleteBlock(bool insertMarkerIfNecessary, bool captureWhitespaceToEndOfLine) - { - if (insertMarkerIfNecessary && Context.Builder.LastAcceptedCharacters != AcceptedCharactersInternal.Any) - { - AddMarkerTokenIfNecessary(); + codeBlock = SyntaxFactory.CSharpCodeBlock(builder.ToList()); } - EnsureCurrent(); - - // Read whitespace, but not newlines - // If we're not inserting a marker span, we don't need to capture whitespace - if (!Context.WhiteSpaceIsSignificantToAncestorBlock && - Context.Builder.CurrentBlock.Type != BlockKindInternal.Expression && - captureWhitespaceToEndOfLine && - !Context.DesignTimeMode && - !IsNested) + RazorMetaCodeSyntax rightBrace = null; + if (At(SyntaxKind.RightBrace)) { - CaptureWhitespaceAtEndOfCodeOnlyLine(); + rightBrace = OutputAsMetaCode(EatCurrentToken()); } else { - PutCurrentBack(); + rightBrace = OutputAsMetaCode( + SyntaxFactory.MissingToken(SyntaxKind.RightBrace), + SpanContext.EditHandler.AcceptedCharacters); } - } - private void CaptureWhitespaceAtEndOfCodeOnlyLine() - { - var whitespace = ReadWhile(token => token.Kind == SyntaxKind.Whitespace); - if (At(SyntaxKind.NewLine)) - { - Accept(whitespace); - AcceptAndMoveNext(); - PutCurrentBack(); - } - else + if (!IsNested) { - PutCurrentBack(); - PutBack(whitespace); + EnsureCurrent(); + if (At(SyntaxKind.NewLine) || + (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.NewLine))) + { + Context.NullGenerateWhitespaceAndNewLine = true; + } } - } - private void ConfigureExplicitExpressionSpan(SpanBuilder sb) - { - sb.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); - sb.ChunkGenerator = new ExpressionChunkGenerator(); + return SyntaxFactory.CSharpStatementBody(leftBrace, codeBlock, rightBrace); } - private void ExplicitExpression() + private void ParseCodeBlock(in SyntaxListBuilder builder, Block block, bool acceptTerminatingBrace = true) { - var block = new Block(Resources.BlockName_ExplicitExpression, CurrentStart); - Assert(SyntaxKind.LeftParenthesis); - AcceptAndMoveNext(); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.MetaCode); - using (PushSpanConfig(ConfigureExplicitExpressionSpan)) - { - var success = Balance( - BalancingModes.BacktrackOnFailure | - BalancingModes.NoErrorOnFailure | - BalancingModes.AllowCommentsAndTemplates, - SyntaxKind.LeftParenthesis, - SyntaxKind.RightParenthesis, - block.Start); - - if (!success) - { - AcceptUntil(SyntaxKind.LessThan); - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( - new SourceSpan(block.Start, contentLength: 1 /* ( */), block.Name, ")", "(")); - } - - // If necessary, put an empty-content marker token here - if (Span.Tokens.Count == 0) - { - Accept(SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty)); - } - - // Output the content span and then capture the ")" - Output(SpanKindInternal.Code); - } - Optional(SyntaxKind.RightParenthesis); - if (!EndOfFile) + EnsureCurrent(); + while (!EndOfFile && !At(SyntaxKind.RightBrace)) { - PutCurrentBack(); + // Parse a statement, then return here + ParseStatement(builder, block: block); + EnsureCurrent(); } - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - Span.ChunkGenerator = SpanChunkGenerator.Null; - CompleteBlock(insertMarkerIfNecessary: false); - Output(SpanKindInternal.MetaCode); - } - private void Template() - { - if (Context.Builder.ActiveBlocks.Any(block => block.Type == BlockKindInternal.Template)) + if (EndOfFile) { Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_InlineMarkupBlocksCannotBeNested( - new SourceSpan(CurrentStart, contentLength: 1 /* @ */))); + RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( + new SourceSpan(block.Start, contentLength: 1 /* { OR } */), block.Name, "}", "{")); } - Output(SpanKindInternal.Code); - using (Context.Builder.StartBlock(BlockKindInternal.Template)) + else if (acceptTerminatingBrace) { - Context.Builder.CurrentBlock.ChunkGenerator = new TemplateBlockChunkGenerator(); - PutCurrentBack(); - OtherParserBlock(); + Assert(SyntaxKind.RightBrace); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + AcceptAndMoveNext(); } } - private void OtherParserBlock() - { - ParseWithOtherParser(p => p.ParseBlock()); - } - - private void SectionBlock(string left, string right, bool caseSensitive) - { - ParseWithOtherParser(p => p.ParseRazorBlock(Tuple.Create(left, right), caseSensitive)); - } - - private void NestedBlock() + private void ParseStatement(in SyntaxListBuilder builder, Block block) { - Output(SpanKindInternal.Code); - - var wasNested = IsNested; - IsNested = true; - using (PushSpanConfig()) + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; + // Accept whitespace but always keep the last whitespace node so we can put it back if necessary + var lastWhitespace = AcceptWhitespaceInLines(); + if (EndOfFile) { - ParseBlock(); + if (lastWhitespace != null) + { + Accept(lastWhitespace); + } + + builder.Add(OutputTokensAsStatementLiteral()); + return; } - Span.Start = CurrentLocation; - Initialize(Span); - IsNested = wasNested; - NextToken(); - } + var kind = CurrentToken.Kind; + var location = CurrentStart; - protected override bool IsAtEmbeddedTransition(bool allowTemplatesAndComments, bool allowTransitions) - { - // No embedded transitions in C#, so ignore that param - return allowTemplatesAndComments - && ((Language.IsTransition(CurrentToken) - && NextIs(SyntaxKind.LessThan, SyntaxKind.Colon, SyntaxKind.DoubleColon)) - || Language.IsCommentStart(CurrentToken)); - } + // Both cases @: and @:: are triggered as markup, second colon in second case will be triggered as a plain text + var isSingleLineMarkup = kind == SyntaxKind.Transition && + (NextIs(SyntaxKind.Colon, SyntaxKind.DoubleColon)); - protected override void HandleEmbeddedTransition() - { - if (Language.IsTransition(CurrentToken)) + var isMarkup = isSingleLineMarkup || + kind == SyntaxKind.LessThan || + (kind == SyntaxKind.Transition && NextIs(SyntaxKind.LessThan)); + + if (Context.DesignTimeMode || !isMarkup) + { + // CODE owns whitespace, MARKUP owns it ONLY in DesignTimeMode. + if (lastWhitespace != null) + { + Accept(lastWhitespace); + } + } + else { + var nextToken = Lookahead(1); + + // MARKUP owns whitespace EXCEPT in DesignTimeMode. PutCurrentBack(); - Template(); + + // Put back the whitespace unless it precedes a '' tag. + if (nextToken != null && + !string.Equals(nextToken.Content, SyntaxConstants.TextTagName, StringComparison.Ordinal)) + { + PutBack(lastWhitespace); + } + else + { + // If it precedes a '' tag, it should be accepted as code. + Accept(lastWhitespace); + } } - else if (Language.IsCommentStart(CurrentToken)) + + if (isMarkup) + { + if (kind == SyntaxKind.Transition && !isSingleLineMarkup) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart( + new SourceSpan(location, contentLength: 1 /* @ */))); + } + + // Markup block + builder.Add(OutputTokensAsStatementLiteral()); + if (Context.DesignTimeMode && CurrentToken != null && + (CurrentToken.Kind == SyntaxKind.LessThan || CurrentToken.Kind == SyntaxKind.Transition)) + { + PutCurrentBack(); + } + OtherParserBlock(builder); + } + else { - RazorComment(); + // What kind of statement is this? + switch (kind) + { + case SyntaxKind.RazorCommentTransition: + AcceptMarkerTokenIfNecessary(); + builder.Add(OutputTokensAsStatementLiteral()); + var comment = ParseRazorComment(); + builder.Add(comment); + ParseStatement(builder, block); + break; + case SyntaxKind.LeftBrace: + // Verbatim Block + AcceptAndMoveNext(); + ParseCodeBlock(builder, block); + break; + case SyntaxKind.Keyword: + if (!TryParseKeyword(builder, transition: null)) + { + ParseStandardStatement(builder); + } + break; + case SyntaxKind.Transition: + // Embedded Expression block + ParseEmbeddedExpression(builder); + break; + case SyntaxKind.RightBrace: + // Possible end of Code Block, just run the continuation + break; + case SyntaxKind.CSharpComment: + Accept(CurrentToken); + NextToken(); + break; + default: + // Other statement + ParseStandardStatement(builder); + break; + } } } - private void ParseWithOtherParser(Action parseAction) + private void ParseEmbeddedExpression(in SyntaxListBuilder builder) { - // When transitioning to the HTML parser we no longer want to act as if we're in a nested C# state. - // For instance, if
@hello.
is in a nested C# block we don't want the trailing '.' to be handled - // as C#; it should be handled as a period because it's wrapped in markup. - var wasNested = IsNested; - IsNested = false; + // First, verify the type of the block + Assert(SyntaxKind.Transition); + var transition = CurrentToken; + NextToken(); - using (PushSpanConfig()) + if (At(SyntaxKind.Transition)) { - parseAction(HtmlParser); - } + // Escaped "@" + builder.Add(OutputTokensAsStatementLiteral()); - Span.Start = CurrentLocation; - Initialize(Span); + // Output "@" as hidden span + Accept(transition); + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + builder.Add(OutputTokensAsEphemeralLiteral()); - IsNested = wasNested; + Assert(SyntaxKind.Transition); + AcceptAndMoveNext(); + ParseStandardStatement(builder); + } + else + { + // Throw errors as necessary, but continue parsing + if (At(SyntaxKind.LeftBrace)) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedNestedCodeBlock( + new SourceSpan(CurrentStart, contentLength: 1 /* { */))); + } - NextToken(); - } + // @( or @foo - Nested expression, parse a child block + PutCurrentBack(); + PutBack(transition); - private void SetUpKeywords() - { - MapKeywords( - ConditionalBlock, - CSharpKeyword.For, - CSharpKeyword.Foreach, - CSharpKeyword.While, - CSharpKeyword.Switch, - CSharpKeyword.Lock); - MapKeywords(CaseStatement, false, CSharpKeyword.Case, CSharpKeyword.Default); - MapKeywords(IfStatement, CSharpKeyword.If); - MapKeywords(TryStatement, CSharpKeyword.Try); - MapKeywords(UsingKeyword, CSharpKeyword.Using); - MapKeywords(DoStatement, CSharpKeyword.Do); - MapKeywords(ReservedDirective, CSharpKeyword.Class, CSharpKeyword.Namespace); - } + // Before exiting, add a marker span if necessary + AcceptMarkerTokenIfNecessary(); + builder.Add(OutputTokensAsStatementLiteral()); - protected virtual void ReservedDirective(bool topLevel) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_ReservedWord( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), CurrentToken.Content)); - - AcceptAndMoveNext(); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - Span.ChunkGenerator = SpanChunkGenerator.Null; - Context.Builder.CurrentBlock.Type = BlockKindInternal.Directive; - CompleteBlock(); - Output(SpanKindInternal.MetaCode); + var nestedBlock = ParseNestedBlock(); + builder.Add(nestedBlock); + } } - private void KeywordBlock(bool topLevel) + private RazorSyntaxNode ParseNestedBlock() { - HandleKeyword(topLevel, () => + var wasNested = IsNested; + IsNested = true; + + RazorSyntaxNode nestedBlock; + using (PushSpanContextConfig()) { - Context.Builder.CurrentBlock.Type = BlockKindInternal.Expression; - Context.Builder.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); - ImplicitExpression(); - }); - } + nestedBlock = ParseBlock(); + } - private void CaseStatement(bool topLevel) - { - Assert(SyntaxKind.Keyword); - var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); - Debug.Assert(result.HasValue && - (result.Value == CSharpKeyword.Case || - result.Value == CSharpKeyword.Default)); - AcceptUntil(SyntaxKind.Colon); - Optional(SyntaxKind.Colon); + InitializeContext(SpanContext); + IsNested = wasNested; + NextToken(); + + return nestedBlock; } - private void DoStatement(bool topLevel) + private void ParseStandardStatement(in SyntaxListBuilder builder) { - Assert(CSharpKeyword.Do); - UnconditionalBlock(); - WhileClause(); - if (topLevel) + while (!EndOfFile) { - CompleteBlock(); + var bookmark = CurrentStart.AbsoluteIndex; + var read = ReadWhile(token => + token.Kind != SyntaxKind.Semicolon && + token.Kind != SyntaxKind.RazorCommentTransition && + token.Kind != SyntaxKind.Transition && + token.Kind != SyntaxKind.LeftBrace && + token.Kind != SyntaxKind.LeftParenthesis && + token.Kind != SyntaxKind.LeftBracket && + token.Kind != SyntaxKind.RightBrace); + + if (At(SyntaxKind.LeftBrace) || + At(SyntaxKind.LeftParenthesis) || + At(SyntaxKind.LeftBracket)) + { + Accept(read); + if (Balance(builder, BalancingModes.AllowCommentsAndTemplates | BalancingModes.BacktrackOnFailure)) + { + TryAccept(SyntaxKind.RightBrace); + } + else + { + // Recovery + AcceptUntil(SyntaxKind.LessThan, SyntaxKind.RightBrace); + return; + } + } + else if (At(SyntaxKind.Transition) && (NextIs(SyntaxKind.LessThan, SyntaxKind.Colon))) + { + Accept(read); + builder.Add(OutputTokensAsStatementLiteral()); + ParseTemplate(builder); + } + else if (At(SyntaxKind.RazorCommentTransition)) + { + Accept(read); + AcceptMarkerTokenIfNecessary(); + builder.Add(OutputTokensAsStatementLiteral()); + builder.Add(ParseRazorComment()); + } + else if (At(SyntaxKind.Semicolon)) + { + Accept(read); + AcceptAndMoveNext(); + return; + } + else if (At(SyntaxKind.RightBrace)) + { + Accept(read); + return; + } + else + { + Context.Source.Position = bookmark; + NextToken(); + AcceptUntil(SyntaxKind.LessThan, SyntaxKind.LeftBrace, SyntaxKind.RightBrace); + return; + } } } - private void WhileClause() + private void ParseTemplate(in SyntaxListBuilder builder) { - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; - var whitespace = SkipToNextImportantToken(); - - if (At(CSharpKeyword.While)) + if (Context.InTemplateContext) { - Accept(whitespace); - Assert(CSharpKeyword.While); - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (AcceptCondition() && Optional(SyntaxKind.Semicolon)) - { - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - } + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_InlineMarkupBlocksCannotBeNested( + new SourceSpan(CurrentStart, contentLength: 1 /* @ */))); + } + if (SpanContext.ChunkGenerator is ExpressionChunkGenerator) + { + builder.Add(OutputTokensAsExpressionLiteral()); } else { + builder.Add(OutputTokensAsStatementLiteral()); + } + + using (var pooledResult = Pool.Allocate()) + { + var templateBuilder = pooledResult.Builder; + Context.InTemplateContext = true; PutCurrentBack(); - PutBack(whitespace); + OtherParserBlock(templateBuilder); + + var template = SyntaxFactory.CSharpTemplateBlock(templateBuilder.ToList()); + builder.Add(template); + + Context.InTemplateContext = false; } } - private void UsingKeyword(bool topLevel) + protected bool TryParseDirective(in SyntaxListBuilder builder, CSharpTransitionSyntax transition, string directive) { - Assert(CSharpKeyword.Using); - var block = new Block(CurrentToken, CurrentStart); - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - - if (At(SyntaxKind.LeftParenthesis)) + if (_directiveParserMap.TryGetValue(directive, out var handler)) { - // using ( ==> Using Statement - UsingStatement(block); - } - else if (At(SyntaxKind.Identifier) || At(CSharpKeyword.Static)) - { - // using Identifier ==> Using Declaration - if (!topLevel) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_NamespaceImportAndTypeAliasCannotExistWithinCodeBlock( - new SourceSpan(block.Start, block.Name.Length))); - StandardStatement(); - } - else - { - UsingDeclaration(); - } + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + handler(builder, transition); + return true; } - if (topLevel) - { - CompleteBlock(); - } + return false; } - private void UsingDeclaration() + private void SetupDirectiveParsers(IEnumerable directiveDescriptors) { - // Set block type to directive - Context.Builder.CurrentBlock.Type = BlockKindInternal.Directive; + var allDirectives = directiveDescriptors.Concat(DefaultDirectiveDescriptors).ToList(); - var start = CurrentStart; - if (At(SyntaxKind.Identifier)) + for (var i = 0; i < allDirectives.Count; i++) { - // non-static using - NamespaceOrTypeName(); - var whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (At(SyntaxKind.Assign)) - { - // Alias - Accept(whitespace); - Assert(SyntaxKind.Assign); - AcceptAndMoveNext(); + var directiveDescriptor = allDirectives[i]; + CurrentKeywords.Add(directiveDescriptor.Directive); + MapDirectives((builder, transition) => ParseExtensibleDirective(builder, transition, directiveDescriptor), directiveDescriptor.Directive); + } - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + MapDirectives(ParseTagHelperPrefixDirective, SyntaxConstants.CSharp.TagHelperPrefixKeyword); + MapDirectives(ParseAddTagHelperDirective, SyntaxConstants.CSharp.AddTagHelperKeyword); + MapDirectives(ParseRemoveTagHelperDirective, SyntaxConstants.CSharp.RemoveTagHelperKeyword); + } - // One more namespace or type name - NamespaceOrTypeName(); - } - else + private void EnsureDirectiveIsAtStartOfLine() + { + // 1 is the offset of the @ transition for the directive. + if (CurrentStart.CharacterIndex > 1) + { + var index = CurrentStart.AbsoluteIndex - 1; + var lineStart = CurrentStart.AbsoluteIndex - CurrentStart.CharacterIndex; + while (--index >= lineStart) { - PutCurrentBack(); - PutBack(whitespace); + var @char = Context.SourceDocument[index]; + + if (!char.IsWhiteSpace(@char)) + { + var currentDirective = CurrentToken.Content; + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DirectiveMustAppearAtStartOfLine( + new SourceSpan(CurrentStart, currentDirective.Length), currentDirective)); + break; + } } } - else if (At(CSharpKeyword.Static)) + } + + protected void MapDirectives(Action, CSharpTransitionSyntax> handler, params string[] directives) + { + foreach (var directive in directives) { - // static using - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - NamespaceOrTypeName(); + _directiveParserMap.Add(directive, (builder, transition) => + { + handler(builder, transition); + Context.SeenDirectives.Add(directive); + }); + + Keywords.Add(directive); + + // These C# keywords are reserved for use in directives. It's an error to use them outside of + // a directive. This code removes the error generation if the directive *is* registered. + if (string.Equals(directive, "class", StringComparison.OrdinalIgnoreCase)) + { + _keywordParserMap.Remove(CSharpKeyword.Class); + } + else if (string.Equals(directive, "namespace", StringComparison.OrdinalIgnoreCase)) + { + _keywordParserMap.Remove(CSharpKeyword.Namespace); + } + } + } + + private void ParseTagHelperPrefixDirective(SyntaxListBuilder builder, CSharpTransitionSyntax transition) + { + RazorDiagnostic duplicateDiagnostic = null; + if (Context.SeenDirectives.Contains(SyntaxConstants.CSharp.TagHelperPrefixKeyword)) + { + var directiveStart = CurrentStart; + if (transition != null) + { + // Start the error from the Transition '@'. + directiveStart = new SourceLocation( + directiveStart.FilePath, + directiveStart.AbsoluteIndex - 1, + directiveStart.LineIndex, + directiveStart.CharacterIndex - 1); + } + var errorLength = /* @ */ 1 + SyntaxConstants.CSharp.TagHelperPrefixKeyword.Length; + duplicateDiagnostic = RazorDiagnosticFactory.CreateParsing_DuplicateDirective( + new SourceSpan(directiveStart, errorLength), + SyntaxConstants.CSharp.TagHelperPrefixKeyword); } - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.AnyExceptNewline; - Span.ChunkGenerator = new AddImportChunkGenerator(new LocationTagged( - string.Concat(Span.Tokens.Skip(1).Select(s => s.Content)), - start)); + var directiveBody = ParseTagHelperDirective( + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + (prefix, errors, startLocation) => + { + if (duplicateDiagnostic != null) + { + errors.Add(duplicateDiagnostic); + } + + var parsedDirective = ParseDirective(prefix, startLocation, TagHelperDirectiveType.TagHelperPrefix, errors); + + return new TagHelperPrefixDirectiveChunkGenerator( + prefix, + parsedDirective.DirectiveText, + errors); + }); + + var directive = SyntaxFactory.RazorDirective(transition, directiveBody); + builder.Add(directive); + } - // Optional ";" - if (EnsureCurrent()) + private void ParseAddTagHelperDirective(SyntaxListBuilder builder, CSharpTransitionSyntax transition) + { + var directiveBody = ParseTagHelperDirective( + SyntaxConstants.CSharp.AddTagHelperKeyword, + (lookupText, errors, startLocation) => + { + var parsedDirective = ParseDirective(lookupText, startLocation, TagHelperDirectiveType.AddTagHelper, errors); + + return new AddTagHelperChunkGenerator( + lookupText, + parsedDirective.DirectiveText, + parsedDirective.TypePattern, + parsedDirective.AssemblyName, + errors); + }); + + var directive = SyntaxFactory.RazorDirective(transition, directiveBody); + builder.Add(directive); + } + + private void ParseRemoveTagHelperDirective(SyntaxListBuilder builder, CSharpTransitionSyntax transition) + { + var directiveBody = ParseTagHelperDirective( + SyntaxConstants.CSharp.RemoveTagHelperKeyword, + (lookupText, errors, startLocation) => + { + var parsedDirective = ParseDirective(lookupText, startLocation, TagHelperDirectiveType.RemoveTagHelper, errors); + + return new RemoveTagHelperChunkGenerator( + lookupText, + parsedDirective.DirectiveText, + parsedDirective.TypePattern, + parsedDirective.AssemblyName, + errors); + }); + + var directive = SyntaxFactory.RazorDirective(transition, directiveBody); + builder.Add(directive); + } + + [Conditional("DEBUG")] + protected void AssertDirective(string directive) + { + Debug.Assert(CurrentToken.Kind == SyntaxKind.Identifier || CurrentToken.Kind == SyntaxKind.Keyword); + Debug.Assert(string.Equals(CurrentToken.Content, directive, StringComparison.Ordinal)); + } + + private RazorDirectiveBodySyntax ParseTagHelperDirective( + string keyword, + Func, SourceLocation, ISpanChunkGenerator> chunkGeneratorFactory) + { + AssertDirective(keyword); + + var savedErrorSink = Context.ErrorSink; + var directiveErrorSink = new ErrorSink(); + RazorMetaCodeSyntax keywordBlock = null; + using (var pooledResult = Pool.Allocate()) + { + var directiveBuilder = pooledResult.Builder; + Context.ErrorSink = directiveErrorSink; + + string directiveValue = null; + SourceLocation? valueStartLocation = null; + try + { + EnsureDirectiveIsAtStartOfLine(); + + var keywordStartLocation = CurrentStart; + + // Accept the directive name + var keywordToken = EatCurrentToken(); + var keywordLength = keywordToken.FullWidth + 1 /* @ */; + + var foundWhitespace = At(SyntaxKind.Whitespace); + + // If we found whitespace then any content placed within the whitespace MAY cause a destructive change + // to the document. We can't accept it. + var acceptedCharacters = foundWhitespace ? AcceptedCharactersInternal.None : AcceptedCharactersInternal.AnyExceptNewline; + Accept(keywordToken); + keywordBlock = OutputAsMetaCode(Output(), acceptedCharacters); + + AcceptWhile(SyntaxKind.Whitespace); + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + SpanContext.EditHandler.AcceptedCharacters = acceptedCharacters; + directiveBuilder.Add(OutputAsMarkupLiteral()); + + if (EndOfFile || At(SyntaxKind.NewLine)) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DirectiveMustHaveValue( + new SourceSpan(keywordStartLocation, keywordLength), keyword)); + + directiveValue = string.Empty; + } + else + { + // Need to grab the current location before we accept until the end of the line. + valueStartLocation = CurrentStart; + + // Parse to the end of the line. Essentially accepts anything until end of line, comments, invalid code + // etc. + AcceptUntil(SyntaxKind.NewLine); + + // Pull out the value and remove whitespaces and optional quotes + var rawValue = string.Concat(TokenBuilder.ToList().Nodes.Select(s => s.Content)).Trim(); + + var startsWithQuote = rawValue.StartsWith("\"", StringComparison.Ordinal); + var endsWithQuote = rawValue.EndsWith("\"", StringComparison.Ordinal); + if (startsWithQuote != endsWithQuote) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_IncompleteQuotesAroundDirective( + new SourceSpan(valueStartLocation.Value, rawValue.Length), keyword)); + } + + directiveValue = rawValue; + } + } + finally + { + SpanContext.ChunkGenerator = chunkGeneratorFactory( + directiveValue, + directiveErrorSink.Errors.ToList(), + valueStartLocation ?? CurrentStart); + Context.ErrorSink = savedErrorSink; + } + + // Finish the block and output the tokens + CompleteBlock(); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.AnyExceptNewline; + + directiveBuilder.Add(OutputTokensAsStatementLiteral()); + var directiveCodeBlock = SyntaxFactory.CSharpCodeBlock(directiveBuilder.ToList()); + + return SyntaxFactory.RazorDirectiveBody(keywordBlock, directiveCodeBlock); + } + } + + private ParsedDirective ParseDirective( + string directiveText, + SourceLocation directiveLocation, + TagHelperDirectiveType directiveType, + List errors) + { + var offset = 0; + directiveText = directiveText.Trim(); + if (directiveText.Length >= 2 && + directiveText.StartsWith("\"", StringComparison.Ordinal) && + directiveText.EndsWith("\"", StringComparison.Ordinal)) + { + directiveText = directiveText.Substring(1, directiveText.Length - 2); + if (string.IsNullOrEmpty(directiveText)) + { + offset = 1; + } + } + + // If this is the "string literal" form of a directive, we'll need to postprocess the location + // and content. + // + // Ex: @addTagHelper "*, Microsoft.AspNetCore.CoolLibrary" + // ^ ^ + // Start End + if (TokenBuilder.Count == 1 && + TokenBuilder[0] is SyntaxToken token && + token.Kind == SyntaxKind.StringLiteral) + { + offset += token.Content.IndexOf(directiveText, StringComparison.Ordinal); + + // This is safe because inside one of these directives all of the text needs to be on the + // same line. + var original = directiveLocation; + directiveLocation = new SourceLocation( + original.FilePath, + original.AbsoluteIndex + offset, + original.LineIndex, + original.CharacterIndex + offset); + } + + var parsedDirective = new ParsedDirective() + { + DirectiveText = directiveText + }; + + if (directiveType == TagHelperDirectiveType.TagHelperPrefix) { - Optional(SyntaxKind.Semicolon); + ValidateTagHelperPrefix(parsedDirective.DirectiveText, directiveLocation, errors); + + return parsedDirective; + } + + return ParseAddOrRemoveDirective(parsedDirective, directiveLocation, errors); + } + + // Internal for testing. + internal ParsedDirective ParseAddOrRemoveDirective(ParsedDirective directive, SourceLocation directiveLocation, List errors) + { + var text = directive.DirectiveText; + var lookupStrings = text?.Split(new[] { ',' }); + + // Ensure that we have valid lookupStrings to work with. The valid format is "typeName, assemblyName" + if (lookupStrings == null || + lookupStrings.Any(string.IsNullOrWhiteSpace) || + lookupStrings.Length != 2 || + text.StartsWith("'") || + text.EndsWith("'")) + { + errors.Add( + RazorDiagnosticFactory.CreateParsing_InvalidTagHelperLookupText( + new SourceSpan(directiveLocation, Math.Max(text.Length, 1)), text)); + + return directive; + } + + var trimmedAssemblyName = lookupStrings[1].Trim(); + + // + 1 is for the comma separator in the lookup text. + var assemblyNameIndex = + lookupStrings[0].Length + 1 + lookupStrings[1].IndexOf(trimmedAssemblyName, StringComparison.Ordinal); + var assemblyNamePrefix = directive.DirectiveText.Substring(0, assemblyNameIndex); + + directive.TypePattern = lookupStrings[0].Trim(); + directive.AssemblyName = trimmedAssemblyName; + + return directive; + } + + // Internal for testing. + internal void ValidateTagHelperPrefix( + string prefix, + SourceLocation directiveLocation, + List diagnostics) + { + foreach (var character in prefix) + { + // Prefixes are correlated with tag names, tag names cannot have whitespace. + if (char.IsWhiteSpace(character) || InvalidNonWhitespaceNameCharacters.Contains(character)) + { + diagnostics.Add( + RazorDiagnosticFactory.CreateParsing_InvalidTagHelperPrefixValue( + new SourceSpan(directiveLocation, prefix.Length), + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + character, + prefix)); + + return; + } + } + } + + private void ParseExtensibleDirective(in SyntaxListBuilder builder, CSharpTransitionSyntax transition, DirectiveDescriptor descriptor) + { + AssertDirective(descriptor.Directive); + + var directiveErrorSink = new ErrorSink(); + var savedErrorSink = Context.ErrorSink; + Context.ErrorSink = directiveErrorSink; + + using (var pooledResult = Pool.Allocate()) + { + var directiveBuilder = pooledResult.Builder; + RazorMetaCodeSyntax keywordBlock = null; + + try + { + EnsureDirectiveIsAtStartOfLine(); + var directiveStart = CurrentStart; + if (transition != null) + { + // Start the error from the Transition '@'. + directiveStart = new SourceLocation( + directiveStart.FilePath, + directiveStart.AbsoluteIndex - 1, + directiveStart.LineIndex, + directiveStart.CharacterIndex - 1); + } + + AcceptAndMoveNext(); + keywordBlock = OutputAsMetaCode(Output()); + + // Even if an error was logged do not bail out early. If a directive was used incorrectly it doesn't mean it can't be parsed. + ValidateDirectiveUsage(descriptor, directiveStart); + + for (var i = 0; i < descriptor.Tokens.Count; i++) + { + if (!At(SyntaxKind.Whitespace) && + !At(SyntaxKind.NewLine) && + !EndOfFile) + { + // This case should never happen in a real scenario. We're just being defensive. + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DirectiveTokensMustBeSeparatedByWhitespace( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); + + builder.Add(BuildDirective()); + return; + } + + var tokenDescriptor = descriptor.Tokens[i]; + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + + if (tokenDescriptor.Kind == DirectiveTokenKind.Member || + tokenDescriptor.Kind == DirectiveTokenKind.Namespace || + tokenDescriptor.Kind == DirectiveTokenKind.Type) + { + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Whitespace; + directiveBuilder.Add(OutputTokensAsStatementLiteral()); + + if (EndOfFile || At(SyntaxKind.NewLine)) + { + // Add a marker token to provide CSharp intellisense when we start typing the directive token. + AcceptMarkerTokenIfNecessary(); + SpanContext.ChunkGenerator = new DirectiveTokenChunkGenerator(tokenDescriptor); + SpanContext.EditHandler = new DirectiveTokenEditHandler(Language.TokenizeString); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.NonWhitespace; + directiveBuilder.Add(OutputTokensAsStatementLiteral()); + } + } + else + { + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Whitespace; + directiveBuilder.Add(OutputAsMarkupEphemeralLiteral()); + } + + if (tokenDescriptor.Optional && (EndOfFile || At(SyntaxKind.NewLine))) + { + break; + } + else if (EndOfFile) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( + new SourceSpan(CurrentStart, contentLength: 1), + descriptor.Directive, + tokenDescriptor.Kind.ToString().ToLowerInvariant())); + builder.Add(BuildDirective()); + return; + } + + switch (tokenDescriptor.Kind) + { + case DirectiveTokenKind.Type: + if (!TryParseNamespaceOrTypeName(directiveBuilder)) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DirectiveExpectsTypeName( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); + + builder.Add(BuildDirective()); + return; + } + break; + + case DirectiveTokenKind.Namespace: + if (!TryParseQualifiedIdentifier(out var identifierLength)) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DirectiveExpectsNamespace( + new SourceSpan(CurrentStart, identifierLength), descriptor.Directive)); + + builder.Add(BuildDirective()); + return; + } + break; + + case DirectiveTokenKind.Member: + if (At(SyntaxKind.Identifier)) + { + AcceptAndMoveNext(); + } + else + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DirectiveExpectsIdentifier( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); + builder.Add(BuildDirective()); + return; + } + break; + + case DirectiveTokenKind.String: + if (At(SyntaxKind.StringLiteral) && !CurrentToken.ContainsDiagnostics) + { + AcceptAndMoveNext(); + } + else + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DirectiveExpectsQuotedStringLiteral( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); + builder.Add(BuildDirective()); + return; + } + break; + } + + SpanContext.ChunkGenerator = new DirectiveTokenChunkGenerator(tokenDescriptor); + SpanContext.EditHandler = new DirectiveTokenEditHandler(Language.TokenizeString); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.NonWhitespace; + directiveBuilder.Add(OutputTokensAsStatementLiteral()); + } + + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + + switch (descriptor.Kind) + { + case DirectiveKind.SingleLine: + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Whitespace; + directiveBuilder.Add(OutputTokensAsUnclassifiedLiteral()); + + TryAccept(SyntaxKind.Semicolon); + directiveBuilder.Add(OutputAsMetaCode(Output(), AcceptedCharactersInternal.Whitespace)); + + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + + if (At(SyntaxKind.NewLine)) + { + AcceptAndMoveNext(); + } + else if (!EndOfFile) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedDirectiveLiteral( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), + descriptor.Directive, + Resources.ErrorComponent_Newline)); + } + + + // This should contain the optional whitespace after the optional semicolon and the new line. + // Output as Markup as we want intellisense here. + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Whitespace; + directiveBuilder.Add(OutputAsMarkupEphemeralLiteral()); + break; + case DirectiveKind.RazorBlock: + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.AllWhitespace; + directiveBuilder.Add(OutputAsMarkupLiteral()); + + ParseDirectiveBlock(directiveBuilder, descriptor, parseChildren: (childBuilder, startingBraceLocation) => + { + // When transitioning to the HTML parser we no longer want to act as if we're in a nested C# state. + // For instance, if
@hello.
is in a nested C# block we don't want the trailing '.' to be handled + // as C#; it should be handled as a period because it's wrapped in markup. + var wasNested = IsNested; + IsNested = false; + + using (PushSpanContextConfig()) + { + var razorBlock = HtmlParser.ParseRazorBlock(Tuple.Create("{", "}"), caseSensitive: true); + directiveBuilder.Add(razorBlock); + } + + InitializeContext(SpanContext); + IsNested = wasNested; + NextToken(); + }); + break; + case DirectiveKind.CodeBlock: + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.AllWhitespace; + directiveBuilder.Add(OutputAsMarkupLiteral()); + + ParseDirectiveBlock(directiveBuilder, descriptor, parseChildren: (childBuilder, startingBraceLocation) => + { + NextToken(); + Balance(childBuilder, BalancingModes.NoErrorOnFailure, SyntaxKind.LeftBrace, SyntaxKind.RightBrace, startingBraceLocation); + SpanContext.ChunkGenerator = new StatementChunkGenerator(); + var existingEditHandler = SpanContext.EditHandler; + SpanContext.EditHandler = new CodeBlockEditHandler(Language.TokenizeString); + + AcceptMarkerTokenIfNecessary(); + + childBuilder.Add(OutputTokensAsStatementLiteral()); + + SpanContext.EditHandler = existingEditHandler; + }); + break; + } + } + finally + { + Context.ErrorSink = savedErrorSink; + } + + builder.Add(BuildDirective()); + + RazorDirectiveSyntax BuildDirective() + { + directiveBuilder.Add(OutputTokensAsStatementLiteral()); + var directiveCodeBlock = SyntaxFactory.CSharpCodeBlock(directiveBuilder.ToList()); + + var directiveBody = SyntaxFactory.RazorDirectiveBody(keywordBlock, directiveCodeBlock); + var directive = SyntaxFactory.RazorDirective(transition, directiveBody); + directive = (RazorDirectiveSyntax)directive.SetDiagnostics(directiveErrorSink.Errors.ToArray()); + directive = directive.WithDirectiveDescriptor(descriptor); + return directive; + } + } + } + + private void ValidateDirectiveUsage(DirectiveDescriptor descriptor, SourceLocation directiveStart) + { + if (descriptor.Usage == DirectiveUsage.FileScopedSinglyOccurring) + { + if (Context.SeenDirectives.Contains(descriptor.Directive)) + { + // There will always be at least 1 child because of the `@` transition. + var errorLength = /* @ */ 1 + descriptor.Directive.Length; + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DuplicateDirective( + new SourceSpan(directiveStart, errorLength), descriptor.Directive)); + + return; + } } } @@ -917,7 +1442,7 @@ private void UsingDeclaration() // qualified-identifier: // identifier // qualified-identifier . identifier - protected bool QualifiedIdentifier(out int identifierLength) + protected bool TryParseQualifiedIdentifier(out int identifierLength) { var currentIdentifierLength = 0; var expectingDot = false; @@ -968,1203 +1493,943 @@ protected bool QualifiedIdentifier(out int identifierLength) } } - protected bool NamespaceOrTypeName() + private void ParseDirectiveBlock(in SyntaxListBuilder builder, DirectiveDescriptor descriptor, Action, SourceLocation> parseChildren) { - if (Optional(SyntaxKind.LeftParenthesis)) + if (EndOfFile) { - while (!Optional(SyntaxKind.RightParenthesis) && !EndOfFile) - { - Optional(SyntaxKind.Whitespace); - - if (!NamespaceOrTypeName()) - { - return false; - } - - Optional(SyntaxKind.Whitespace); - Optional(SyntaxKind.Identifier); - Optional(SyntaxKind.Whitespace); - Optional(SyntaxKind.Comma); - } - - if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) - { - // Only accept the whitespace if we are going to consume the next token. - AcceptAndMoveNext(); - } - - Optional(SyntaxKind.QuestionMark); // Nullable - - return true; + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( + new SourceSpan(CurrentStart, contentLength: 1 /* { */), descriptor.Directive, "{")); + } + else if (!At(SyntaxKind.LeftBrace)) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedDirectiveLiteral( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, "{")); } - else if (Optional(SyntaxKind.Identifier) || Optional(SyntaxKind.Keyword)) + else { - if (Optional(SyntaxKind.DoubleColon)) + var editHandler = new AutoCompleteEditHandler(Language.TokenizeString, autoCompleteAtEndOfSpan: true); + SpanContext.EditHandler = editHandler; + var startingBraceLocation = CurrentStart; + Accept(CurrentToken); + builder.Add(OutputAsMetaCode(Output())); + + using (var pooledResult = Pool.Allocate()) { - if (!Optional(SyntaxKind.Identifier)) + var childBuilder = pooledResult.Builder; + parseChildren(childBuilder, startingBraceLocation); + if (childBuilder.Count > 0) { - Optional(SyntaxKind.Keyword); + builder.Add(SyntaxFactory.CSharpCodeBlock(childBuilder.ToList())); } } - if (At(SyntaxKind.LessThan)) - { - TypeArgumentList(); - } - if (Optional(SyntaxKind.Dot)) - { - NamespaceOrTypeName(); - } - if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + if (!TryAccept(SyntaxKind.RightBrace)) { - // Only accept the whitespace if we are going to consume the next token. - AcceptAndMoveNext(); - } - - Optional(SyntaxKind.QuestionMark); // Nullable + editHandler.AutoCompleteString = "}"; + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( + new SourceSpan(startingBraceLocation, contentLength: 1 /* } */), descriptor.Directive, "}", "{")); - if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.LeftBracket)) - { - // Only accept the whitespace if we are going to consume the next token. - AcceptAndMoveNext(); + Accept(SyntaxFactory.MissingToken(SyntaxKind.RightBrace)); } - - while (At(SyntaxKind.LeftBracket)) + else { - Balance(BalancingModes.None); - Optional(SyntaxKind.RightBracket); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; } - return true; - } - else - { - return false; + CompleteBlock(insertMarkerIfNecessary: false, captureWhitespaceToEndOfLine: true); + builder.Add(OutputAsMetaCode(Output(), SpanContext.EditHandler.AcceptedCharacters)); } } - private void TypeArgumentList() - { - Assert(SyntaxKind.LessThan); - Balance(BalancingModes.None); - Optional(SyntaxKind.GreaterThan); - } - - private void UsingStatement(Block block) + private bool TryParseKeyword(in SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - Assert(SyntaxKind.LeftParenthesis); - - // Parse condition - if (AcceptCondition()) + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && result.HasValue); + if (_keywordParserMap.TryGetValue(result.Value, out var handler)) { - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - - // Parse code block - ExpectCodeBlock(block); + handler(builder, transition); + return true; } - } - private void TryStatement(bool topLevel) - { - Assert(CSharpKeyword.Try); - UnconditionalBlock(); - AfterTryClause(); - if (topLevel) - { - CompleteBlock(); - } + return false; } - private void IfStatement(bool topLevel) + private void SetupExpressionParsers() { - Assert(CSharpKeyword.If); - ConditionalBlock(topLevel: false); - AfterIfClause(); - if (topLevel) - { - CompleteBlock(); - } + MapExpressionKeyword(ParseAwaitExpression, CSharpKeyword.Await); } - private void AfterTryClause() + private void SetupKeywordParsers() { - // Grab whitespace - var whitespace = SkipToNextImportantToken(); - - // Check for a catch or finally part - if (At(CSharpKeyword.Catch)) - { - Accept(whitespace); - Assert(CSharpKeyword.Catch); - FilterableCatchBlock(); - AfterTryClause(); - } - else if (At(CSharpKeyword.Finally)) - { - Accept(whitespace); - Assert(CSharpKeyword.Finally); - UnconditionalBlock(); - } - else - { - // Return whitespace and end the block - PutCurrentBack(); - PutBack(whitespace); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; - } + MapKeywords( + ParseConditionalBlock, + CSharpKeyword.For, + CSharpKeyword.Foreach, + CSharpKeyword.While, + CSharpKeyword.Switch, + CSharpKeyword.Lock); + MapKeywords(ParseCaseStatement, false, CSharpKeyword.Case, CSharpKeyword.Default); + MapKeywords(ParseIfStatement, CSharpKeyword.If); + MapKeywords(ParseTryStatement, CSharpKeyword.Try); + MapKeywords(ParseDoStatement, CSharpKeyword.Do); + MapKeywords(ParseUsingKeyword, CSharpKeyword.Using); + MapKeywords(ParseReservedDirective, CSharpKeyword.Class, CSharpKeyword.Namespace); } - private void AfterIfClause() + private void MapExpressionKeyword(Action, CSharpTransitionSyntax> handler, CSharpKeyword keyword) { - // Grab whitespace and razor comments - var whitespace = SkipToNextImportantToken(); + _keywordParserMap.Add(keyword, handler); - // Check for an else part - if (At(CSharpKeyword.Else)) - { - Accept(whitespace); - Assert(CSharpKeyword.Else); - ElseClause(); - } - else - { - // No else, return whitespace - PutCurrentBack(); - PutBack(whitespace); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; - } + // Expression keywords don't belong in the regular keyword list } - private void ElseClause() + private void MapKeywords(Action, CSharpTransitionSyntax> handler, params CSharpKeyword[] keywords) { - if (!At(CSharpKeyword.Else)) - { - return; - } - var block = new Block(CurrentToken, CurrentStart); - - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (At(CSharpKeyword.If)) - { - // ElseIf - block.Name = SyntaxConstants.CSharp.ElseIfKeyword; - ConditionalBlock(block); - AfterIfClause(); - } - else if (!EndOfFile) - { - // Else - ExpectCodeBlock(block); - } + MapKeywords(handler, topLevel: true, keywords: keywords); } - private void ExpectCodeBlock(Block block) + private void MapKeywords(Action, CSharpTransitionSyntax> handler, bool topLevel, params CSharpKeyword[] keywords) { - if (!EndOfFile) + foreach (var keyword in keywords) { - // Check for "{" to make sure we're at a block - if (!At(SyntaxKind.LeftBrace)) + _keywordParserMap.Add(keyword, handler); + if (topLevel) { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_SingleLineControlFlowStatementsNotAllowed( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), - Language.GetSample(SyntaxKind.LeftBrace), - CurrentToken.Content)); + Keywords.Add(CSharpLanguageCharacteristics.GetKeyword(keyword)); } - - // Parse the statement and then we're done - Statement(block); } } - private void UnconditionalBlock() - { - Assert(SyntaxKind.Keyword); - var block = new Block(CurrentToken, CurrentStart); - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - ExpectCodeBlock(block); - } - - private void FilterableCatchBlock() + private void ParseAwaitExpression(SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - Assert(CSharpKeyword.Catch); - - var block = new Block(CurrentToken, CurrentStart); + // Ensure that we're on the await statement (only runs in debug) + Assert(CSharpKeyword.Await); - // Accept "catch" + // Accept the "await" and move on AcceptAndMoveNext(); - AcceptWhile(IsValidStatementSpacingToken); - - // Parse the catch condition if present. If not present, let the C# compiler complain. - if (AcceptCondition()) - { - AcceptWhile(IsValidStatementSpacingToken); - - if (At(CSharpKeyword.When)) - { - // Accept "when". - AcceptAndMoveNext(); - AcceptWhile(IsValidStatementSpacingToken); - - // Parse the filter condition if present. If not present, let the C# compiler complain. - if (!AcceptCondition()) - { - // Incomplete condition. - return; - } - - AcceptWhile(IsValidStatementSpacingToken); - } - ExpectCodeBlock(block); - } - } + // Accept 1 or more spaces between the await and the following code. + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - private void ConditionalBlock(bool topLevel) - { - Assert(SyntaxKind.Keyword); - var block = new Block(CurrentToken, CurrentStart); - ConditionalBlock(block); + // Top level basically indicates if we're within an expression or statement. + // Ex: topLevel true = @await Foo() | topLevel false = @{ await Foo(); } + // Note that in this case @{ @await Foo() } top level is true for await. + // Therefore, if we're top level then we want to act like an implicit expression, + // otherwise just act as whatever we're contained in. + var topLevel = transition != null; if (topLevel) { - CompleteBlock(); - } - } - - private void ConditionalBlock(Block block) - { - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - - // Parse the condition, if present (if not present, we'll let the C# compiler complain) - if (AcceptCondition()) - { - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - ExpectCodeBlock(block); - } - } - - private bool AcceptCondition() - { - if (At(SyntaxKind.LeftParenthesis)) - { - var complete = Balance(BalancingModes.BacktrackOnFailure | BalancingModes.AllowCommentsAndTemplates); - if (!complete) - { - AcceptUntil(SyntaxKind.NewLine); - } - else - { - Optional(SyntaxKind.RightParenthesis); - } - return complete; + // Setup the Span to be an async implicit expression (an implicit expresison that allows spaces). + // Spaces are allowed because of "@await Foo()". + var implicitExpressionBody = ParseImplicitExpressionBody(async: true); + builder.Add(SyntaxFactory.CSharpImplicitExpression(transition, implicitExpressionBody)); } - return true; } - private void Statement() + private void ParseConditionalBlock(SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - Statement(null); + var topLevel = transition != null; + ParseConditionalBlock(builder, transition, topLevel); } - private void Statement(Block block) + private void ParseConditionalBlock(in SyntaxListBuilder builder, CSharpTransitionSyntax transition, bool topLevel) { - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; - - // Accept whitespace but always keep the last whitespace node so we can put it back if necessary - var lastWhitespace = AcceptWhiteSpaceInLines(); - - if (EndOfFile) + Assert(SyntaxKind.Keyword); + if (transition != null) { - if (lastWhitespace != null) - { - Accept(lastWhitespace); - } - return; + builder.Add(transition); } - var type = CurrentToken.Kind; - var loc = CurrentStart; - - // Both cases @: and @:: are triggered as markup, second colon in second case will be triggered as a plain text - var isSingleLineMarkup = type == SyntaxKind.Transition && - (NextIs(SyntaxKind.Colon, SyntaxKind.DoubleColon)); - - var isMarkup = isSingleLineMarkup || - type == SyntaxKind.LessThan || - (type == SyntaxKind.Transition && NextIs(SyntaxKind.LessThan)); - - if (Context.DesignTimeMode || !isMarkup) + var block = new Block(CurrentToken, CurrentStart); + ParseConditionalBlock(builder, block); + if (topLevel) { - // CODE owns whitespace, MARKUP owns it ONLY in DesignTimeMode. - if (lastWhitespace != null) - { - Accept(lastWhitespace); - } + CompleteBlock(); } - else + } + + private void ParseConditionalBlock(in SyntaxListBuilder builder, Block block) + { + AcceptAndMoveNext(); + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + + // Parse the condition, if present (if not present, we'll let the C# compiler complain) + if (TryParseCondition(builder)) { - var nextToken = Lookahead(1); + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - // MARKUP owns whitespace EXCEPT in DesignTimeMode. - PutCurrentBack(); + ParseExpectedCodeBlock(builder, block); + } + } - // Put back the whitespace unless it precedes a '' tag. - if (nextToken != null && - !string.Equals(nextToken.Content, SyntaxConstants.TextTagName, StringComparison.Ordinal)) + private bool TryParseCondition(in SyntaxListBuilder builder) + { + if (At(SyntaxKind.LeftParenthesis)) + { + var complete = Balance(builder, BalancingModes.BacktrackOnFailure | BalancingModes.AllowCommentsAndTemplates); + if (!complete) { - PutBack(lastWhitespace); + AcceptUntil(SyntaxKind.NewLine); } else { - // If it precedes a '' tag, it should be accepted as code. - Accept(lastWhitespace); + TryAccept(SyntaxKind.RightParenthesis); } + return complete; } + return true; + } - if (isMarkup) + private void ParseExpectedCodeBlock(in SyntaxListBuilder builder, Block block) + { + if (!EndOfFile) { - if (type == SyntaxKind.Transition && !isSingleLineMarkup) + // Check for "{" to make sure we're at a block + if (!At(SyntaxKind.LeftBrace)) { Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart( - new SourceSpan(loc, contentLength: 1 /* @ */))); + RazorDiagnosticFactory.CreateParsing_SingleLineControlFlowStatementsNotAllowed( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), + Language.GetSample(SyntaxKind.LeftBrace), + CurrentToken.Content)); } - // Markup block - Output(SpanKindInternal.Code); - if (Context.DesignTimeMode && CurrentToken != null && - (CurrentToken.Kind == SyntaxKind.LessThan || CurrentToken.Kind == SyntaxKind.Transition)) - { - PutCurrentBack(); - } - OtherParserBlock(); + // Parse the statement and then we're done + ParseStatement(builder, block); } - else + } + + private void ParseUnconditionalBlock(in SyntaxListBuilder builder) + { + Assert(SyntaxKind.Keyword); + var block = new Block(CurrentToken, CurrentStart); + AcceptAndMoveNext(); + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + ParseExpectedCodeBlock(builder, block); + } + + private void ParseCaseStatement(SyntaxListBuilder builder, CSharpTransitionSyntax transition) + { + Assert(SyntaxKind.Keyword); + if (transition != null) { - // What kind of statement is this? - HandleStatement(block, type); + // Normally, case statement won't start with a transition in a valid scenario. + // If it does, just accept it and let the compiler complain. + builder.Add(transition); } + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + Debug.Assert(result.HasValue && + (result.Value == CSharpKeyword.Case || + result.Value == CSharpKeyword.Default)); + AcceptUntil(SyntaxKind.Colon); + TryAccept(SyntaxKind.Colon); } - private void HandleStatement(Block block, SyntaxKind type) + private void ParseIfStatement(SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - switch (type) + Assert(CSharpKeyword.If); + ParseConditionalBlock(builder, transition, topLevel: false); + ParseAfterIfClause(builder); + var topLevel = transition != null; + if (topLevel) { - case SyntaxKind.RazorCommentTransition: - Output(SpanKindInternal.Code); - RazorComment(); - Statement(block); - break; - case SyntaxKind.LeftBrace: - // Verbatim Block - block = block ?? new Block(Resources.BlockName_Code, CurrentStart); - AcceptAndMoveNext(); - CodeBlock(block); - break; - case SyntaxKind.Keyword: - // Keyword block - HandleKeyword(false, StandardStatement); - break; - case SyntaxKind.Transition: - // Embedded Expression block - EmbeddedExpression(); - break; - case SyntaxKind.RightBrace: - // Possible end of Code Block, just run the continuation - break; - case SyntaxKind.CSharpComment: - AcceptAndMoveNext(); - break; - default: - // Other statement - StandardStatement(); - break; + CompleteBlock(); } } - private void EmbeddedExpression() + private void ParseAfterIfClause(SyntaxListBuilder builder) { - // First, verify the type of the block - Assert(SyntaxKind.Transition); - var transition = CurrentToken; - NextToken(); + // Grab whitespace and razor comments + var whitespace = SkipToNextImportantToken(builder); - if (At(SyntaxKind.Transition)) + // Check for an else part + if (At(CSharpKeyword.Else)) { - // Escaped "@" - Output(SpanKindInternal.Code); - - // Output "@" as hidden span - Accept(transition); - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.Code); - - Assert(SyntaxKind.Transition); - AcceptAndMoveNext(); - StandardStatement(); + Accept(whitespace); + Assert(CSharpKeyword.Else); + ParseElseClause(builder); } else { - // Throw errors as necessary, but continue parsing - if (At(SyntaxKind.LeftBrace)) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedNestedCodeBlock( - new SourceSpan(CurrentStart, contentLength: 1 /* { */))); - } - - // @( or @foo - Nested expression, parse a child block + // No else, return whitespace PutCurrentBack(); - PutBack(transition); - - // Before exiting, add a marker span if necessary - AddMarkerTokenIfNecessary(); - - NestedBlock(); + PutBack(whitespace); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; } } - private void StandardStatement() + private void ParseElseClause(in SyntaxListBuilder builder) { - while (!EndOfFile) + if (!At(CSharpKeyword.Else)) { - var bookmark = CurrentStart.AbsoluteIndex; - var read = ReadWhile(token => - token.Kind != SyntaxKind.Semicolon && - token.Kind != SyntaxKind.RazorCommentTransition && - token.Kind != SyntaxKind.Transition && - token.Kind != SyntaxKind.LeftBrace && - token.Kind != SyntaxKind.LeftParenthesis && - token.Kind != SyntaxKind.LeftBracket && - token.Kind != SyntaxKind.RightBrace); - - if (At(SyntaxKind.LeftBrace) || - At(SyntaxKind.LeftParenthesis) || - At(SyntaxKind.LeftBracket)) - { - Accept(read); - if (Balance(BalancingModes.AllowCommentsAndTemplates | BalancingModes.BacktrackOnFailure)) - { - Optional(SyntaxKind.RightBrace); - } - else - { - // Recovery - AcceptUntil(SyntaxKind.LessThan, SyntaxKind.RightBrace); - return; - } - } - else if (At(SyntaxKind.Transition) && (NextIs(SyntaxKind.LessThan, SyntaxKind.Colon))) - { - Accept(read); - Output(SpanKindInternal.Code); - Template(); - } - else if (At(SyntaxKind.RazorCommentTransition)) - { - Accept(read); - RazorComment(); - } - else if (At(SyntaxKind.Semicolon)) - { - Accept(read); - AcceptAndMoveNext(); - return; - } - else if (At(SyntaxKind.RightBrace)) - { - Accept(read); - return; - } - else - { - Context.Source.Position = bookmark; - NextToken(); - AcceptUntil(SyntaxKind.LessThan, SyntaxKind.LeftBrace, SyntaxKind.RightBrace); - return; - } + return; } - } + var block = new Block(CurrentToken, CurrentStart); - private void CodeBlock(Block block) - { - CodeBlock(true, block); + AcceptAndMoveNext(); + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + if (At(CSharpKeyword.If)) + { + // ElseIf + block.Name = SyntaxConstants.CSharp.ElseIfKeyword; + ParseConditionalBlock(builder, block); + ParseAfterIfClause(builder); + } + else if (!EndOfFile) + { + // Else + ParseExpectedCodeBlock(builder, block); + } } - private void CodeBlock(bool acceptTerminatingBrace, Block block) + private void ParseTryStatement(SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - EnsureCurrent(); - while (!EndOfFile && !At(SyntaxKind.RightBrace)) + Assert(CSharpKeyword.Try); + var topLevel = transition != null; + if (topLevel) { - // Parse a statement, then return here - Statement(); - EnsureCurrent(); + builder.Add(transition); } - if (EndOfFile) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( - new SourceSpan(block.Start, contentLength: 1 /* { OR } */), block.Name, "}", "{")); - } - else if (acceptTerminatingBrace) + ParseUnconditionalBlock(builder); + ParseAfterTryClause(builder); + if (topLevel) { - Assert(SyntaxKind.RightBrace); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; - AcceptAndMoveNext(); + CompleteBlock(); } } - private void HandleKeyword(bool topLevel, Action fallback) + private void ParseAfterTryClause(in SyntaxListBuilder builder) { - var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); - Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && result.HasValue); - if (_keywordParsers.TryGetValue(result.Value, out var handler)) + // Grab whitespace + var whitespace = SkipToNextImportantToken(builder); + + // Check for a catch or finally part + if (At(CSharpKeyword.Catch)) + { + Accept(whitespace); + Assert(CSharpKeyword.Catch); + ParseFilterableCatchBlock(builder); + ParseAfterTryClause(builder); + } + else if (At(CSharpKeyword.Finally)) { - handler(topLevel); + Accept(whitespace); + Assert(CSharpKeyword.Finally); + ParseUnconditionalBlock(builder); } else { - fallback(); + // Return whitespace and end the block + PutCurrentBack(); + PutBack(whitespace); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; } } - private IEnumerable SkipToNextImportantToken() + private void ParseFilterableCatchBlock(in SyntaxListBuilder builder) { - while (!EndOfFile) + Assert(CSharpKeyword.Catch); + + var block = new Block(CurrentToken, CurrentStart); + + // Accept "catch" + AcceptAndMoveNext(); + AcceptWhile(IsValidStatementSpacingToken); + + // Parse the catch condition if present. If not present, let the C# compiler complain. + if (TryParseCondition(builder)) { - var whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (At(SyntaxKind.RazorCommentTransition)) - { - Accept(whitespace); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; - RazorComment(); - } - else + AcceptWhile(IsValidStatementSpacingToken); + + if (At(CSharpKeyword.When)) { - return whitespace; - } - } - return Enumerable.Empty(); - } + // Accept "when". + AcceptAndMoveNext(); + AcceptWhile(IsValidStatementSpacingToken); - // Common code for Parsers, but FxCop REALLY doesn't like it in the base class.. moving it here for now. - protected override void OutputSpanBeforeRazorComment() - { - AddMarkerTokenIfNecessary(); - Output(SpanKindInternal.Code); - } + // Parse the filter condition if present. If not present, let the C# compiler complain. + if (!TryParseCondition(builder)) + { + // Incomplete condition. + return; + } - private void SetUpExpressions() - { - MapExpressionKeyword(AwaitExpression, CSharpKeyword.Await); + AcceptWhile(IsValidStatementSpacingToken); + } + + ParseExpectedCodeBlock(builder, block); + } } - private void AwaitExpression(bool topLevel) + private void ParseDoStatement(SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - // Ensure that we're on the await statement (only runs in debug) - Assert(CSharpKeyword.Await); - - // Accept the "await" and move on - AcceptAndMoveNext(); - - // Accept 1 or more spaces between the await and the following code. - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + Assert(CSharpKeyword.Do); + if (transition != null) + { + builder.Add(transition); + } - // Top level basically indicates if we're within an expression or statement. - // Ex: topLevel true = @await Foo() | topLevel false = @{ await Foo(); } - // Note that in this case @{ @await Foo() } top level is true for await. - // Therefore, if we're top level then we want to act like an implicit expression, - // otherwise just act as whatever we're contained in. + ParseUnconditionalBlock(builder); + ParseWhileClause(builder); + var topLevel = transition != null; if (topLevel) { - // Setup the Span to be an async implicit expression (an implicit expresison that allows spaces). - // Spaces are allowed because of "@await Foo()". - AsyncImplicitExpression(); + CompleteBlock(); } } - private void SetupDirectives(IEnumerable directiveDescriptors) + private void ParseWhileClause(in SyntaxListBuilder builder) { - var allDirectives = directiveDescriptors.Concat(DefaultDirectiveDescriptors).ToList(); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; + var whitespace = SkipToNextImportantToken(builder); - for (var i = 0; i < allDirectives.Count; i++) + if (At(CSharpKeyword.While)) { - var directiveDescriptor = allDirectives[i]; - CurrentKeywords.Add(directiveDescriptor.Directive); - MapDirectives(() => HandleDirective(directiveDescriptor), directiveDescriptor.Directive); + Accept(whitespace); + Assert(CSharpKeyword.While); + AcceptAndMoveNext(); + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + if (TryParseCondition(builder) && TryAccept(SyntaxKind.Semicolon)) + { + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + } + } + else + { + PutCurrentBack(); + PutBack(whitespace); } - - MapDirectives(TagHelperPrefixDirective, SyntaxConstants.CSharp.TagHelperPrefixKeyword); - MapDirectives(AddTagHelperDirective, SyntaxConstants.CSharp.AddTagHelperKeyword); - MapDirectives(RemoveTagHelperDirective, SyntaxConstants.CSharp.RemoveTagHelperKeyword); } - private void EnsureDirectiveIsAtStartOfLine() + private void ParseUsingKeyword(SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - // 1 is the offset of the @ transition for the directive. - if (CurrentStart.CharacterIndex > 1) + Assert(CSharpKeyword.Using); + var topLevel = transition != null; + var block = new Block(CurrentToken, CurrentStart); + var usingToken = EatCurrentToken(); + var whitespaceOrComments = ReadWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + var atLeftParen = At(SyntaxKind.LeftParenthesis); + var atIdentifier = At(SyntaxKind.Identifier); + var atStatic = At(CSharpKeyword.Static); + + // Put the read tokens back and let them be handled later. + PutCurrentBack(); + PutBack(whitespaceOrComments); + PutBack(usingToken); + EnsureCurrent(); + + if (atLeftParen) { - var index = CurrentStart.AbsoluteIndex - 1; - var lineStart = CurrentStart.AbsoluteIndex - CurrentStart.CharacterIndex; - while (--index >= lineStart) + // using ( ==> Using Statement + ParseUsingStatement(builder, transition, block); + } + else if (atIdentifier || atStatic) + { + // using Identifier ==> Using Declaration + if (!topLevel) { - var @char = Context.SourceDocument[index]; - - if (!char.IsWhiteSpace(@char)) + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_NamespaceImportAndTypeAliasCannotExistWithinCodeBlock( + new SourceSpan(block.Start, block.Name.Length))); + if (transition != null) { - var currentDirective = CurrentToken.Content; - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_DirectiveMustAppearAtStartOfLine( - new SourceSpan(CurrentStart, currentDirective.Length), currentDirective)); - break; + builder.Add(transition); } + AcceptAndMoveNext(); + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + ParseStandardStatement(builder); + } + else + { + ParseUsingDeclaration(builder, transition); + return; } } + else + { + AcceptAndMoveNext(); + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + } + + if (topLevel) + { + CompleteBlock(); + } } - private void HandleDirective(DirectiveDescriptor descriptor) + private void ParseUsingStatement(in SyntaxListBuilder builder, CSharpTransitionSyntax transition, Block block) { - AssertDirective(descriptor.Directive); + Assert(CSharpKeyword.Using); + AcceptAndMoveNext(); + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - var directiveErrorSink = new ErrorSink(); - var savedErrorSink = Context.ErrorSink; - Context.ErrorSink = directiveErrorSink; + Assert(SyntaxKind.LeftParenthesis); + if (transition != null) + { + builder.Add(transition); + } - var directiveChunkGenerator = new DirectiveChunkGenerator(descriptor); - try + // Parse condition + if (TryParseCondition(builder)) { - EnsureDirectiveIsAtStartOfLine(); + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - Context.Builder.CurrentBlock.Type = BlockKindInternal.Directive; - Context.Builder.CurrentBlock.ChunkGenerator = directiveChunkGenerator; + // Parse code block + ParseExpectedCodeBlock(builder, block); + } + } + private void ParseUsingDeclaration(in SyntaxListBuilder builder, CSharpTransitionSyntax transition) + { + // Using declarations should always be top level. The error case is handled in a different code path. + Debug.Assert(transition != null); + using (var pooledResult = Pool.Allocate()) + { + var directiveBuilder = pooledResult.Builder; + Assert(CSharpKeyword.Using); AcceptAndMoveNext(); - Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.None); - - // Even if an error was logged do not bail out early. If a directive was used incorrectly it doesn't mean it can't be parsed. - ValidateDirectiveUsage(descriptor); - - for (var i = 0; i < descriptor.Tokens.Count; i++) + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + var start = CurrentStart; + if (At(SyntaxKind.Identifier)) { - if (!At(SyntaxKind.Whitespace) && - !At(SyntaxKind.NewLine) && - !EndOfFile) + // non-static using + TryParseNamespaceOrTypeName(directiveBuilder); + var whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + if (At(SyntaxKind.Assign)) { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_DirectiveTokensMustBeSeparatedByWhitespace( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); - return; - } - - var tokenDescriptor = descriptor.Tokens[i]; - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + // Alias + Accept(whitespace); + Assert(SyntaxKind.Assign); + AcceptAndMoveNext(); - if (tokenDescriptor.Kind == DirectiveTokenKind.Member || - tokenDescriptor.Kind == DirectiveTokenKind.Namespace || - tokenDescriptor.Kind == DirectiveTokenKind.Type) - { - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.Code, AcceptedCharactersInternal.Whitespace); + AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (EndOfFile || At(SyntaxKind.NewLine)) - { - // Add a marker token to provide CSharp intellisense when we start typing the directive token. - AddMarkerTokenIfNecessary(); - Span.ChunkGenerator = new DirectiveTokenChunkGenerator(tokenDescriptor); - Span.EditHandler = new DirectiveTokenEditHandler(Language.TokenizeString); - Output(SpanKindInternal.Code, AcceptedCharactersInternal.NonWhitespace); - } + // One more namespace or type name + TryParseNamespaceOrTypeName(directiveBuilder); } else { - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.Whitespace); - } - - if (tokenDescriptor.Optional && (EndOfFile || At(SyntaxKind.NewLine))) - { - break; - } - else if (EndOfFile) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( - new SourceSpan(CurrentStart, contentLength: 1), - descriptor.Directive, - tokenDescriptor.Kind.ToString().ToLowerInvariant())); - return; + PutCurrentBack(); + PutBack(whitespace); } + } + else if (At(CSharpKeyword.Static)) + { + // static using + AcceptAndMoveNext(); + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + TryParseNamespaceOrTypeName(directiveBuilder); + } - switch (tokenDescriptor.Kind) - { - case DirectiveTokenKind.Type: - if (!NamespaceOrTypeName()) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_DirectiveExpectsTypeName( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); - - return; - } - break; + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.AnyExceptNewline; + SpanContext.ChunkGenerator = new AddImportChunkGenerator(new LocationTagged( + string.Concat(TokenBuilder.ToList().Nodes.Skip(1).Select(s => s.Content)), + start)); - case DirectiveTokenKind.Namespace: - if (!QualifiedIdentifier(out var identifierLength)) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_DirectiveExpectsNamespace( - new SourceSpan(CurrentStart, identifierLength), descriptor.Directive)); + // Optional ";" + if (EnsureCurrent()) + { + TryAccept(SyntaxKind.Semicolon); + } - return; - } - break; + CompleteBlock(); + Debug.Assert(directiveBuilder.Count == 0, "We should not have built any blocks so far."); + var keywordTokens = OutputTokensAsStatementLiteral(); + var directiveBody = SyntaxFactory.RazorDirectiveBody(keywordTokens, null); + builder.Add(SyntaxFactory.RazorDirective(transition, directiveBody)); + } + } - case DirectiveTokenKind.Member: - if (At(SyntaxKind.Identifier)) - { - AcceptAndMoveNext(); - } - else - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_DirectiveExpectsIdentifier( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); - return; - } - break; + private bool TryParseNamespaceOrTypeName(in SyntaxListBuilder builder) + { + if (TryAccept(SyntaxKind.LeftParenthesis)) + { + while (!TryAccept(SyntaxKind.RightParenthesis) && !EndOfFile) + { + TryAccept(SyntaxKind.Whitespace); - case DirectiveTokenKind.String: - if (At(SyntaxKind.StringLiteral) && !CurrentToken.ContainsDiagnostics) - { - AcceptAndMoveNext(); - } - else - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_DirectiveExpectsQuotedStringLiteral( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); - return; - } - break; + if (!TryParseNamespaceOrTypeName(builder)) + { + return false; } - Span.ChunkGenerator = new DirectiveTokenChunkGenerator(tokenDescriptor); - Span.EditHandler = new DirectiveTokenEditHandler(Language.TokenizeString); - Output(SpanKindInternal.Code, AcceptedCharactersInternal.NonWhitespace); + TryAccept(SyntaxKind.Whitespace); + TryAccept(SyntaxKind.Identifier); + TryAccept(SyntaxKind.Whitespace); + TryAccept(SyntaxKind.Comma); } - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - Span.ChunkGenerator = SpanChunkGenerator.Null; - - switch (descriptor.Kind) + if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) { - case DirectiveKind.SingleLine: - Output(SpanKindInternal.None, AcceptedCharactersInternal.Whitespace); - - Optional(SyntaxKind.Semicolon); - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.Whitespace); - - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - - if (At(SyntaxKind.NewLine)) - { - AcceptAndMoveNext(); - } - else if (!EndOfFile) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedDirectiveLiteral( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), - descriptor.Directive, - Resources.ErrorComponent_Newline)); - } - - Span.ChunkGenerator = SpanChunkGenerator.Null; - - // This should contain the optional whitespace after the optional semicolon and the new line. - // Output as Markup as we want intellisense here. - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.Whitespace); - break; - case DirectiveKind.RazorBlock: - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.AllWhitespace); - - ParseDirectiveBlock(descriptor, parseChildren: (startingBraceLocation) => - { - // When transitioning to the HTML parser we no longer want to act as if we're in a nested C# state. - // For instance, if
@hello.
is in a nested C# block we don't want the trailing '.' to be handled - // as C#; it should be handled as a period because it's wrapped in markup. - var wasNested = IsNested; - IsNested = false; - - using (PushSpanConfig()) - { - HtmlParser.ParseRazorBlock(Tuple.Create("{", "}"), caseSensitive: true); - } - - Span.Start = CurrentLocation; - Initialize(Span); + // Only accept the whitespace if we are going to consume the next token. + AcceptAndMoveNext(); + } - IsNested = wasNested; + TryAccept(SyntaxKind.QuestionMark); // Nullable - NextToken(); - }); - break; - case DirectiveKind.CodeBlock: - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.AllWhitespace); + return true; + } + else if (TryAccept(SyntaxKind.Identifier) || TryAccept(SyntaxKind.Keyword)) + { + if (TryAccept(SyntaxKind.DoubleColon)) + { + if (!TryAccept(SyntaxKind.Identifier)) + { + TryAccept(SyntaxKind.Keyword); + } + } + if (At(SyntaxKind.LessThan)) + { + ParseTypeArgumentList(builder); + } + if (TryAccept(SyntaxKind.Dot)) + { + TryParseNamespaceOrTypeName(builder); + } - ParseDirectiveBlock(descriptor, parseChildren: (startingBraceLocation) => - { - NextToken(); - Balance(BalancingModes.NoErrorOnFailure, SyntaxKind.LeftBrace, SyntaxKind.RightBrace, startingBraceLocation); - Span.ChunkGenerator = new StatementChunkGenerator(); - var existingEditHandler = Span.EditHandler; - Span.EditHandler = new CodeBlockEditHandler(Language.TokenizeString); + if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) + { + // Only accept the whitespace if we are going to consume the next token. + AcceptAndMoveNext(); + } - AddMarkerTokenIfNecessary(); + TryAccept(SyntaxKind.QuestionMark); // Nullable - Output(SpanKindInternal.Code); + if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.LeftBracket)) + { + // Only accept the whitespace if we are going to consume the next token. + AcceptAndMoveNext(); + } - Span.EditHandler = existingEditHandler; - }); - break; + while (At(SyntaxKind.LeftBracket)) + { + Balance(builder, BalancingModes.None); + if (!TryAccept(SyntaxKind.RightBracket)) + { + Accept(SyntaxFactory.MissingToken(SyntaxKind.RightBracket)); + } } + return true; } - finally + else { - if (directiveErrorSink.Errors.Count > 0) - { - directiveChunkGenerator.Diagnostics.AddRange(directiveErrorSink.Errors); - } + return false; + } + } - Context.ErrorSink = savedErrorSink; + private void ParseTypeArgumentList(in SyntaxListBuilder builder) + { + Assert(SyntaxKind.LessThan); + Balance(builder, BalancingModes.None); + if (!TryAccept(SyntaxKind.GreaterThan)) + { + Accept(SyntaxFactory.MissingToken(SyntaxKind.GreaterThan)); } } + private void ParseReservedDirective(SyntaxListBuilder builder, CSharpTransitionSyntax transition) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_ReservedWord( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), CurrentToken.Content)); + + AcceptAndMoveNext(); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + CompleteBlock(); + var keyword = OutputAsMetaCode(Output()); + var directiveBody = SyntaxFactory.RazorDirectiveBody(keyword, cSharpCode: null); + var directive = SyntaxFactory.RazorDirective(transition, directiveBody); + builder.Add(directive); + } - private void ValidateDirectiveUsage(DirectiveDescriptor descriptor) + protected void CompleteBlock() { - if (descriptor.Usage == DirectiveUsage.FileScopedSinglyOccurring) - { - if (Context.SeenDirectives.Contains(descriptor.Directive)) - { - // There will always be at least 1 child because of the `@` transition. - var directiveStart = Context.Builder.CurrentBlock.Children.First().Start; - var errorLength = /* @ */ 1 + descriptor.Directive.Length; - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_DuplicateDirective( - new SourceSpan(directiveStart, errorLength), descriptor.Directive)); + CompleteBlock(insertMarkerIfNecessary: true); + } - return; - } - } + protected void CompleteBlock(bool insertMarkerIfNecessary) + { + CompleteBlock(insertMarkerIfNecessary, captureWhitespaceToEndOfLine: insertMarkerIfNecessary); } - private void ParseDirectiveBlock(DirectiveDescriptor descriptor, Action parseChildren) + protected void CompleteBlock(bool insertMarkerIfNecessary, bool captureWhitespaceToEndOfLine) { - if (EndOfFile) + if (insertMarkerIfNecessary && Context.LastAcceptedCharacters != AcceptedCharactersInternal.Any) { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( - new SourceSpan(CurrentStart, contentLength: 1 /* { */), descriptor.Directive, "{")); + AcceptMarkerTokenIfNecessary(); } - else if (!At(SyntaxKind.LeftBrace)) + + EnsureCurrent(); + + // Read whitespace, but not newlines + // If we're not inserting a marker span, we don't need to capture whitespace + if (!Context.WhiteSpaceIsSignificantToAncestorBlock && + captureWhitespaceToEndOfLine && + !Context.DesignTimeMode && + !IsNested) { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedDirectiveLiteral( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, "{")); + var whitespace = ReadWhile(token => token.Kind == SyntaxKind.Whitespace); + if (At(SyntaxKind.NewLine)) + { + Accept(whitespace); + AcceptAndMoveNext(); + PutCurrentBack(); + } + else + { + PutCurrentBack(); + PutBack(whitespace); + } } else { - var editHandler = new AutoCompleteEditHandler(Language.TokenizeString, autoCompleteAtEndOfSpan: true); - Span.EditHandler = editHandler; - var startingBraceLocation = CurrentStart; - Accept(CurrentToken); - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.None); - - parseChildren(startingBraceLocation); + PutCurrentBack(); + } + } - Span.ChunkGenerator = SpanChunkGenerator.Null; - if (!Optional(SyntaxKind.RightBrace)) + private IEnumerable SkipToNextImportantToken(in SyntaxListBuilder builder) + { + while (!EndOfFile) + { + var whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + if (At(SyntaxKind.RazorCommentTransition)) { - editHandler.AutoCompleteString = "}"; - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( - new SourceSpan(startingBraceLocation, contentLength: 1 /* } */), descriptor.Directive, "}", "{")); + Accept(whitespace); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; + AcceptMarkerTokenIfNecessary(); + builder.Add(OutputTokensAsStatementLiteral()); + var comment = ParseRazorComment(); + builder.Add(comment); } else { - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + return whitespace; } - CompleteBlock(insertMarkerIfNecessary: false, captureWhitespaceToEndOfLine: true); - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.None); } + return Enumerable.Empty(); } - protected virtual void TagHelperPrefixDirective() + private void DefaultSpanContextConfig(SpanContextBuilder spanContext) { - RazorDiagnostic duplicateDiagnostic = null; - if (Context.SeenDirectives.Contains(SyntaxConstants.CSharp.TagHelperPrefixKeyword)) - { - // There wil always be at least 1 child because of the `@` transition. - var directiveStart = Context.Builder.CurrentBlock.Children.First().Start; - var errorLength = /* @ */ 1 + SyntaxConstants.CSharp.TagHelperPrefixKeyword.Length; - duplicateDiagnostic = RazorDiagnosticFactory.CreateParsing_DuplicateDirective( - new SourceSpan(directiveStart, errorLength), - SyntaxConstants.CSharp.TagHelperPrefixKeyword); - } - - TagHelperDirective( - SyntaxConstants.CSharp.TagHelperPrefixKeyword, - (prefix, errors) => - { - if (duplicateDiagnostic != null) - { - errors.Add(duplicateDiagnostic); - } - - var parsedDirective = ParseDirective(prefix, Span.Start, TagHelperDirectiveType.TagHelperPrefix, errors); + spanContext.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); + spanContext.ChunkGenerator = new StatementChunkGenerator(); + } - return new TagHelperPrefixDirectiveChunkGenerator( - prefix, - parsedDirective.DirectiveText, - errors); - }); + private void ExplicitExpressionSpanContextConfig(SpanContextBuilder spanContext) + { + spanContext.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); + spanContext.ChunkGenerator = new ExpressionChunkGenerator(); } - // Internal for testing. - internal void ValidateTagHelperPrefix( - string prefix, - SourceLocation directiveLocation, - List diagnostics) + private CSharpStatementLiteralSyntax OutputTokensAsStatementLiteral() { - foreach (var character in prefix) + var tokens = Output(); + if (tokens.Count == 0) { - // Prefixes are correlated with tag names, tag names cannot have whitespace. - if (char.IsWhiteSpace(character) || InvalidNonWhitespaceNameCharacters.Contains(character)) - { - diagnostics.Add( - RazorDiagnosticFactory.CreateParsing_InvalidTagHelperPrefixValue( - new SourceSpan(directiveLocation, prefix.Length), - SyntaxConstants.CSharp.TagHelperPrefixKeyword, - character, - prefix)); - - return; - } + return null; } + + return GetNodeWithSpanContext(SyntaxFactory.CSharpStatementLiteral(tokens)); } - private ParsedDirective ParseDirective( - string directiveText, - SourceLocation directiveLocation, - TagHelperDirectiveType directiveType, - List errors) + private CSharpExpressionLiteralSyntax OutputTokensAsExpressionLiteral() { - var offset = 0; - directiveText = directiveText.Trim(); - if (directiveText.Length >= 2 && - directiveText.StartsWith("\"", StringComparison.Ordinal) && - directiveText.EndsWith("\"", StringComparison.Ordinal)) + var tokens = Output(); + if (tokens.Count == 0) { - directiveText = directiveText.Substring(1, directiveText.Length - 2); - if (string.IsNullOrEmpty(directiveText)) - { - offset = 1; - } + return null; } - // If this is the "string literal" form of a directive, we'll need to postprocess the location - // and content. - // - // Ex: @addTagHelper "*, Microsoft.AspNetCore.CoolLibrary" - // ^ ^ - // Start End - if (Span.Tokens.Count == 1 && (Span.Tokens[0] as SyntaxToken)?.Kind == SyntaxKind.StringLiteral) - { - offset += Span.Tokens[0].Content.IndexOf(directiveText, StringComparison.Ordinal); + return GetNodeWithSpanContext(SyntaxFactory.CSharpExpressionLiteral(tokens)); + } - // This is safe because inside one of these directives all of the text needs to be on the - // same line. - var original = directiveLocation; - directiveLocation = new SourceLocation( - original.FilePath, - original.AbsoluteIndex + offset, - original.LineIndex, - original.CharacterIndex + offset); + private CSharpEphemeralTextLiteralSyntax OutputTokensAsEphemeralLiteral() + { + var tokens = Output(); + if (tokens.Count == 0) + { + return null; } - var parsedDirective = new ParsedDirective() - { - DirectiveText = directiveText - }; + return GetNodeWithSpanContext(SyntaxFactory.CSharpEphemeralTextLiteral(tokens)); + } - if (directiveType == TagHelperDirectiveType.TagHelperPrefix) + private UnclassifiedTextLiteralSyntax OutputTokensAsUnclassifiedLiteral() + { + var tokens = Output(); + if (tokens.Count == 0) { - ValidateTagHelperPrefix(parsedDirective.DirectiveText, directiveLocation, errors); - - return parsedDirective; + return null; } - return ParseAddOrRemoveDirective(parsedDirective, directiveLocation, errors); + + return GetNodeWithSpanContext(SyntaxFactory.UnclassifiedTextLiteral(tokens)); } - // Internal for testing. - internal ParsedDirective ParseAddOrRemoveDirective(ParsedDirective directive, SourceLocation directiveLocation, List errors) + private void OtherParserBlock(in SyntaxListBuilder builder) { - var text = directive.DirectiveText; - var lookupStrings = text?.Split(new[] { ',' }); + // When transitioning to the HTML parser we no longer want to act as if we're in a nested C# state. + // For instance, if
@hello.
is in a nested C# block we don't want the trailing '.' to be handled + // as C#; it should be handled as a period because it's wrapped in markup. + var wasNested = IsNested; + IsNested = false; - // Ensure that we have valid lookupStrings to work with. The valid format is "typeName, assemblyName" - if (lookupStrings == null || - lookupStrings.Any(string.IsNullOrWhiteSpace) || - lookupStrings.Length != 2 || - text.StartsWith("'") || - text.EndsWith("'")) + RazorSyntaxNode htmlBlock = null; + using (PushSpanContextConfig()) { - errors.Add( - RazorDiagnosticFactory.CreateParsing_InvalidTagHelperLookupText( - new SourceSpan(directiveLocation, Math.Max(text.Length, 1)), text)); - - return directive; + htmlBlock = HtmlParser.ParseBlock(); } - var trimmedAssemblyName = lookupStrings[1].Trim(); - - // + 1 is for the comma separator in the lookup text. - var assemblyNameIndex = - lookupStrings[0].Length + 1 + lookupStrings[1].IndexOf(trimmedAssemblyName, StringComparison.Ordinal); - var assemblyNamePrefix = directive.DirectiveText.Substring(0, assemblyNameIndex); - - directive.TypePattern = lookupStrings[0].Trim(); - directive.AssemblyName = trimmedAssemblyName; + builder.Add(htmlBlock); + InitializeContext(SpanContext); - return directive; + IsNested = wasNested; + NextToken(); } - protected virtual void AddTagHelperDirective() + private bool Balance(SyntaxListBuilder builder, BalancingModes mode) { - TagHelperDirective( - SyntaxConstants.CSharp.AddTagHelperKeyword, - (lookupText, errors) => - { - var parsedDirective = ParseDirective(lookupText, Span.Start, TagHelperDirectiveType.AddTagHelper, errors); + var left = CurrentToken.Kind; + var right = Language.FlipBracket(left); + var start = CurrentStart; + AcceptAndMoveNext(); + if (EndOfFile && ((mode & BalancingModes.NoErrorOnFailure) != BalancingModes.NoErrorOnFailure)) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_ExpectedCloseBracketBeforeEOF( + new SourceSpan(start, contentLength: 1 /* { OR } */), + Language.GetSample(left), + Language.GetSample(right))); + } - return new AddTagHelperChunkGenerator( - lookupText, - parsedDirective.DirectiveText, - parsedDirective.TypePattern, - parsedDirective.AssemblyName, - errors); - }); + return Balance(builder, mode, left, right, start); } - protected virtual void RemoveTagHelperDirective() + private bool Balance(SyntaxListBuilder builder, BalancingModes mode, SyntaxKind left, SyntaxKind right, SourceLocation start) { - TagHelperDirective( - SyntaxConstants.CSharp.RemoveTagHelperKeyword, - (lookupText, errors) => + var startPosition = CurrentStart.AbsoluteIndex; + var nesting = 1; + if (!EndOfFile) + { + var tokens = new List(); + do { - var parsedDirective = ParseDirective(lookupText, Span.Start, TagHelperDirectiveType.RemoveTagHelper, errors); + if (IsAtEmbeddedTransition( + (mode & BalancingModes.AllowCommentsAndTemplates) == BalancingModes.AllowCommentsAndTemplates, + (mode & BalancingModes.AllowEmbeddedTransitions) == BalancingModes.AllowEmbeddedTransitions)) + { + Accept(tokens); + tokens.Clear(); + ParseEmbeddedTransition(builder); - return new RemoveTagHelperChunkGenerator( - lookupText, - parsedDirective.DirectiveText, - parsedDirective.TypePattern, - parsedDirective.AssemblyName, - errors); - }); + // Reset backtracking since we've already outputted some spans. + startPosition = CurrentStart.AbsoluteIndex; + } + if (At(left)) + { + nesting++; + } + else if (At(right)) + { + nesting--; + } + if (nesting > 0) + { + tokens.Add(CurrentToken); + } + } + while (nesting > 0 && NextToken()); + + if (nesting > 0) + { + if ((mode & BalancingModes.NoErrorOnFailure) != BalancingModes.NoErrorOnFailure) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_ExpectedCloseBracketBeforeEOF( + new SourceSpan(start, contentLength: 1 /* { OR } */), + Language.GetSample(left), + Language.GetSample(right))); + } + if ((mode & BalancingModes.BacktrackOnFailure) == BalancingModes.BacktrackOnFailure) + { + Context.Source.Position = startPosition; + NextToken(); + } + else + { + Accept(tokens); + } + } + else + { + // Accept all the tokens we saw + Accept(tokens); + } + } + return nesting == 0; } - [Conditional("DEBUG")] - protected void AssertDirective(string directive) + private bool IsAtEmbeddedTransition(bool allowTemplatesAndComments, bool allowTransitions) { - Debug.Assert(CurrentToken.Kind == SyntaxKind.Identifier || CurrentToken.Kind == SyntaxKind.Keyword); - Debug.Assert(string.Equals(CurrentToken.Content, directive, StringComparison.Ordinal)); + // No embedded transitions in C#, so ignore that param + return allowTemplatesAndComments + && ((Language.IsTransition(CurrentToken) + && NextIs(SyntaxKind.LessThan, SyntaxKind.Colon, SyntaxKind.DoubleColon)) + || Language.IsCommentStart(CurrentToken)); } - private void TagHelperDirective(string keyword, Func, ISpanChunkGenerator> chunkGeneratorFactory) + private void ParseEmbeddedTransition(in SyntaxListBuilder builder) { - AssertDirective(keyword); - - var savedErrorSink = Context.ErrorSink; - var directiveErrorSink = new ErrorSink(); - Context.ErrorSink = directiveErrorSink; - - string directiveValue = null; - try + if (Language.IsTransition(CurrentToken)) { - EnsureDirectiveIsAtStartOfLine(); - - var keywordStartLocation = CurrentStart; - - // Accept the directive name - AcceptAndMoveNext(); - - // Set the block type - Context.Builder.CurrentBlock.Type = BlockKindInternal.Directive; - - var keywordLength = Span.End.AbsoluteIndex - Span.Start.AbsoluteIndex; - - var foundWhitespace = At(SyntaxKind.Whitespace); - - // If we found whitespace then any content placed within the whitespace MAY cause a destructive change - // to the document. We can't accept it. - var acceptedCharacters = foundWhitespace ? AcceptedCharactersInternal.None : AcceptedCharactersInternal.AnyExceptNewline; - Output(SpanKindInternal.MetaCode, acceptedCharacters); - - AcceptWhile(SyntaxKind.Whitespace); - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.Markup, acceptedCharacters); - - if (EndOfFile || At(SyntaxKind.NewLine)) + PutCurrentBack(); + ParseTemplate(builder); + } + else if (Language.IsCommentStart(CurrentToken)) + { + // Output tokens before parsing the comment. + AcceptMarkerTokenIfNecessary(); + if (SpanContext.ChunkGenerator is ExpressionChunkGenerator) { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_DirectiveMustHaveValue( - new SourceSpan(keywordStartLocation, keywordLength), keyword)); - - directiveValue = string.Empty; + builder.Add(OutputTokensAsExpressionLiteral()); } else { - // Need to grab the current location before we accept until the end of the line. - var startLocation = CurrentStart; - - // Parse to the end of the line. Essentially accepts anything until end of line, comments, invalid code - // etc. - AcceptUntil(SyntaxKind.NewLine); + builder.Add(OutputTokensAsStatementLiteral()); + } - // Pull out the value and remove whitespaces and optional quotes - var rawValue = string.Concat(Span.Tokens.Select(s => s.Content)).Trim(); + var comment = ParseRazorComment(); + builder.Add(comment); + } + } - var startsWithQuote = rawValue.StartsWith("\"", StringComparison.Ordinal); - var endsWithQuote = rawValue.EndsWith("\"", StringComparison.Ordinal); - if (startsWithQuote != endsWithQuote) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_IncompleteQuotesAroundDirective( - new SourceSpan(startLocation, rawValue.Length), keyword)); - } + [Conditional("DEBUG")] + internal void Assert(CSharpKeyword expectedKeyword) + { + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && + result.HasValue && + result.Value == expectedKeyword); + } - directiveValue = rawValue; - } - } - finally - { - Span.ChunkGenerator = chunkGeneratorFactory(directiveValue, directiveErrorSink.Errors.ToList()); - Context.ErrorSink = savedErrorSink; - } + protected internal bool At(CSharpKeyword keyword) + { + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + return At(SyntaxKind.Keyword) && + result.HasValue && + result.Value == keyword; + } - // Output the span and finish the block - CompleteBlock(); - Output(SpanKindInternal.Code, AcceptedCharactersInternal.AnyExceptNewline); + protected static Func IsSpacingToken(bool includeNewLines, bool includeComments) + { + return token => token.Kind == SyntaxKind.Whitespace || + (includeNewLines && token.Kind == SyntaxKind.NewLine) || + (includeComments && token.Kind == SyntaxKind.CSharpComment); } protected class Block diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpLanguageCharacteristics.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpLanguageCharacteristics.cs index e8144cbc0..3a017b54d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpLanguageCharacteristics.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpLanguageCharacteristics.cs @@ -114,7 +114,7 @@ public override string GetSample(SyntaxKind kind) public override SyntaxToken CreateMarkerToken() { - return SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); + return SyntaxFactory.Token(SyntaxKind.Marker, string.Empty); } public override SyntaxKind GetKnownTokenType(KnownTokenType type) @@ -127,7 +127,7 @@ public override SyntaxKind GetKnownTokenType(KnownTokenType type) return SyntaxKind.Keyword; case KnownTokenType.NewLine: return SyntaxKind.NewLine; - case KnownTokenType.WhiteSpace: + case KnownTokenType.Whitespace: return SyntaxKind.Whitespace; case KnownTokenType.Transition: return SyntaxKind.Transition; @@ -138,7 +138,7 @@ public override SyntaxKind GetKnownTokenType(KnownTokenType type) case KnownTokenType.CommentBody: return SyntaxKind.RazorCommentLiteral; default: - return SyntaxKind.Unknown; + return SyntaxKind.Marker; } } @@ -164,7 +164,7 @@ public override SyntaxKind FlipBracket(SyntaxKind bracket) return SyntaxKind.LessThan; default: Debug.Fail("FlipBracket must be called with a bracket character"); - return SyntaxKind.Unknown; + return SyntaxKind.Marker; } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs index 8d29ab0fe..21cd0dc00 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs @@ -458,7 +458,7 @@ private SyntaxKind Operator() { return handler(); } - return SyntaxKind.Unknown; + return SyntaxKind.Marker; } private SyntaxKind LessThanOperator() diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ChunkGeneratorContext.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ChunkGeneratorContext.cs deleted file mode 100644 index b4a4a4782..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ChunkGeneratorContext.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class ChunkGeneratorContext - { - public ChunkGeneratorContext( - string className, - string rootNamespace, - string sourceFile, - bool shouldGenerateLinePragmas) - { - SourceFile = shouldGenerateLinePragmas ? sourceFile : null; - RootNamespace = rootNamespace; - ClassName = className; - } - - public string SourceFile { get; internal set; } - - public string RootNamespace { get; } - - public string ClassName { get; } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CodeBlockEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CodeBlockEditHandler.cs index 89d1f3d6c..8ecbd8590 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CodeBlockEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CodeBlockEditHandler.cs @@ -4,17 +4,17 @@ using System; using System.Collections.Generic; using System.Globalization; -using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { internal class CodeBlockEditHandler : SpanEditHandler { - public CodeBlockEditHandler(Func> tokenizer) : base(tokenizer) + public CodeBlockEditHandler(Func> tokenizer) : base(tokenizer) { } - protected override PartialParseResultInternal CanAcceptChange(Span target, SourceChange change) + protected override PartialParseResultInternal CanAcceptChange(SyntaxNode target, SourceChange change) { if (IsAcceptableDeletion(target, change)) { @@ -35,7 +35,7 @@ protected override PartialParseResultInternal CanAcceptChange(Span target, Sourc } // Internal for testing - internal static bool IsAcceptableReplacement(Span target, SourceChange change) + internal static bool IsAcceptableReplacement(SyntaxNode target, SourceChange change) { if (!change.IsReplace) { @@ -56,7 +56,7 @@ internal static bool IsAcceptableReplacement(Span target, SourceChange change) } // Internal for testing - internal static bool IsAcceptableDeletion(Span target, SourceChange change) + internal static bool IsAcceptableDeletion(SyntaxNode target, SourceChange change) { if (!change.IsDelete) { @@ -72,11 +72,11 @@ internal static bool IsAcceptableDeletion(Span target, SourceChange change) } // Internal for testing - internal static bool ModifiesInvalidContent(Span target, SourceChange change) + internal static bool ModifiesInvalidContent(SyntaxNode target, SourceChange change) { - var relativePosition = change.Span.AbsoluteIndex - target.Start.AbsoluteIndex; + var relativePosition = change.Span.AbsoluteIndex - target.Position; - if (target.Content.IndexOfAny(new[] { '{', '}' }, relativePosition, change.Span.Length) >= 0) + if (target.GetContent().IndexOfAny(new[] { '{', '}' }, relativePosition, change.Span.Length) >= 0) { return true; } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ConditionalAttributeCollapser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ConditionalAttributeCollapser.cs deleted file mode 100644 index 4fa89603d..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ConditionalAttributeCollapser.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Diagnostics; -using System.Text; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class ConditionalAttributeCollapser : MarkupRewriter - { - protected override bool CanRewrite(Block block) - { - var generator = block.ChunkGenerator as AttributeBlockChunkGenerator; - if (generator != null && block.Children.Count > 0) - { - // Perf: Avoid allocating an enumerator. - for (var i = 0; i < block.Children.Count; i++) - { - if (!IsLiteralAttributeValue(block.Children[i])) - { - return false; - } - } - - return true; - } - - return false; - } - - protected override SyntaxTreeNode RewriteBlock(BlockBuilder parent, Block block) - { - // Collect the content of this node - var builder = new StringBuilder(); - for (var i = 0; i < block.Children.Count; i++) - { - var childSpan = (Span)block.Children[i]; - builder.Append(childSpan.Content); - } - - // Create a new span containing this content - var span = new SpanBuilder(block.Children[0].Start); - - span.EditHandler = SpanEditHandler.CreateDefault(HtmlLanguageCharacteristics.Instance.TokenizeString); - Debug.Assert(block.Children.Count > 0); - var start = ((Span)block.Children[0]).Start; - FillSpan(span, start, builder.ToString()); - return span.Build(); - } - - private bool IsLiteralAttributeValue(SyntaxTreeNode node) - { - if (node.IsBlock) - { - return false; - } - - var span = node as Span; - Debug.Assert(span != null); - - return span != null && - (span.ChunkGenerator is LiteralAttributeChunkGenerator || - span.ChunkGenerator is MarkupChunkGenerator || - span.ChunkGenerator == SpanChunkGenerator.Null); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveChunkGenerator.cs deleted file mode 100644 index 19a6bad46..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveChunkGenerator.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright(c) .NET Foundation.All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Extensions.Internal; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class DirectiveChunkGenerator : ParentChunkGenerator - { - private static readonly Type Type = typeof(DirectiveChunkGenerator); - private List _diagnostics; - - public DirectiveChunkGenerator(DirectiveDescriptor descriptor) - { - Descriptor = descriptor; - } - - public DirectiveDescriptor Descriptor { get; } - - public List Diagnostics - { - get - { - if (_diagnostics == null) - { - _diagnostics = new List(); - } - - return _diagnostics; - } - } - - public override void Accept(ParserVisitor visitor, Block block) - { - visitor.VisitDirectiveBlock(this, block); - } - - public override bool Equals(object obj) - { - var other = obj as DirectiveChunkGenerator; - return base.Equals(other) && - Enumerable.SequenceEqual(Diagnostics, other.Diagnostics) && - DirectiveDescriptorComparer.Default.Equals(Descriptor, other.Descriptor); - } - - public override int GetHashCode() - { - var combiner = HashCodeCombiner.Start(); - combiner.Add(base.GetHashCode()); - combiner.Add(Type); - - return combiner.CombinedHash; - } - - public override string ToString() - { - // This is used primarily at test time to show an identifiable representation of the chunk generator. - - var builder = new StringBuilder("Directive:{"); - builder.Append(Descriptor.Directive); - builder.Append(";"); - builder.Append(Descriptor.Kind); - builder.Append(";"); - builder.Append(Descriptor.Usage); - builder.Append("}"); - - if (Diagnostics.Count > 0) - { - builder.Append(" ["); - var ids = string.Join(", ", Diagnostics.Select(diagnostic => $"{diagnostic.Id}{diagnostic.Span}")); - builder.Append(ids); - builder.Append("]"); - } - - return builder.ToString(); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveTokenChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveTokenChunkGenerator.cs index 69327ba6e..ea1095bd5 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveTokenChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveTokenChunkGenerator.cs @@ -18,11 +18,6 @@ public DirectiveTokenChunkGenerator(DirectiveTokenDescriptor tokenDescriptor) public DirectiveTokenDescriptor Descriptor { get; } - public override void Accept(ParserVisitor visitor, Span span) - { - visitor.VisitDirectiveToken(this, span); - } - public override bool Equals(object obj) { var other = obj as DirectiveTokenChunkGenerator; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DynamicAttributeBlockChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DynamicAttributeBlockChunkGenerator.cs deleted file mode 100644 index 5b8c31efa..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DynamicAttributeBlockChunkGenerator.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Globalization; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class DynamicAttributeBlockChunkGenerator : ParentChunkGenerator - { - public DynamicAttributeBlockChunkGenerator(LocationTagged prefix, int offset, int line, int col) - : this(prefix, new SourceLocation(offset, line, col)) - { - } - - public DynamicAttributeBlockChunkGenerator(LocationTagged prefix, SourceLocation valueStart) - { - Prefix = prefix; - ValueStart = valueStart; - } - - public LocationTagged Prefix { get; } - - public SourceLocation ValueStart { get; } - - public override void Accept(ParserVisitor visitor, Block block) - { - visitor.VisitDynamicAttributeBlock(this, block); - } - - public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) - { - //var chunk = context.ChunkTreeBuilder.StartParentChunk(target); - //chunk.Start = ValueStart; - //chunk.Prefix = Prefix; - } - - public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) - { - //context.ChunkTreeBuilder.EndParentChunk(); - } - - public override string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "DynAttr:{0:F}", Prefix); - } - - public override bool Equals(object obj) - { - var other = obj as DynamicAttributeBlockChunkGenerator; - return other != null && - Equals(other.Prefix, Prefix); - } - - public override int GetHashCode() - { - return Prefix == null ? 0 : Prefix.GetHashCode(); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/EditResult.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/EditResult.cs index 6aff8dea2..13dfb20a7 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/EditResult.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/EditResult.cs @@ -1,17 +1,19 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax; + namespace Microsoft.AspNetCore.Razor.Language.Legacy { internal class EditResult { - public EditResult(PartialParseResultInternal result, SpanBuilder editedSpan) + public EditResult(PartialParseResultInternal result, SyntaxNode editedNode) { Result = result; - EditedSpan = editedSpan; + EditedNode = editedNode; } public PartialParseResultInternal Result { get; set; } - public SpanBuilder EditedSpan { get; set; } + public SyntaxNode EditedNode { get; set; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ExpressionChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ExpressionChunkGenerator.cs index fd2ef3ab9..24eb488c1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ExpressionChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ExpressionChunkGenerator.cs @@ -5,35 +5,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal class ExpressionChunkGenerator : ISpanChunkGenerator, IParentChunkGenerator + internal class ExpressionChunkGenerator : ISpanChunkGenerator { private static readonly int TypeHashCode = typeof(ExpressionChunkGenerator).GetHashCode(); - public void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) - { - //context.ChunkTreeBuilder.StartParentChunk(target); - } - - public void GenerateChunk(Span target, ChunkGeneratorContext context) - { - //context.ChunkTreeBuilder.AddExpressionChunk(target.Content, target); - } - - public void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) - { - //context.ChunkTreeBuilder.EndParentChunk(); - } - - public void Accept(ParserVisitor visitor, Span span) - { - visitor.VisitExpressionSpan(this, span); - } - - public void Accept(ParserVisitor visitor, Block block) - { - visitor.VisitExpressionBlock(this, block); - } - public override string ToString() { return "Expr"; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlLanguageCharacteristics.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlLanguageCharacteristics.cs index c404183ed..5efd2b80a 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlLanguageCharacteristics.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlLanguageCharacteristics.cs @@ -86,13 +86,13 @@ public override SyntaxKind FlipBracket(SyntaxKind bracket) return SyntaxKind.OpenAngle; default: Debug.Fail("FlipBracket must be called with a bracket character"); - return SyntaxKind.Unknown; + return SyntaxKind.Marker; } } public override SyntaxToken CreateMarkerToken() { - return SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); + return SyntaxFactory.Token(SyntaxKind.Marker, string.Empty); } public override SyntaxKind GetKnownTokenType(KnownTokenType type) @@ -113,10 +113,10 @@ public override SyntaxKind GetKnownTokenType(KnownTokenType type) return SyntaxKind.NewLine; case KnownTokenType.Transition: return SyntaxKind.Transition; - case KnownTokenType.WhiteSpace: + case KnownTokenType.Whitespace: return SyntaxKind.Whitespace; default: - return SyntaxKind.Unknown; + return SyntaxKind.Marker; } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs index efc0d2759..f06c8db1b 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs @@ -19,10 +19,6 @@ internal class HtmlMarkupParser : TokenizerBackedParser SyntaxFactory.Token(SyntaxKind.Bang, "!"), SyntaxFactory.Token(SyntaxKind.OpenAngle, "<"), }; - private static readonly SyntaxToken[] singleHyphenArray = new[] - { - SyntaxFactory.Token(SyntaxKind.Text, "-") - }; private static readonly char[] ValidAfterTypeAttributeNameCharacters = { ' ', '\t', '\r', '\n', '\f', '=' }; private SourceLocation _lastTagStart = SourceLocation.Zero; @@ -54,7 +50,7 @@ public HtmlMarkupParser(ParserContext context) { } - public ParserBase CodeParser { get; set; } + public CSharpCodeParser CodeParser { get; set; } public ISet VoidElements { @@ -68,26 +64,57 @@ private StringComparison Comparison get { return CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; } } - protected override bool TokenKindEquals(SyntaxKind x, SyntaxKind y) => x == y; - - public override void BuildSpan(SpanBuilder span, SourceLocation start, string content) + // Special tags include - + + + + + + + @@ -13,8 +20,8 @@ - - + + @@ -23,39 +30,147 @@ + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + + + + + - + - + @@ -66,37 +181,50 @@ - + - + - - + + - + - - - + + + - + - - + + - + - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxAnnotation.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxAnnotation.cs index dbb72fb1a..e63933547 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxAnnotation.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxAnnotation.cs @@ -21,7 +21,7 @@ internal sealed class SyntaxAnnotation : IEquatable // use a value identity instead of object identity so a deserialized instance matches the original instance. public string Kind { get; } - public string Data { get; } + public object Data { get; } public SyntaxAnnotation() { @@ -34,7 +34,7 @@ public SyntaxAnnotation(string kind) Kind = kind; } - public SyntaxAnnotation(string kind, string data) + public SyntaxAnnotation(string kind, object data) : this(kind) { Data = data; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxExtensions.cs new file mode 100644 index 000000000..055180ca9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxExtensions.cs @@ -0,0 +1,53 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal partial class MarkupTextLiteralSyntax + { + protected override string GetDebuggerDisplay() + { + return string.Format("{0} [{1}]", base.GetDebuggerDisplay(), this.GetContent()); + } + } + + internal partial class MarkupEphemeralTextLiteralSyntax + { + protected override string GetDebuggerDisplay() + { + return string.Format("{0} [{1}]", base.GetDebuggerDisplay(), this.GetContent()); + } + } + + internal partial class CSharpStatementLiteralSyntax + { + protected override string GetDebuggerDisplay() + { + return string.Format("{0} [{1}]", base.GetDebuggerDisplay(), this.GetContent()); + } + } + + internal partial class CSharpExpressionLiteralSyntax + { + protected override string GetDebuggerDisplay() + { + return string.Format("{0} [{1}]", base.GetDebuggerDisplay(), this.GetContent()); + } + } + + internal partial class CSharpEphemeralTextLiteralSyntax + { + protected override string GetDebuggerDisplay() + { + return string.Format("{0} [{1}]", base.GetDebuggerDisplay(), this.GetContent()); + } + } + + internal partial class UnclassifiedTextLiteralSyntax + { + protected override string GetDebuggerDisplay() + { + return string.Format("{0} [{1}]", base.GetDebuggerDisplay(), this.GetContent()); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.cs index 98568d21d..4e619799d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.cs @@ -14,5 +14,10 @@ public static SyntaxToken Token(SyntaxKind kind, string content, params RazorDia { return new SyntaxToken(InternalSyntax.SyntaxFactory.Token(kind, content), parent: null, position: 0); } + + internal static SyntaxToken MissingToken(SyntaxKind kind, params RazorDiagnostic[] diagnostics) + { + return new SyntaxToken(InternalSyntax.SyntaxFactory.MissingToken(kind, diagnostics), parent: null, position: 0); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs index 59cddf711..75dd554ab 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs @@ -6,31 +6,53 @@ namespace Microsoft.AspNetCore.Razor.Language internal enum SyntaxKind : byte { #region Nodes - // HTML - HtmlTextLiteral, - HtmlDocument, - HtmlDeclaration, + // Common + RazorDocument, + GenericBlock, + RazorComment, + RazorMetaCode, + RazorDirective, + RazorDirectiveBody, + UnclassifiedTextLiteral, + + // Markup + MarkupBlock, + MarkupTransition, + MarkupElement, + MarkupTagBlock, + MarkupTextLiteral, + MarkupEphemeralTextLiteral, + MarkupCommentBlock, + MarkupAttributeBlock, + MarkupMinimizedAttributeBlock, + MarkupLiteralAttributeValue, + MarkupDynamicAttributeValue, + MarkupTagHelperElement, + MarkupTagHelperStartTag, + MarkupTagHelperEndTag, + MarkupTagHelperAttribute, + MarkupMinimizedTagHelperAttribute, + MarkupTagHelperAttributeValue, // CSharp - CSharpBlock, CSharpStatement, CSharpStatementBody, - CSharpExpression, - CSharpExpressionBody, - CSharpDirective, - CSharpDirectiveBody, + CSharpExplicitExpression, + CSharpExplicitExpressionBody, + CSharpImplicitExpression, + CSharpImplicitExpressionBody, CSharpCodeBlock, - CSharpCodeLiteral, - CSharpMetaCode, + CSharpTemplateBlock, + CSharpStatementLiteral, + CSharpExpressionLiteral, + CSharpEphemeralTextLiteral, CSharpTransition, - - // Common - RazorComment, #endregion #region Tokens // Common - Unknown, + None, + Marker, List, Whitespace, NewLine, diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.Iterators.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.Iterators.cs new file mode 100644 index 000000000..e619a75b2 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.Iterators.cs @@ -0,0 +1,126 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal abstract partial class SyntaxNode + { + private IEnumerable DescendantNodesImpl(TextSpan span, Func descendIntoChildren, bool includeSelf) + { + if (includeSelf && IsInSpan(in span, FullSpan)) + { + yield return this; + } + + using (var stack = new ChildSyntaxListEnumeratorStack(this, descendIntoChildren)) + { + while (stack.IsNotEmpty) + { + var nodeValue = stack.TryGetNextAsNodeInSpan(in span); + if (nodeValue != null) + { + // PERF: Push before yield return so that "nodeValue" is 'dead' after the yield + // and therefore doesn't need to be stored in the iterator state machine. This + // saves a field. + stack.PushChildren(nodeValue, descendIntoChildren); + + yield return nodeValue; + } + } + } + } + + private static bool IsInSpan(in TextSpan span, TextSpan childSpan) + { + return span.OverlapsWith(childSpan) + // special case for zero-width tokens (OverlapsWith never returns true for these) + || (childSpan.Length == 0 && span.IntersectsWith(childSpan)); + } + + private struct ChildSyntaxListEnumeratorStack : IDisposable + { + private static readonly ObjectPool StackPool = new ObjectPool(() => new ChildSyntaxList.Enumerator[16]); + + private ChildSyntaxList.Enumerator[] _stack; + private int _stackPtr; + + public ChildSyntaxListEnumeratorStack(SyntaxNode startingNode, Func descendIntoChildren) + { + if (descendIntoChildren == null || descendIntoChildren(startingNode)) + { + _stack = StackPool.Allocate(); + _stackPtr = 0; + _stack[0].InitializeFrom(startingNode); + } + else + { + _stack = null; + _stackPtr = -1; + } + } + + public bool IsNotEmpty { get { return _stackPtr >= 0; } } + + public bool TryGetNextInSpan(in TextSpan span, out SyntaxNode value) + { + while (_stack[_stackPtr].TryMoveNextAndGetCurrent(out value)) + { + if (IsInSpan(in span, value.FullSpan)) + { + return true; + } + } + + _stackPtr--; + return false; + } + + public SyntaxNode TryGetNextAsNodeInSpan(in TextSpan span) + { + SyntaxNode nodeValue; + while ((nodeValue = _stack[_stackPtr].TryMoveNextAndGetCurrentAsNode()) != null) + { + if (IsInSpan(in span, nodeValue.FullSpan)) + { + return nodeValue; + } + } + + _stackPtr--; + return null; + } + + public void PushChildren(SyntaxNode node) + { + if (++_stackPtr >= _stack.Length) + { + // Geometric growth + Array.Resize(ref _stack, checked(_stackPtr * 2)); + } + + _stack[_stackPtr].InitializeFrom(node); + } + + public void PushChildren(SyntaxNode node, Func descendIntoChildren) + { + if (descendIntoChildren == null || descendIntoChildren(node)) + { + PushChildren(node); + } + } + + public void Dispose() + { + // Return only reasonably-sized stacks to the pool. + if (_stack?.Length < 256) + { + Array.Clear(_stack, 0, _stack.Length); + StackPool.Free(_stack); + } + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs index 1c63ed966..2f58f13fe 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs @@ -1,12 +1,16 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; using System.Diagnostics; +using System.Text; using System.Threading; namespace Microsoft.AspNetCore.Razor.Language.Syntax { - internal abstract class SyntaxNode + [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] + internal abstract partial class SyntaxNode { public SyntaxNode(GreenNode green, SyntaxNode parent, int position) { @@ -60,6 +64,10 @@ public TextSpan Span public bool IsMissing => Green.IsMissing; + public bool IsToken => Green.IsToken; + + public bool IsTrivia => Green.IsTrivia; + public bool HasLeadingTrivia { get @@ -80,6 +88,8 @@ public bool HasTrailingTrivia public bool ContainsAnnotations => Green.ContainsAnnotations; + internal string SerializedValue => SyntaxSerializer.Serialize(this); + public abstract TResult Accept(SyntaxVisitor visitor); public abstract void Accept(SyntaxVisitor visitor); @@ -253,18 +263,102 @@ public SyntaxNode GetLastTerminal() do { + SyntaxNode lastChild = null; for (var i = node.SlotCount - 1; i >= 0; i--) { var child = node.GetNodeSlot(i); - if (child != null) + if (child != null && child.FullWidth > 0) { - node = child; + lastChild = child; break; } } - } while (node.SlotCount != 0); + node = lastChild; + } while (node?.SlotCount > 0); - return node == this ? this : node; + return node; + } + + /// + /// The list of child nodes of this node, where each element is a SyntaxNode instance. + /// + public ChildSyntaxList ChildNodes() + { + return new ChildSyntaxList(this); + } + + /// + /// Gets a list of ancestor nodes + /// + public IEnumerable Ancestors() + { + return Parent? + .AncestorsAndSelf() ?? + Array.Empty(); + } + + /// + /// Gets a list of ancestor nodes (including this node) + /// + public IEnumerable AncestorsAndSelf() + { + for (var node = this; node != null; node = node.Parent) + { + yield return node; + } + } + + /// + /// Gets the first node of type TNode that matches the predicate. + /// + public TNode FirstAncestorOrSelf(Func predicate = null) + where TNode : SyntaxNode + { + for (var node = this; node != null; node = node.Parent) + { + if (node is TNode tnode && (predicate == null || predicate(tnode))) + { + return tnode; + } + } + + return default; + } + + /// + /// Gets a list of descendant nodes in prefix document order. + /// + /// An optional function that determines if the search descends into the argument node's children. + public IEnumerable DescendantNodes(Func descendIntoChildren = null) + { + return DescendantNodesImpl(FullSpan, descendIntoChildren, includeSelf: false); + } + + /// + /// Gets a list of descendant nodes (including this node) in prefix document order. + /// + /// An optional function that determines if the search descends into the argument node's children. + public IEnumerable DescendantNodesAndSelf(Func descendIntoChildren = null) + { + return DescendantNodesImpl(FullSpan, descendIntoChildren, includeSelf: true); + } + + protected internal SyntaxNode ReplaceCore( + IEnumerable nodes = null, + Func computeReplacementNode = null) + where TNode : SyntaxNode + { + return SyntaxReplacer.Replace(this, nodes, computeReplacementNode); + } + + protected internal SyntaxNode ReplaceNodeInListCore(SyntaxNode originalNode, IEnumerable replacementNodes) + { + return SyntaxReplacer.ReplaceNodeInList(this, originalNode, replacementNodes); + } + + protected internal SyntaxNode InsertNodesInListCore(SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore) + { + return SyntaxReplacer.InsertNodeInList(this, nodeInList, nodesToInsert, insertBefore); } public RazorDiagnostic[] GetDiagnostics() @@ -294,12 +388,26 @@ public bool IsEquivalentTo(SyntaxNode other) public override string ToString() { - return Green.ToString(); + var builder = new StringBuilder(); + builder.Append(Green.ToString()); + builder.AppendFormat(" at {0}::{1}", Position, FullWidth); + + return builder.ToString(); } public virtual string ToFullString() { return Green.ToFullString(); } + + protected virtual string GetDebuggerDisplay() + { + if (IsToken) + { + return string.Format("{0};[{1}]", Kind, ToFullString()); + } + + return string.Format("{0} [{1}..{2})", Kind, Position, EndPosition); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNodeExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNodeExtensions.cs index 21ae1260e..86b8cf4a1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNodeExtensions.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNodeExtensions.cs @@ -1,13 +1,339 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Legacy; + namespace Microsoft.AspNetCore.Razor.Language.Syntax { internal static class SyntaxNodeExtensions { + // From http://dev.w3.org/html5/spec/Overview.html#elements-0 + private static readonly HashSet VoidElements = new HashSet(StringComparer.OrdinalIgnoreCase) + { + "area", + "base", + "br", + "col", + "command", + "embed", + "hr", + "img", + "input", + "keygen", + "link", + "meta", + "param", + "source", + "track", + "wbr" + }; + public static TNode WithAnnotations(this TNode node, params SyntaxAnnotation[] annotations) where TNode : SyntaxNode { - return (TNode)node.Green.SetAnnotations(annotations).CreateRed(); + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + return (TNode)node.Green.SetAnnotations(annotations).CreateRed(node.Parent, node.Position); + } + + public static object GetAnnotationValue(this TNode node, string key) where TNode : SyntaxNode + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + var annotation = node.GetAnnotations().FirstOrDefault(n => n.Kind == key); + return annotation?.Data; + } + + public static TNode WithDiagnostics(this TNode node, params RazorDiagnostic[] diagnostics) where TNode : SyntaxNode + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + return (TNode)node.Green.SetDiagnostics(diagnostics).CreateRed(node.Parent, node.Position); + } + + public static TNode AppendDiagnostic(this TNode node, params RazorDiagnostic[] diagnostics) where TNode : SyntaxNode + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + var existingDiagnostics = node.GetDiagnostics(); + var allDiagnostics = existingDiagnostics.Concat(diagnostics).ToArray(); + + return (TNode)node.WithDiagnostics(allDiagnostics); + } + + public static SourceLocation GetSourceLocation(this SyntaxNode node, RazorSourceDocument source) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + try + { + if (source.Length == 0) + { + // Just a marker symbol + return new SourceLocation(source.FilePath, 0, 0, 0); + } + if (node.Position == source.Length) + { + // E.g. Marker symbol at the end of the document + var lastPosition = source.Length - 1; + var endsWithLineBreak = ParserHelpers.IsNewLine(source[lastPosition]); + var lastLocation = source.Lines.GetLocation(lastPosition); + return new SourceLocation( + source.FilePath, // GetLocation prefers RelativePath but we want FilePath. + lastLocation.AbsoluteIndex + 1, + lastLocation.LineIndex + (endsWithLineBreak ? 1 : 0), + endsWithLineBreak ? 0 : lastLocation.CharacterIndex + 1); + } + + var location = source.Lines.GetLocation(node.Position); + return new SourceLocation( + source.FilePath, // GetLocation prefers RelativePath but we want FilePath. + location.AbsoluteIndex, + location.LineIndex, + location.CharacterIndex); + } + catch (IndexOutOfRangeException) + { + Debug.Assert(false, "Node position should stay within document length."); + return new SourceLocation(source.FilePath, node.Position, 0, 0); + } + } + + public static SourceSpan GetSourceSpan(this SyntaxNode node, RazorSourceDocument source) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + var location = node.GetSourceLocation(source); + + return new SourceSpan(location, node.FullWidth); + } + + /// + /// Creates a new tree of nodes with the specified nodes, tokens and trivia replaced. + /// + /// The type of the root node. + /// The root node of the tree of nodes. + /// The nodes to be replaced. + /// A function that computes a replacement node for the + /// argument nodes. The first argument is the original node. The second argument is the same + /// node potentially rewritten with replaced descendants. + public static TRoot ReplaceSyntax( + this TRoot root, + IEnumerable nodes, + Func computeReplacementNode) + where TRoot : SyntaxNode + { + return (TRoot)root.ReplaceCore( + nodes: nodes, computeReplacementNode: computeReplacementNode); + } + + /// + /// Creates a new tree of nodes with the specified old node replaced with a new node. + /// + /// The type of the root node. + /// The type of the nodes being replaced. + /// The root node of the tree of nodes. + /// The nodes to be replaced; descendants of the root node. + /// A function that computes a replacement node for the + /// argument nodes. The first argument is the original node. The second argument is the same + /// node potentially rewritten with replaced descendants. + public static TRoot ReplaceNodes(this TRoot root, IEnumerable nodes, Func computeReplacementNode) + where TRoot : SyntaxNode + where TNode : SyntaxNode + { + return (TRoot)root.ReplaceCore(nodes: nodes, computeReplacementNode: computeReplacementNode); + } + + /// + /// Creates a new tree of nodes with the specified old node replaced with a new node. + /// + /// The type of the root node. + /// The root node of the tree of nodes. + /// The node to be replaced; a descendant of the root node. + /// The new node to use in the new tree in place of the old node. + public static TRoot ReplaceNode(this TRoot root, SyntaxNode oldNode, SyntaxNode newNode) + where TRoot : SyntaxNode + { + if (oldNode == newNode) + { + return root; + } + + return (TRoot)root.ReplaceCore(nodes: new[] { oldNode }, computeReplacementNode: (o, r) => newNode); + } + + /// + /// Creates a new tree of nodes with specified old node replaced with a new nodes. + /// + /// The type of the root node. + /// The root of the tree of nodes. + /// The node to be replaced; a descendant of the root node and an element of a list member. + /// A sequence of nodes to use in the tree in place of the old node. + public static TRoot ReplaceNode(this TRoot root, SyntaxNode oldNode, IEnumerable newNodes) + where TRoot : SyntaxNode + { + return (TRoot)root.ReplaceNodeInListCore(oldNode, newNodes); + } + + /// + /// Creates a new tree of nodes with new nodes inserted before the specified node. + /// + /// The type of the root node. + /// The root of the tree of nodes. + /// The node to insert before; a descendant of the root node an element of a list member. + /// A sequence of nodes to insert into the tree immediately before the specified node. + public static TRoot InsertNodesBefore(this TRoot root, SyntaxNode nodeInList, IEnumerable newNodes) + where TRoot : SyntaxNode + { + return (TRoot)root.InsertNodesInListCore(nodeInList, newNodes, insertBefore: true); + } + + /// + /// Creates a new tree of nodes with new nodes inserted after the specified node. + /// + /// The type of the root node. + /// The root of the tree of nodes. + /// The node to insert after; a descendant of the root node an element of a list member. + /// A sequence of nodes to insert into the tree immediately after the specified node. + public static TRoot InsertNodesAfter(this TRoot root, SyntaxNode nodeInList, IEnumerable newNodes) + where TRoot : SyntaxNode + { + return (TRoot)root.InsertNodesInListCore(nodeInList, newNodes, insertBefore: false); + } + + public static string GetContent(this TNode node) where TNode : SyntaxNode + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + var tokens = node.DescendantNodes().Where(n => n.IsToken).Cast(); + var content = string.Concat(tokens.Select(t => t.Content)); + return content; + } + + public static string GetTagName(this MarkupTagBlockSyntax tagBlock) + { + if (tagBlock == null) + { + throw new ArgumentNullException(nameof(tagBlock)); + } + + var child = tagBlock.Children[0]; + + if (tagBlock.Children.Count == 0 || !(child is MarkupTextLiteralSyntax)) + { + return null; + } + + var childLiteral = (MarkupTextLiteralSyntax)child; + SyntaxToken textToken = null; + for (var i = 0; i < childLiteral.LiteralTokens.Count; i++) + { + var token = childLiteral.LiteralTokens[i]; + + if (token != null && + (token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.Text)) + { + textToken = token; + break; + } + } + + if (textToken == null) + { + return null; + } + + return textToken.Kind == SyntaxKind.Whitespace ? null : textToken.Content; + } + + public static string GetTagName(this MarkupTagHelperStartTagSyntax tagBlock) + { + if (tagBlock == null) + { + throw new ArgumentNullException(nameof(tagBlock)); + } + + var child = tagBlock.Children[0]; + + if (tagBlock.Children.Count == 0 || !(child is MarkupTextLiteralSyntax)) + { + return null; + } + + var childLiteral = (MarkupTextLiteralSyntax)child; + SyntaxToken textToken = null; + for (var i = 0; i < childLiteral.LiteralTokens.Count; i++) + { + var token = childLiteral.LiteralTokens[i]; + + if (token != null && + (token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.Text)) + { + textToken = token; + break; + } + } + + if (textToken == null) + { + return null; + } + + return textToken.Kind == SyntaxKind.Whitespace ? null : textToken.Content; + } + + public static bool IsSelfClosing(this MarkupTagBlockSyntax tagBlock) + { + if (tagBlock == null) + { + throw new ArgumentNullException(nameof(tagBlock)); + } + + var lastChild = tagBlock.ChildNodes().LastOrDefault(); + + return lastChild?.GetContent().EndsWith("/>", StringComparison.Ordinal) ?? false; + } + + public static bool IsVoidElement(this MarkupTagBlockSyntax tagBlock) + { + if (tagBlock == null) + { + throw new ArgumentNullException(nameof(tagBlock)); + } + + return VoidElements.Contains(tagBlock.GetTagName()); } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxReplacer.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxReplacer.cs new file mode 100644 index 000000000..2d192958e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxReplacer.cs @@ -0,0 +1,207 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal static class SyntaxReplacer + { + internal static SyntaxNode Replace( + SyntaxNode root, + IEnumerable nodes = null, + Func computeReplacementNode = null) + where TNode : SyntaxNode + { + var replacer = new Replacer(nodes, computeReplacementNode); + + if (replacer.HasWork) + { + return replacer.Visit(root); + } + else + { + return root; + } + } + + internal static SyntaxNode ReplaceNodeInList(SyntaxNode root, SyntaxNode originalNode, IEnumerable newNodes) + { + return new NodeListEditor(originalNode, newNodes, ListEditKind.Replace).Visit(root); + } + + internal static SyntaxNode InsertNodeInList(SyntaxNode root, SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore) + { + return new NodeListEditor(nodeInList, nodesToInsert, insertBefore ? ListEditKind.InsertBefore : ListEditKind.InsertAfter).Visit(root); + } + + private class Replacer : SyntaxRewriter where TNode : SyntaxNode + { + private readonly Func _computeReplacementNode; + private readonly HashSet _nodeSet; + private readonly HashSet _spanSet; + private readonly TextSpan _totalSpan; + + public Replacer(IEnumerable nodes, Func computeReplacementNode) + { + _computeReplacementNode = computeReplacementNode; + _nodeSet = nodes != null ? new HashSet(nodes) : new HashSet(); + _spanSet = new HashSet(_nodeSet.Select(n => n.FullSpan)); + _totalSpan = ComputeTotalSpan(_spanSet); + } + + public bool HasWork => _nodeSet.Count > 0; + + public override SyntaxNode Visit(SyntaxNode node) + { + var rewritten = node; + + if (node != null) + { + if (ShouldVisit(node.FullSpan)) + { + rewritten = base.Visit(node); + } + + if (_nodeSet.Contains(node) && _computeReplacementNode != null) + { + rewritten = _computeReplacementNode((TNode)node, (TNode)rewritten); + } + } + + return rewritten; + } + + private static TextSpan ComputeTotalSpan(IEnumerable spans) + { + var first = true; + var start = 0; + var end = 0; + + foreach (var span in spans) + { + if (first) + { + start = span.Start; + end = span.End; + first = false; + } + else + { + start = Math.Min(start, span.Start); + end = Math.Max(end, span.End); + } + } + + return new TextSpan(start, end - start); + } + + private bool ShouldVisit(TextSpan span) + { + // first do quick check against total span + if (!span.IntersectsWith(_totalSpan)) + { + // if the node is outside the total span of the nodes to be replaced + // then we won't find any nodes to replace below it. + return false; + } + + foreach (var s in _spanSet) + { + if (span.IntersectsWith(s)) + { + // node's full span intersects with at least one node to be replaced + // so we need to visit node's children to find it. + return true; + } + } + + return false; + } + } + + private class NodeListEditor : SyntaxRewriter + { + private readonly TextSpan _elementSpan; + private readonly SyntaxNode _originalNode; + private readonly IEnumerable _newNodes; + private readonly ListEditKind _editKind; + + public NodeListEditor( + SyntaxNode originalNode, + IEnumerable replacementNodes, + ListEditKind editKind) + { + _elementSpan = originalNode.Span; + _originalNode = originalNode; + _newNodes = replacementNodes; + _editKind = editKind; + } + + private bool ShouldVisit(TextSpan span) + { + if (span.IntersectsWith(_elementSpan)) + { + // node's full span intersects with at least one node to be replaced + // so we need to visit node's children to find it. + return true; + } + + return false; + } + + public override SyntaxNode Visit(SyntaxNode node) + { + if (node == _originalNode) + { + throw new InvalidOperationException("Expecting a list"); + } + + var rewritten = node; + + if (node != null) + { + if (ShouldVisit(node.FullSpan)) + { + rewritten = base.Visit(node); + } + } + + return rewritten; + } + + public override SyntaxList VisitList(SyntaxList list) + { + if (_originalNode is TNode) + { + var index = list.IndexOf((TNode)_originalNode); + if (index >= 0 && index < list.Count) + { + switch (_editKind) + { + case ListEditKind.Replace: + return list.ReplaceRange((TNode)_originalNode, _newNodes.Cast()); + + case ListEditKind.InsertAfter: + return list.InsertRange(index + 1, _newNodes.Cast()); + + case ListEditKind.InsertBefore: + return list.InsertRange(index, _newNodes.Cast()); + } + } + } + + return base.VisitList(list); + } + } + + private enum ListEditKind + { + InsertBefore, + InsertAfter, + Replace + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxRewriter.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxRewriter.cs new file mode 100644 index 000000000..d491bd0e8 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxRewriter.cs @@ -0,0 +1,148 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Diagnostics; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal abstract partial class SyntaxRewriter : SyntaxVisitor + { + public override SyntaxNode VisitToken(SyntaxToken token) + { + // PERF: This is a hot method, so it has been written to minimize the following: + // 1. Virtual method calls + // 2. Copying of structs + // 3. Repeated null checks + + // PERF: Avoid testing node for null more than once + var node = token?.Green; + if (node == null) + { + return token; + } + + // PERF: Make one virtual method call each to get the leading and trailing trivia + var leadingTrivia = node.GetLeadingTrivia(); + var trailingTrivia = node.GetTrailingTrivia(); + + // Trivia is either null or a non-empty list (there's no such thing as an empty green list) + Debug.Assert(leadingTrivia == null || !leadingTrivia.IsList || leadingTrivia.SlotCount > 0); + Debug.Assert(trailingTrivia == null || !trailingTrivia.IsList || trailingTrivia.SlotCount > 0); + + if (leadingTrivia != null) + { + // PERF: Expand token.LeadingTrivia when node is not null. + var leading = VisitList(new SyntaxTriviaList(leadingTrivia.CreateRed(token, token.Position))); + + if (trailingTrivia != null) + { + // Both leading and trailing trivia + + // PERF: Expand token.TrailingTrivia when node is not null and leadingTrivia is not null. + // Also avoid node.Width because it makes a virtual call to GetText. Instead use node.FullWidth - trailingTrivia.FullWidth. + var index = leadingTrivia.IsList ? leadingTrivia.SlotCount : 1; + var position = token.Position + node.FullWidth - trailingTrivia.FullWidth; + var trailing = VisitList(new SyntaxTriviaList(trailingTrivia.CreateRed(token, position), position, index)); + + if (leading.Node.Green != leadingTrivia) + { + token = token.WithLeadingTrivia(leading); + } + + return trailing.Node.Green != trailingTrivia ? token.WithTrailingTrivia(trailing) : token; + } + else + { + // Leading trivia only + return leading.Node.Green != leadingTrivia ? token.WithLeadingTrivia(leading) : token; + } + } + else if (trailingTrivia != null) + { + // Trailing trivia only + // PERF: Expand token.TrailingTrivia when node is not null and leading is null. + // Also avoid node.Width because it makes a virtual call to GetText. Instead use node.FullWidth - trailingTrivia.FullWidth. + var position = token.Position + node.FullWidth - trailingTrivia.FullWidth; + var trailing = VisitList(new SyntaxTriviaList(trailingTrivia.CreateRed(token, position), position, index: 0)); + return trailing.Node.Green != trailingTrivia ? token.WithTrailingTrivia(trailing) : token; + } + else + { + // No trivia + return token; + } + } + + public virtual SyntaxList VisitList(SyntaxList list) where TNode : SyntaxNode + { + SyntaxListBuilder alternate = null; + for (int i = 0, n = list.Count; i < n; i++) + { + var item = list[i]; + var visited = VisitListElement(item); + if (item != visited && alternate == null) + { + alternate = new SyntaxListBuilder(n); + alternate.AddRange(list, 0, i); + } + + if (alternate != null && visited != null) + { + alternate.Add(visited); + } + } + + if (alternate != null) + { + return alternate.ToList(); + } + + return list; + } + + public override SyntaxNode VisitTrivia(SyntaxTrivia trivia) + { + return trivia; + } + + public virtual SyntaxTriviaList VisitList(SyntaxTriviaList list) + { + var count = list.Count; + if (count != 0) + { + SyntaxTriviaListBuilder alternate = null; + var index = -1; + + foreach (var item in list) + { + index++; + var visited = VisitListElement(item); + + //skip the null check since SyntaxTrivia is a value type + if (visited != item && alternate == null) + { + alternate = new SyntaxTriviaListBuilder(count); + alternate.Add(list, 0, index); + } + + if (alternate != null && visited != null) + { + alternate.Add(visited); + } + } + + if (alternate != null) + { + return alternate.ToList(); + } + } + + return list; + } + + public virtual TNode VisitListElement(TNode node) where TNode : SyntaxNode + { + return (TNode)(SyntaxNode)Visit(node); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxSerializer.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxSerializer.cs new file mode 100644 index 000000000..5b167b510 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxSerializer.cs @@ -0,0 +1,304 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.AspNetCore.Razor.Language.Legacy; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal class SyntaxSerializer + { + internal static string Serialize(SyntaxNode node) + { + using (var writer = new StringWriter()) + { + var walker = new Walker(writer); + walker.Visit(node); + + return writer.ToString(); + } + } + + private class Walker : SyntaxWalker + { + private readonly SyntaxWriter _visitor; + private readonly TextWriter _writer; + + public Walker(TextWriter writer) + { + _visitor = new SyntaxWriter(writer); + _writer = writer; + } + + public TextWriter Writer { get; } + + public override SyntaxNode Visit(SyntaxNode node) + { + if (node == null) + { + return node; + } + + if (node.IsList) + { + return base.DefaultVisit(node); + } + + _visitor.Visit(node); + _writer.WriteLine(); + + if (!node.IsToken && !node.IsTrivia) + { + _visitor.Depth++; + node = base.DefaultVisit(node); + _visitor.Depth--; + } + + return node; + } + } + + private class SyntaxWalker : SyntaxRewriter + { + private readonly List _ancestors = new List(); + + protected IReadOnlyList Ancestors => _ancestors; + + protected SyntaxNode Parent => _ancestors.Count > 0 ? _ancestors[0] : null; + + protected override SyntaxNode DefaultVisit(SyntaxNode node) + { + _ancestors.Insert(0, node); + + try + { + for (var i = 0; i < node.SlotCount; i++) + { + var child = node.GetNodeSlot(i); + Visit(child); + } + } + finally + { + _ancestors.RemoveAt(0); + } + + return node; + } + } + + private class SyntaxWriter : SyntaxRewriter + { + private readonly TextWriter _writer; + private bool _visitedRoot; + + public SyntaxWriter(TextWriter writer) + { + _writer = writer; + } + + public int Depth { get; set; } + + public override SyntaxNode Visit(SyntaxNode node) + { + if (node is SyntaxToken token) + { + return VisitToken(token); + } + + WriteNode(node); + return node; + } + + public override SyntaxNode VisitToken(SyntaxToken token) + { + WriteToken(token); + return base.VisitToken(token); + } + + public override SyntaxNode VisitTrivia(SyntaxTrivia trivia) + { + WriteTrivia(trivia); + return base.VisitTrivia(trivia); + } + + private void WriteNode(SyntaxNode node) + { + WriteIndent(); + Write(node.Kind); + WriteSeparator(); + Write($"[{node.Position}..{node.EndPosition})"); + WriteSeparator(); + Write($"FullWidth: {node.FullWidth}"); + + if (node is RazorDirectiveSyntax razorDirective) + { + WriteRazorDirective(razorDirective); + } + else if (node is MarkupTagHelperElementSyntax tagHelperElement) + { + WriteTagHelperElement(tagHelperElement); + } + else if (node is MarkupTagHelperAttributeSyntax tagHelperAttribute) + { + WriteTagHelperAttributeInfo(tagHelperAttribute.TagHelperAttributeInfo); + } + else if (node is MarkupMinimizedTagHelperAttributeSyntax minimizedTagHelperAttribute) + { + WriteTagHelperAttributeInfo(minimizedTagHelperAttribute.TagHelperAttributeInfo); + } + + if (ShouldDisplayNodeContent(node)) + { + WriteSeparator(); + Write($"[{node.GetContent()}]"); + } + + var annotation = node.GetAnnotations().FirstOrDefault(a => a.Kind == SyntaxConstants.SpanContextKind); + if (annotation != null && annotation.Data is SpanContext context) + { + WriteSpanContext(context); + } + + if (!_visitedRoot) + { + WriteSeparator(); + Write($"[{node.ToFullString()}]"); + _visitedRoot = true; + } + } + + private void WriteRazorDirective(RazorDirectiveSyntax node) + { + if (node.DirectiveDescriptor == null) + { + return; + } + + var builder = new StringBuilder("Directive:{"); + builder.Append(node.DirectiveDescriptor.Directive); + builder.Append(";"); + builder.Append(node.DirectiveDescriptor.Kind); + builder.Append(";"); + builder.Append(node.DirectiveDescriptor.Usage); + builder.Append("}"); + + var diagnostics = node.GetDiagnostics(); + if (diagnostics.Length > 0) + { + builder.Append(" ["); + var ids = string.Join(", ", diagnostics.Select(diagnostic => $"{diagnostic.Id}{diagnostic.Span}")); + builder.Append(ids); + builder.Append("]"); + } + + WriteSeparator(); + Write(builder.ToString()); + } + + private void WriteTagHelperElement(MarkupTagHelperElementSyntax node) + { + // Write tag name + WriteSeparator(); + Write($"{node.TagHelperInfo.TagName}[{node.TagHelperInfo.TagMode}]"); + + // Write descriptors + foreach (var descriptor in node.TagHelperInfo.BindingResult.Descriptors) + { + WriteSeparator(); + + // Get the type name without the namespace. + var typeName = descriptor.Name.Substring(descriptor.Name.LastIndexOf('.') + 1); + Write(typeName); + } + } + + private void WriteTagHelperAttributeInfo(TagHelperAttributeInfo info) + { + // Write attributes + WriteSeparator(); + Write(info.Name); + WriteSeparator(); + Write(info.AttributeStructure); + WriteSeparator(); + Write(info.Bound ? "Bound" : "Unbound"); + } + + private void WriteToken(SyntaxToken token) + { + WriteIndent(); + var content = token.IsMissing ? "" : token.Content; + var diagnostics = token.GetDiagnostics(); + var tokenString = $"{token.Kind};[{content}];{string.Join(", ", diagnostics.Select(diagnostic => diagnostic.Id + diagnostic.Span))}"; + Write(tokenString); + } + + private void WriteTrivia(SyntaxTrivia trivia) + { + throw new NotImplementedException(); + } + + private void WriteSpanContext(SpanContext context) + { + WriteSeparator(); + Write($"Gen<{context.ChunkGenerator}>"); + WriteSeparator(); + Write(context.EditHandler); + } + + protected void WriteIndent() + { + for (var i = 0; i < Depth; i++) + { + for (var j = 0; j < 4; j++) + { + Write(' '); + } + } + } + + protected void WriteSeparator() + { + Write(" - "); + } + + protected void WriteNewLine() + { + _writer.WriteLine(); + } + + protected void Write(object value) + { + if (value is string stringValue) + { + stringValue = stringValue.Replace(Environment.NewLine, "LF"); + _writer.Write(stringValue); + return; + } + + _writer.Write(value); + } + + private static bool ShouldDisplayNodeContent(SyntaxNode node) + { + return node.Kind == SyntaxKind.MarkupTextLiteral || + node.Kind == SyntaxKind.MarkupEphemeralTextLiteral || + node.Kind == SyntaxKind.MarkupTagBlock || + node.Kind == SyntaxKind.MarkupAttributeBlock || + node.Kind == SyntaxKind.MarkupMinimizedAttributeBlock || + node.Kind == SyntaxKind.MarkupTagHelperAttribute || + node.Kind == SyntaxKind.MarkupMinimizedTagHelperAttribute || + node.Kind == SyntaxKind.MarkupLiteralAttributeValue || + node.Kind == SyntaxKind.MarkupDynamicAttributeValue || + node.Kind == SyntaxKind.CSharpStatementLiteral || + node.Kind == SyntaxKind.CSharpExpressionLiteral || + node.Kind == SyntaxKind.CSharpEphemeralTextLiteral || + node.Kind == SyntaxKind.UnclassifiedTextLiteral; + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs index b87562f8f..e3ecd35bf 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs @@ -9,50 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax { - internal class SyntaxToken : SyntaxNode + internal class SyntaxToken : RazorSyntaxNode { internal SyntaxToken(GreenNode green, SyntaxNode parent, int position) - : this(green, parent, null, position) - { - } - - // Temporary plumbing - internal SyntaxToken(GreenNode green, SyntaxNode parent, Span parentSpan, int position) : base(green, parent, position) { - Debug.Assert(parent == null || !parent.Green.IsList, "list cannot be a parent"); - Debug.Assert(green == null || green.IsToken, "green must be a token"); - - ParentSpan = parentSpan; - } - - // Temporary plumbing - internal Span ParentSpan { get; } - - // Temporary plumbing - internal SourceLocation Start - { - get - { - if (ParentSpan == null) - { - return SourceLocation.Undefined; - } - - var tracker = new SourceLocationTracker(ParentSpan.Start); - for (var i = 0; i < ParentSpan.Tokens.Count; i++) - { - var token = ParentSpan.Tokens[i]; - if (object.ReferenceEquals(this, token)) - { - break; - } - - tracker.UpdateLocation(token.Content); - } - - return tracker.CurrentLocation; - } } internal new InternalSyntax.SyntaxToken Green => (InternalSyntax.SyntaxToken)base.Green; @@ -107,32 +68,33 @@ public SyntaxToken WithTrailingTrivia(IEnumerable trivia) public override SyntaxTriviaList GetLeadingTrivia() { - if (Green.LeadingTrivia == null) + var leading = Green.GetLeadingTrivia(); + if (leading == null) { return default(SyntaxTriviaList); } - return new SyntaxTriviaList(Green.LeadingTrivia.CreateRed(this, Position), Position); + return new SyntaxTriviaList(leading.CreateRed(this, Position), Position); } public override SyntaxTriviaList GetTrailingTrivia() { - var trailingGreen = Green.TrailingTrivia; - if (trailingGreen == null) + var trailing = Green.GetTrailingTrivia(); + if (trailing == null) { return default(SyntaxTriviaList); } - var leading = Green.LeadingTrivia; - int index = 0; + var leading = Green.GetLeadingTrivia(); + var index = 0; if (leading != null) { index = leading.IsList ? leading.SlotCount : 1; } int trailingPosition = Position + FullWidth; - trailingPosition -= trailingGreen.FullWidth; + trailingPosition -= trailing.FullWidth; - return new SyntaxTriviaList(trailingGreen.CreateRed(this, trailingPosition), trailingPosition, index); + return new SyntaxTriviaList(trailing.CreateRed(this, trailingPosition), trailingPosition, index); } public override string ToString() diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs index 98e1c8f24..2ff23683f 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs @@ -3,6 +3,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax { + /// + /// Represents a visitor that visits only the single SyntaxNode + /// passed into its Visit method and produces + /// a value of the type specified by the parameter. + /// + /// + /// The type of the return value this visitor's Visit method. + /// internal abstract partial class SyntaxVisitor { public virtual TResult Visit(SyntaxNode node) @@ -31,6 +39,10 @@ protected virtual TResult DefaultVisit(SyntaxNode node) } } + /// + /// Represents a visitor that visits only the single SyntaxNode + /// passed into its Visit method. + /// internal abstract partial class SyntaxVisitor { public virtual void Visit(SyntaxNode node) diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxWalker.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxWalker.cs new file mode 100644 index 000000000..214a0039f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxWalker.cs @@ -0,0 +1,55 @@ +// 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 +{ + /// + /// Represents a that descends an entire graph + /// visiting each SyntaxNode and its child SyntaxNodes and s in depth-first order. + /// + internal abstract class SyntaxWalker : SyntaxVisitor + { + public override void Visit(SyntaxNode node) + { + node?.Accept(this); + } + + public override void DefaultVisit(SyntaxNode node) + { + var children = node.ChildNodes(); + for (var i = 0; i < children.Count; i++) + { + var child = children[i]; + Visit(child); + } + } + + public override void VisitToken(SyntaxToken token) + { + VisitLeadingTrivia(token); + VisitTrailingTrivia(token); + } + + public virtual void VisitLeadingTrivia(SyntaxToken token) + { + if (token.HasLeadingTrivia) + { + foreach (var trivia in token.GetLeadingTrivia()) + { + VisitTrivia(trivia); + } + } + } + + public virtual void VisitTrailingTrivia(SyntaxToken token) + { + if (token.HasTrailingTrivia) + { + foreach (var trivia in token.GetTrailingTrivia()) + { + VisitTrivia(trivia); + } + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/TagHelperAttributeInfo.cs b/src/Microsoft.AspNetCore.Razor.Language/TagHelperAttributeInfo.cs new file mode 100644 index 000000000..a3f15f170 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/TagHelperAttributeInfo.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language +{ + internal class TagHelperAttributeInfo + { + public TagHelperAttributeInfo( + string name, + AttributeStructure attributeStructure, + bool bound) + { + Name = name; + AttributeStructure = attributeStructure; + Bound = bound; + } + + public string Name { get; } + + public AttributeStructure AttributeStructure { get; } + + public bool Bound { get; } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/TagHelperInfo.cs b/src/Microsoft.AspNetCore.Razor.Language/TagHelperInfo.cs new file mode 100644 index 000000000..3cc665b4f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/TagHelperInfo.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language +{ + internal class TagHelperInfo + { + public TagHelperInfo( + string tagName, + TagMode tagMode, + TagHelperBinding bindingResult) + { + TagName = tagName; + TagMode = tagMode; + BindingResult = bindingResult; + } + + public string TagName { get; } + + public TagMode TagMode { get; } + + public TagHelperBinding BindingResult { get; } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/TagHelperSpanVisitor.cs b/src/Microsoft.AspNetCore.Razor.Language/TagHelperSpanVisitor.cs new file mode 100644 index 000000000..836a45ae9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/TagHelperSpanVisitor.cs @@ -0,0 +1,31 @@ +// 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 TagHelperSpanVisitor : SyntaxWalker + { + private RazorSourceDocument _source; + private List _spans; + + public TagHelperSpanVisitor(RazorSourceDocument source) + { + _source = source; + _spans = new List(); + } + + public IReadOnlyList TagHelperSpans => _spans; + + public override void VisitMarkupTagHelperElement(MarkupTagHelperElementSyntax node) + { + var span = new TagHelperSpanInternal(node.GetSourceSpan(_source), node.TagHelperInfo.BindingResult); + _spans.Add(span); + + base.VisitMarkupTagHelperElement(node); + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultRazorCompletionFactsService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultRazorCompletionFactsService.cs index 17c0664f4..5d0c542e5 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultRazorCompletionFactsService.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultRazorCompletionFactsService.cs @@ -6,6 +6,7 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.CodeAnalysis.Razor { @@ -68,12 +69,11 @@ internal static bool AtDirectiveCompletionPoint(RazorSyntaxTree syntaxTree, Sour return false; } - if (owner.ChunkGenerator is ExpressionChunkGenerator && - owner.Tokens.All(IsDirectiveCompletableToken) && - // Do not provide IntelliSense for explicit expressions. Explicit expressions will usually look like: - // [@] [(] [DateTime.Now] [)] - owner.Parent?.Children.Count > 1 && - owner.Parent.Children[1] == owner) + // Do not provide IntelliSense for explicit expressions. Explicit expressions will usually look like: + // [@] [(] [DateTime.Now] [)] + var isImplicitExpression = owner.FirstAncestorOrSelf() != null; + if (isImplicitExpression && + owner.ChildNodes().All(n => n.IsToken && IsDirectiveCompletableToken((AspNetCore.Razor.Language.Syntax.SyntaxToken)n))) { return true; } @@ -86,7 +86,7 @@ internal static bool IsDirectiveCompletableToken(AspNetCore.Razor.Language.Synta { return token.Kind == SyntaxKind.Identifier || // Marker symbol - token.Kind == SyntaxKind.Unknown; + token.Kind == SyntaxKind.Marker; } } } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs b/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs index 4de857b96..1c04b0671 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs @@ -5,12 +5,12 @@ using System.Text; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.CodeAnalysis.Razor; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Operations; using ITextBuffer = Microsoft.VisualStudio.Text.ITextBuffer; -using Span = Microsoft.AspNetCore.Razor.Language.Legacy.Span; namespace Microsoft.VisualStudio.Editor.Razor { @@ -274,13 +274,15 @@ internal static bool AtApplicableRazorBlock(int changePosition, RazorSyntaxTree } // Internal for testing - internal static bool ContainsInvalidContent(Span owner) + internal static bool ContainsInvalidContent(SyntaxNode owner) { - // We only support whitespace based content. Any non-whitespace content is an unkonwn to us + // We only support whitespace based content. Any non-whitespace content is an unknown to us // in regards to indentation. - for (var i = 0; i < owner.Tokens.Count; i++) + var children = owner.ChildNodes(); + for (var i = 0; i < children.Count; i++) { - if (!string.IsNullOrWhiteSpace(owner.Tokens[i].Content)) + if (!(children[i] is SyntaxToken token) || + !string.IsNullOrWhiteSpace(token.Content)) { return true; } @@ -290,18 +292,18 @@ internal static bool ContainsInvalidContent(Span owner) } // Internal for testing - internal static bool IsUnlinkedSpan(Span owner) + internal static bool IsUnlinkedSpan(SyntaxNode owner) { return owner == null || - owner.Next == null || - owner.Previous == null; + owner.NextSpan() == null || + owner.PreviousSpan() == null; } // Internal for testing - internal static bool SurroundedByInvalidContent(Span owner) + internal static bool SurroundedByInvalidContent(SyntaxNode owner) { - return owner.Next.Kind != SpanKindInternal.MetaCode || - owner.Previous.Kind != SpanKindInternal.MetaCode; + return !owner.NextSpan().IsMetaCodeSpanKind() || + !owner.PreviousSpan().IsMetaCodeSpanKind(); } internal static bool BeforeClosingBrace(int linePosition, ITextSnapshotLine lineSnapshot) diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs index f8776d699..8b460df9c 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs @@ -5,8 +5,8 @@ using System.ComponentModel.Composition; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.VisualStudio.Text; -using Span = Microsoft.AspNetCore.Razor.Language.Legacy.Span; namespace Microsoft.VisualStudio.Editor.Razor { @@ -63,8 +63,8 @@ internal class DefaultRazorIndentationFactsService : RazorIndentationFactsServic var previousLineEndIndex = GetPreviousLineEndIndex(syntaxTreeSnapshot, line); var simulatedChange = new SourceChange(previousLineEndIndex, 0, string.Empty); - var owningSpan = syntaxTree.Root.LocateOwner(simulatedChange); - if (owningSpan == null || owningSpan.Kind == SpanKindInternal.Code) + var owner = syntaxTree.Root.LocateOwner(simulatedChange); + if (owner == null || owner.IsCodeSpanKind()) { // Example, // @{\n @@ -74,20 +74,19 @@ internal class DefaultRazorIndentationFactsService : RazorIndentationFactsServic } int? desiredIndentation = null; - SyntaxTreeNode owningChild = owningSpan; - while (owningChild.Parent != null) + while (owner.Parent != null) { - var owningParent = owningChild.Parent; - for (var i = 0; i < owningParent.Children.Count; i++) + var children = owner.Parent.ChildNodes(); + for (var i = 0; i < children.Count; i++) { - var currentChild = owningParent.Children[i]; + var currentChild = children[i]; if (IsCSharpOpenCurlyBrace(currentChild)) { - var lineText = line.Snapshot.GetLineFromLineNumber(currentChild.Start.LineIndex).GetText(); + var lineText = line.Snapshot.GetLineFromLineNumber(currentChild.GetSourceLocation(syntaxTree.Source).LineIndex).GetText(); desiredIndentation = GetIndentLevelOfLine(lineText, tabSize) + indentSize; } - if (currentChild == owningChild) + if (currentChild == owner) { break; } @@ -98,7 +97,7 @@ internal class DefaultRazorIndentationFactsService : RazorIndentationFactsServic return desiredIndentation; } - owningChild = owningParent; + owner = owner.Parent; } // Couldn't determine indentation @@ -139,11 +138,12 @@ internal static int GetPreviousLineEndIndex(ITextSnapshot syntaxTreeSnapshot, IT } // Internal for testing - internal static bool IsCSharpOpenCurlyBrace(SyntaxTreeNode currentChild) + internal static bool IsCSharpOpenCurlyBrace(SyntaxNode node) { - return currentChild is Span currentSpan && - currentSpan.Tokens.Count == 1 && - currentSpan.Tokens[0].Kind == SyntaxKind.LeftBrace; + var children = node.ChildNodes(); + return children.Count == 1 && + children[0].IsToken && + children[0].Kind == SyntaxKind.LeftBrace; } } } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxTreePartialParser.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxTreePartialParser.cs index 377351c95..36b4955e3 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxTreePartialParser.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxTreePartialParser.cs @@ -4,13 +4,13 @@ using System; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; -using Span = Microsoft.AspNetCore.Razor.Language.Legacy.Span; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.VisualStudio.Editor.Razor { internal class RazorSyntaxTreePartialParser { - private Span _lastChangeOwner; + private SyntaxNode _lastChangeOwner; private bool _lastResultProvisional; public RazorSyntaxTreePartialParser(RazorSyntaxTree syntaxTree) @@ -20,13 +20,15 @@ public RazorSyntaxTreePartialParser(RazorSyntaxTree syntaxTree) throw new ArgumentNullException(nameof(syntaxTree)); } - // We mutate the existing syntax tree so we need to clone the one passed in so our mutations don't - // impact external state. - SyntaxTreeRoot = (Block)syntaxTree.Root.Clone(); + OriginalSyntaxTree = syntaxTree; + ModifiedSyntaxTreeRoot = syntaxTree.Root; } // Internal for testing - internal Block SyntaxTreeRoot { get; } + internal RazorSyntaxTree OriginalSyntaxTree { get; } + + // Internal for testing + internal SyntaxNode ModifiedSyntaxTreeRoot { get; private set; } public PartialParseResultInternal Parse(SourceChange change) { @@ -43,20 +45,24 @@ private PartialParseResultInternal GetPartialParseResult(SourceChange change) var result = PartialParseResultInternal.Rejected; // Try the last change owner - if (_lastChangeOwner != null && _lastChangeOwner.EditHandler.OwnsChange(_lastChangeOwner, change)) + if (_lastChangeOwner != null) { - var editResult = _lastChangeOwner.EditHandler.ApplyChange(_lastChangeOwner, change); - result = editResult.Result; - if ((editResult.Result & PartialParseResultInternal.Rejected) != PartialParseResultInternal.Rejected) + var editHandler = _lastChangeOwner.GetSpanContext()?.EditHandler ?? SpanEditHandler.CreateDefault(); + if (editHandler.OwnsChange(_lastChangeOwner, change)) { - _lastChangeOwner.ReplaceWith(editResult.EditedSpan); + var editResult = editHandler.ApplyChange(_lastChangeOwner, change); + result = editResult.Result; + if ((editResult.Result & PartialParseResultInternal.Rejected) != PartialParseResultInternal.Rejected) + { + ReplaceLastChangeOwner(editResult.EditedNode); + } } return result; } // Locate the span responsible for this change - _lastChangeOwner = SyntaxTreeRoot.LocateOwner(change); + _lastChangeOwner = ModifiedSyntaxTreeRoot.LocateOwner(change); if (_lastResultProvisional) { @@ -65,15 +71,29 @@ private PartialParseResultInternal GetPartialParseResult(SourceChange change) } else if (_lastChangeOwner != null) { - var editResult = _lastChangeOwner.EditHandler.ApplyChange(_lastChangeOwner, change); + var editHandler = _lastChangeOwner.GetSpanContext()?.EditHandler ?? SpanEditHandler.CreateDefault(); + var editResult = editHandler.ApplyChange(_lastChangeOwner, change); result = editResult.Result; if ((editResult.Result & PartialParseResultInternal.Rejected) != PartialParseResultInternal.Rejected) { - _lastChangeOwner.ReplaceWith(editResult.EditedSpan); + ReplaceLastChangeOwner(editResult.EditedNode); } } return result; } + + private void ReplaceLastChangeOwner(SyntaxNode editedNode) + { + ModifiedSyntaxTreeRoot = ModifiedSyntaxTreeRoot.ReplaceNode(_lastChangeOwner, editedNode); + foreach (var node in ModifiedSyntaxTreeRoot.DescendantNodes()) + { + if (node.Green == editedNode.Green) + { + _lastChangeOwner = node; + break; + } + } + } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/DefaultRazorTagHelperBinderPhaseTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/DefaultRazorTagHelperBinderPhaseTest.cs index 65b5b49fe..43c21817a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/DefaultRazorTagHelperBinderPhaseTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/DefaultRazorTagHelperBinderPhaseTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language @@ -45,8 +46,8 @@ public void Execute_CanHandleSingleLengthAddTagHelperDirective() // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); - var directiveValue = rewrittenTree.Root.Children.OfType().First().Children.Last() as Span; - var chunkGenerator = Assert.IsType(directiveValue.ChunkGenerator); + var erroredNode = rewrittenTree.Root.DescendantNodes().First(n => n.GetSpanContext()?.ChunkGenerator is AddTagHelperChunkGenerator); + var chunkGenerator = Assert.IsType(erroredNode.GetSpanContext().ChunkGenerator); Assert.Equal(expectedDiagnostics, chunkGenerator.Diagnostics); } @@ -84,8 +85,8 @@ public void Execute_CanHandleSingleLengthRemoveTagHelperDirective() // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); - var directiveValue = rewrittenTree.Root.Children.OfType().First().Children.Last() as Span; - var chunkGenerator = Assert.IsType(directiveValue.ChunkGenerator); + var erroredNode = rewrittenTree.Root.DescendantNodes().First(n => n.GetSpanContext()?.ChunkGenerator is RemoveTagHelperChunkGenerator); + var chunkGenerator = Assert.IsType(erroredNode.GetSpanContext().ChunkGenerator); Assert.Equal(expectedDiagnostics, chunkGenerator.Diagnostics); } @@ -123,8 +124,8 @@ public void Execute_CanHandleSingleLengthTagHelperPrefix() // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); - var directiveValue = rewrittenTree.Root.Children.OfType().First().Children.Last() as Span; - var chunkGenerator = Assert.IsType(directiveValue.ChunkGenerator); + var erroredNode = rewrittenTree.Root.DescendantNodes().First(n => n.GetSpanContext()?.ChunkGenerator is TagHelperPrefixDirectiveChunkGenerator); + var chunkGenerator = Assert.IsType(erroredNode.GetSpanContext().ChunkGenerator); Assert.Equal(expectedDiagnostics, chunkGenerator.Diagnostics); } @@ -162,13 +163,11 @@ public void Execute_RewritesTagHelpers() // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); + var descendantNodes = rewrittenTree.Root.DescendantNodes(); Assert.Empty(rewrittenTree.Diagnostics); - Assert.Equal(3, rewrittenTree.Root.Children.Count); - var formTagHelper = Assert.IsType(rewrittenTree.Root.Children[2]); - Assert.Equal("form", formTagHelper.TagName); - Assert.Equal(3, formTagHelper.Children.Count); - var inputTagHelper = Assert.IsType(formTagHelper.Children[1]); - Assert.Equal("input", inputTagHelper.TagName); + var tagHelperNodes = descendantNodes.Where(n => n is MarkupTagHelperElementSyntax tagHelper).Cast().ToArray(); + Assert.Equal("form", tagHelperNodes[0].TagHelperInfo.TagName); + Assert.Equal("input", tagHelperNodes[1].TagHelperInfo.TagName); } [Fact] @@ -204,13 +203,11 @@ public void Execute_WithTagHelperDescriptorsFromCodeDocument_RewritesTagHelpers( // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); + var descendantNodes = rewrittenTree.Root.DescendantNodes(); Assert.Empty(rewrittenTree.Diagnostics); - Assert.Equal(3, rewrittenTree.Root.Children.Count); - var formTagHelper = Assert.IsType(rewrittenTree.Root.Children[2]); - Assert.Equal("form", formTagHelper.TagName); - Assert.Equal(3, formTagHelper.Children.Count); - var inputTagHelper = Assert.IsType(formTagHelper.Children[1]); - Assert.Equal("input", inputTagHelper.TagName); + var tagHelperNodes = descendantNodes.Where(n => n is MarkupTagHelperElementSyntax tagHelper).Cast().ToArray(); + Assert.Equal("form", tagHelperNodes[0].TagHelperInfo.TagName); + Assert.Equal("input", tagHelperNodes[1].TagHelperInfo.TagName); } [Fact] @@ -246,13 +243,11 @@ public void Execute_NullTagHelperDescriptorsFromCodeDocument_FallsBackToTagHelpe // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); + var descendantNodes = rewrittenTree.Root.DescendantNodes(); Assert.Empty(rewrittenTree.Diagnostics); - Assert.Equal(3, rewrittenTree.Root.Children.Count); - var formTagHelper = Assert.IsType(rewrittenTree.Root.Children[2]); - Assert.Equal("form", formTagHelper.TagName); - Assert.Equal(3, formTagHelper.Children.Count); - var inputTagHelper = Assert.IsType(formTagHelper.Children[1]); - Assert.Equal("input", inputTagHelper.TagName); + var tagHelperNodes = descendantNodes.Where(n => n is MarkupTagHelperElementSyntax tagHelper).Cast().ToArray(); + Assert.Equal("form", tagHelperNodes[0].TagHelperInfo.TagName); + Assert.Equal("input", tagHelperNodes[1].TagHelperInfo.TagName); } [Fact] @@ -288,10 +283,10 @@ public void Execute_EmptyTagHelperDescriptorsFromCodeDocument_DoesNotFallbackToT // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); + var descendantNodes = rewrittenTree.Root.DescendantNodes(); Assert.Empty(rewrittenTree.Diagnostics); - Assert.Equal(7, rewrittenTree.Root.Children.Count); - var rewrittenNodes = rewrittenTree.Root.Children.OfType(); - Assert.Empty(rewrittenNodes); + var tagHelperNodes = descendantNodes.Where(n => n is MarkupTagHelperElementSyntax tagHelper).Cast().ToArray(); + Assert.Empty(tagHelperNodes); } [Fact] @@ -339,12 +334,13 @@ public void Execute_DirectiveWithoutQuotes_RewritesTagHelpers_TagHelperMatchesEl // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); + var descendantNodes = rewrittenTree.Root.DescendantNodes(); Assert.Empty(rewrittenTree.Diagnostics); - Assert.Equal(3, rewrittenTree.Root.Children.Count); + var tagHelperNodes = descendantNodes.Where(n => n is MarkupTagHelperElementSyntax tagHelper).Cast().ToArray(); - var formTagHelper = Assert.IsType(rewrittenTree.Root.Children[2]); - Assert.Equal("form", formTagHelper.TagName); - Assert.Equal(2, formTagHelper.Binding.GetBoundRules(descriptor).Count()); + var formTagHelper = Assert.Single(tagHelperNodes); + Assert.Equal("form", formTagHelper.TagHelperInfo.TagName); + Assert.Equal(2, formTagHelper.TagHelperInfo.BindingResult.GetBoundRules(descriptor).Count()); } [Fact] @@ -392,12 +388,13 @@ public void Execute_DirectiveWithQuotes_RewritesTagHelpers_TagHelperMatchesEleme // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); + var descendantNodes = rewrittenTree.Root.DescendantNodes(); Assert.Empty(rewrittenTree.Diagnostics); - Assert.Equal(3, rewrittenTree.Root.Children.Count); + var tagHelperNodes = descendantNodes.Where(n => n is MarkupTagHelperElementSyntax tagHelper).Cast().ToArray(); - var formTagHelper = Assert.IsType(rewrittenTree.Root.Children[2]); - Assert.Equal("form", formTagHelper.TagName); - Assert.Equal(2, formTagHelper.Binding.GetBoundRules(descriptor).Count()); + var formTagHelper = Assert.Single(tagHelperNodes); + Assert.Equal("form", formTagHelper.TagHelperInfo.TagName); + Assert.Equal(2, formTagHelper.TagHelperInfo.BindingResult.GetBoundRules(descriptor).Count()); } [Fact] @@ -437,15 +434,12 @@ public void Execute_TagHelpersFromCodeDocumentAndFeature_PrefersCodeDocument() // Assert var rewrittenTree = codeDocument.GetSyntaxTree(); + var descendantNodes = rewrittenTree.Root.DescendantNodes(); Assert.Empty(rewrittenTree.Diagnostics); - Assert.Equal(3, rewrittenTree.Root.Children.Count); - var formTagHelper = Assert.IsType(rewrittenTree.Root.Children[2]); - Assert.Equal("form", formTagHelper.TagName); - Assert.Collection( - formTagHelper.Children, - node => Assert.IsNotType(node), - node => Assert.IsNotType(node), - node => Assert.IsNotType(node)); + var tagHelperNodes = descendantNodes.Where(n => n is MarkupTagHelperElementSyntax tagHelper).Cast().ToArray(); + + var formTagHelper = Assert.Single(tagHelperNodes); + Assert.Equal("form", formTagHelper.TagHelperInfo.TagName); } [Fact] @@ -691,7 +685,7 @@ public void DirectiveVisitor_ExtractsPrefixFromSyntaxTree( var visitor = new DefaultRazorTagHelperBinderPhase.DirectiveVisitor(tagHelpers: new List()); // Act - visitor.VisitBlock(syntaxTree.Root); + visitor.Visit(syntaxTree.Root); // Assert Assert.Equal(expectedPrefix, visitor.TagHelperPrefix); @@ -857,7 +851,7 @@ public void DirectiveVisitor_FiltersTagHelpersByDirectives( var visitor = new DefaultRazorTagHelperBinderPhase.DirectiveVisitor((TagHelperDescriptor[])tagHelpers); // Act - visitor.VisitBlock(syntaxTree.Root); + visitor.Visit(syntaxTree.Root); // Assert Assert.Equal(expected.Count(), visitor.Matches.Count()); @@ -1001,7 +995,7 @@ public void ProcessDirectives_CanReturnEmptyDescriptorsBasedOnDirectiveDescripto var visitor = new DefaultRazorTagHelperBinderPhase.DirectiveVisitor((TagHelperDescriptor[])tagHelpers); // Act - visitor.VisitBlock(syntaxTree.Root); + visitor.Visit(syntaxTree.Root); // Assert Assert.Empty(visitor.Matches); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/DirectiveTokenEditHandlerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/DirectiveTokenEditHandlerTest.cs index 9cb09633a..1f0336d00 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/DirectiveTokenEditHandlerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/DirectiveTokenEditHandlerTest.cs @@ -1,10 +1,10 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; -using System.Text; +using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Test @@ -18,11 +18,11 @@ public class DirectiveTokenEditHandlerTest public void CanAcceptChange_ProvisionallyAcceptsNonWhitespaceChanges(int index, int length, string newText) { // Arrange - var factory = new SpanFactory(); var directiveTokenHandler = new TestDirectiveTokenEditHandler(); - var target = factory.Span(SpanKindInternal.Code, "SomeNamespace", markup: false) - .With(directiveTokenHandler) - .Accepts(AcceptedCharactersInternal.NonWhitespace); + directiveTokenHandler.AcceptedCharacters = AcceptedCharactersInternal.NonWhitespace; + + var target = GetSyntaxNode(directiveTokenHandler, "SomeNamespace"); + var sourceChange = new SourceChange(index, length, newText); // Act @@ -39,11 +39,11 @@ public void CanAcceptChange_ProvisionallyAcceptsNonWhitespaceChanges(int index, public void CanAcceptChange_RejectsWhitespaceChanges(int index, int length, string newText) { // Arrange - var factory = new SpanFactory(); var directiveTokenHandler = new TestDirectiveTokenEditHandler(); - var target = factory.Span(SpanKindInternal.Code, "Some Namespace", markup: false) - .With(directiveTokenHandler) - .Accepts(AcceptedCharactersInternal.NonWhitespace); + directiveTokenHandler.AcceptedCharacters = AcceptedCharactersInternal.NonWhitespace; + + var target = GetSyntaxNode(directiveTokenHandler, "Some Namespace"); + var sourceChange = new SourceChange(index, length, newText); // Act @@ -53,14 +53,34 @@ public void CanAcceptChange_RejectsWhitespaceChanges(int index, int length, stri Assert.Equal(PartialParseResultInternal.Rejected, result); } + private static CSharpStatementLiteralSyntax GetSyntaxNode(DirectiveTokenEditHandler editHandler, string content) + { + var builder = SyntaxListBuilder.Create(); + var tokens = CSharpLanguageCharacteristics.Instance.TokenizeString(content).ToArray(); + foreach (var token in tokens) + { + builder.Add((SyntaxToken)token.CreateRed()); + } + var node = SyntaxFactory.CSharpStatementLiteral(builder.ToList()); + + var context = new SpanContext(SpanChunkGenerator.Null, editHandler); + + return node.WithSpanContext(context); + } + private class TestDirectiveTokenEditHandler : DirectiveTokenEditHandler { - public TestDirectiveTokenEditHandler() : base(content => SpanConstructor.TestTokenizer(content)) + public TestDirectiveTokenEditHandler() : base(content => TestTokenizer(content)) { } - public new PartialParseResultInternal CanAcceptChange(Span target, SourceChange change) + public new PartialParseResultInternal CanAcceptChange(SyntaxNode target, SourceChange change) => base.CanAcceptChange(target, change); + + internal static IEnumerable TestTokenizer(string str) + { + yield return Syntax.InternalSyntax.SyntaxFactory.Token(SyntaxKind.Marker, str); + } } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/HtmlNodeOptimizationPassTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/HtmlNodeOptimizationPassTest.cs index 4ece47b0c..bf08903e5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/HtmlNodeOptimizationPassTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/HtmlNodeOptimizationPassTest.cs @@ -4,33 +4,13 @@ using System; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language { public class HtmlNodeOptimizationPassTest { - [Fact] - public void Execute_CollapsesConditionalAttributes() - { - // Assert - var content = ""; - var sourceDocument = TestRazorSourceDocument.Create(content); - var originalTree = RazorSyntaxTree.Parse(sourceDocument); - var pass = new HtmlNodeOptimizationPass(); - var codeDocument = RazorCodeDocument.Create(sourceDocument); - - // Act - var outputTree = pass.Execute(codeDocument, originalTree); - - // Assert - var tag = Assert.Single(outputTree.Root.Children); - var tagBlock = Assert.IsType(tag); - Assert.Equal(BlockKindInternal.Tag, tagBlock.Type); - Assert.Equal(3, tagBlock.Children.Count); - Assert.IsType(tagBlock.Children[1]); - } - [Fact] public void Execute_RewritesWhitespace() { @@ -45,9 +25,11 @@ public void Execute_RewritesWhitespace() var outputTree = pass.Execute(codeDocument, originalTree); // Assert - Assert.Equal(4, outputTree.Root.Children.Count); - var whitespace = Assert.IsType(outputTree.Root.Children[1]); - Assert.True(whitespace.Content.All(char.IsWhiteSpace)); + var document = Assert.IsType(outputTree.Root); + var block = Assert.IsType(document.Document); + Assert.Equal(4, block.Children.Count); + var whitespace = Assert.IsType(block.Children[1]); + Assert.True(whitespace.GetContent().All(char.IsWhiteSpace)); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/TagHelpersIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/TagHelpersIntegrationTest.cs index c8cd0e414..c5c9810e7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/TagHelpersIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/TagHelpersIntegrationTest.cs @@ -94,6 +94,8 @@ public void NestedTagHelpers() var codeDocument = projectEngine.Process(projectItem); // Assert + var syntaxTree = codeDocument.GetSyntaxTree(); + var irTree = codeDocument.GetDocumentIntermediateNode(); AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode()); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs deleted file mode 100644 index 5cfbec740..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Linq; -using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; -using Xunit; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - public class BlockTest - { - [Fact] - public void ChildChanged_NotifiesParent() - { - // Arrange - var spanBuilder = new SpanBuilder(SourceLocation.Zero); - spanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hello")); - var span = spanBuilder.Build(); - var blockBuilder = new BlockBuilder() - { - Type = BlockKindInternal.Markup, - }; - blockBuilder.Children.Add(span); - var childBlock = blockBuilder.Build(); - blockBuilder = new BlockBuilder() - { - Type = BlockKindInternal.Markup, - }; - blockBuilder.Children.Add(childBlock); - var parentBlock = blockBuilder.Build(); - var originalBlockLength = parentBlock.Length; - spanBuilder = new SpanBuilder(SourceLocation.Zero); - spanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hi")); - span.ReplaceWith(spanBuilder); - - // Wire up parents now so we can re-trigger ChildChanged to cause cache refresh. - span.Parent = childBlock; - childBlock.Parent = parentBlock; - - // Act - childBlock.ChildChanged(); - - // Assert - Assert.Equal(5, originalBlockLength); - Assert.Equal(2, parentBlock.Length); - } - - [Fact] - public void Clone_ClonesBlock() - { - // Arrange - var blockBuilder = new BlockBuilder() - { - ChunkGenerator = new DynamicAttributeBlockChunkGenerator(new LocationTagged("class=\"", SourceLocation.Zero), 0, 0, 0), - Type = BlockKindInternal.Expression, - }; - blockBuilder.Children.Add(new SpanBuilder(new SourceLocation(1, 2, 3)).Build()); - var block = blockBuilder.Build(); - - // Act - var copy = (Block)block.Clone(); - - // Assert - ParserTestBase.EvaluateParseTree(copy, block); - Assert.NotSame(block, copy); - } - - [Fact] - public void ConstructorWithBlockBuilderSetsParent() - { - // Arrange - var builder = new BlockBuilder() { Type = BlockKindInternal.Comment }; - var span = new SpanBuilder(SourceLocation.Undefined) { Kind = SpanKindInternal.Code }.Build(); - builder.Children.Add(span); - - // Act - var block = builder.Build(); - - // Assert - Assert.Same(block, span.Parent); - } - - [Fact] - public void ConstructorTransfersInstanceOfChunkGeneratorFromBlockBuilder() - { - // Arrange - var expected = new ExpressionChunkGenerator(); - var builder = new BlockBuilder() - { - Type = BlockKindInternal.Statement, - ChunkGenerator = expected - }; - - // Act - var actual = builder.Build(); - - // Assert - Assert.Same(expected, actual.ChunkGenerator); - } - - [Fact] - public void ConstructorTransfersChildrenFromBlockBuilder() - { - // Arrange - var expected = new SpanBuilder(SourceLocation.Undefined) { Kind = SpanKindInternal.Code }.Build(); - var builder = new BlockBuilder() - { - Type = BlockKindInternal.Statement - }; - builder.Children.Add(expected); - - // Act - var block = builder.Build(); - - // Assert - Assert.Same(expected, block.Children.Single()); - } - } -} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpCodeParserTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpCodeParserTest.cs index ea86c7222..250eff4f4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpCodeParserTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpCodeParserTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy @@ -205,9 +206,8 @@ public void TagHelperPrefixDirective_DuplicatesCauseError() var document = RazorSyntaxTree.Parse(source); // Assert - var directive = document.Root.Children.OfType().Last(); - var erroredSpan = (Span)directive.Children.Last(); - var chunkGenerator = Assert.IsType(erroredSpan.ChunkGenerator); + var erroredNode = document.Root.DescendantNodes().Last(n => n.GetSpanContext()?.ChunkGenerator is TagHelperPrefixDirectiveChunkGenerator); + var chunkGenerator = Assert.IsType(erroredNode.GetSpanContext().ChunkGenerator); var diagnostic = Assert.Single(chunkGenerator.Diagnostics); Assert.Equal(expectedDiagnostic, diagnostic); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs index af280d67f..141735687 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs @@ -33,6 +33,18 @@ public void UnterminatedRazorCommentInImplicitExpressionMethodCall() ParseDocumentTest("@foo(@*"); } + [Fact] + public void RazorMultilineCommentInBlock() + { + ParseDocumentTest(@" +@{ + @* +This is a comment + *@ +} +"); + } + [Fact] public void RazorCommentInVerbatimBlock() { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpSectionTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpSectionTest.cs index 52bca860e..c4221e501 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpSectionTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpSectionTest.cs @@ -139,15 +139,6 @@ public void HandlesUnterminatedSectionWithNestedIf() public void ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace() { // ParseSectionBlockReportsErrorAndAcceptsWhitespaceToEndOfLineIfSectionNotFollowedByOpenBrace - // Arrange - var chunkGenerator = new DirectiveChunkGenerator(SectionDirective.Directive); - chunkGenerator.Diagnostics.Add( - RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( - new SourceSpan(new SourceLocation(18 + Environment.NewLine.Length, 1, 0), contentLength: 1), - SectionDirective.Directive.Directive, - "{")); - - // Act & Assert ParseDocumentTest( "@section foo " + Environment.NewLine, new[] { SectionDirective.Directive }); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTestBase.cs index 60652e402..83b2adc68 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTestBase.cs @@ -7,7 +7,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { public abstract class CSharpTokenizerTestBase : TokenizerTestBase { - private static SyntaxToken _ignoreRemaining = SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); + private static SyntaxToken _ignoreRemaining = SyntaxFactory.Token(SyntaxKind.Marker, string.Empty); internal override object IgnoreRemaining { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeBlockEditHandlerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeBlockEditHandlerTest.cs index df17deb58..a300d388b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeBlockEditHandlerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeBlockEditHandlerTest.cs @@ -3,6 +3,7 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy @@ -205,17 +206,17 @@ public void ContainsInvalidContent_ValidContent_ReturnsFalse(string content) Assert.False(result); } - private static Span GetSpan(SourceLocation start, string content) + private static SyntaxNode GetSpan(SourceLocation start, string content) { - var spanBuilder = new SpanBuilder(start); + var builder = SyntaxListBuilder.Create(); var tokens = CSharpLanguageCharacteristics.Instance.TokenizeString(content).ToArray(); foreach (var token in tokens) { - spanBuilder.Accept(token); + builder.Add((SyntaxToken)token.CreateRed()); } - var span = spanBuilder.Build(); + var node = SyntaxFactory.CSharpStatementLiteral(builder.ToList()); - return span; + return node; } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CsHtmlCodeParserTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CsHtmlCodeParserTestBase.cs index db0f3d845..e87bb40d3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CsHtmlCodeParserTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CsHtmlCodeParserTestBase.cs @@ -11,10 +11,5 @@ internal override ISet KeywordSet { get { return CSharpCodeParser.DefaultKeywords; } } - - internal override BlockFactory CreateBlockFactory() - { - return new BlockFactory(Factory ?? CreateSpanFactory()); - } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CsHtmlMarkupParserTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CsHtmlMarkupParserTestBase.cs index a643ea73a..072769f1e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CsHtmlMarkupParserTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CsHtmlMarkupParserTestBase.cs @@ -11,10 +11,5 @@ internal override ISet KeywordSet { get { return CSharpCodeParser.DefaultKeywords; } } - - internal override BlockFactory CreateBlockFactory() - { - return new BlockFactory(Factory ?? CreateSpanFactory()); - } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlAttributeTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlAttributeTest.cs index 1fae85afb..41ba2004f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlAttributeTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlAttributeTest.cs @@ -219,90 +219,6 @@ public void UnquotedAttributeWithCodeWithSpacesInDocument() ParseDocumentTest(""); } - [Fact] - public void ConditionalAttributeCollapserDoesNotRewriteEscapedTransitions() - { - // Act - var results = ParseDocument(""); - var attributeCollapser = new ConditionalAttributeCollapser(); - var rewritten = attributeCollapser.Rewrite(results.Root); - - // Assert - BaselineTest(rewritten); - } - - [Fact] - public void ConditionalAttributesDoNotCreateExtraDataForEntirelyLiteralAttribute() - { - // Arrange - const string code = - @"
-

Title

-

- As the author, you can edit - or remove this photo. -

-
-
Description
-
- The uploader did not provide a description for this photo. -
-
Uploaded by
-
user.DisplayName
-
Upload date
-
photo.UploadDate
-
Gallery
-
gallery.Name
-
Tags
-
-
    -
  • This photo has no tags.
  • -
- edit tags -
-
- -

- Download full photo ((photo.FileSize / 1024) KB) -

-
-
- -

Nobody has commented on this photo

-
    -
  1. -

    - comment.DisplayName commented at comment.CommentDate: -

    -

    comment.CommentText

    -
  2. -
- -
-
- Post new comment -
    -
  1. - - -
  2. -
-

- -

-
-
-
"; - - // Act - var results = ParseDocument(code); - var attributeCollapser = new ConditionalAttributeCollapser(); - var rewritten = attributeCollapser.Rewrite(results.Root); - - // Assert - Assert.Equal(rewritten.Children.Count(), results.Root.Children.Count()); - } - [Fact] public void ConditionalAttributesAreEnabledForDataAttributesWithExperimentalFlag() { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs index f77ee48b6..ca41b2d47 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Linq; using Microsoft.AspNetCore.Razor.Language.Extensions; using Xunit; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlMarkupParserTests.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlMarkupParserTests.cs index c59bd36b0..dafb6b241 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlMarkupParserTests.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlMarkupParserTests.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; @@ -206,18 +209,13 @@ private class TestHtmlMarkupParser : HtmlMarkupParser public TestHtmlMarkupParser(ParserContext context) : base(context) { - this.EnsureCurrent(); + EnsureCurrent(); } public new SyntaxToken AcceptAllButLastDoubleHyphens() { return base.AcceptAllButLastDoubleHyphens(); } - - public override void BuildSpan(SpanBuilder span, SourceLocation start, string content) - { - base.BuildSpan(span, start, content); - } } private static TestHtmlMarkupParser CreateTestParserForContent(string content) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlToCodeSwitchTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlToCodeSwitchTest.cs index 3676dc27a..8c3291481 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlToCodeSwitchTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlToCodeSwitchTest.cs @@ -144,7 +144,6 @@ public void ParseDocumentTreatsTwoAtSignsAsEscapeSequence() [Fact] public void ParseDocumentTreatsPairsOfAtSignsAsEscapeSequence() { - var factory = new SpanFactory(); ParseDocumentTest("@@@@@bar"); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTestBase.cs index 76762e5be..0b6250d6d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTestBase.cs @@ -7,7 +7,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { public abstract class HtmlTokenizerTestBase : TokenizerTestBase { - private static SyntaxToken _ignoreRemaining = SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); + private static SyntaxToken _ignoreRemaining = SyntaxFactory.Token(SyntaxKind.Marker, string.Empty); internal override object IgnoreRemaining { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/ImplicitExpressionEditHandlerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/ImplicitExpressionEditHandlerTest.cs index 2b3d8aa45..bf71526ed 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/ImplicitExpressionEditHandlerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/ImplicitExpressionEditHandlerTest.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; -using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -14,7 +14,7 @@ public class ImplicitExpressionEditHandlerTest public void IsAcceptableDeletionInBalancedParenthesis_DeletionStartNotInBalancedParenthesis_ReturnsFalse() { // Arrange - var span = GetSpan(SourceLocation.Zero, "(Hell)(o)"); + var span = GetSyntaxNode(SourceLocation.Zero, "(Hell)(o)"); var change = new SourceChange(new SourceSpan(6, 1), string.Empty); // Act @@ -28,7 +28,7 @@ public void IsAcceptableDeletionInBalancedParenthesis_DeletionStartNotInBalanced public void IsAcceptableDeletionInBalancedParenthesis_DeletionEndNotInBalancedParenthesis_ReturnsFalse() { // Arrange - var span = GetSpan(SourceLocation.Zero, "(Hell)(o)"); + var span = GetSyntaxNode(SourceLocation.Zero, "(Hell)(o)"); var change = new SourceChange(new SourceSpan(5, 1), string.Empty); // Act @@ -42,7 +42,7 @@ public void IsAcceptableDeletionInBalancedParenthesis_DeletionEndNotInBalancedPa public void IsAcceptableDeletionInBalancedParenthesis_DeletionOverlapsBalancedParenthesis_ReturnsFalse() { // Arrange - var span = GetSpan(SourceLocation.Zero, "(Hell)(o)"); + var span = GetSyntaxNode(SourceLocation.Zero, "(Hell)(o)"); var change = new SourceChange(new SourceSpan(5, 2), string.Empty); // Act @@ -56,7 +56,7 @@ public void IsAcceptableDeletionInBalancedParenthesis_DeletionOverlapsBalancedPa public void IsAcceptableDeletionInBalancedParenthesis_DeletionDoesNotImpactBalancedParenthesis_ReturnsTrue() { // Arrange - var span = GetSpan(SourceLocation.Zero, "(H(ell)o)"); + var span = GetSyntaxNode(SourceLocation.Zero, "(H(ell)o)"); var change = new SourceChange(new SourceSpan(3, 3), string.Empty); // Act @@ -160,7 +160,7 @@ public void TryUpdateCountFromContent_InvalidParenthesis_ReturnsFalse() public void TryUpdateBalanceCount_SingleLeftParenthesis_CountsCorrectly() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.LeftParenthesis, "("); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.LeftParenthesis, "("); var count = 0; // Act @@ -175,7 +175,7 @@ public void TryUpdateBalanceCount_SingleLeftParenthesis_CountsCorrectly() public void TryUpdateBalanceCount_SingleRightParenthesis_CountsCorrectly() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.RightParenthesis, ")"); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.RightParenthesis, ")"); var count = 2; // Act @@ -190,7 +190,7 @@ public void TryUpdateBalanceCount_SingleRightParenthesis_CountsCorrectly() public void TryUpdateBalanceCount_IncompleteStringLiteral_CountsCorrectly() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"(("); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"(("); var count = 2; // Act @@ -205,7 +205,7 @@ public void TryUpdateBalanceCount_IncompleteStringLiteral_CountsCorrectly() public void TryUpdateBalanceCount_IncompleteCharacterLiteral_CountsCorrectly() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'(("); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'(("); var count = 2; // Act @@ -220,7 +220,7 @@ public void TryUpdateBalanceCount_IncompleteCharacterLiteral_CountsCorrectly() public void TryUpdateBalanceCount_CompleteStringLiteral_CountsCorrectly() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"((\""); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"((\""); var count = 2; // Act @@ -235,7 +235,7 @@ public void TryUpdateBalanceCount_CompleteStringLiteral_CountsCorrectly() public void TryUpdateBalanceCount_CompleteCharacterLiteral_CountsCorrectly() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'('"); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'('"); var count = 2; // Act @@ -250,7 +250,7 @@ public void TryUpdateBalanceCount_CompleteCharacterLiteral_CountsCorrectly() public void TryUpdateBalanceCount_InvalidParenthesis_ReturnsFalse() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.RightParenthesis, ")"); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.RightParenthesis, ")"); var count = 0; // Act @@ -265,7 +265,7 @@ public void TryUpdateBalanceCount_InvalidParenthesis_ReturnsFalse() public void TryUpdateBalanceCount_InvalidParenthesisStringLiteral_ReturnsFalse() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.StringLiteral, "\")"); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.StringLiteral, "\")"); var count = 0; // Act @@ -280,7 +280,7 @@ public void TryUpdateBalanceCount_InvalidParenthesisStringLiteral_ReturnsFalse() public void TryUpdateBalanceCount_InvalidParenthesisCharacterLiteral_ReturnsFalse() { // Arrange - var token = SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "')"); + var token = Syntax.SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "')"); var count = 0; // Act @@ -403,7 +403,7 @@ public void IsInsideParenthesis_InBalancedParenthesis_ReturnsTrue() public void IsAcceptableInsertionInBalancedParenthesis_InsertingParenthesis_ReturnsFalse(string text) { // Arrange - var span = GetSpan(SourceLocation.Zero, "(Hello World)"); + var span = GetSyntaxNode(SourceLocation.Zero, "(Hello World)"); var change = new SourceChange(new SourceSpan(3, 0), text); // Act @@ -417,7 +417,7 @@ public void IsAcceptableInsertionInBalancedParenthesis_InsertingParenthesis_Retu public void IsAcceptableInsertionInBalancedParenthesis_UnbalancedParenthesis_ReturnsFalse() { // Arrange - var span = GetSpan(SourceLocation.Zero, "(Hello"); + var span = GetSyntaxNode(SourceLocation.Zero, "(Hello"); var change = new SourceChange(new SourceSpan(6, 0), " World"); // Act @@ -431,7 +431,7 @@ public void IsAcceptableInsertionInBalancedParenthesis_UnbalancedParenthesis_Ret public void IsAcceptableInsertionInBalancedParenthesis_BalancedParenthesis_ReturnsTrue() { // Arrange - var span = GetSpan(SourceLocation.Zero, "(Hello)"); + var span = GetSyntaxNode(SourceLocation.Zero, "(Hello)"); var change = new SourceChange(new SourceSpan(6, 0), " World"); // Act @@ -441,23 +441,23 @@ public void IsAcceptableInsertionInBalancedParenthesis_BalancedParenthesis_Retur Assert.True(result); } - private static Span GetSpan(SourceLocation start, string content) + private static Syntax.MarkupTextLiteralSyntax GetSyntaxNode(SourceLocation start, string content) { - var spanBuilder = new SpanBuilder(start); + var builder = SyntaxListBuilder.Create(); var tokens = CSharpLanguageCharacteristics.Instance.TokenizeString(content).ToArray(); foreach (var token in tokens) { - spanBuilder.Accept(token); + builder.Add(token); } - var span = spanBuilder.Build(); + var node = SyntaxFactory.MarkupTextLiteral(builder.ToList()).CreateRed(parent: null, position: start.AbsoluteIndex); - return span; + return (Syntax.MarkupTextLiteralSyntax)node; } - private static IReadOnlyList GetTokens(SourceLocation start, string content) + private static IReadOnlyList GetTokens(SourceLocation start, string content) { - var parent = GetSpan(start, content); - return parent.Tokens; + var parent = GetSyntaxNode(start, content); + return parent.LiteralTokens; } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/MarkupElementRewriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/MarkupElementRewriterTest.cs new file mode 100644 index 000000000..4275ec123 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/MarkupElementRewriterTest.cs @@ -0,0 +1,154 @@ +// 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.Text; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Language.Legacy +{ + public class MarkupElementRewriterTest : CsHtmlMarkupParserTestBase + { + [Fact] + public void Rewrites_ValidTags() + { + // Arrange + var content = @" +
Foo
+

Bar

+"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_ValidNestedTags() + { + // Arrange + var content = @" +
+ Foo +

Bar

+ Baz +
"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_ValidNestedTagsMixedWithCode() + { + // Arrange + var content = @" +
+ Foo +

@Bar

+ @{ var x = Bar; } +
+"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_EndTagsWithMissingStartTags() + { + // Arrange + var content = @" +Foo +"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_StartTagsWithMissingEndTags() + { + // Arrange + var content = @" +
+ Foo +

+ Bar + +"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_SelfClosingTags() + { + // Arrange + var content = @" +
Foo +"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_MalformedTags_RecoversSuccessfully() + { + // Arrange + var content = @" +

contentfooter
+"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_MisplacedEndTags_RecoversSuccessfully() + { + // Arrange + var content = @" +
contentfooter
+"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_DoesNotSpecialCase_VoidTags() + { + // Arrange + var content = @" +Foo +"; + + // Act & Assert + RewriterTest(content); + } + + [Fact] + public void Rewrites_IncompleteTags() + { + // Arrange + var content = @" +<
>Foo< > +"; + + // Act & Assert + RewriterTest(content); + } + + private void RewriterTest(string input) + { + var syntaxTree = ParseDocument(input, designTime: false); + var rewritten = MarkupElementRewriter.AddMarkupElements(syntaxTree); + BaselineTest(rewritten); + + var unrewritten = MarkupElementRewriter.RemoveMarkupElements(rewritten); + Assert.Equal(syntaxTree.Root.SerializedValue, unrewritten.Root.SerializedValue); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorDirectivesTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorDirectivesTest.cs index 5da2a4bba..e4b999fd1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorDirectivesTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorDirectivesTest.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { - public class CSharpDirectivesTest : CsHtmlCodeParserTestBase + public class RazorDirectivesTest : CsHtmlCodeParserTestBase { [Fact] public void DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates() diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs index 43d53bf84..7d848c297 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs @@ -1,7 +1,6 @@ // 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.Linq; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -22,67 +21,32 @@ public void CanParseStuff() public void ParseMethodCallsParseDocumentOnMarkupParserAndReturnsResults() { // Arrange - var factory = new SpanFactory(); var parser = new RazorParser(); + var expected = +@"RazorDocument - [0..12)::12 - [foo @bar baz] + MarkupBlock - [0..12)::12 + MarkupTextLiteral - [0..4)::4 - [foo ] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Whitespace;[ ]; + CSharpCodeBlock - [4..8)::4 + CSharpImplicitExpression - [4..8)::4 + CSharpTransition - [4..5)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [5..8)::3 + CSharpCodeBlock - [5..8)::3 + CSharpExpressionLiteral - [5..8)::3 - [bar] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[bar]; + MarkupTextLiteral - [8..12)::4 - [ baz] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + Text;[baz]; +"; // Act var syntaxTree = parser.Parse(TestRazorSourceDocument.Create("foo @bar baz")); // Assert - ParserTestBase.EvaluateResults(parser.Parse(TestRazorSourceDocument.Create("foo @bar baz")), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("bar") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhitespace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ParseMethodUsesProvidedParserListenerIfSpecified() - { - // Arrange - var factory = new SpanFactory(); - var parser = new RazorParser(); - - // Act - var results = parser.Parse(TestRazorSourceDocument.Create("foo @bar baz")); - - // Assert - ParserTestBase.EvaluateResults(results, - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("bar") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhitespace)), - factory.Markup(" baz"))); - } - - [Fact] - public void Parse_SyntaxTreeSpansAreLinked() - { - // Arrange - var factory = new SpanFactory(); - var parser = new RazorParser(); - - // Act - var results = parser.Parse(TestRazorSourceDocument.Create("foo @bar baz")); - - // Assert - var spans = results.Root.Flatten().ToArray(); - for (var i = 0; i < spans.Length - 1; i++) - { - Assert.Same(spans[i + 1], spans[i].Next); - } - - for (var i = spans.Length - 1; i > 0; i--) - { - Assert.Same(spans[i - 1], spans[i].Previous); - } + var actual = SyntaxNodeSerializer.Serialize(syntaxTree.Root); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs deleted file mode 100644 index 15b01b5d7..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; -using Xunit; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - public class SpanTest - { - [Fact] - public void ReplaceWith_ResetsLength() - { - // Arrange - var builder = new SpanBuilder(SourceLocation.Zero); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hello")); - var span = builder.Build(); - var newBuilder = new SpanBuilder(SourceLocation.Zero); - newBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hi")); - var originalLength = span.Length; - - // Act - span.ReplaceWith(newBuilder); - - // Assert - Assert.Equal(5, originalLength); - Assert.Equal(2, span.Length); - } - - // Note: This is more of an integration-like test. However, it's valuable to determine - // that the Span's ReplaceWith code is properly propogating change notifications to parents. - [Fact] - public void ReplaceWith_NotifiesParentChildHasChanged() - { - // Arrange - var spanBuilder = new SpanBuilder(SourceLocation.Zero); - spanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hello")); - var span = spanBuilder.Build(); - var blockBuilder = new BlockBuilder() - { - Type = BlockKindInternal.Markup, - }; - blockBuilder.Children.Add(span); - var block = blockBuilder.Build(); - span.Parent = block; - var originalBlockLength = block.Length; - var newSpanBuilder = new SpanBuilder(SourceLocation.Zero); - newSpanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hi")); - - // Act - span.ReplaceWith(newSpanBuilder); - - // Assert - Assert.Equal(5, originalBlockLength); - Assert.Equal(2, block.Length); - } - - [Fact] - public void Clone_ClonesSpan() - { - // Arrange - var spanBuilder = new SpanBuilder(new SourceLocation(1, 2, 3)) - { - EditHandler = new SpanEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString), - Kind = SpanKindInternal.Transition, - ChunkGenerator = new ExpressionChunkGenerator(), - }; - spanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Transition, "@")); - var span = spanBuilder.Build(); - - // Act - var copy = (Span)span.Clone(); - - // Assert - Assert.Equal(span, copy); - Assert.NotSame(span, copy); - } - } -} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperBlockTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperBlockTest.cs deleted file mode 100644 index 971e97f36..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperBlockTest.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Xunit; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - public class TagHelperBlockTest - { - [Fact] - public void Clone_ClonesTagHelperChildren() - { - // Arrange - var tagHelper = new TagHelperBlockBuilder( - "p", - TagMode.StartTagAndEndTag, - attributes: new List(), - children: new[] - { - new SpanBuilder(SourceLocation.Zero).Build(), - new SpanBuilder(new SourceLocation(0, 1, 2)).Build(), - }).Build(); - - // Act - var copy = (TagHelperBlock)tagHelper.Clone(); - - // Assert - ParserTestBase.EvaluateParseTree(copy, tagHelper); - Assert.Collection( - copy.Children, - child => Assert.NotSame(tagHelper.Children[0], child), - child => Assert.NotSame(tagHelper.Children[1], child)); - } - - [Fact] - public void Clone_ClonesTagHelperAttributes() - { - // Arrange - var tagHelper = (TagHelperBlock)new TagHelperBlockBuilder( - "p", - TagMode.StartTagAndEndTag, - attributes: new List() - { - new TagHelperAttributeNode("class", new SpanBuilder(SourceLocation.Zero).Build(), AttributeStructure.NoQuotes), - new TagHelperAttributeNode("checked", new SpanBuilder(SourceLocation.Undefined).Build(), AttributeStructure.NoQuotes) - }, - children: Enumerable.Empty()).Build(); - - // Act - var copy = (TagHelperBlock)tagHelper.Clone(); - - // Assert - ParserTestBase.EvaluateParseTree(copy, tagHelper); - Assert.Collection( - copy.Attributes, - attribute => Assert.NotSame(tagHelper.Attributes[0], attribute), - attribute => Assert.NotSame(tagHelper.Attributes[1], attribute)); - } - - [Fact] - public void Clone_ClonesTagHelperSourceStartTag() - { - // Arrange - var tagHelper = (TagHelperBlock)new TagHelperBlockBuilder( - "p", - TagMode.StartTagAndEndTag, - attributes: new List(), - children: Enumerable.Empty()) - { - SourceStartTag = new BlockBuilder() - { - Type = BlockKindInternal.Comment, - ChunkGenerator = new RazorCommentChunkGenerator() - }.Build() - }.Build(); - - // Act - var copy = (TagHelperBlock)tagHelper.Clone(); - - // Assert - ParserTestBase.EvaluateParseTree(copy, tagHelper); - Assert.NotSame(tagHelper.SourceStartTag, copy.SourceStartTag); - } - - [Fact] - public void Clone_ClonesTagHelperSourceEndTag() - { - // Arrange - var tagHelper = (TagHelperBlock)new TagHelperBlockBuilder( - "p", - TagMode.StartTagAndEndTag, - attributes: new List(), - children: Enumerable.Empty()) - { - SourceEndTag = new BlockBuilder() - { - Type = BlockKindInternal.Comment, - ChunkGenerator = new RazorCommentChunkGenerator() - }.Build() - }.Build(); - - // Act - var copy = (TagHelperBlock)tagHelper.Clone(); - - // Assert - ParserTestBase.EvaluateParseTree(copy, tagHelper); - Assert.NotSame(tagHelper.SourceEndTag, copy.SourceEndTag); - } - - [Fact] - public void FlattenFlattensSelfClosingTagHelpers() - { - // Arrange - var spanFactory = new SpanFactory(); - var blockFactory = new BlockFactory(spanFactory); - var tagHelper = (TagHelperBlock)blockFactory.TagHelperBlock( - tagName: "input", - tagMode: TagMode.SelfClosing, - start: SourceLocation.Zero, - startTag: blockFactory.MarkupTagBlock(""), - children: new SyntaxTreeNode[0], - endTag: null); - spanFactory.Reset(); - var expectedNode = spanFactory.Markup(""); - - // Act - var flattenedNodes = tagHelper.Flatten(); - - // Assert - var node = Assert.Single(flattenedNodes); - Assert.True(node.EquivalentTo(expectedNode)); - } - - [Fact] - public void FlattenFlattensStartAndEndTagTagHelpers() - { - // Arrange - var spanFactory = new SpanFactory(); - var blockFactory = new BlockFactory(spanFactory); - var tagHelper = (TagHelperBlock)blockFactory.TagHelperBlock( - tagName: "div", - tagMode: TagMode.StartTagAndEndTag, - start: SourceLocation.Zero, - startTag: blockFactory.MarkupTagBlock("
"), - children: new SyntaxTreeNode[0], - endTag: blockFactory.MarkupTagBlock("
")); - spanFactory.Reset(); - var expectedStartTag = spanFactory.Markup("
"); - var expectedEndTag = spanFactory.Markup("
"); - - // Act - var flattenedNodes = tagHelper.Flatten(); - - // Assert - Assert.Collection( - flattenedNodes, - first => - { - Assert.True(first.EquivalentTo(expectedStartTag)); - }, - second => - { - Assert.True(second.EquivalentTo(expectedEndTag)); - }); - } - - [Fact] - public void FlattenFlattensStartAndEndTagWithChildrenTagHelpers() - { - // Arrange - var spanFactory = new SpanFactory(); - var blockFactory = new BlockFactory(spanFactory); - var tagHelper = (TagHelperBlock)blockFactory.TagHelperBlock( - tagName: "div", - tagMode: TagMode.StartTagAndEndTag, - start: SourceLocation.Zero, - startTag: blockFactory.MarkupTagBlock("
"), - children: new SyntaxTreeNode[] { spanFactory.Markup("Hello World") }, - endTag: blockFactory.MarkupTagBlock("
")); - spanFactory.Reset(); - var expectedStartTag = spanFactory.Markup("
"); - var expectedChildren = spanFactory.Markup("Hello World"); - var expectedEndTag = spanFactory.Markup("
"); - - // Act - var flattenedNodes = tagHelper.Flatten(); - - // Assert - Assert.Collection( - flattenedNodes, - first => - { - Assert.True(first.EquivalentTo(expectedStartTag)); - }, - second => - { - Assert.True(second.EquivalentTo(expectedChildren)); - }, - third => - { - Assert.True(third.EquivalentTo(expectedEndTag)); - }); - } - } -} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperParseTreeRewriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperParseTreeRewriterTest.cs index 76ef95f37..6fd3c4281 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperParseTreeRewriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperParseTreeRewriterTest.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -14,12 +15,10 @@ public static TheoryData GetAttributeNameValuePairsData { get { - var factory = new SpanFactory(); - var blockFactory = new BlockFactory(factory); Func> kvp = (key, value) => new KeyValuePair(key, value); var empty = Enumerable.Empty>(); - var csharp = TagHelperParseTreeRewriter.InvalidAttributeValueMarker; + var csharp = TagHelperParseTreeRewriter.Rewriter.InvalidAttributeValueMarker; // documentContent, expectedPairs return new TheoryData>> @@ -29,13 +28,13 @@ public static TheoryData GetAttributeNameValuePairsData { "", new[] { kvp("href", csharp) } }, { "", new[] { kvp("href", $"prefix{csharp} suffix") } }, { "", new[] { kvp("href", "~/home") } }, - { "", new[] { kvp("href", "~/home"), kvp("", "") } }, + { "", new[] { kvp("href", "~/home") } }, { "", new[] { kvp("href", $"{csharp}::0"), kvp("class", "btn btn-success"), kvp("random", "") } }, { "", new[] { kvp("href", "") } }, - { " ", new[] { kvp("href", "\"> ") } }, { "(), parseResult.Options.FeatureFlags); + var parseTreeRewriter = new TagHelperParseTreeRewriter.Rewriter( + parseResult.Source, + null, + Enumerable.Empty(), + parseResult.Options.FeatureFlags, + errorSink); // Assert - Guard - var rootBlock = Assert.IsType(document); - var child = Assert.Single(rootBlock.Children); - var tagBlock = Assert.IsType(child); - Assert.Equal(BlockKindInternal.Tag, tagBlock.Type); + var rootBlock = Assert.IsType(document); + var rootMarkup = Assert.IsType(rootBlock.Document); + var childBlock = Assert.Single(rootMarkup.Children); + var tagBlock = Assert.IsType(childBlock); Assert.Empty(errorSink.Errors); // Act diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperRewritingTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperRewritingTestBase.cs index a6db68b3c..98d19a307 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperRewritingTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperRewritingTestBase.cs @@ -10,31 +10,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public class TagHelperRewritingTestBase : CsHtmlMarkupParserTestBase { internal void RunParseTreeRewriterTest(string documentContent, params string[] tagNames) - { - RunParseTreeRewriterTest(documentContent, expectedOutput: null, tagNames: tagNames); - } - - internal void RunParseTreeRewriterTest( - string documentContent, - MarkupBlock expectedOutput, - params string[] tagNames) - { - RunParseTreeRewriterTest( - documentContent, - expectedOutput, - errors: Enumerable.Empty(), - tagNames: tagNames); - } - - internal void RunParseTreeRewriterTest( - string documentContent, - MarkupBlock expectedOutput, - IEnumerable errors, - params string[] tagNames) { var descriptors = BuildDescriptors(tagNames); - EvaluateData(descriptors, documentContent, expectedOutput, errors); + EvaluateData(descriptors, documentContent); } internal IEnumerable BuildDescriptors(params string[] tagNames) @@ -58,32 +37,12 @@ internal void EvaluateData( string tagHelperPrefix = null, RazorParserFeatureFlags featureFlags = null) { - EvaluateData(descriptors, documentContent, null, Array.Empty(), tagHelperPrefix, featureFlags); - } - - internal void EvaluateData( - IEnumerable descriptors, - string documentContent, - MarkupBlock expectedOutput, - IEnumerable expectedErrors, - string tagHelperPrefix = null, - RazorParserFeatureFlags featureFlags = null) - { - var syntaxTree = ParseDocument(documentContent); + var syntaxTree = ParseDocument(documentContent, featureFlags: featureFlags); var errorSink = new ErrorSink(); - var parseTreeRewriter = new TagHelperParseTreeRewriter( - tagHelperPrefix, - descriptors, - featureFlags ?? syntaxTree.Options.FeatureFlags); - - var actualTree = parseTreeRewriter.Rewrite(syntaxTree.Root, errorSink); - var allErrors = syntaxTree.Diagnostics.Concat(errorSink.Errors); - var actualErrors = allErrors - .OrderBy(error => error.Span.AbsoluteIndex) - .ToList(); + var rewrittenTree = TagHelperParseTreeRewriter.Rewrite(syntaxTree, tagHelperPrefix, descriptors); - BaselineTest(actualTree, filePath: null, verifySyntaxTree: false, actualErrors.ToArray()); + BaselineTest(rewrittenTree, verifySyntaxTree: false); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs index 7776b5f53..655a88d14 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs @@ -208,16 +208,6 @@ internal TestTokenizerBackedParser(LanguageCharacteristics langua { } - public override void ParseBlock() - { - throw new NotImplementedException(); - } - - protected override bool TokenKindEquals(SyntaxKind x, SyntaxKind y) - { - throw new NotImplementedException(); - } - internal new bool LookaheadUntil(Func, bool> condition) { return base.LookaheadUntil(condition); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/WhiteSpaceRewriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/WhiteSpaceRewriterTest.cs index 856172a10..f8c2c34b4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/WhiteSpaceRewriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/WhiteSpaceRewriterTest.cs @@ -12,18 +12,26 @@ public class WhiteSpaceRewriterTest : CsHtmlMarkupParserTestBase public void Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block() { // Arrange + var content = @" +
+ @result +
+
+ @(result) +
"; var parsed = ParseDocument( RazorLanguageVersion.Latest, - "test @foo test", + content, Array.Empty()); - var rewriter = new WhiteSpaceRewriter(); + var rewriter = new WhitespaceRewriter(); // Act - var rewritten = rewriter.Rewrite(parsed.Root); + var rewritten = rewriter.Visit(parsed.Root); // Assert - BaselineTest(parsed); + var rewrittenTree = RazorSyntaxTree.Create(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); + BaselineTest(rewrittenTree); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/RazorSyntaxTreeTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/RazorSyntaxTreeTest.cs index 09b36651c..dde505ab0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/RazorSyntaxTreeTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/RazorSyntaxTreeTest.cs @@ -1,9 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language.Legacy; +using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Test @@ -25,7 +24,7 @@ public void Parse_CanParseEmptyDocument() } [Fact] - public void Parse_Persists_FilePath() + public void Parse_NodesReturnCorrectFilePath() { // Arrange var filePath = "test.cshtml"; @@ -38,24 +37,8 @@ public void Parse_Persists_FilePath() Assert.Empty(syntaxTree.Diagnostics); Assert.NotNull(syntaxTree); - var spans = new List(); - GetChildren(syntaxTree.Root); - Assert.All(spans, node => Assert.Equal(filePath, node.Start.FilePath)); - - void GetChildren(SyntaxTreeNode node) - { - if (node is Block block) - { - foreach (var child in block.Children) - { - GetChildren(child); - } - } - else - { - spans.Add(node); - } - } + var children = syntaxTree.Root.DescendantNodes(); + Assert.All(children, node => Assert.Equal(filePath, node.GetSourceLocation(source).FilePath)); } [Fact] @@ -69,10 +52,11 @@ public void Parse_UseDirectiveTokenizer_ParsesUntilFirstDirective() var syntaxTree = RazorSyntaxTree.Parse(source, options); // Assert + var root = syntaxTree.Root; Assert.NotNull(syntaxTree); - Assert.Equal(6, syntaxTree.Root.Children.Count); - var block = Assert.IsType(syntaxTree.Root.Children[4]); - Assert.Equal(BlockKindInternal.Directive, block.Type); + Assert.Equal(61, root.EndPosition); + Assert.Single(root.DescendantNodes().Where(n => n is RazorDirectiveBodySyntax body && body.Keyword.GetContent() == "tagHelperPrefix")); + Assert.Empty(root.DescendantNodes().Where(n => n is MarkupTagBlockSyntax)); Assert.Empty(syntaxTree.Diagnostics); } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs index d569974b6..2d829be38 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs @@ -101,19 +101,19 @@ public void GetEditedContent_ForReplace_ReturnsNewContent() } [Fact] - public void GetEditedContent_Span_ReturnsNewContent() + public void GetEditedContent_SyntaxNode_ReturnsNewContent() { // Arrange - var builder = new SpanBuilder(new SourceLocation(0, 0, 0)); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); + var builder = SyntaxListBuilder.Create(); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "Hello, ")); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "World")); - var span = new Span(builder); + var node = SyntaxFactory.MarkupTextLiteral(builder.ToList()).CreateRed(); var change = new SourceChange(2, 2, "heyo"); // Act - var result = change.GetEditedContent(span); + var result = change.GetEditedContent(node); // Act Assert.Equal("Heheyoo, World", result); @@ -123,16 +123,16 @@ public void GetEditedContent_Span_ReturnsNewContent() public void GetOffSet_SpanIsOwner_ReturnsOffset() { // Arrange - var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); + var builder = SyntaxListBuilder.Create(); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "Hello, ")); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "World")); - var span = new Span(builder); + var node = SyntaxFactory.MarkupTextLiteral(builder.ToList()).CreateRed(null, 13); var change = new SourceChange(15, 2, "heyo"); // Act - var result = change.GetOffset(span); + var result = change.GetOffset(node); // Act Assert.Equal(2, result); @@ -142,18 +142,18 @@ public void GetOffSet_SpanIsOwner_ReturnsOffset() public void GetOffSet_SpanIsNotOwnerOfChange_ThrowsException() { // Arrange - var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); + var builder = SyntaxListBuilder.Create(); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "Hello, ")); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "World")); - var span = new Span(builder); + var node = SyntaxFactory.MarkupTextLiteral(builder.ToList()).CreateRed(null, 13); var change = new SourceChange(12, 2, "heyo"); - var expected = $"The node '{span}' is not the owner of change '{change}'."; + var expected = $"The node '{node}' is not the owner of change '{change}'."; // Act & Assert - var exception = Assert.Throws(() => { change.GetOffset(span); }); + var exception = Assert.Throws(() => { change.GetOffset(node); }); Assert.Equal(expected, exception.Message); } @@ -161,16 +161,16 @@ public void GetOffSet_SpanIsNotOwnerOfChange_ThrowsException() public void GetOrigninalText_SpanIsOwner_ReturnsContent() { // Arrange - var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); + var builder = SyntaxListBuilder.Create(); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "Hello, ")); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "World")); - var span = new Span(builder); + var node = SyntaxFactory.MarkupTextLiteral(builder.ToList()).CreateRed(null, 13); var change = new SourceChange(15, 2, "heyo"); // Act - var result = change.GetOriginalText(span); + var result = change.GetOriginalText(node); // Act Assert.Equal("ll", result); @@ -180,16 +180,16 @@ public void GetOrigninalText_SpanIsOwner_ReturnsContent() public void GetOrigninalText_SpanIsOwner_ReturnsContent_ZeroLengthSpan() { // Arrange - var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); - builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); + var builder = SyntaxListBuilder.Create(); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "Hello, ")); + builder.Add(SyntaxFactory.Token(SyntaxKind.Marker, "World")); - var span = new Span(builder); + var node = SyntaxFactory.MarkupTextLiteral(builder.ToList()).CreateRed(null, 13); var change = new SourceChange(15, 0, "heyo"); // Act - var result = change.GetOriginalText(span); + var result = change.GetOriginalText(node); // Act Assert.Equal(string.Empty, result); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TagHelperParseTreeRewriterTests.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TagHelperParseTreeRewriterTests.cs deleted file mode 100644 index a24a9c8d4..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TagHelperParseTreeRewriterTests.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Xunit; - -namespace Microsoft.AspNetCore.Razor.Language.Test -{ - public class TagHelperParseTreeRewriterTests - { - public void IsComment_ReturnsTrueForSpanInHtmlCommentBlock() - { - // Arrange - SpanFactory spanFactory = new SpanFactory(); - - Span content = spanFactory.Markup(""); - Block commentBlock = new HtmlCommentBlock(content); - - // Act - bool actualResult = TagHelperParseTreeRewriter.IsComment(content); - - // Assert - Assert.True(actualResult); - } - } -} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt index 2d4242e8c..2d86df357 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt @@ -6,7 +6,7 @@ Document - MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [4] FunctionsBlockMinimal.cshtml) IntermediateToken - (0:0,0 [4] FunctionsBlockMinimal.cshtml) - Html - \n\n - CSharpCode - (4:2,0 [1] FunctionsBlockMinimal.cshtml) - IntermediateToken - (4:2,0 [1] FunctionsBlockMinimal.cshtml) - CSharp - + CSharpCode - (4:2,0 [1] FunctionsBlockMinimal.cshtml) + IntermediateToken - (4:2,0 [1] FunctionsBlockMinimal.cshtml) - CSharp - CSharpCode - (16:2,12 [55] FunctionsBlockMinimal.cshtml) IntermediateToken - (16:2,12 [55] FunctionsBlockMinimal.cshtml) - CSharp - \nstring foo(string input) {\n return input + "!";\n}\n diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.ir.txt index 2ada0a986..8f89ff3a4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.ir.txt @@ -69,7 +69,7 @@ Document - DefaultTagHelperProperty - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) - type - string TestNamespace.InputTagHelper2.Type - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) IntermediateToken - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) - Html - password - DefaultTagHelperHtmlAttribute - - data-content - HtmlAttributeValueStyle.NoQuotes + DefaultTagHelperHtmlAttribute - - data-content - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (270:14,31 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) IntermediateToken - (270:14,31 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) - Html - blah DefaultTagHelperExecute - diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs index b975f6f6e..9a0be1c8e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs @@ -13,7 +13,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpers private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("hello"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("hello2"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "password", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("blah"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("blah"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden #pragma warning disable 0169 private string __tagHelperStringValueBuffer; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.ir.txt index e6920b306..b89b1ddb2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.ir.txt @@ -8,7 +8,7 @@ Document - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - data-content - hello - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_3 - data-content - hello2 - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_4 - type - password - HtmlAttributeValueStyle.DoubleQuotes - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_5 - data-content - blah - HtmlAttributeValueStyle.NoQuotes + PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_5 - data-content - blah - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtEOF.stree.txt index 96c1e627c..b8015bc06 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtEOF.stree.txt @@ -1,9 +1,15 @@ -Directive block - Gen - 11 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[functions]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (10:0,10) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (11:0,11) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..11)::11 - [@functions{] + RazorDirective - [0..11)::11 - Directive:{functions;CodeBlock;Unrestricted} [RZ1006(10:0,10 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..11)::10 + RazorMetaCode - [1..10)::9 - Gen - SpanEditHandler;Accepts:None + Identifier;[functions]; + CSharpCodeBlock - [10..11)::1 + RazorMetaCode - [10..11)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + CSharpCodeBlock - [11..11)::0 + CSharpStatementLiteral - [11..11)::0 - [] - Gen - CodeBlockEditHandler;Accepts:Any;CodeBlock + Marker;[]; + RazorMetaCode - [11..11)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtStartOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtStartOfFile.stree.txt index 62f1357ad..e6bcdf142 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtStartOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtStartOfFile.stree.txt @@ -1,10 +1,16 @@ -Directive block - Gen - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[functions]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (10:0,10) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [LFfoo] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (11:0,11) - Tokens:2 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[foo]; +CSharpCodeBlock - [0..16)::16 - [@functions{LFfoo] + RazorDirective - [0..16)::16 - Directive:{functions;CodeBlock;Unrestricted} [RZ1006(10:0,10 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..16)::15 + RazorMetaCode - [1..10)::9 - Gen - SpanEditHandler;Accepts:None + Identifier;[functions]; + CSharpCodeBlock - [10..16)::6 + RazorMetaCode - [10..11)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + CSharpCodeBlock - [11..16)::5 + CSharpStatementLiteral - [11..16)::5 - [LFfoo] - Gen - CodeBlockEditHandler;Accepts:Any;CodeBlock + NewLine;[LF]; + Identifier;[foo]; + RazorMetaCode - [16..16)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt index 1a861c9f1..c3e53c2bf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt @@ -1,16 +1,21 @@ -Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[Header]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (16:0,16) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 0 - (17:0,17) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..17)::17 - [@section Header {] + RazorDirective - [0..17)::17 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(16:0,16 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..17)::16 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..17)::9 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..15)::6 - [Header] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[Header]; + MarkupTextLiteral - [15..16)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [16..17)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [17..17)::0 + MarkupTextLiteral - [17..17)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [17..17)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt index 71141a41b..ae4c4c319 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt @@ -1,29 +1,34 @@ -Directive block - Gen - 29 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[Header]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (16:0,16) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 12 - (17:0,17) - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Tag block - Gen - 3 - (19:1,0) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (25:1,6) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; +CSharpCodeBlock - [0..29)::29 - [@section Header {LF

Foo

] + RazorDirective - [0..29)::29 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(16:0,16 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..29)::28 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..29)::21 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..15)::6 - [Header] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[Header]; + MarkupTextLiteral - [15..16)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [16..17)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [17..29)::12 + MarkupTextLiteral - [17..19)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTagBlock - [19..22)::3 - [

] + MarkupTextLiteral - [19..22)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [22..25)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [25..29)::4 - [

] + MarkupTextLiteral - [25..29)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + RazorMetaCode - [29..29)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtEOF.stree.txt index b2da8414a..b3c2a2753 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtEOF.stree.txt @@ -1,7 +1,12 @@ -Statement block - Gen - 2 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (2:0,2) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..2)::2 - [@{] + CSharpStatement - [0..2)::2 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementBody - [1..2)::1 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [2..2)::0 + CSharpStatementLiteral - [2..2)::0 - [] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL + Marker;[]; + RazorMetaCode - [2..2)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtStartOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtStartOfFile.stree.txt index 928cc26ae..85fa027b2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtStartOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtStartOfFile.stree.txt @@ -1,21 +1,26 @@ -Statement block - Gen - 11 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [LF] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (2:0,2) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup block - Gen - 7 - (4:1,0) - Tag block - Gen - 3 - (4:1,0) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:None - (7:1,3) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (11:1,7) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..11)::11 - [@{LF

] + CSharpStatement - [0..11)::11 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementBody - [1..11)::10 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [2..11)::9 + CSharpStatementLiteral - [2..4)::2 - [LF] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL + NewLine;[LF]; + MarkupBlock - [4..11)::7 + MarkupTagBlock - [4..7)::3 - [

] + MarkupTextLiteral - [4..7)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTagBlock - [7..11)::4 - [

] + MarkupTextLiteral - [7..11)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + CSharpStatementLiteral - [11..11)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [11..11)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsElseIfWithNoCondition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsElseIfWithNoCondition.stree.txt index 868839ebf..4342976bf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsElseIfWithNoCondition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsElseIfWithNoCondition.stree.txt @@ -1,60 +1,62 @@ -Statement block - Gen - 106 - (0:0,0) - Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if { foo(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:58 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..106)::106 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if { foo(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..106)::106 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if { foo(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt index da0e4e568..a4c126252 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt @@ -1,18 +1,23 @@ -Statement block - Gen - 17 - (0:0,0) - Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 5 - (10:0,10) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:0,10) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (11:0,11) - Tokens:2 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..17)::17 - [if(foo) { @foo. }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..10)::10 - [if(foo) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [10..15)::5 + CSharpImplicitExpression - [10..15)::5 + CSharpTransition - [10..11)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [11..15)::4 + CSharpCodeBlock - [11..15)::4 + CSharpExpressionLiteral - [11..15)::4 - [foo.] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 + Identifier;[foo]; + Dot;[.]; + CSharpStatementLiteral - [15..17)::2 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AllowsEmptyBlockStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AllowsEmptyBlockStatement.stree.txt index e52cb3277..3d1e8ad34 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AllowsEmptyBlockStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AllowsEmptyBlockStatement.stree.txt @@ -1,10 +1,12 @@ -Statement block - Gen - 13 - (0:0,0) - Code span - Gen - [if(false) { }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:8 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..13)::13 - [if(false) { }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..13)::13 - [if(false) { }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[false]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBrackets.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBrackets.stree.txt index 6fa6c5ed3..a7c7c7baf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBrackets.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBrackets.stree.txt @@ -1,19 +1,21 @@ -Statement block - Gen - 47 - (0:0,0) - Code span - Gen - [if(foo) {LF // bar } " baz 'LF zoop();LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:17 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[// bar } " baz ']; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[zoop]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..47)::47 - [if(foo) {LF // bar } " baz 'LF zoop();LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..47)::47 - [if(foo) {LF // bar } " baz 'LF zoop();LF}] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + CSharpComment;[// bar } " baz ']; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[zoop]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideBlockComments.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideBlockComments.stree.txt index 7d34a8138..435942c4e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideBlockComments.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideBlockComments.stree.txt @@ -1,21 +1,23 @@ -Statement block - Gen - 54 - (0:0,0) - Code span - Gen - [if(foo) {LF /* bar } " */ ' baz } 'LF zoop();LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:19 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* bar } " */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CharacterLiteral;[' baz } ']; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[zoop]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..54)::54 - [if(foo) {LF /* bar } " */ ' baz } 'LF zoop();LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..54)::54 - [if(foo) {LF /* bar } " */ ' baz } 'LF zoop();LF}] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + CSharpComment;[/* bar } " */]; + Whitespace;[ ]; + CharacterLiteral;[' baz } ']; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[zoop]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt index 6b754ce0a..ce48e1b53 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt @@ -1,6 +1,10 @@ -Directive block - Gen - 11 - (0:0,0) - Code span - Gen - [using FooLF] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:4 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..11)::11 - [using FooLF] + RazorDirective - [0..11)::11 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + RazorDirectiveBody - [0..11)::11 + CSharpStatementLiteral - [0..11)::11 - [using FooLF] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Identifier;[Foo]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlock.stree.txt index ead956f33..5b1868483 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlock.stree.txt @@ -1,26 +1,28 @@ -Statement block - Gen - 40 - (0:0,0) - Code span - Gen - [do { var foo = bar; } while(foo != bar);] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:24 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..40)::40 - [do { var foo = bar; } while(foo != bar);] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..40)::40 - [do { var foo = bar; } while(foo != bar);] - Gen - SpanEditHandler;Accepts:None + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[while]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Identifier;[bar]; + RightParenthesis;[)]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingSemicolon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingSemicolon.stree.txt index e7b6d30e0..454ba645d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingSemicolon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingSemicolon.stree.txt @@ -1,25 +1,27 @@ -Statement block - Gen - 39 - (0:0,0) - Code span - Gen - [do { var foo = bar; } while(foo != bar)] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:23 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..39)::39 - [do { var foo = bar; } while(foo != bar)] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..39)::39 - [do { var foo = bar; } while(foo != bar)] - Gen - SpanEditHandler;Accepts:Any + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[while]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Identifier;[bar]; + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely.stree.txt index 45a35ab1d..9c1ddef84 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely.stree.txt @@ -1,16 +1,18 @@ -Statement block - Gen - 21 - (0:0,0) - Code span - Gen - [do { var foo = bar; }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..21)::21 - [do { var foo = bar; }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..21)::21 - [do { var foo = bar; }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileCondition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileCondition.stree.txt index acc83fbd9..3aa59c8da 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileCondition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileCondition.stree.txt @@ -1,18 +1,20 @@ -Statement block - Gen - 27 - (0:0,0) - Code span - Gen - [do { var foo = bar; } while] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:16 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; +CSharpCodeBlock - [0..27)::27 - [do { var foo = bar; } while] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..27)::27 - [do { var foo = bar; } while] - Gen - SpanEditHandler;Accepts:Any + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[while]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon.stree.txt index 84dbbd25a..3e8f224bd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon.stree.txt @@ -1,19 +1,21 @@ -Statement block - Gen - 28 - (0:0,0) - Code span - Gen - [do { var foo = bar; } while;] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:17 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..28)::28 - [do { var foo = bar; } while;] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..28)::28 - [do { var foo = bar; } while;] - Gen - SpanEditHandler;Accepts:None + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[while]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesMarkupInDoWhileBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesMarkupInDoWhileBlock.stree.txt index ea31ba710..8cfa9e2ee 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesMarkupInDoWhileBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesMarkupInDoWhileBlock.stree.txt @@ -1,50 +1,50 @@ -Statement block - Gen - 58 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [do { var foo = bar;] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:12 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - Markup block - Gen - 12 - (20:0,20) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (21:0,21) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo++; } while (foo);] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:15 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Increment;[++]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..58)::58 - [@do { var foo = bar;

Foo

foo++; } while (foo);] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..20)::19 - [do { var foo = bar;] - Gen - SpanEditHandler;Accepts:Any + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + MarkupBlock - [20..32)::12 + MarkupTextLiteral - [20..21)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [21..24)::3 - [

] + MarkupTextLiteral - [21..24)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [24..27)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [27..31)::4 - [

] + MarkupTextLiteral - [27..31)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [31..32)::1 - [ ] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + CSharpStatementLiteral - [32..58)::26 - [foo++; } while (foo);] - Gen - SpanEditHandler;Accepts:None + Identifier;[foo]; + Increment;[++]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[while]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[foo]; + LessThan;[<]; + Identifier;[bar]; + GreaterThan;[>]; + RightParenthesis;[)]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotAllowMultipleFinallyBlocks.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotAllowMultipleFinallyBlocks.stree.txt index 8ae4de426..cb95bfbf5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotAllowMultipleFinallyBlocks.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotAllowMultipleFinallyBlocks.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 55 - (0:0,0) - Code span - Gen - [try { var foo = new { } } finally { var foo = new { } }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..55)::55 - [try { var foo = new { } } finally { var foo = new { } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..55)::55 - [try { var foo = new { } } finally { var foo = new { } }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon.stree.txt index a2187f435..511ac5e90 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon.stree.txt @@ -1,17 +1,19 @@ -Statement block - Gen - 30 - (0:0,0) - Code span - Gen - [if(foo) { @"Foo".ToString(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:15 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;[@"Foo"]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ToString]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..30)::30 - [if(foo) { @"Foo".ToString(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..30)::30 - [if(foo) { @"Foo".ToString(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + StringLiteral;[@"Foo"]; + Dot;[.]; + Identifier;[ToString]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesntCaptureWhitespaceAfterUsing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesntCaptureWhitespaceAfterUsing.stree.txt index 955f9551a..bcea8cb11 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesntCaptureWhitespaceAfterUsing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesntCaptureWhitespaceAfterUsing.stree.txt @@ -1,5 +1,9 @@ -Directive block - Gen - 9 - (0:0,0) - Code span - Gen - [using Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:3 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; +CSharpCodeBlock - [0..9)::9 - [using Foo] + RazorDirective - [0..9)::9 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + RazorDirectiveBody - [0..9)::9 + CSharpStatementLiteral - [0..9)::9 - [using Foo] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Identifier;[Foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceAliasMissingSemicolon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceAliasMissingSemicolon.stree.txt index d2ea23142..d118c30b2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceAliasMissingSemicolon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceAliasMissingSemicolon.stree.txt @@ -1,13 +1,17 @@ -Directive block - Gen - 29 - (0:0,0) - Code span - Gen - [using Foo.Bar.Baz = FooBarBaz] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:11 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[FooBarBaz]; +CSharpCodeBlock - [0..29)::29 - [using Foo.Bar.Baz = FooBarBaz] + RazorDirective - [0..29)::29 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + RazorDirectiveBody - [0..29)::29 + CSharpStatementLiteral - [0..29)::29 - [using Foo.Bar.Baz = FooBarBaz] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Identifier;[Foo]; + Dot;[.]; + Identifier;[Bar]; + Dot;[.]; + Identifier;[Baz]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[FooBarBaz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceImportMissingSemicolon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceImportMissingSemicolon.stree.txt index 92f8d6a42..2218ed9ac 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceImportMissingSemicolon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceImportMissingSemicolon.stree.txt @@ -1,9 +1,13 @@ -Directive block - Gen - 17 - (0:0,0) - Code span - Gen - [using Foo.Bar.Baz] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:7 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Baz]; +CSharpCodeBlock - [0..17)::17 - [using Foo.Bar.Baz] + RazorDirective - [0..17)::17 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + RazorDirectiveBody - [0..17)::17 + CSharpStatementLiteral - [0..17)::17 - [using Foo.Bar.Baz] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Identifier;[Foo]; + Dot;[.]; + Identifier;[Bar]; + Dot;[.]; + Identifier;[Baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithAtDoesntCauseError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithAtDoesntCauseError.stree.txt index 88eb4a444..b46729f16 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithAtDoesntCauseError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithAtDoesntCauseError.stree.txt @@ -1,25 +1,27 @@ -Statement block - Gen - 28 - (0:0,0) - Code span - Gen - [if (true) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:8 - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Statement block - Gen - 14 - (12:0,12) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [if(false) { }] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:8 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..28)::28 - [if (true) { @if(false) { } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..12)::12 - [if (true) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [12..26)::14 + CSharpTransition - [12..13)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [13..26)::13 - [if(false) { }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[false]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + CSharpStatementLiteral - [26..28)::2 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithCSharpAt.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithCSharpAt.stree.txt index 4d2b18266..f4b22b072 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithCSharpAt.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithCSharpAt.stree.txt @@ -1,41 +1,46 @@ -Statement block - Gen - 49 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [ if (true) { var val = @x; if (val != 3) { } } ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:35 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[val]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Transition;[@]; - SyntaxKind.Identifier;[x]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[val]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[3]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (48:0,48) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..49)::49 - [{ if (true) { var val = @x; if (val != 3) { } } }] + CSharpStatement - [0..49)::49 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..49)::49 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..48)::47 + CSharpStatementLiteral - [1..48)::47 - [ if (true) { var val = @x; if (val != 3) { } } ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + Whitespace;[ ]; + Keyword;[if]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[val]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Transition;[@]; + Identifier;[x]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[val]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + IntegerLiteral;[3]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorMetaCode - [48..49)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt index faaeb88e7..93ac739d1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt @@ -1,50 +1,55 @@ -Statement block - Gen - 51 - (0:0,0) - Code span - Gen - [if (true) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:8 - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Statement block - Gen - 37 - (12:0,12) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [if(false) {] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:6 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 24 - (24:0,24) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 5 - (25:0,25) - Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:3 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.Text;[div]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:1 - SyntaxKind.Unknown;[]; - Expression block - Gen - 10 - (30:0,30) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [something] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (31:0,31) - Tokens:1 - SyntaxKind.Identifier;[something]; - Markup span - Gen - [.] - SpanEditHandler;Accepts:Any - (40:0,40) - Tokens:1 - SyntaxKind.Text;[.]; - Tag block - Gen - 6 - (41:0,41) - Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (41:0,41) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[div]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (47:0,47) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (48:0,48) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (49:0,49) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..51)::51 - [if (true) { @if(false) {
@something.
} }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..12)::12 - [if (true) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [12..49)::37 + CSharpTransition - [12..13)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [13..24)::11 - [if(false) {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[false]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + MarkupBlock - [24..48)::24 + MarkupTextLiteral - [24..25)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [25..30)::5 - [
] + MarkupTextLiteral - [25..30)::5 - [
] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[div]; + CloseAngle;[>]; + MarkupTextLiteral - [30..30)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [30..40)::10 + CSharpImplicitExpression - [30..40)::10 + CSharpTransition - [30..31)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [31..40)::9 + CSharpCodeBlock - [31..40)::9 + CSharpExpressionLiteral - [31..40)::9 - [something] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[something]; + MarkupTextLiteral - [40..41)::1 - [.] - Gen - SpanEditHandler;Accepts:Any + Text;[.]; + MarkupTagBlock - [41..47)::6 - [
] + MarkupTextLiteral - [41..47)::6 - [
] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[div]; + CloseAngle;[>]; + MarkupTextLiteral - [47..48)::1 - [ ] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + CSharpStatementLiteral - [48..49)::1 - [}] - Gen - SpanEditHandler;Accepts:Any + RightBrace;[}]; + CSharpStatementLiteral - [49..51)::2 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt index a8cf93351..e37aa10fd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt @@ -1,179 +1,194 @@ -Statement block - Gen - 351 - (0:0,0) - Code span - Gen - [foreach(var c in db.Categories) {LF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:15 - SyntaxKind.Keyword;[foreach]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[c]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[in]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[db]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Categories]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - Markup block - Gen - 307 - (35:1,0) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (35:1,0) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 5 - (47:1,12) - Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (47:1,12) - Tokens:3 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.Text;[div]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (52:1,17) - Tokens:2 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 4 - (70:2,16) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:None - (81:2,27) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[h1]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (86:2,32) - Tokens:2 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 4 - (104:3,16) - Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (315:7,16) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[ul]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (320:7,21) - Tokens:2 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 6 - (334:8,12) - Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (334:8,12) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[div]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (340:8,18) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:None - (342:9,0) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..351)::351 - [foreach(var c in db.Categories) {LF
LF

@c.Name

LF
    LF @foreach(var p in c.Products) {LF
  • @p.Name
  • LF }LF
LF
LF }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..35)::35 - [foreach(var c in db.Categories) {LF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[foreach]; + LeftParenthesis;[(]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[c]; + Whitespace;[ ]; + Keyword;[in]; + Whitespace;[ ]; + Identifier;[db]; + Dot;[.]; + Identifier;[Categories]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + MarkupBlock - [35..342)::307 + MarkupTextLiteral - [35..47)::12 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [47..52)::5 - [
] + MarkupTextLiteral - [47..52)::5 - [
] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[div]; + CloseAngle;[>]; + MarkupTextLiteral - [52..70)::18 - [LF ] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + Whitespace;[ ]; + MarkupTagBlock - [70..74)::4 - [

] + MarkupTextLiteral - [70..74)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[h1]; + CloseAngle;[>]; + MarkupTextLiteral - [74..74)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [74..81)::7 + CSharpImplicitExpression - [74..81)::7 + CSharpTransition - [74..75)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [75..81)::6 + CSharpCodeBlock - [75..81)::6 + CSharpExpressionLiteral - [75..81)::6 - [c.Name] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[c]; + Dot;[.]; + Identifier;[Name]; + MarkupTagBlock - [81..86)::5 - [

] + MarkupTextLiteral - [81..86)::5 - [] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[h1]; + CloseAngle;[>]; + MarkupTextLiteral - [86..104)::18 - [LF ] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + Whitespace;[ ]; + MarkupTagBlock - [104..108)::4 - [] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[ul]; + CloseAngle;[>]; + MarkupTextLiteral - [320..334)::14 - [LF ] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + Whitespace;[ ]; + MarkupTagBlock - [334..340)::6 - [
] + MarkupTextLiteral - [334..340)::6 - [
] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[div]; + CloseAngle;[>]; + MarkupTextLiteral - [340..342)::2 - [LF] - Gen - SpanEditHandler;Accepts:None + NewLine;[LF]; + CSharpStatementLiteral - [342..351)::9 - [ }] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesElseIfBranchesOfIfStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesElseIfBranchesOfIfStatement.stree.txt index c86d52c61..874dd8d64 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesElseIfBranchesOfIfStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesElseIfBranchesOfIfStatement.stree.txt @@ -1,95 +1,97 @@ -Statement block - Gen - 180 - (0:0,0) - Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:93 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..180)::180 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..180)::180 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF}] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt index 7e1f4a485..ec306314d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt @@ -1,24 +1,29 @@ -Statement block - Gen - 25 - (0:0,0) - Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 13 - (10:0,10) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:0,10) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo[4].bar()] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (11:0,11) - Tokens:8 - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.IntegerLiteral;[4]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..25)::25 - [if(foo) { @foo[4].bar() }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..10)::10 - [if(foo) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [10..23)::13 + CSharpImplicitExpression - [10..23)::13 + CSharpTransition - [10..11)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [11..23)::12 + CSharpCodeBlock - [11..23)::12 + CSharpExpressionLiteral - [11..23)::12 - [foo[4].bar()] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 + Identifier;[foo]; + LeftBracket;[[]; + IntegerLiteral;[4]; + RightBracket;[]]; + Dot;[.]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + CSharpStatementLiteral - [23..25)::2 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByOpenParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByOpenParen.stree.txt index 1bfc6b33f..7a4de524b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByOpenParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByOpenParen.stree.txt @@ -1,25 +1,30 @@ -Statement block - Gen - 24 - (0:0,0) - Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 12 - (10:0,10) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:0,10) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (11:0,11) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [foo + bar] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:5 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Plus;[+]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..24)::24 - [if(foo) { @(foo + bar) }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..10)::10 - [if(foo) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [10..22)::12 + CSharpExplicitExpression - [10..22)::12 + CSharpTransition - [10..11)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [11..22)::11 + RazorMetaCode - [11..12)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [12..21)::9 + CSharpExpressionLiteral - [12..21)::9 - [foo + bar] - Gen - SpanEditHandler;Accepts:Any + Identifier;[foo]; + Whitespace;[ ]; + Plus;[+]; + Whitespace;[ ]; + Identifier;[bar]; + RazorMetaCode - [21..22)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; + CSharpStatementLiteral - [22..24)::2 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatement.stree.txt index cb4f3cd09..752dcb297 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatement.stree.txt @@ -1,239 +1,241 @@ -Statement block - Gen - 459 - (0:0,0) - Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:237 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..459)::459 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..459)::459 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF}] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch.stree.txt index 62a654f7b..7fb831fef 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch.stree.txt @@ -1,157 +1,159 @@ -Statement block - Gen - 313 - (0:0,0) - Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else { Debug.WriteLine(@"bar } baz"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:155 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..313)::313 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else { Debug.WriteLine(@"bar } baz"); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..313)::313 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else { Debug.WriteLine(@"bar } baz"); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt index c6cb9e90a..103ef0ce0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt @@ -1,10 +1,14 @@ -Directive block - Gen - 28 - (0:0,0) - Code span - Gen - [using FooBarBaz = FooBarBaz;] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:8 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[FooBarBaz]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[FooBarBaz]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..28)::28 - [using FooBarBaz = FooBarBaz;] + RazorDirective - [0..28)::28 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + RazorDirectiveBody - [0..28)::28 + CSharpStatementLiteral - [0..28)::28 - [using FooBarBaz = FooBarBaz;] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Identifier;[FooBarBaz]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[FooBarBaz]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt index 5fa73eb8f..1884354be 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt @@ -1,10 +1,14 @@ -Directive block - Gen - 18 - (0:0,0) - Code span - Gen - [using Foo.Bar.Baz;] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:8 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..18)::18 - [using Foo.Bar.Baz;] + RazorDirective - [0..18)::18 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + RazorDirectiveBody - [0..18)::18 + CSharpStatementLiteral - [0..18)::18 - [using Foo.Bar.Baz;] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Identifier;[Foo]; + Dot;[.]; + Identifier;[Bar]; + Dot;[.]; + Identifier;[Baz]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword.stree.txt index 9bd2fe906..5e4de1333 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword.stree.txt @@ -1,46 +1,48 @@ -Statement block - Gen - 82 - (0:0,0) - Code span - Gen - [for(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - SyntaxKind.Keyword;[for]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..82)::82 - [for(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..82)::82 - [for(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[for]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword.stree.txt index a6ba84a76..7bed8c30f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword.stree.txt @@ -1,46 +1,48 @@ -Statement block - Gen - 86 - (0:0,0) - Code span - Gen - [foreach(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - SyntaxKind.Keyword;[foreach]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..86)::86 - [foreach(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..86)::86 - [foreach(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[foreach]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches.stree.txt index 712f8110b..f7f1f67c9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches.stree.txt @@ -1,46 +1,48 @@ -Statement block - Gen - 81 - (0:0,0) - Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:44 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..81)::81 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..81)::81 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword.stree.txt index 23b29665e..46890c793 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword.stree.txt @@ -1,54 +1,56 @@ -Statement block - Gen - 161 - (0:0,0) - Code span - Gen - [switch(foo) {LF case 0:LF break;LF case 1:LF {LF break;LF }LF case 2:LF return;LF default:LF return;LF}] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:52 - SyntaxKind.Keyword;[switch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[case]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Colon;[:]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[break]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[case]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[1]; - SyntaxKind.Colon;[:]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[break]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[case]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[2]; - SyntaxKind.Colon;[:]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[return]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[default]; - SyntaxKind.Colon;[:]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[return]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..161)::161 - [switch(foo) {LF case 0:LF break;LF case 1:LF {LF break;LF }LF case 2:LF return;LF default:LF return;LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..161)::161 - [switch(foo) {LF case 0:LF break;LF case 1:LF {LF break;LF }LF case 2:LF return;LF default:LF return;LF}] - Gen - SpanEditHandler;Accepts:None + Keyword;[switch]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Keyword;[case]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Colon;[:]; + NewLine;[LF]; + Whitespace;[ ]; + Keyword;[break]; + Semicolon;[;]; + NewLine;[LF]; + Whitespace;[ ]; + Keyword;[case]; + Whitespace;[ ]; + IntegerLiteral;[1]; + Colon;[:]; + NewLine;[LF]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Keyword;[break]; + Semicolon;[;]; + NewLine;[LF]; + Whitespace;[ ]; + RightBrace;[}]; + NewLine;[LF]; + Whitespace;[ ]; + Keyword;[case]; + Whitespace;[ ]; + IntegerLiteral;[2]; + Colon;[:]; + NewLine;[LF]; + Whitespace;[ ]; + Keyword;[return]; + Semicolon;[;]; + NewLine;[LF]; + Whitespace;[ ]; + Keyword;[default]; + Colon;[:]; + NewLine;[LF]; + Whitespace;[ ]; + Keyword;[return]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword.stree.txt index 8867fa66f..2bb6e1023 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword.stree.txt @@ -1,46 +1,48 @@ -Statement block - Gen - 84 - (0:0,0) - Code span - Gen - [while(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..84)::84 - [while(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..84)::84 - [while(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen.stree.txt index 18268ec09..2a7208cd4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen.stree.txt @@ -1,46 +1,48 @@ -Statement block - Gen - 84 - (0:0,0) - Code span - Gen - [using(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - SyntaxKind.Keyword;[using]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..84)::84 - [using(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..84)::84 - [using(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[using]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCatchClausesAfterFinallyBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCatchClausesAfterFinallyBlock.stree.txt index 8ae4de426..cb95bfbf5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCatchClausesAfterFinallyBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCatchClausesAfterFinallyBlock.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 55 - (0:0,0) - Code span - Gen - [try { var foo = new { } } finally { var foo = new { } }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..55)::55 - [try { var foo = new { } } finally { var foo = new { } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..55)::55 - [try { var foo = new { } } finally { var foo = new { } }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCodeAfterElseBranch.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCodeAfterElseBranch.stree.txt index 7ed107129..6f62c1d22 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCodeAfterElseBranch.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCodeAfterElseBranch.stree.txt @@ -1,109 +1,111 @@ -Statement block - Gen - 220 - (0:0,0) - Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else { Debug.WriteLine(@"bar } baz"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:107 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bar } baz"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..220)::220 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else { Debug.WriteLine(@"bar } baz"); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..220)::220 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else { Debug.WriteLine(@"bar } baz"); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"bar } baz"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingIfIfStatementNotFollowedByElse.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingIfIfStatementNotFollowedByElse.stree.txt index 66455be82..87799cf41 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingIfIfStatementNotFollowedByElse.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingIfIfStatementNotFollowedByElse.stree.txt @@ -1,47 +1,49 @@ -Statement block - Gen - 87 - (0:0,0) - Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:45 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..87)::87 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..87)::87 - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF}] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenCatchAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenCatchAndFinallyClause.stree.txt index 73bc070d6..fed923fc3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenCatchAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenCatchAndFinallyClause.stree.txt @@ -1,41 +1,43 @@ -Statement block - Gen - 75 - (0:0,0) - Code span - Gen - [try { bar(); } catch(bar) { baz(); } /* Foo */ /* Bar */ finally { biz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:39 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Foo */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Bar */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[biz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..75)::75 - [try { bar(); } catch(bar) { baz(); } /* Foo */ /* Bar */ finally { biz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..75)::75 - [try { bar(); } catch(bar) { baz(); } /* Foo */ /* Bar */ finally { biz(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + CSharpComment;[/* Foo */]; + Whitespace;[ ]; + CSharpComment;[/* Bar */]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[biz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenDoAndWhileClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenDoAndWhileClause.stree.txt index 55417a811..3388a6556 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenDoAndWhileClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenDoAndWhileClause.stree.txt @@ -1,26 +1,28 @@ -Statement block - Gen - 54 - (0:0,0) - Code span - Gen - [do { var foo = bar; } /* Foo */ /* Bar */ while(true);] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:24 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Foo */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Bar */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..54)::54 - [do { var foo = bar; } /* Foo */ /* Bar */ while(true);] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..54)::54 - [do { var foo = bar; } /* Foo */ /* Bar */ while(true);] - Gen - SpanEditHandler;Accepts:None + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + CSharpComment;[/* Foo */]; + Whitespace;[ ]; + CSharpComment;[/* Bar */]; + Whitespace;[ ]; + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenElseIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenElseIfAndElseClause.stree.txt index af30d4aa6..6bc688a45 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenElseIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenElseIfAndElseClause.stree.txt @@ -1,46 +1,48 @@ -Statement block - Gen - 78 - (0:0,0) - Code span - Gen - [if(foo) { bar(); } else if(bar) { baz(); } /* Foo */ /* Bar */ else { biz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Foo */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Bar */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[biz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..78)::78 - [if(foo) { bar(); } else if(bar) { baz(); } /* Foo */ /* Bar */ else { biz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..78)::78 - [if(foo) { bar(); } else if(bar) { baz(); } /* Foo */ /* Bar */ else { biz(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + CSharpComment;[/* Foo */]; + Whitespace;[ ]; + CSharpComment;[/* Bar */]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[biz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseClause.stree.txt index 5c0454a7c..53bf39362 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseClause.stree.txt @@ -1,30 +1,32 @@ -Statement block - Gen - 54 - (0:0,0) - Code span - Gen - [if(foo) { bar(); } /* Foo */ /* Bar */ else { baz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:28 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Foo */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Bar */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..54)::54 - [if(foo) { bar(); } /* Foo */ /* Bar */ else { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..54)::54 - [if(foo) { bar(); } /* Foo */ /* Bar */ else { baz(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + CSharpComment;[/* Foo */]; + Whitespace;[ ]; + CSharpComment;[/* Bar */]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseIfClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseIfClause.stree.txt index 6d0d09b6b..67306cce2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseIfClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseIfClause.stree.txt @@ -1,35 +1,37 @@ -Statement block - Gen - 62 - (0:0,0) - Code span - Gen - [if(foo) { bar(); } /* Foo */ /* Bar */ else if(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:33 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Foo */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Bar */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..62)::62 - [if(foo) { bar(); } /* Foo */ /* Bar */ else if(bar) { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..62)::62 - [if(foo) { bar(); } /* Foo */ /* Bar */ else if(bar) { baz(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + CSharpComment;[/* Foo */]; + Whitespace;[ ]; + CSharpComment;[/* Bar */]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndCatchClause.stree.txt index 7d9cdf7fb..7aa27c665 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndCatchClause.stree.txt @@ -1,30 +1,32 @@ -Statement block - Gen - 56 - (0:0,0) - Code span - Gen - [try { bar(); } /* Foo */ /* Bar */ catch(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:28 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Foo */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Bar */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..56)::56 - [try { bar(); } /* Foo */ /* Bar */ catch(bar) { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..56)::56 - [try { bar(); } /* Foo */ /* Bar */ catch(bar) { baz(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + CSharpComment;[/* Foo */]; + Whitespace;[ ]; + CSharpComment;[/* Bar */]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndFinallyClause.stree.txt index fc6549a8d..5ceedb1a4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndFinallyClause.stree.txt @@ -1,27 +1,29 @@ -Statement block - Gen - 53 - (0:0,0) - Code span - Gen - [try { bar(); } /* Foo */ /* Bar */ finally { baz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:25 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Foo */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* Bar */]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..53)::53 - [try { bar(); } /* Foo */ /* Bar */ finally { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..53)::53 - [try { bar(); } /* Foo */ /* Bar */ finally { baz(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + CSharpComment;[/* Foo */]; + Whitespace;[ ]; + CSharpComment;[/* Bar */]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsExceptionLessCatchClauses.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsExceptionLessCatchClauses.stree.txt index cfdfe1039..a201eec07 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsExceptionLessCatchClauses.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsExceptionLessCatchClauses.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 53 - (0:0,0) - Code span - Gen - [try { var foo = new { } } catch { var foo = new { } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..53)::53 - [try { var foo = new { } } catch { var foo = new { } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..53)::53 - [try { var foo = new { } } catch { var foo = new { } }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenCatchAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenCatchAndFinallyClause.stree.txt index 1c1dd3248..299be6593 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenCatchAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenCatchAndFinallyClause.stree.txt @@ -1,41 +1,43 @@ -Statement block - Gen - 72 - (0:0,0) - Code span - Gen - [try { bar(); } catch(bar) { baz(); }LF// FooLF// BarLFfinally { biz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:39 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Foo]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Bar]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[biz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..72)::72 - [try { bar(); } catch(bar) { baz(); }LF// FooLF// BarLFfinally { biz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..72)::72 - [try { bar(); } catch(bar) { baz(); }LF// FooLF// BarLFfinally { biz(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + NewLine;[LF]; + CSharpComment;[// Foo]; + NewLine;[LF]; + CSharpComment;[// Bar]; + NewLine;[LF]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[biz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenDoAndWhileClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenDoAndWhileClause.stree.txt index 2882f0ab4..34203c8a1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenDoAndWhileClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenDoAndWhileClause.stree.txt @@ -1,26 +1,28 @@ -Statement block - Gen - 51 - (0:0,0) - Code span - Gen - [do { var foo = bar; }LF// FooLF// BarLFwhile(true);] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:24 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Foo]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Bar]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..51)::51 - [do { var foo = bar; }LF// FooLF// BarLFwhile(true);] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..51)::51 - [do { var foo = bar; }LF// FooLF// BarLFwhile(true);] - Gen - SpanEditHandler;Accepts:None + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + NewLine;[LF]; + CSharpComment;[// Foo]; + NewLine;[LF]; + CSharpComment;[// Bar]; + NewLine;[LF]; + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenElseIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenElseIfAndElseClause.stree.txt index 0fc2eef2b..9e4a455d6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenElseIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenElseIfAndElseClause.stree.txt @@ -1,46 +1,48 @@ -Statement block - Gen - 75 - (0:0,0) - Code span - Gen - [if(foo) { bar(); } else if(bar) { baz(); }LF// FooLF// BarLFelse { biz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Foo]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Bar]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[biz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..75)::75 - [if(foo) { bar(); } else if(bar) { baz(); }LF// FooLF// BarLFelse { biz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..75)::75 - [if(foo) { bar(); } else if(bar) { baz(); }LF// FooLF// BarLFelse { biz(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + NewLine;[LF]; + CSharpComment;[// Foo]; + NewLine;[LF]; + CSharpComment;[// Bar]; + NewLine;[LF]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[biz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseClause.stree.txt index ab73bc444..b5623098d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseClause.stree.txt @@ -1,30 +1,32 @@ -Statement block - Gen - 51 - (0:0,0) - Code span - Gen - [if(foo) { bar(); }LF// FooLF// BarLFelse { baz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:28 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Foo]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Bar]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..51)::51 - [if(foo) { bar(); }LF// FooLF// BarLFelse { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..51)::51 - [if(foo) { bar(); }LF// FooLF// BarLFelse { baz(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + NewLine;[LF]; + CSharpComment;[// Foo]; + NewLine;[LF]; + CSharpComment;[// Bar]; + NewLine;[LF]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseIfClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseIfClause.stree.txt index a151fa562..3743f8609 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseIfClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseIfClause.stree.txt @@ -1,35 +1,37 @@ -Statement block - Gen - 59 - (0:0,0) - Code span - Gen - [if(foo) { bar(); }LF// FooLF// BarLFelse if(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:33 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Foo]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Bar]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..59)::59 - [if(foo) { bar(); }LF// FooLF// BarLFelse if(bar) { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..59)::59 - [if(foo) { bar(); }LF// FooLF// BarLFelse if(bar) { baz(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + NewLine;[LF]; + CSharpComment;[// Foo]; + NewLine;[LF]; + CSharpComment;[// Bar]; + NewLine;[LF]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndCatchClause.stree.txt index 51faa5f9e..efec2a574 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndCatchClause.stree.txt @@ -1,30 +1,32 @@ -Statement block - Gen - 53 - (0:0,0) - Code span - Gen - [try { bar(); }LF// FooLF// BarLFcatch(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:28 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Foo]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Bar]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..53)::53 - [try { bar(); }LF// FooLF// BarLFcatch(bar) { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..53)::53 - [try { bar(); }LF// FooLF// BarLFcatch(bar) { baz(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + NewLine;[LF]; + CSharpComment;[// Foo]; + NewLine;[LF]; + CSharpComment;[// Bar]; + NewLine;[LF]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndFinallyClause.stree.txt index 1bdb46e8d..ab272ae2f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndFinallyClause.stree.txt @@ -1,27 +1,29 @@ -Statement block - Gen - 50 - (0:0,0) - Code span - Gen - [try { bar(); }LF// FooLF// BarLFfinally { baz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:25 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Foo]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.CSharpComment;[// Bar]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..50)::50 - [try { bar(); }LF// FooLF// BarLFfinally { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..50)::50 - [try { bar(); }LF// FooLF// BarLFfinally { baz(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + NewLine;[LF]; + CSharpComment;[// Foo]; + NewLine;[LF]; + CSharpComment;[// Bar]; + NewLine;[LF]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinAdditionalCatchClauses.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinAdditionalCatchClauses.stree.txt index f8e061509..ba3619a37 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinAdditionalCatchClauses.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinAdditionalCatchClauses.stree.txt @@ -1,100 +1,102 @@ -Statement block - Gen - 141 - (0:0,0) - Code span - Gen - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) {] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:78 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 12 - (128:0,128) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (128:0,128) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (129:0,129) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:None - (135:0,135) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (139:0,139) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (140:0,140) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..141)::141 - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) {

Foo

}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..128)::128 - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Identifier;[Baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Identifier;[Baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Identifier;[Baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + MarkupBlock - [128..140)::12 + MarkupTextLiteral - [128..129)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [129..132)::3 - [

] + MarkupTextLiteral - [129..132)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [132..135)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [135..139)::4 - [

] + MarkupTextLiteral - [135..139)::4 - [

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

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

] - SpanEditHandler;Accepts:None - (53:0,53) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (57:0,57) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (58:0,58) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..59)::59 - [try { var foo = new { } } catch(Foo Bar Baz) {

Foo

}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..46)::46 - [try { var foo = new { } } catch(Foo Bar Baz) {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Identifier;[Baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + MarkupBlock - [46..58)::12 + MarkupTextLiteral - [46..47)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [47..50)::3 - [

] + MarkupTextLiteral - [47..50)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [50..53)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [53..57)::4 - [

] + MarkupTextLiteral - [53..57)::4 - [

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

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

] - SpanEditHandler;Accepts:None - (42:0,42) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (46:0,46) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [}] - SpanEditHandler;Accepts:None - (47:0,47) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..48)::48 - [try { var foo = new { } } finally {

Foo

}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..35)::35 - [try { var foo = new { } } finally {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + MarkupBlock - [35..47)::12 + MarkupTextLiteral - [35..36)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [36..39)::3 - [

] + MarkupTextLiteral - [36..39)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [39..42)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [42..46)::4 - [

] + MarkupTextLiteral - [42..46)::4 - [

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

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

] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..18)::18 - [try {

Foo

}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..5)::5 - [try {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + MarkupBlock - [5..17)::12 + MarkupTextLiteral - [5..6)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [6..9)::3 - [

] + MarkupTextLiteral - [6..9)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [9..12)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [12..16)::4 - [

] + MarkupTextLiteral - [12..16)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [16..17)::1 - [ ] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + CSharpStatementLiteral - [17..18)::1 - [}] - Gen - SpanEditHandler;Accepts:Any + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenCatchAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenCatchAndFinallyClause.stree.txt index 0c589bfbe..5d8c7b08a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenCatchAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenCatchAndFinallyClause.stree.txt @@ -1,63 +1,55 @@ -Statement block - Gen - 75 - (0:0,0) - Code span - Gen - [try { bar(); } catch(bar) { baz(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:25 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (37:0,37) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (37:0,37) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Foo ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (44:0,44) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (45:0,45) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (46:0,46) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (47:0,47) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (47:0,47) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (48:0,48) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (49:0,49) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Bar ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (54:0,54) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (55:0,55) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ finally { biz(); }] - SpanEditHandler;Accepts:None - (56:0,56) - Tokens:11 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[biz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..75)::75 - [try { bar(); } catch(bar) { baz(); } @* Foo *@ @* Bar *@ finally { biz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..37)::37 - [try { bar(); } catch(bar) { baz(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorComment - [37..46)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Foo ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [46..47)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [47..56)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Bar ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [56..75)::19 - [ finally { biz(); }] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[biz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenDoAndWhileClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenDoAndWhileClause.stree.txt index 3c23c80fa..71b8b166e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenDoAndWhileClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenDoAndWhileClause.stree.txt @@ -1,48 +1,40 @@ -Statement block - Gen - 54 - (0:0,0) - Code span - Gen - [do { var foo = bar; } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:15 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (22:0,22) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (22:0,22) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Foo ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (29:0,29) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (32:0,32) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (33:0,33) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (34:0,34) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Bar ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (39:0,39) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (40:0,40) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ while(true);] - SpanEditHandler;Accepts:None - (41:0,41) - Tokens:6 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..54)::54 - [do { var foo = bar; } @* Foo *@ @* Bar *@ while(true);] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..22)::22 - [do { var foo = bar; } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorComment - [22..31)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Foo ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [31..32)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [32..41)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Bar ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [41..54)::13 - [ while(true);] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenElseIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenElseIfAndElseClause.stree.txt index b6367f8a3..5d70ae76c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenElseIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenElseIfAndElseClause.stree.txt @@ -1,68 +1,60 @@ -Statement block - Gen - 78 - (0:0,0) - Code span - Gen - [if(foo) { bar(); } else if(bar) { baz(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:30 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (43:0,43) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (43:0,43) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (44:0,44) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (45:0,45) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Foo ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (50:0,50) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (51:0,51) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (52:0,52) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (53:0,53) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (53:0,53) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (54:0,54) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (55:0,55) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Bar ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (60:0,60) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (61:0,61) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ else { baz(); }] - SpanEditHandler;Accepts:None - (62:0,62) - Tokens:11 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..78)::78 - [if(foo) { bar(); } else if(bar) { baz(); } @* Foo *@ @* Bar *@ else { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..43)::43 - [if(foo) { bar(); } else if(bar) { baz(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorComment - [43..52)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Foo ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [52..53)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [53..62)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Bar ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [62..78)::16 - [ else { baz(); }] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseClause.stree.txt index 24f5021c5..fa6d7871f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseClause.stree.txt @@ -1,52 +1,44 @@ -Statement block - Gen - 54 - (0:0,0) - Code span - Gen - [if(foo) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (19:0,19) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Foo ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (29:0,29) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (29:0,29) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Bar ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (37:0,37) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ else { baz(); }] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:11 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..54)::54 - [if(foo) { bar(); } @* Foo *@ @* Bar *@ else { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..19)::19 - [if(foo) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorComment - [19..28)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Foo ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [28..29)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [29..38)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Bar ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [38..54)::16 - [ else { baz(); }] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseIfClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseIfClause.stree.txt index 868fb9cd8..e16b61a5d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseIfClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseIfClause.stree.txt @@ -1,57 +1,49 @@ -Statement block - Gen - 62 - (0:0,0) - Code span - Gen - [if(foo) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (19:0,19) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Foo ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (29:0,29) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (29:0,29) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Bar ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (37:0,37) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ else if(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (38:0,38) - Tokens:16 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..62)::62 - [if(foo) { bar(); } @* Foo *@ @* Bar *@ else if(bar) { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..19)::19 - [if(foo) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorComment - [19..28)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Foo ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [28..29)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [29..38)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Bar ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [38..62)::24 - [ else if(bar) { baz(); }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndCatchClause.stree.txt index 465652cc2..d9cccdcf4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndCatchClause.stree.txt @@ -1,51 +1,43 @@ -Statement block - Gen - 55 - (0:0,0) - Code span - Gen - [try { bar(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:10 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - Comment block - Gen - 9 - (14:0,14) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Foo ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (22:0,22) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (24:0,24) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (24:0,24) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Bar ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ catch(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (33:0,33) - Tokens:14 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..55)::55 - [try { bar(); }@* Foo *@ @* Bar *@ catch(bar) { baz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..14)::14 - [try { bar(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + RazorComment - [14..23)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Foo ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [23..24)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [24..33)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Bar ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [33..55)::22 - [ catch(bar) { baz(); }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndFinallyClause.stree.txt index 82faa128c..c491cbcce 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndFinallyClause.stree.txt @@ -1,49 +1,41 @@ -Statement block - Gen - 53 - (0:0,0) - Code span - Gen - [try { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:11 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (15:0,15) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Foo ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (22:0,22) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 9 - (25:0,25) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ Bar ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (33:0,33) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [ finally { biz(); }] - SpanEditHandler;Accepts:None - (34:0,34) - Tokens:11 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[biz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..53)::53 - [try { bar(); } @* Foo *@ @* Bar *@ finally { biz(); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..15)::15 - [try { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorComment - [15..24)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Foo ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [24..25)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [25..34)::9 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ Bar ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [34..53)::19 - [ finally { biz(); }] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[biz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithFinallyClause.stree.txt index 8ae4de426..cb95bfbf5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithFinallyClause.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 55 - (0:0,0) - Code span - Gen - [try { var foo = new { } } finally { var foo = new { } }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..55)::55 - [try { var foo = new { } } finally { var foo = new { } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..55)::55 - [try { var foo = new { } } finally { var foo = new { } }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithMultipleCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithMultipleCatchClause.stree.txt index 46447b2fe..15d720a6d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithMultipleCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithMultipleCatchClause.stree.txt @@ -1,94 +1,96 @@ -Statement block - Gen - 148 - (0:0,0) - Code span - Gen - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:92 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..148)::148 - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..148)::148 - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Identifier;[Baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Identifier;[Baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Identifier;[Baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithNoAdditionalClauses.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithNoAdditionalClauses.stree.txt index 8a1d73994..f31f9f22a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithNoAdditionalClauses.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithNoAdditionalClauses.stree.txt @@ -1,19 +1,21 @@ -Statement block - Gen - 25 - (0:0,0) - Code span - Gen - [try { var foo = new { } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:17 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..25)::25 - [try { var foo = new { } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..25)::25 - [try { var foo = new { } }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithOneCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithOneCatchClause.stree.txt index 54e153018..ff0710153 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithOneCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithOneCatchClause.stree.txt @@ -1,44 +1,46 @@ -Statement block - Gen - 66 - (0:0,0) - Code span - Gen - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:42 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..66)::66 - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..66)::66 - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Identifier;[Baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsUsingsNestedWithinOtherBlocks.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsUsingsNestedWithinOtherBlocks.stree.txt index 429b126cb..867e696b2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsUsingsNestedWithinOtherBlocks.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsUsingsNestedWithinOtherBlocks.stree.txt @@ -1,55 +1,57 @@ -Statement block - Gen - 96 - (0:0,0) - Code span - Gen - [if(foo) { using(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:53 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[using]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["baz"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..96)::96 - [if(foo) { using(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); } }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..96)::96 - [if(foo) { using(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); } }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Keyword;[using]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["baz"]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesBlockCommentAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesBlockCommentAtEndOfFile.stree.txt index ea93ea30d..43cd0d98f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesBlockCommentAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesBlockCommentAtEndOfFile.stree.txt @@ -1,16 +1,18 @@ -Statement block - Gen - 38 - (0:0,0) - Code span - Gen - [foreach(var f in Foo) { /* foo bar baz] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - SyntaxKind.Keyword;[foreach]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[f]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[in]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[/* foo bar baz];RZ1001(24:0,24 [1] ) +CSharpCodeBlock - [0..38)::38 - [foreach(var f in Foo) { /* foo bar baz] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..38)::38 - [foreach(var f in Foo) { /* foo bar baz] - Gen - SpanEditHandler;Accepts:Any + Keyword;[foreach]; + LeftParenthesis;[(]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[f]; + Whitespace;[ ]; + Keyword;[in]; + Whitespace;[ ]; + Identifier;[Foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpComment;[/* foo bar baz];RZ1001(24:0,24 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesParenBalancingAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesParenBalancingAtEOF.stree.txt index 9f50f9589..1b96a7930 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesParenBalancingAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesParenBalancingAtEOF.stree.txt @@ -1,11 +1,14 @@ -Expression block - Gen - 15 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [Html.En(code()] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 - SyntaxKind.Identifier;[Html]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[En]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[code]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..15)::15 - [@Html.En(code()] + CSharpImplicitExpression - [0..15)::15 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..15)::14 + CSharpCodeBlock - [1..15)::14 + CSharpExpressionLiteral - [1..15)::14 - [Html.En(code()] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[Html]; + Dot;[.]; + Identifier;[En]; + LeftParenthesis;[(]; + Identifier;[code]; + LeftParenthesis;[(]; + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleLineCommentAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleLineCommentAtEndOfFile.stree.txt index 615163907..51347e9a0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleLineCommentAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleLineCommentAtEndOfFile.stree.txt @@ -1,16 +1,18 @@ -Statement block - Gen - 38 - (0:0,0) - Code span - Gen - [foreach(var f in Foo) { // foo bar baz] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - SyntaxKind.Keyword;[foreach]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[f]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[in]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[// foo bar baz]; +CSharpCodeBlock - [0..38)::38 - [foreach(var f in Foo) { // foo bar baz] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..38)::38 - [foreach(var f in Foo) { // foo bar baz] - Gen - SpanEditHandler;Accepts:Any + Keyword;[foreach]; + LeftParenthesis;[(]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[f]; + Whitespace;[ ]; + Keyword;[in]; + Whitespace;[ ]; + Identifier;[Foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpComment;[// foo bar baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleSlashAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleSlashAtEndOfFile.stree.txt index f2643653c..5fbe10803 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleSlashAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleSlashAtEndOfFile.stree.txt @@ -1,22 +1,24 @@ -Statement block - Gen - 37 - (0:0,0) - Code span - Gen - [foreach(var f in Foo) { / foo bar baz] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:20 - SyntaxKind.Keyword;[foreach]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[f]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[in]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Slash;[/]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; +CSharpCodeBlock - [0..37)::37 - [foreach(var f in Foo) { / foo bar baz] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..37)::37 - [foreach(var f in Foo) { / foo bar baz] - Gen - SpanEditHandler;Accepts:Any + Keyword;[foreach]; + LeftParenthesis;[(]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[f]; + Whitespace;[ ]; + Keyword;[in]; + Whitespace;[ ]; + Identifier;[Foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Slash;[/]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Identifier;[bar]; + Whitespace;[ ]; + Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock.stree.txt index b0fd67916..0880fd7ca 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock.stree.txt @@ -1,4 +1,4 @@ -Statement block - Gen - 25 - (0:0,0) - Code span - Gen - [using ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..25)::25 - [using ] + CSharpStatementLiteral - [0..25)::25 - [using ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[using]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ThenBalancesBracesIfFirstIdentifierIsLockKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ThenBalancesBracesIfFirstIdentifierIsLockKeyword.stree.txt index 7d68d60c1..31249b0f2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ThenBalancesBracesIfFirstIdentifierIsLockKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ThenBalancesBracesIfFirstIdentifierIsLockKeyword.stree.txt @@ -1,18 +1,20 @@ -Statement block - Gen - 44 - (0:0,0) - Code span - Gen - [lock(foo) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:16 - SyntaxKind.Keyword;[lock]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Debug]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WriteLine]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"foo } bar"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..44)::44 - [lock(foo) { Debug.WriteLine(@"foo } bar"); }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..44)::44 - [lock(foo) { Debug.WriteLine(@"foo } bar"); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[lock]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Debug]; + Dot;[.]; + Identifier;[WriteLine]; + LeftParenthesis;[(]; + StringLiteral;[@"foo } bar"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt index 83909c4da..87ffa57e5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt @@ -1,22 +1,24 @@ -Statement block - Gen - 27 - (0:0,0) - Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [@] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [@@@class.Foo() }] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:10 - SyntaxKind.Transition;[@]; - SyntaxKind.Transition;[@]; - SyntaxKind.Transition;[@]; - SyntaxKind.Keyword;[class]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..27)::27 - [if(foo) { @@@@class.Foo() }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..10)::10 - [if(foo) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpEphemeralTextLiteral - [10..11)::1 - [@] - Gen - SpanEditHandler;Accepts:Any + Transition;[@]; + CSharpStatementLiteral - [11..27)::16 - [@@@class.Foo() }] - Gen - SpanEditHandler;Accepts:Any + Transition;[@]; + Transition;[@]; + Transition;[@]; + Keyword;[class]; + Dot;[.]; + Identifier;[Foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart.stree.txt index cfd3620a0..a2b3f220c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart.stree.txt @@ -1,20 +1,22 @@ -Statement block - Gen - 25 - (0:0,0) - Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [@] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [@class.Foo() }] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:8 - SyntaxKind.Transition;[@]; - SyntaxKind.Keyword;[class]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..25)::25 - [if(foo) { @@class.Foo() }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..10)::10 - [if(foo) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpEphemeralTextLiteral - [10..11)::1 - [@] - Gen - SpanEditHandler;Accepts:Any + Transition;[@]; + CSharpStatementLiteral - [11..25)::14 - [@class.Foo() }] - Gen - SpanEditHandler;Accepts:Any + Transition;[@]; + Keyword;[class]; + Dot;[.]; + Identifier;[Foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow.stree.txt index ce9722564..b7ffda307 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow.stree.txt @@ -1,31 +1,40 @@ -Statement block - Gen - 22 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 20 - (1:0,1) - Tag block - Gen - 20 - (1:0,1) - Markup span - Gen - [ - 12 - (6:0,6) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 2 - (12:0,12) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [def] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Text;[def]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (18:0,18) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..22)::22 - [{}] + CSharpStatement - [0..22)::22 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..22)::22 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..21)::20 + MarkupBlock - [1..21)::20 + MarkupTagBlock - [1..21)::20 - [] + MarkupTextLiteral - [1..6)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..18)::12 - [ foo='@@def'] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [12..17)::5 + MarkupBlock - [12..14)::2 + MarkupTextLiteral - [12..13)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [13..14)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupLiteralAttributeValue - [14..17)::3 - [def] + MarkupTextLiteral - [14..17)::3 - [def] - Gen - SpanEditHandler;Accepts:Any + Text;[def]; + MarkupTextLiteral - [17..18)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [18..21)::3 - [ />] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + CSharpStatementLiteral - [21..21)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [21..22)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow.stree.txt index 6fdd67310..277f2e629 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow.stree.txt @@ -1,31 +1,40 @@ -Statement block - Gen - 22 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 20 - (1:0,1) - Tag block - Gen - 20 - (1:0,1) - Markup span - Gen - [ - 12 - (6:0,6) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [abc] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - SyntaxKind.Text;[abc]; - Markup block - Gen - 2 - (15:0,15) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (18:0,18) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..22)::22 - [{}] + CSharpStatement - [0..22)::22 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..22)::22 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..21)::20 + MarkupBlock - [1..21)::20 + MarkupTagBlock - [1..21)::20 - [] + MarkupTextLiteral - [1..6)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..18)::12 - [ foo='abc@@'] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [12..17)::5 + MarkupLiteralAttributeValue - [12..15)::3 - [abc] + MarkupTextLiteral - [12..15)::3 - [abc] - Gen - SpanEditHandler;Accepts:Any + Text;[abc]; + MarkupBlock - [15..17)::2 + MarkupTextLiteral - [15..16)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [16..17)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTextLiteral - [17..18)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [18..21)::3 - [ />] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + CSharpStatementLiteral - [21..21)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [21..22)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionBetweenAttributeValue_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionBetweenAttributeValue_DoesNotThrow.stree.txt index 028b870a5..196257f35 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionBetweenAttributeValue_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionBetweenAttributeValue_DoesNotThrow.stree.txt @@ -1,35 +1,46 @@ -Statement block - Gen - 27 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 25 - (1:0,1) - Tag block - Gen - 25 - (1:0,1) - Markup span - Gen - [ - 17 - (6:0,6) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [abc] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - SyntaxKind.Text;[abc]; - Markup block - Gen - 3 - (15:0,15) - Markup span - Gen - [ @] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (17:0,17) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [ def] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[def]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..27)::27 - [{}] + CSharpStatement - [0..27)::27 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..27)::27 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..26)::25 + MarkupBlock - [1..26)::25 + MarkupTagBlock - [1..26)::25 - [] + MarkupTextLiteral - [1..6)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..23)::17 - [ foo='abc @@ def'] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [12..22)::10 + MarkupLiteralAttributeValue - [12..15)::3 - [abc] + MarkupTextLiteral - [12..15)::3 - [abc] - Gen - SpanEditHandler;Accepts:Any + Text;[abc]; + MarkupBlock - [15..18)::3 + MarkupTextLiteral - [15..17)::2 - [ @] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Transition;[@]; + MarkupEphemeralTextLiteral - [17..18)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupLiteralAttributeValue - [18..22)::4 - [ def] + MarkupTextLiteral - [18..19)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [19..22)::3 - [def] - Gen - SpanEditHandler;Accepts:Any + Text;[def]; + MarkupTextLiteral - [22..23)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [23..26)::3 - [ />] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + CSharpStatementLiteral - [26..26)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [26..27)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInAttributeValue_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInAttributeValue_DoesNotThrow.stree.txt index b979bc364..38ffb3ab7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInAttributeValue_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInAttributeValue_DoesNotThrow.stree.txt @@ -1,29 +1,37 @@ -Statement block - Gen - 19 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 17 - (1:0,1) - Tag block - Gen - 17 - (1:0,1) - Markup span - Gen - [ - 9 - (6:0,6) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 2 - (12:0,12) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (18:0,18) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..19)::19 - [{}] + CSharpStatement - [0..19)::19 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..19)::19 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..18)::17 + MarkupBlock - [1..18)::17 + MarkupTagBlock - [1..18)::17 - [] + MarkupTextLiteral - [1..6)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..15)::9 - [ foo='@@'] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [12..14)::2 + MarkupBlock - [12..14)::2 + MarkupTextLiteral - [12..13)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [13..14)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTextLiteral - [14..15)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [15..18)::3 - [ />] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + CSharpStatementLiteral - [18..18)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [18..19)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInEmail_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInEmail_DoesNotThrow.stree.txt index 1d16ff79f..01cbcf602 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInEmail_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInEmail_DoesNotThrow.stree.txt @@ -1,42 +1,54 @@ -Statement block - Gen - 44 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 42 - (1:0,1) - Tag block - Gen - 42 - (1:0,1) - Markup span - Gen - [ - 34 - (6:0,6) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [abc@def.com] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - SyntaxKind.Text;[abc@def.com]; - Markup span - Gen - [ abc] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[abc]; - Markup block - Gen - 2 - (27:0,27) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (28:0,28) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [def.com] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 - SyntaxKind.Text;[def.com]; - Markup block - Gen - 3 - (36:0,36) - Markup span - Gen - [ @] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (40:0,40) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (43:0,43) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..44)::44 - [{}] + CSharpStatement - [0..44)::44 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..44)::44 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..43)::42 + MarkupBlock - [1..43)::42 + MarkupTagBlock - [1..43)::42 - [] + MarkupTextLiteral - [1..6)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..40)::34 - [ foo='abc@def.com abc@@def.com @@'] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [12..39)::27 + MarkupLiteralAttributeValue - [12..23)::11 - [abc@def.com] + MarkupTextLiteral - [12..23)::11 - [abc@def.com] - Gen - SpanEditHandler;Accepts:Any + Text;[abc@def.com]; + MarkupLiteralAttributeValue - [23..27)::4 - [ abc] + MarkupTextLiteral - [23..24)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [24..27)::3 - [abc] - Gen - SpanEditHandler;Accepts:Any + Text;[abc]; + MarkupBlock - [27..29)::2 + MarkupTextLiteral - [27..28)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [28..29)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupLiteralAttributeValue - [29..36)::7 - [def.com] + MarkupTextLiteral - [29..36)::7 - [def.com] - Gen - SpanEditHandler;Accepts:Any + Text;[def.com]; + MarkupBlock - [36..39)::3 + MarkupTextLiteral - [36..38)::2 - [ @] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Transition;[@]; + MarkupEphemeralTextLiteral - [38..39)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTextLiteral - [39..40)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [40..43)::3 - [ />] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + CSharpStatementLiteral - [43..43)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [43..44)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInRegex_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInRegex_DoesNotThrow.stree.txt index 759fea4f4..b98a56dae 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInRegex_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInRegex_DoesNotThrow.stree.txt @@ -1,75 +1,85 @@ -Statement block - Gen - 117 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 115 - (1:0,1) - Tag block - Gen - 115 - (1:0,1) - Markup span - Gen - [ - 107 - (6:0,6) - Markup span - Gen - [ foo="] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.DoubleQuote;["]; - Markup span - Gen - [/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:14 - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[^]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Text;[a-z0-9]; - SyntaxKind.Bang;[!]; - SyntaxKind.Text;[#$%&]; - SyntaxKind.SingleQuote;[']; - SyntaxKind.Text;[*+\]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Equals;[=]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Text;[^_`{|}~.-]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Text;[+]; - Markup block - Gen - 2 - (44:0,44) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (44:0,44) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (45:0,45) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i] - SpanEditHandler;Accepts:Any - (46:0,46) - Tokens:30 - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Text;[a-z0-9]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Text;[(]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Text;[a-z0-9-]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Text;[*]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Text;[a-z0-9]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Text;[)]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Text;[\.(]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Text;[a-z0-9]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Text;[(]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Text;[a-z0-9-]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Text;[*]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Text;[a-z0-9]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Text;[)]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Text;[)*$]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[i]; - Markup span - Gen - ["] - SpanEditHandler;Accepts:Any - (112:0,112) - Tokens:1 - SyntaxKind.DoubleQuote;["]; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (113:0,113) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (116:0,116) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (116:0,116) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..117)::117 - [{}] + CSharpStatement - [0..117)::117 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..117)::117 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..116)::115 + MarkupBlock - [1..116)::115 + MarkupTagBlock - [1..116)::115 - [] + MarkupTextLiteral - [1..6)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..113)::107 - [ foo="/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@@[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i"] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ["] - Gen - SpanEditHandler;Accepts:Any + DoubleQuote;["]; + GenericBlock - [12..112)::100 + MarkupLiteralAttributeValue - [12..44)::32 - [/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+] + MarkupTextLiteral - [12..44)::32 - [/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+] - Gen - SpanEditHandler;Accepts:Any + ForwardSlash;[/]; + Text;[^]; + LeftBracket;[[]; + Text;[a-z0-9]; + Bang;[!]; + Text;[#$%&]; + SingleQuote;[']; + Text;[*+\]; + ForwardSlash;[/]; + Equals;[=]; + QuestionMark;[?]; + Text;[^_`{|}~.-]; + RightBracket;[]]; + Text;[+]; + MarkupBlock - [44..46)::2 + MarkupTextLiteral - [44..45)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [45..46)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupLiteralAttributeValue - [46..112)::66 - [[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i] + MarkupTextLiteral - [46..112)::66 - [[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i] - Gen - SpanEditHandler;Accepts:Any + LeftBracket;[[]; + Text;[a-z0-9]; + RightBracket;[]]; + Text;[(]; + LeftBracket;[[]; + Text;[a-z0-9-]; + RightBracket;[]]; + Text;[*]; + LeftBracket;[[]; + Text;[a-z0-9]; + RightBracket;[]]; + Text;[)]; + QuestionMark;[?]; + Text;[\.(]; + LeftBracket;[[]; + Text;[a-z0-9]; + RightBracket;[]]; + Text;[(]; + LeftBracket;[[]; + Text;[a-z0-9-]; + RightBracket;[]]; + Text;[*]; + LeftBracket;[[]; + Text;[a-z0-9]; + RightBracket;[]]; + Text;[)]; + QuestionMark;[?]; + Text;[)*$]; + ForwardSlash;[/]; + Text;[i]; + MarkupTextLiteral - [112..113)::1 - ["] - Gen - SpanEditHandler;Accepts:Any + DoubleQuote;["]; + MarkupTextLiteral - [113..116)::3 - [ />] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + CSharpStatementLiteral - [116..116)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [116..117)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt index a01eb4ccc..6415ccab3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt @@ -1,144 +1,188 @@ -Statement block - Gen - 120 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 118 - (1:0,1) - Tag block - Gen - 118 - (1:0,1) - Markup span - Gen - [ - 15 - (6:0,6) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 2 - (12:0,12) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup block - Gen - 6 - (14:0,14) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Unknown;[]; - Expression block - Gen - 6 - (14:0,14) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [2+3] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:3 - SyntaxKind.IntegerLiteral;[2]; - SyntaxKind.Plus;[+]; - SyntaxKind.IntegerLiteral;[3]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 28 - (21:0,21) - Markup span - Gen - [ bar='] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[bar]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 6 - (27:0,27) - Expression block - Gen - 6 - (27:0,27) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (28:0,28) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [2+3] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:3 - SyntaxKind.IntegerLiteral;[2]; - SyntaxKind.Plus;[+]; - SyntaxKind.IntegerLiteral;[3]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; - Markup block - Gen - 2 - (33:0,33) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (33:0,33) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (34:0,34) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup block - Gen - 13 - (35:0,35) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 - SyntaxKind.Unknown;[]; - Expression block - Gen - 13 - (35:0,35) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (35:0,35) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (36:0,36) - Tokens:3 - SyntaxKind.Identifier;[DateTime]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Now]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (48:0,48) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 22 - (49:0,49) - Markup span - Gen - [ baz='] - SpanEditHandler;Accepts:Any - (49:0,49) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[baz]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 13 - (55:0,55) - Expression block - Gen - 13 - (55:0,55) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (55:0,55) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (56:0,56) - Tokens:3 - SyntaxKind.Identifier;[DateTime]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Now]; - Markup block - Gen - 2 - (68:0,68) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (68:0,68) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (69:0,69) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (70:0,70) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 23 - (71:0,71) - Markup span - Gen - [ bat='] - SpanEditHandler;Accepts:Any - (71:0,71) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[bat]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 13 - (77:0,77) - Expression block - Gen - 13 - (77:0,77) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (77:0,77) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (78:0,78) - Tokens:3 - SyntaxKind.Identifier;[DateTime]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Now]; - Markup block - Gen - 3 - (90:0,90) - Markup span - Gen - [ @] - SpanEditHandler;Accepts:None - (90:0,90) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (92:0,92) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (93:0,93) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 22 - (94:0,94) - Markup span - Gen - [ zoo='] - SpanEditHandler;Accepts:Any - (94:0,94) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[zoo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 2 - (100:0,100) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (100:0,100) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (101:0,101) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup block - Gen - 13 - (102:0,102) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (102:0,102) - Tokens:1 - SyntaxKind.Unknown;[]; - Expression block - Gen - 13 - (102:0,102) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (102:0,102) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (103:0,103) - Tokens:3 - SyntaxKind.Identifier;[DateTime]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Now]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (115:0,115) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (116:0,116) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (119:0,119) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (119:0,119) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..120)::120 - [{}] + CSharpStatement - [0..120)::120 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..120)::120 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..119)::118 + MarkupBlock - [1..119)::118 + MarkupTagBlock - [1..119)::118 - [] + MarkupTextLiteral - [1..6)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..21)::15 - [ foo='@@@(2+3)'] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [12..20)::8 + MarkupBlock - [12..14)::2 + MarkupTextLiteral - [12..13)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [13..14)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupDynamicAttributeValue - [14..20)::6 - [@(2+3)] + GenericBlock - [14..20)::6 + MarkupTextLiteral - [14..14)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [14..20)::6 + CSharpExplicitExpression - [14..20)::6 + CSharpTransition - [14..15)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [15..20)::5 + RazorMetaCode - [15..16)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [16..19)::3 + CSharpExpressionLiteral - [16..19)::3 - [2+3] - Gen - SpanEditHandler;Accepts:Any + IntegerLiteral;[2]; + Plus;[+]; + IntegerLiteral;[3]; + RazorMetaCode - [19..20)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; + MarkupTextLiteral - [20..21)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupAttributeBlock - [21..49)::28 - [ bar='@(2+3)@@@DateTime.Now'] + MarkupTextLiteral - [21..22)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [22..25)::3 - [bar] - Gen - SpanEditHandler;Accepts:Any + Text;[bar]; + Equals;[=]; + MarkupTextLiteral - [26..27)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [27..48)::21 + MarkupDynamicAttributeValue - [27..33)::6 - [@(2+3)] + GenericBlock - [27..33)::6 + CSharpCodeBlock - [27..33)::6 + CSharpExplicitExpression - [27..33)::6 + CSharpTransition - [27..28)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [28..33)::5 + RazorMetaCode - [28..29)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [29..32)::3 + CSharpExpressionLiteral - [29..32)::3 - [2+3] - Gen - SpanEditHandler;Accepts:Any + IntegerLiteral;[2]; + Plus;[+]; + IntegerLiteral;[3]; + RazorMetaCode - [32..33)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; + MarkupBlock - [33..35)::2 + MarkupTextLiteral - [33..34)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [34..35)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupDynamicAttributeValue - [35..48)::13 - [@DateTime.Now] + GenericBlock - [35..48)::13 + MarkupTextLiteral - [35..35)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [35..48)::13 + CSharpImplicitExpression - [35..48)::13 + CSharpTransition - [35..36)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [36..48)::12 + CSharpCodeBlock - [36..48)::12 + CSharpExpressionLiteral - [36..48)::12 - [DateTime.Now] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[DateTime]; + Dot;[.]; + Identifier;[Now]; + MarkupTextLiteral - [48..49)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupAttributeBlock - [49..71)::22 - [ baz='@DateTime.Now@@'] + MarkupTextLiteral - [49..50)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [50..53)::3 - [baz] - Gen - SpanEditHandler;Accepts:Any + Text;[baz]; + Equals;[=]; + MarkupTextLiteral - [54..55)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [55..70)::15 + MarkupDynamicAttributeValue - [55..68)::13 - [@DateTime.Now] + GenericBlock - [55..68)::13 + CSharpCodeBlock - [55..68)::13 + CSharpImplicitExpression - [55..68)::13 + CSharpTransition - [55..56)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [56..68)::12 + CSharpCodeBlock - [56..68)::12 + CSharpExpressionLiteral - [56..68)::12 - [DateTime.Now] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[DateTime]; + Dot;[.]; + Identifier;[Now]; + MarkupBlock - [68..70)::2 + MarkupTextLiteral - [68..69)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [69..70)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTextLiteral - [70..71)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupAttributeBlock - [71..94)::23 - [ bat='@DateTime.Now @@'] + MarkupTextLiteral - [71..72)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [72..75)::3 - [bat] - Gen - SpanEditHandler;Accepts:Any + Text;[bat]; + Equals;[=]; + MarkupTextLiteral - [76..77)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [77..93)::16 + MarkupDynamicAttributeValue - [77..90)::13 - [@DateTime.Now] + GenericBlock - [77..90)::13 + CSharpCodeBlock - [77..90)::13 + CSharpImplicitExpression - [77..90)::13 + CSharpTransition - [77..78)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [78..90)::12 + CSharpCodeBlock - [78..90)::12 + CSharpExpressionLiteral - [78..90)::12 - [DateTime.Now] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[DateTime]; + Dot;[.]; + Identifier;[Now]; + MarkupBlock - [90..93)::3 + MarkupTextLiteral - [90..92)::2 - [ @] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Transition;[@]; + MarkupEphemeralTextLiteral - [92..93)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTextLiteral - [93..94)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupAttributeBlock - [94..116)::22 - [ zoo='@@@DateTime.Now'] + MarkupTextLiteral - [94..95)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [95..98)::3 - [zoo] - Gen - SpanEditHandler;Accepts:Any + Text;[zoo]; + Equals;[=]; + MarkupTextLiteral - [99..100)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [100..115)::15 + MarkupBlock - [100..102)::2 + MarkupTextLiteral - [100..101)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [101..102)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupDynamicAttributeValue - [102..115)::13 - [@DateTime.Now] + GenericBlock - [102..115)::13 + MarkupTextLiteral - [102..102)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [102..115)::13 + CSharpImplicitExpression - [102..115)::13 + CSharpTransition - [102..103)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [103..115)::12 + CSharpCodeBlock - [103..115)::12 + CSharpExpressionLiteral - [103..115)::12 - [DateTime.Now] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[DateTime]; + Dot;[.]; + Identifier;[Now]; + MarkupTextLiteral - [115..116)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [116..119)::3 - [ />] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + CSharpStatementLiteral - [119..119)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [119..120)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransition_EndOfFile_Throws.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransition_EndOfFile_Throws.stree.txt index f37297146..d9a8d250f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransition_EndOfFile_Throws.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransition_EndOfFile_Throws.stree.txt @@ -1,21 +1,31 @@ -Statement block - Gen - 14 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 13 - (1:0,1) - Tag block - Gen - 13 - (1:0,1) - Markup span - Gen - [ - 2 - (12:0,12) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..14)::14 - [{ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..14)::8 - [ foo='@@] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [12..14)::2 + MarkupBlock - [12..14)::2 + MarkupTextLiteral - [12..13)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [13..14)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTextLiteral - [14..14)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [14..14)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt index 7ba022371..a9904ed71 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt @@ -1,38 +1,54 @@ -Statement block - Gen - 20 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 18 - (1:0,1) - Tag block - Gen - 18 - (1:0,1) - Markup span - Gen - [ - 10 - (6:0,6) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 1 - (12:0,12) - Expression block - Gen - 1 - (12:0,12) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (13:0,13) - Tokens:1 - SyntaxKind.Unknown;[]; - Markup block - Gen - 2 - (13:0,13) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 1 - (14:0,14) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (15:0,15) - Tokens:1 - SyntaxKind.Unknown;[]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..20)::20 - [{}] + CSharpStatement - [0..20)::20 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..20)::20 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..19)::18 + MarkupBlock - [1..19)::18 + MarkupTagBlock - [1..19)::18 - [] + MarkupTextLiteral - [1..6)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [6..16)::10 - [ foo='@ @'] + MarkupTextLiteral - [6..7)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [7..10)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [11..12)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [12..15)::3 + MarkupDynamicAttributeValue - [12..13)::1 - [@] + GenericBlock - [12..13)::1 + CSharpCodeBlock - [12..13)::1 + CSharpImplicitExpression - [12..13)::1 + CSharpTransition - [12..13)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [13..13)::0 + CSharpCodeBlock - [13..13)::0 + CSharpExpressionLiteral - [13..13)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Marker;[]; + MarkupDynamicAttributeValue - [13..15)::2 - [ @] + MarkupTextLiteral - [13..14)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + GenericBlock - [14..15)::1 + CSharpCodeBlock - [14..15)::1 + CSharpImplicitExpression - [14..15)::1 + CSharpTransition - [14..15)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [15..15)::0 + CSharpCodeBlock - [15..15)::0 + CSharpExpressionLiteral - [15..15)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Marker;[]; + MarkupTextLiteral - [15..16)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [16..19)::3 - [ />] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + CSharpStatementLiteral - [19..19)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [19..20)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt deleted file mode 100644 index bc7be6b73..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ /dev/null @@ -1,15 +0,0 @@ -Markup block - Gen - 18 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 18 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:2 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.StringLiteral;["];RZ1000(17:0,17 [1] ) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt deleted file mode 100644 index 7eca75440..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - SyntaxKind.Identifier;[Foo]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt deleted file mode 100644 index 4673d994f..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 16 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - SyntaxKind.StringLiteral;[""]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt deleted file mode 100644 index 70e94ca37..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 14 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - SyntaxKind.Unknown;[]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt deleted file mode 100644 index ac3968136..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 22 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ['*, Foo'] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - SyntaxKind.CharacterLiteral;['*, Foo']; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt deleted file mode 100644 index d135d7804..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 18 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 18 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - SyntaxKind.StringLiteral;["Foo];RZ1000(14:0,14 [1] ) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt deleted file mode 100644 index 2d2db1bc4..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt +++ /dev/null @@ -1,18 +0,0 @@ -Markup block - Gen - 32 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 32 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo, Bar ] - SpanEditHandler;Accepts:AnyExceptNewline - (18:0,18) - Tokens:5 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt deleted file mode 100644 index cfe643e1d..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 19 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - SyntaxKind.StringLiteral;["Foo"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt deleted file mode 100644 index 2e4413ce6..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt +++ /dev/null @@ -1,16 +0,0 @@ -Markup block - Gen - 26 - (0:0,0) - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Directive block - Gen - 24 - (2:1,0) - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (2:1,0) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (4:1,2) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (5:1,3) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (17:1,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["*, Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (18:1,16) - Tokens:1 - SyntaxKind.StringLiteral;["*, Foo"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:1,24) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt deleted file mode 100644 index 6c90f6f46..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt +++ /dev/null @@ -1,16 +0,0 @@ -Markup block - Gen - 28 - (0:0,0) - Markup span - Gen - [{ ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 - SyntaxKind.Text;[{]; - SyntaxKind.Whitespace;[ ]; - Directive block - Gen - 24 - (3:0,3) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (3:0,3) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (4:0,4) - Tokens:1 - SyntaxKind.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["*, Foo"LF] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:2 - SyntaxKind.StringLiteral;["*, Foo"]; - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [}] - SpanEditHandler;Accepts:Any - (27:1,0) - Tokens:1 - SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt deleted file mode 100644 index 6a9b54398..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt +++ /dev/null @@ -1,76 +0,0 @@ -Markup block - Gen - 176 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 176 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [string?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:2 - SyntaxKind.Keyword;[string]; - SyntaxKind.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (15:0,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [string?[]] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (16:0,16) - Tokens:4 - SyntaxKind.Keyword;[string]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.RightBracket;[]]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (25:0,25) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [global::System.Int32?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (26:0,26) - Tokens:6 - SyntaxKind.Identifier;[global]; - SyntaxKind.DoubleColon;[::]; - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Int32]; - SyntaxKind.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (47:0,47) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [KeyValuePair?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (48:0,48) - Tokens:8 - SyntaxKind.Identifier;[KeyValuePair]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (77:0,77) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [KeyValuePair?[]] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (78:0,78) - Tokens:10 - SyntaxKind.Identifier;[KeyValuePair]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.RightBracket;[]]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (109:0,109) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [global::System.Collections.Generic.KeyValuePair?[]] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (110:0,110) - Tokens:18 - SyntaxKind.Identifier;[global]; - SyntaxKind.DoubleColon;[::]; - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Collections]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Generic]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[KeyValuePair]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.RightBracket;[]]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (176:0,176) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt deleted file mode 100644 index 1fca727de..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt +++ /dev/null @@ -1,160 +0,0 @@ -Markup block - Gen - 246 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 246 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [(bool, int)] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:6 - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[bool]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[int]; - SyntaxKind.RightParenthesis;[)]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (19:0,19) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [(int aa, string bb)?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (20:0,20) - Tokens:11 - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[aa]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bb]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (40:0,40) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [( int? q , bool w )] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (41:0,41) - Tokens:14 - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[int]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[q]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[bool]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[w]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightParenthesis;[)]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (70:0,70) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [( int ? q, bool ?w ,(long ? [])) ?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (71:0,71) - Tokens:26 - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[q]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[bool]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Identifier;[w]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Comma;[,]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[long]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (108:0,108) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [(List<(int, string)?> aa, string bb)] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (109:0,109) - Tokens:19 - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[List]; - SyntaxKind.LessThan;[<]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[aa]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bb]; - SyntaxKind.RightParenthesis;[)]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (145:0,145) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [(string ss, (int u, List<(string, int)> k, (Char c, bool b, List l)), global::System.Int32[] a)] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (146:0,146) - Tokens:56 - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[ss]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[u]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[List]; - SyntaxKind.LessThan;[<]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[int]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[k]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Char]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[c]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[bool]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[b]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[List]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Keyword;[int]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[l]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[global]; - SyntaxKind.DoubleColon;[::]; - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Int32]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[a]; - SyntaxKind.RightParenthesis;[)]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (246:0,246) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt deleted file mode 100644 index 36eac56a6..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt +++ /dev/null @@ -1,22 +0,0 @@ -Markup block - Gen - 23 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 23 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [(bool, int?)] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[bool]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[int]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.RightParenthesis;[)]; - None span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (20:0,20) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt deleted file mode 100644 index 5ffe9978b..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt +++ /dev/null @@ -1,26 +0,0 @@ -Markup block - Gen - 67 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 67 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (11:0,11) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (45:0,45) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (52:0,52) - Tokens:1 - SyntaxKind.Identifier;[Some_Member]; - None span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (63:0,63) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (67:0,67) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt deleted file mode 100644 index ee74b316d..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt +++ /dev/null @@ -1,12 +0,0 @@ -Markup block - Gen - 15 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [System.] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - SyntaxKind.Text;[System.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt deleted file mode 100644 index 5ab7bd217..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt +++ /dev/null @@ -1,15 +0,0 @@ -Markup block - Gen - 15 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [System] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - SyntaxKind.Text;[System]; - Tag block - Gen - 1 - (14:0,14) - Markup span - Gen - [<] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt deleted file mode 100644 index 5bc8e3d8b..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt +++ /dev/null @@ -1,13 +0,0 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [System.LF] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 - SyntaxKind.Text;[System.]; - SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt deleted file mode 100644 index 11bce5452..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt +++ /dev/null @@ -1,16 +0,0 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [System] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - SyntaxKind.Text;[System]; - Tag block - Gen - 3 - (14:0,14) - Markup span - Gen - [ - 23 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["hello"]; - None span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (15:0,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - ["world"] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:3 - SyntaxKind.DoubleQuote;["]; - SyntaxKind.Text;[world]; - SyntaxKind.DoubleQuote;["]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt deleted file mode 100644 index e80139ceb..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt +++ /dev/null @@ -1,12 +0,0 @@ -Markup block - Gen - 20 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [-Some_Member] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - SyntaxKind.Text;[-Some_Member]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt deleted file mode 100644 index 8e0af839b..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 15 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 15 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["Hello"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt deleted file mode 100644 index 421836eef..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt +++ /dev/null @@ -1,24 +0,0 @@ -Markup block - Gen - 39 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["Hello"]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [World { foo(); bar(); }] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:9 - SyntaxKind.Text;[World]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo();]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[bar();]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt deleted file mode 100644 index fdf4b27ff..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt +++ /dev/null @@ -1,18 +0,0 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["Hello"]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (16:0,16) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt deleted file mode 100644 index 6c9bc613c..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt +++ /dev/null @@ -1,39 +0,0 @@ -Markup block - Gen - 85 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 44 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (42:0,42) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:1,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 41 - (44:1,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (44:1,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (45:1,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (51:1,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.UTF8Encoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (52:1,8) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[UTF8Encoding]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (85:1,41) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt deleted file mode 100644 index b24cfe018..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt +++ /dev/null @@ -1,39 +0,0 @@ -Markup block - Gen - 85 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 44 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (42:0,42) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:1,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 41 - (44:1,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (44:1,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (45:1,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (51:1,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.UTF8Encoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (52:1,8) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[UTF8Encoding]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (85:1,41) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt deleted file mode 100644 index 50c499246..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt +++ /dev/null @@ -1,33 +0,0 @@ -Markup block - Gen - 59 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 44 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (42:0,42) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:1,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 15 - (44:1,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (44:1,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [something] - SpanEditHandler;Accepts:None - (45:1,1) - Tokens:1 - SyntaxKind.Identifier;[something]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (54:1,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Else] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (55:1,11) - Tokens:1 - SyntaxKind.Identifier;[Else]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (59:1,15) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt deleted file mode 100644 index 52ce24677..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt +++ /dev/null @@ -1,66 +0,0 @@ -Markup block - Gen - 130 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Comment block - Gen - 43 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ There are two directives beneath this ] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ There are two directives beneath this ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (41:0,41) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (42:0,42) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Directive block - Gen - 44 - (45:1,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (45:1,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (46:1,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (52:1,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (53:1,8) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (87:1,42) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (89:2,0) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Directive block - Gen - 17 - (91:3,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (91:3,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [something] - SpanEditHandler;Accepts:None - (92:3,1) - Tokens:1 - SyntaxKind.Identifier;[something]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (101:3,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Else] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (102:3,11) - Tokens:1 - SyntaxKind.Identifier;[Else]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (106:3,15) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (108:4,0) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Tag block - Gen - 3 - (110:5,0) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (126:5,16) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt deleted file mode 100644 index 686fa9221..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt +++ /dev/null @@ -1,20 +0,0 @@ -Markup block - Gen - 19 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["hello"]; - None span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (15:0,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [;] - SpanEditHandler;Accepts:Whitespace - (16:0,16) - Tokens:1 - SyntaxKind.Semicolon;[;]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (17:0,17) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt deleted file mode 100644 index 154f851b0..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 14 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [{foo?}] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:3 - SyntaxKind.Text;[{foo]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt deleted file mode 100644 index e5ebe493a..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt +++ /dev/null @@ -1,13 +0,0 @@ -Markup block - Gen - 16 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [AString"] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 - SyntaxKind.Text;[AString]; - SyntaxKind.DoubleQuote;["]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt deleted file mode 100644 index 32b2606e4..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - ['AString'] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:3 - SyntaxKind.SingleQuote;[']; - SyntaxKind.Text;[AString]; - SyntaxKind.SingleQuote;[']; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt deleted file mode 100644 index 64f9b87bb..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt +++ /dev/null @@ -1,12 +0,0 @@ -Markup block - Gen - 15 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [AString] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - SyntaxKind.Text;[AString]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt deleted file mode 100644 index 337552e7e..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt +++ /dev/null @@ -1,16 +0,0 @@ -Markup block - Gen - 26 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["string1"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["string1"]; - Markup span - Gen - ["string2"] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:3 - SyntaxKind.DoubleQuote;["]; - SyntaxKind.Text;[string2]; - SyntaxKind.DoubleQuote;["]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt deleted file mode 100644 index 4f7ff6b74..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt +++ /dev/null @@ -1,32 +0,0 @@ -Markup block - Gen - 32 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 32 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Name"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["Name"]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (15:0,15) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [ foo(); bar(); ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (16:0,16) - Tokens:11 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt deleted file mode 100644 index 8c7fd5cca..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 19 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.Identifier;[Some_Member]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt deleted file mode 100644 index c42a45462..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt +++ /dev/null @@ -1,28 +0,0 @@ -Markup block - Gen - 64 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 64 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (42:0,42) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (43:0,43) - Tokens:1 - SyntaxKind.Identifier;[Some_Member]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (54:0,54) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["AString"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (55:0,55) - Tokens:1 - SyntaxKind.StringLiteral;["AString"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (64:0,64) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt deleted file mode 100644 index 13a0b22a6..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt +++ /dev/null @@ -1,43 +0,0 @@ -Markup block - Gen - 33 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 33 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Header"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["Header"]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (17:0,17) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 14 - (18:0,18) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (19:0,19) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (33:0,33) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt deleted file mode 100644 index bef10a81c..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["AString"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["AString"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt deleted file mode 100644 index 0947eb9d4..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt +++ /dev/null @@ -1,20 +0,0 @@ -Markup block - Gen - 42 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 42 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (42:0,42) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt deleted file mode 100644 index 5c945ea75..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt +++ /dev/null @@ -1,10 +0,0 @@ -Markup block - Gen - 6 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 6 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [class] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Keyword;[class]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt deleted file mode 100644 index 83ae36a2e..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt +++ /dev/null @@ -1,10 +0,0 @@ -Markup block - Gen - 10 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 10 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [namespace] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Keyword;[namespace]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.stree.txt deleted file mode 100644 index b35ade0d6..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.stree.txt +++ /dev/null @@ -1,18 +0,0 @@ -Markup block - Gen - 14 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[functions]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [ ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt deleted file mode 100644 index 9800bcc8f..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt +++ /dev/null @@ -1,22 +0,0 @@ -Markup block - Gen - 46 - (0:0,0) - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Directive block - Gen - 44 - (2:1,0) - Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (2:1,0) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (4:1,2) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (5:1,3) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (11:1,9) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (12:1,10) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (46:1,44) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt deleted file mode 100644 index 0921a9be4..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt +++ /dev/null @@ -1,23 +0,0 @@ -Markup block - Gen - 48 - (0:0,0) - Markup span - Gen - [{ ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 - SyntaxKind.Text;[{]; - SyntaxKind.Whitespace;[ ]; - Directive block - Gen - 44 - (3:0,3) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (3:0,3) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (4:0,4) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (11:0,11) - Tokens:7 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (45:0,45) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [}] - SpanEditHandler;Accepts:Any - (47:1,0) - Tokens:1 - SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt deleted file mode 100644 index cb7c610d0..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt +++ /dev/null @@ -1,20 +0,0 @@ -Markup block - Gen - 22 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [inherits] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[inherits]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (9:0,9) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [string[[]][]] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (10:0,10) - Tokens:7 - SyntaxKind.Keyword;[string]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.RightBracket;[]]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt deleted file mode 100644 index 9a883699e..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt +++ /dev/null @@ -1,30 +0,0 @@ -Markup block - Gen - 87 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 87 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [inherits] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[inherits]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (9:0,9) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.Web.Mvc.WebViewPage>] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (10:0,10) - Tokens:17 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Web]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Mvc]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[WebViewPage]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Identifier;[IEnumerable]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Identifier;[MvcApplication2]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Models]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[RegisterModel]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.GreaterThan;[>]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (87:0,87) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt deleted file mode 100644 index 5a7bc55b5..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 16 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [inherits] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[inherits]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (9:0,9) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [string] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Keyword;[string]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt deleted file mode 100644 index 937267a11..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt +++ /dev/null @@ -1,12 +0,0 @@ -Markup block - Gen - 8 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt deleted file mode 100644 index a08f88a74..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 29 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 29 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["{formaction}?/{id}?"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["{formaction}?/{id}?"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt deleted file mode 100644 index 7cb6d46f4..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt +++ /dev/null @@ -1,20 +0,0 @@ -Markup block - Gen - 43 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 43 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["{formaction}?/{id}?"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["{formaction}?/{id}?"]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (29:0,29) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [System.String] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (30:0,30) - Tokens:3 - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[String]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt deleted file mode 100644 index 2709d6336..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 22 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["simple-value"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.StringLiteral;["simple-value"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt deleted file mode 100644 index f9f4020e3..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 27 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 27 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [TestDirective] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[TestDirective]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [PropertyName] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (15:0,15) - Tokens:1 - SyntaxKind.Identifier;[PropertyName]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt deleted file mode 100644 index e7a4614bd..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 15 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 15 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [TestDirective] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[TestDirective]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (15:0,15) - Tokens:1 - SyntaxKind.Unknown;[]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.stree.txt deleted file mode 100644 index d6b8dce29..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.stree.txt +++ /dev/null @@ -1,28 +0,0 @@ -Markup block - Gen - 28 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 28 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[functions]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [ foo(); bar(); ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (12:0,12) - Tokens:11 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.stree.txt deleted file mode 100644 index 3a6b35cf2..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.stree.txt +++ /dev/null @@ -1,43 +0,0 @@ -Markup block - Gen - 32 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 32 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[Header]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (16:0,16) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 14 - (17:0,17) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (18:0,18) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt deleted file mode 100644 index 0585c3609..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt +++ /dev/null @@ -1,18 +0,0 @@ -Markup block - Gen - 29 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 29 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [BaseNamespace.Foo.Bar] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:5 - SyntaxKind.Identifier;[BaseNamespace]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Bar]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt deleted file mode 100644 index 446919afd..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 21 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [BaseNamespace] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.Identifier;[BaseNamespace]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt deleted file mode 100644 index 8391cb3f4..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ /dev/null @@ -1,15 +0,0 @@ -Markup block - Gen - 21 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:2 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.StringLiteral;["];RZ1000(20:0,20 [1] ) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt deleted file mode 100644 index c30421dcd..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 20 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.Identifier;[Foo]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt deleted file mode 100644 index 4d2ecdf2a..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 19 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.StringLiteral;[""]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt deleted file mode 100644 index b0b7c8cd3..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt deleted file mode 100644 index edc2c98e6..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 25 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 25 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ['*, Foo'] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.CharacterLiteral;['*, Foo']; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt deleted file mode 100644 index 870c348af..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 21 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt deleted file mode 100644 index fe72198ba..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt +++ /dev/null @@ -1,18 +0,0 @@ -Markup block - Gen - 35 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 35 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo, Bar ] - SpanEditHandler;Accepts:AnyExceptNewline - (21:0,21) - Tokens:5 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt deleted file mode 100644 index 1f0666df2..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 22 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.StringLiteral;["Foo"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt deleted file mode 100644 index 2dbb3eb56..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ /dev/null @@ -1,16 +0,0 @@ -Markup block - Gen - 24 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 24 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo "] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:3 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["];RZ1000(23:0,23 [1] ) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt deleted file mode 100644 index d7a2dd3c6..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 19 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.StringLiteral;[""]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt deleted file mode 100644 index b47f0135f..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt deleted file mode 100644 index ad7e95ee8..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 21 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt deleted file mode 100644 index 8f4da6020..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 20 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.Identifier;[Foo]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt deleted file mode 100644 index 997e4fb95..000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt +++ /dev/null @@ -1,14 +0,0 @@ -Markup block - Gen - 22 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - SyntaxKind.StringLiteral;["Foo"]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode.stree.txt index c7cdd8cb0..b18a8a91e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode.stree.txt @@ -1,5 +1,5 @@ -Statement block - Gen - 17 - (0:0,0) - Code span - Gen - [using LF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..17)::17 - [using LF] + CSharpStatementLiteral - [0..17)::17 - [using LF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[using]; + Whitespace;[ ]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed.stree.txt index 5285577e7..468237491 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed.stree.txt @@ -1,5 +1,10 @@ -Expression block - Gen - 7 - (0:0,0) - Code span - Gen - [Href(LF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:3 - SyntaxKind.Identifier;[Href]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..7)::7 - [Href(LF] + CSharpImplicitExpression - [0..7)::7 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpImplicitExpressionBody - [0..7)::7 + CSharpCodeBlock - [0..7)::7 + CSharpExpressionLiteral - [0..7)::7 - [Href(LF] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[Href]; + LeftParenthesis;[(]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt index 6ef5983ab..2bcf3d8ec 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt @@ -1,17 +1,22 @@ -Expression block - Gen - 46 - (0:0,0) - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [Request["description"] ?? @photo.Description] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:11 - SyntaxKind.Identifier;[Request]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.StringLiteral;["description"]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NullCoalesce;[??]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Transition;[@]; - SyntaxKind.Identifier;[photo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Description]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (45:0,45) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..46)::46 - [(Request["description"] ?? @photo.Description)] + CSharpExplicitExpression - [0..46)::46 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpExplicitExpressionBody - [0..46)::46 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [1..45)::44 + CSharpExpressionLiteral - [1..45)::44 - [Request["description"] ?? @photo.Description] - Gen - SpanEditHandler;Accepts:Any + Identifier;[Request]; + LeftBracket;[[]; + StringLiteral;["description"]; + RightBracket;[]]; + Whitespace;[ ]; + NullCoalesce;[??]; + Whitespace;[ ]; + Transition;[@]; + Identifier;[photo]; + Dot;[.]; + Identifier;[Description]; + RazorMetaCode - [45..46)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt index b55b387ef..d7ce8533b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt @@ -1,45 +1,50 @@ -Statement block - Gen - 64 - (0:0,0) - Code span - Gen - [if(foo) {LF var foo = "foo bar bazLF ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:17 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["foo bar baz];RZ1000(25:1,14 [1] ) - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - Markup block - Gen - 20 - (43:2,4) - Tag block - Gen - 3 - (43:2,4) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:None - (57:2,18) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (61:2,22) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (63:3,0) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..64)::64 - [if(foo) {LF var foo = "foo bar bazLF

Foo is @foo

LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..43)::43 - [if(foo) {LF var foo = "foo bar bazLF ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["foo bar baz];RZ1000(25:1,14 [1] ) + NewLine;[LF]; + Whitespace;[ ]; + MarkupBlock - [43..63)::20 + MarkupTagBlock - [43..46)::3 - [

] + MarkupTextLiteral - [43..46)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [46..53)::7 - [Foo is ] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + Whitespace;[ ]; + Text;[is]; + Whitespace;[ ]; + CSharpCodeBlock - [53..57)::4 + CSharpImplicitExpression - [53..57)::4 + CSharpTransition - [53..54)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [54..57)::3 + CSharpCodeBlock - [54..57)::3 + CSharpExpressionLiteral - [54..57)::3 - [foo] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + MarkupTagBlock - [57..61)::4 - [

] + MarkupTextLiteral - [57..61)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [61..63)::2 - [LF] - Gen - SpanEditHandler;Accepts:None + NewLine;[LF]; + CSharpStatementLiteral - [63..64)::1 - [}] - Gen - SpanEditHandler;Accepts:Any + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode.stree.txt index 0bf190899..5c1e798cb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode.stree.txt @@ -1,24 +1,29 @@ -Statement block - Gen - 29 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [string.Format(] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:4 - SyntaxKind.Keyword;[string]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Format]; - SyntaxKind.LeftParenthesis;[(]; - Markup block - Gen - 13 - (15:0,15) - Tag block - Gen - 6 - (15:0,15) - Markup span - Gen - [] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:3 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.Text;[html]; - SyntaxKind.CloseAngle;[>]; - Tag block - Gen - 7 - (21:0,21) - Markup span - Gen - [] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[html]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (28:0,28) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..29)::29 - [{string.Format(}] + CSharpStatement - [0..29)::29 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..29)::29 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..28)::27 + CSharpStatementLiteral - [1..15)::14 - [string.Format(] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + Keyword;[string]; + Dot;[.]; + Identifier;[Format]; + LeftParenthesis;[(]; + MarkupBlock - [15..28)::13 + MarkupTagBlock - [15..21)::6 - [] + MarkupTextLiteral - [15..21)::6 - [] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[html]; + CloseAngle;[>]; + MarkupTagBlock - [21..28)::7 - [] + MarkupTextLiteral - [21..28)::7 - [] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[html]; + CloseAngle;[>]; + CSharpStatementLiteral - [28..28)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [28..29)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt index 40da231bf..ba1a0451b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 1 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..1)::1 - [@] + CSharpImplicitExpression - [0..1)::1 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..1)::0 + CSharpCodeBlock - [1..1)::0 + CSharpExpressionLiteral - [1..1)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError.stree.txt index 144277679..e8e84a746 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError.stree.txt @@ -1,20 +1,22 @@ -Statement block - Gen - 27 - (0:0,0) - Code span - Gen - [if(foo)) { var bar = foo; }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:18 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..27)::27 - [if(foo)) { var bar = foo; }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..27)::27 - [if(foo)) { var bar = foo; }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[bar]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[foo]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace.stree.txt index 491e28350..783274bd7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace.stree.txt @@ -1,5 +1,12 @@ -Statement block - Gen - 1 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (1:0,1) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..1)::1 - [{] + CSharpStatement - [0..1)::1 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..1)::1 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..1)::0 + CSharpStatementLiteral - [1..1)::0 - [] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL + Marker;[]; + RazorMetaCode - [1..1)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty.stree.txt index 2128b1744..6e07f6a20 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty.stree.txt @@ -1,7 +1,12 @@ -Statement block - Gen - 2 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..2)::2 - [{}] + CSharpStatement - [0..2)::2 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..2)::2 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..1)::0 + CSharpStatementLiteral - [1..1)::0 - [] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + Marker;[]; + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt index 40da231bf..ba1a0451b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 1 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..1)::1 - [@] + CSharpImplicitExpression - [0..1)::1 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..1)::0 + CSharpCodeBlock - [1..1)::0 + CSharpExpressionLiteral - [1..1)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.stree.txt index c80317bc2..484ae4e14 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.stree.txt @@ -1,13 +1,23 @@ -Statement block - Gen - 8 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [LF ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (1:0,1) - Tokens:2 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 1 - (7:1,4) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (7:1,4) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (8:1,5) - Tokens:1 - SyntaxKind.Unknown;[]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (8:1,5) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..8)::8 - [{LF @] + CSharpStatement - [0..8)::8 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..8)::8 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..8)::7 + CSharpStatementLiteral - [1..7)::6 - [LF ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL + NewLine;[LF]; + Whitespace;[ ]; + CSharpCodeBlock - [7..8)::1 + CSharpImplicitExpression - [7..8)::1 + CSharpTransition - [7..8)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [8..8)::0 + CSharpCodeBlock - [8..8)::0 + CSharpExpressionLiteral - [8..8)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 + Marker;[]; + CSharpStatementLiteral - [8..8)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [8..8)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt index 40da231bf..ba1a0451b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 1 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..1)::1 - [@] + CSharpImplicitExpression - [0..1)::1 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..1)::0 + CSharpCodeBlock - [1..1)::0 + CSharpExpressionLiteral - [1..1)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.stree.txt index 3b85ef0e9..202bea6f3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.stree.txt @@ -1,18 +1,26 @@ -Statement block - Gen - 16 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [LF ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:2 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 1 - (7:1,4) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (7:1,4) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (8:1,5) - Tokens:1 - SyntaxKind.Unknown;[]; - Code span - Gen - [ {}LF] - SpanEditHandler;Accepts:Any - (8:1,5) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (15:2,0) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..16)::16 - [{LF @ {}LF}] + CSharpStatement - [0..16)::16 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..16)::16 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..15)::14 + CSharpStatementLiteral - [1..7)::6 - [LF ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + NewLine;[LF]; + Whitespace;[ ]; + CSharpCodeBlock - [7..8)::1 + CSharpImplicitExpression - [7..8)::1 + CSharpTransition - [7..8)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [8..8)::0 + CSharpCodeBlock - [8..8)::0 + CSharpExpressionLiteral - [8..8)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 + Marker;[]; + CSharpStatementLiteral - [8..15)::7 - [ {}LF] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + LeftBrace;[{]; + RightBrace;[}]; + NewLine;[LF]; + RazorMetaCode - [15..16)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart.stree.txt index 87158d029..f7c288d0e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart.stree.txt @@ -1,30 +1,32 @@ -Statement block - Gen - 23 - (0:0,0) - Code span - Gen - [if(foo) {] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 13 - (9:0,9) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:0,10) - Tokens:1 - SyntaxKind.Transition;[@]; - Tag block - Gen - 3 - (11:0,11) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:None - (17:0,17) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..23)::23 - [if(foo) { @

Bar

}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..9)::9 - [if(foo) {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + MarkupBlock - [9..22)::13 + MarkupTextLiteral - [9..10)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTransition - [10..11)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTagBlock - [11..14)::3 - [

] + MarkupTextLiteral - [11..14)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [14..17)::3 - [Bar] - Gen - SpanEditHandler;Accepts:Any + Text;[Bar]; + MarkupTagBlock - [17..21)::4 - [

] + MarkupTextLiteral - [17..21)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [21..22)::1 - [ ] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + CSharpStatementLiteral - [22..23)::1 - [}] - Gen - SpanEditHandler;Accepts:Any + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfCatchBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfCatchBlockUnterminatedAtEOF.stree.txt index 7a8d56805..6346eaedf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfCatchBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfCatchBlockUnterminatedAtEOF.stree.txt @@ -1,47 +1,49 @@ -Statement block - Gen - 70 - (0:0,0) - Code span - Gen - [try { baz(); } catch(Foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:45 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..70)::70 - [try { baz(); } catch(Foo) { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..70)::70 - [try { baz(); } catch(Foo) { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt index 9a606a91a..a8904978f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt @@ -1,36 +1,44 @@ -Directive block - Gen - 54 - (0:0,0) - MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Identifier;[functions]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (10:0,10) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [ var foo = bar; if(foo != null) { bar(); } ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (11:0,11) - Tokens:28 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..54)::54 - [functions { var foo = bar; if(foo != null) { bar(); } ] + RazorDirective - [0..54)::54 - Directive:{functions;CodeBlock;Unrestricted} [RZ1006(10:0,10 [1] )] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + RazorDirectiveBody - [0..54)::54 + RazorMetaCode - [0..9)::9 - Gen - SpanEditHandler;Accepts:None + Identifier;[functions]; + CSharpCodeBlock - [9..54)::45 + MarkupTextLiteral - [9..10)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [10..11)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + CSharpCodeBlock - [11..54)::43 + CSharpStatementLiteral - [11..54)::43 - [ var foo = bar; if(foo != null) { bar(); } ] - Gen - CodeBlockEditHandler;Accepts:Any;CodeBlock + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorMetaCode - [54..54)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfDoBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfDoBlockUnterminatedAtEOF.stree.txt index dffd45efb..d00fd01cb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfDoBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfDoBlockUnterminatedAtEOF.stree.txt @@ -1,33 +1,35 @@ -Statement block - Gen - 47 - (0:0,0) - Code span - Gen - [do { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:31 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..47)::47 - [do { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..47)::47 - [do { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseBlockUnterminatedAtEOF.stree.txt index 1c52331a4..a83c042a6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseBlockUnterminatedAtEOF.stree.txt @@ -1,47 +1,49 @@ -Statement block - Gen - 68 - (0:0,0) - Code span - Gen - [if(foo) { baz(); } else { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:45 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..68)::68 - [if(foo) { baz(); } else { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..68)::68 - [if(foo) { baz(); } else { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseIfBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseIfBlockUnterminatedAtEOF.stree.txt index a37cd6084..b84d16267 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseIfBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseIfBlockUnterminatedAtEOF.stree.txt @@ -1,49 +1,51 @@ -Statement block - Gen - 71 - (0:0,0) - Code span - Gen - [if(foo) { baz(); } else if { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:47 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..71)::71 - [if(foo) { baz(); } else if { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..71)::71 - [if(foo) { baz(); } else if { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF.stree.txt index ed2107e5d..067e43014 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF.stree.txt @@ -1,32 +1,39 @@ -Statement block - Gen - 44 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [ var foo = bar; if(foo != null) { bar(); } ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (1:0,1) - Tokens:28 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..44)::44 - [{ var foo = bar; if(foo != null) { bar(); } ] + CSharpStatement - [0..44)::44 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..44)::44 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..44)::43 + CSharpStatementLiteral - [1..44)::43 - [ var foo = bar; if(foo != null) { bar(); } ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorMetaCode - [44..44)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfFinallyBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfFinallyBlockUnterminatedAtEOF.stree.txt index 96559bd77..acb7cdbca 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfFinallyBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfFinallyBlockUnterminatedAtEOF.stree.txt @@ -1,44 +1,46 @@ -Statement block - Gen - 67 - (0:0,0) - Code span - Gen - [try { baz(); } finally { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:42 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..67)::67 - [try { baz(); } finally { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..67)::67 - [try { baz(); } finally { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[baz]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForBlockUnterminatedAtEOF.stree.txt index d65c73a1b..ec0e99c70 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 54 - (0:0,0) - Code span - Gen - [for (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[for]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..54)::54 - [for (foo) { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..54)::54 - [for (foo) { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[for]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForeachBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForeachBlockUnterminatedAtEOF.stree.txt index 611834ba2..278618718 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForeachBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForeachBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 58 - (0:0,0) - Code span - Gen - [foreach (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[foreach]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..58)::58 - [foreach (foo) { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..58)::58 - [foreach (foo) { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[foreach]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfIfBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfIfBlockUnterminatedAtEOF.stree.txt index 9dcb914c0..570fd4097 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfIfBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfIfBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 53 - (0:0,0) - Code span - Gen - [if (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..53)::53 - [if (foo) { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..53)::53 - [if (foo) { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfLockBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfLockBlockUnterminatedAtEOF.stree.txt index 408980c53..2fdc1d616 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfLockBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfLockBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 55 - (0:0,0) - Code span - Gen - [lock (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[lock]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..55)::55 - [lock (foo) { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..55)::55 - [lock (foo) { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[lock]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfSwitchBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfSwitchBlockUnterminatedAtEOF.stree.txt index c9988fb22..4f7feb247 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfSwitchBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfSwitchBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 57 - (0:0,0) - Code span - Gen - [switch (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[switch]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..57)::57 - [switch (foo) { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..57)::57 - [switch (foo) { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[switch]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfTryBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfTryBlockUnterminatedAtEOF.stree.txt index 29ed508ce..269deab5f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfTryBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfTryBlockUnterminatedAtEOF.stree.txt @@ -1,33 +1,35 @@ -Statement block - Gen - 48 - (0:0,0) - Code span - Gen - [try { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:31 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..48)::48 - [try { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..48)::48 - [try { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfUsingBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfUsingBlockUnterminatedAtEOF.stree.txt index 61ae01586..b18009cd7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfUsingBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfUsingBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 56 - (0:0,0) - Code span - Gen - [using (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..56)::56 - [using (foo) { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..56)::56 - [using (foo) { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[using]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfWhileBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfWhileBlockUnterminatedAtEOF.stree.txt index 21cd2742d..89c336682 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfWhileBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfWhileBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,39 @@ -Statement block - Gen - 56 - (0:0,0) - Code span - Gen - [while (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - SyntaxKind.Keyword;[while]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NotEqual;[!=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[null]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; +CSharpCodeBlock - [0..56)::56 - [while (foo) { var foo = bar; if(foo != null) { bar(); } ] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..56)::56 - [while (foo) { var foo = bar; if(foo != null) { bar(); } ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[while]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + NotEqual;[!=]; + Whitespace;[ ]; + Keyword;[null]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/RequiresControlFlowStatementsToHaveBraces.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/RequiresControlFlowStatementsToHaveBraces.stree.txt index 5e9d2a11b..c73c39fea 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/RequiresControlFlowStatementsToHaveBraces.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/RequiresControlFlowStatementsToHaveBraces.stree.txt @@ -1,66 +1,68 @@ -Statement block - Gen - 58 - (0:0,0) - Code span - Gen - [if(foo) ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:5 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - Markup block - Gen - 11 - (8:0,8) - Tag block - Gen - 3 - (8:0,8) - Markup span - Gen - [

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

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

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

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

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

] - SpanEditHandler;Accepts:None - (54:0,54) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (58:0,58) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..58)::58 - [if(foo)

Bar

else if(bar)

Baz

else

Boz

] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..8)::8 - [if(foo) ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + MarkupBlock - [8..19)::11 + MarkupTagBlock - [8..11)::3 - [

] + MarkupTextLiteral - [8..11)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [11..14)::3 - [Bar] - Gen - SpanEditHandler;Accepts:Any + Text;[Bar]; + MarkupTagBlock - [14..18)::4 - [

] + MarkupTextLiteral - [14..18)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [18..19)::1 - [ ] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + CSharpStatementLiteral - [19..32)::13 - [else if(bar) ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + MarkupBlock - [32..43)::11 + MarkupTagBlock - [32..35)::3 - [

] + MarkupTextLiteral - [32..35)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [35..38)::3 - [Baz] - Gen - SpanEditHandler;Accepts:Any + Text;[Baz]; + MarkupTagBlock - [38..42)::4 - [

] + MarkupTextLiteral - [38..42)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [42..43)::1 - [ ] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + CSharpStatementLiteral - [43..48)::5 - [else ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[else]; + Whitespace;[ ]; + MarkupBlock - [48..58)::10 + MarkupTagBlock - [48..51)::3 - [

] + MarkupTextLiteral - [48..51)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [51..54)::3 - [Boz] - Gen - SpanEditHandler;Accepts:Any + Text;[Boz]; + MarkupTagBlock - [54..58)::4 - [

] + MarkupTextLiteral - [54..58)::4 - [

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

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

] - SpanEditHandler;Accepts:None - (18:1,13) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (22:1,17) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [}] - SpanEditHandler;Accepts:None - (23:1,18) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..24)::24 - [if(LFelse {

Foo

}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..11)::11 - [if(LFelse {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + NewLine;[LF]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + MarkupBlock - [11..23)::12 + MarkupTextLiteral - [11..12)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [12..15)::3 - [

] + MarkupTextLiteral - [12..15)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [15..18)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [18..22)::4 - [

] + MarkupTextLiteral - [18..22)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [22..23)::1 - [ ] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + CSharpStatementLiteral - [23..24)::1 - [}] - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed.stree.txt index 7edce3566..1f0a3bc0e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed.stree.txt @@ -1,12 +1,17 @@ -Expression block - Gen - 22 - (0:0,0) - Code span - Gen - [Foo[Bar[Baz]LFBizLFBoz] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:10 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[Biz]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[Boz]; +CSharpCodeBlock - [0..22)::22 - [Foo[Bar[Baz]LFBizLFBoz] + CSharpImplicitExpression - [0..22)::22 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpImplicitExpressionBody - [0..22)::22 + CSharpCodeBlock - [0..22)::22 + CSharpExpressionLiteral - [0..22)::22 - [Foo[Bar[Baz]LFBizLFBoz] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[Foo]; + LeftBracket;[[]; + Identifier;[Bar]; + LeftBracket;[[]; + Identifier;[Baz]; + RightBracket;[]]; + NewLine;[LF]; + Identifier;[Biz]; + NewLine;[LF]; + Identifier;[Boz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed.stree.txt index 5bc5080b0..766d81299 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed.stree.txt @@ -1,9 +1,16 @@ -Expression block - Gen - 13 - (0:0,0) - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [foo barLFbaz] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:5 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[baz]; +CSharpCodeBlock - [0..13)::13 - [(foo barLFbaz] + CSharpExplicitExpression - [0..13)::13 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpExplicitExpressionBody - [0..13)::13 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [1..13)::12 + CSharpExpressionLiteral - [1..13)::12 - [foo barLFbaz] - Gen - SpanEditHandler;Accepts:Any + Identifier;[foo]; + Whitespace;[ ]; + Identifier;[bar]; + NewLine;[LF]; + Identifier;[baz]; + RazorMetaCode - [13..13)::0 - Gen - SpanEditHandler;Accepts:Any + RightParenthesis;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed.stree.txt index 487be52e9..e23f852f6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed.stree.txt @@ -1,12 +1,17 @@ -Expression block - Gen - 22 - (0:0,0) - Code span - Gen - [Foo(Bar(Baz)LFBizLFBoz] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:10 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[Biz]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[Boz]; +CSharpCodeBlock - [0..22)::22 - [Foo(Bar(Baz)LFBizLFBoz] + CSharpImplicitExpression - [0..22)::22 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpImplicitExpressionBody - [0..22)::22 + CSharpCodeBlock - [0..22)::22 + CSharpExpressionLiteral - [0..22)::22 - [Foo(Bar(Baz)LFBizLFBoz] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[Foo]; + LeftParenthesis;[(]; + Identifier;[Bar]; + LeftParenthesis;[(]; + Identifier;[Baz]; + RightParenthesis;[)]; + NewLine;[LF]; + Identifier;[Biz]; + NewLine;[LF]; + Identifier;[Boz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed.stree.txt index 6f02e88ce..80c61bdee 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed.stree.txt @@ -1,11 +1,16 @@ -Expression block - Gen - 19 - (0:0,0) - Code span - Gen - [Foo[Bar[Baz]LFBizLF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:9 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[Biz]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..19)::19 - [Foo[Bar[Baz]LFBizLF] + CSharpImplicitExpression - [0..19)::19 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpImplicitExpressionBody - [0..19)::19 + CSharpCodeBlock - [0..19)::19 + CSharpExpressionLiteral - [0..19)::19 - [Foo[Bar[Baz]LFBizLF] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[Foo]; + LeftBracket;[[]; + Identifier;[Bar]; + LeftBracket;[[]; + Identifier;[Baz]; + RightBracket;[]]; + NewLine;[LF]; + Identifier;[Biz]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed.stree.txt index 526cc8c99..783b2be03 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed.stree.txt @@ -1,8 +1,15 @@ -Expression block - Gen - 10 - (0:0,0) - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [foo barLF] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:4 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..10)::10 - [(foo barLF] + CSharpExplicitExpression - [0..10)::10 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpExplicitExpressionBody - [0..10)::10 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [1..10)::9 + CSharpExpressionLiteral - [1..10)::9 - [foo barLF] - Gen - SpanEditHandler;Accepts:Any + Identifier;[foo]; + Whitespace;[ ]; + Identifier;[bar]; + NewLine;[LF]; + RazorMetaCode - [10..10)::0 - Gen - SpanEditHandler;Accepts:Any + RightParenthesis;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed.stree.txt index 74a5b4d8e..87fcb7b68 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed.stree.txt @@ -1,11 +1,16 @@ -Expression block - Gen - 19 - (0:0,0) - Code span - Gen - [Foo(Bar(Baz)LFBizLF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:9 - SyntaxKind.Identifier;[Foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[Biz]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..19)::19 - [Foo(Bar(Baz)LFBizLF] + CSharpImplicitExpression - [0..19)::19 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpImplicitExpressionBody - [0..19)::19 + CSharpCodeBlock - [0..19)::19 + CSharpExpressionLiteral - [0..19)::19 - [Foo(Bar(Baz)LFBizLF] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[Foo]; + LeftParenthesis;[(]; + Identifier;[Bar]; + LeftParenthesis;[(]; + Identifier;[Baz]; + RightParenthesis;[)]; + NewLine;[LF]; + Identifier;[Biz]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt index 4ea2cc9be..70277e63f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt @@ -1,8 +1,10 @@ -Statement block - Gen - 17 - (0:0,0) - Code span - Gen - [foreach(foo barLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - SyntaxKind.Keyword;[foreach]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..17)::17 - [foreach(foo barLF] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..17)::17 - [foreach(foo barLF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[foreach]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + Identifier;[bar]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt index 2fb112fac..48e421bb1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt @@ -1,8 +1,10 @@ -Statement block - Gen - 12 - (0:0,0) - Code span - Gen - [if(foo barLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..12)::12 - [if(foo barLF] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..12)::12 - [if(foo barLF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + Identifier;[bar]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing.stree.txt index c8a7548e0..4239af888 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing.stree.txt @@ -1,21 +1,23 @@ -Statement block - Gen - 41 - (0:0,0) - Code span - Gen - [if(foo) {LF var p = "foo bar bazLF;LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:19 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[p]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["foo bar baz];RZ1000(23:1,12 [1] ) - SyntaxKind.NewLine;[LF]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..41)::41 - [if(foo) {LF var p = "foo bar bazLF;LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..41)::41 - [if(foo) {LF var p = "foo bar bazLF;LF}] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[p]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["foo bar baz];RZ1000(23:1,12 [1] ) + NewLine;[LF]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalStringAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalStringAtEndOfFile.stree.txt index 5626bc015..8d5349ea5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalStringAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalStringAtEndOfFile.stree.txt @@ -1,16 +1,18 @@ -Statement block - Gen - 45 - (0:0,0) - Code span - Gen - [if(foo) { var foo = "blah blah blah blah blah] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.StringLiteral;["blah blah blah blah blah];RZ1000(20:0,20 [1] ) +CSharpCodeBlock - [0..45)::45 - [if(foo) { var foo = "blah blah blah blah blah] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..45)::45 - [if(foo) { var foo = "blah blah blah blah blah] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["blah blah blah blah blah];RZ1000(20:0,20 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt index cb18b098c..4364777d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt @@ -1,8 +1,10 @@ -Statement block - Gen - 15 - (0:0,0) - Code span - Gen - [using(foo barLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - SyntaxKind.Keyword;[using]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..15)::15 - [using(foo barLF] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..15)::15 - [using(foo barLF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[using]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + Identifier;[bar]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesVerbatimStringAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesVerbatimStringAtEndOfFile.stree.txt index e3dff85a7..6de37b9ca 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesVerbatimStringAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesVerbatimStringAtEndOfFile.stree.txt @@ -1,16 +1,18 @@ -Statement block - Gen - 60 - (0:0,0) - Code span - Gen - [if(foo) { var foo = @"blah LFblah; LF

Foo

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

Foo

LFblah LFblah];RZ1000(20:0,20 [1] ) +CSharpCodeBlock - [0..60)::60 - [if(foo) { var foo = @"blah LFblah; LF

Foo

LFblah LFblah] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..60)::60 - [if(foo) { var foo = @"blah LFblah; LF

Foo

LFblah LFblah] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;[@"blah LFblah; LF

Foo

LFblah LFblah];RZ1000(20:0,20 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen.stree.txt index 995a7e16d..d9a531912 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen.stree.txt @@ -1,14 +1,16 @@ -Statement block - Gen - 22 - (0:0,0) - Code span - Gen - [do { } while(foo barLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:12 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.NewLine;[LF]; +CSharpCodeBlock - [0..22)::22 - [do { } while(foo barLF] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..22)::22 - [do { } while(foo barLF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[while]; + LeftParenthesis;[(]; + Identifier;[foo]; + Whitespace;[ ]; + Identifier;[bar]; + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt index 933270de6..9f58fb8d4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 7 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [helper] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[helper]; +CSharpCodeBlock - [0..7)::7 - [@helper] + CSharpImplicitExpression - [0..7)::7 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..7)::6 + CSharpCodeBlock - [1..7)::6 + CSharpExpressionLiteral - [1..7)::6 - [helper] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[helper]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithNestedCodeBlockProducesError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithNestedCodeBlockProducesError.stree.txt index c4e84ca78..cd9063b5d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithNestedCodeBlockProducesError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithNestedCodeBlockProducesError.stree.txt @@ -1,20 +1,23 @@ -Statement block - Gen - 11 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [if { ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:4 - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Statement block - Gen - 3 - (6:0,6) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (7:0,7) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (8:0,8) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (8:0,8) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..11)::11 - [@if { @{} }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..6)::5 - [if { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [6..9)::3 + CSharpStatement - [6..9)::3 + CSharpTransition - [6..7)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementBody - [7..9)::2 + RazorMetaCode - [7..8)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [8..8)::0 + CSharpStatementLiteral - [8..8)::0 - [] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + Marker;[]; + RazorMetaCode - [8..9)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + CSharpStatementLiteral - [9..11)::2 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings.stree.txt index 23eb18e37..f49a76b02 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 9 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - ["\"\""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.StringLiteral;["\"\""]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (8:0,8) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..9)::9 - [@("\"\"")] + CSharpExplicitExpression - [0..9)::9 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..9)::8 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..8)::6 + CSharpExpressionLiteral - [2..8)::6 - ["\"\""] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;["\"\""]; + RazorMetaCode - [8..9)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings.stree.txt index 6b9fcb719..e69f9b164 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 10 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [@""""""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.StringLiteral;[@""""""]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (9:0,9) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..10)::10 - [@(@"""""")] + CSharpExplicitExpression - [0..10)::10 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..10)::9 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..9)::7 + CSharpExpressionLiteral - [2..9)::7 - [@""""""] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;[@""""""]; + RazorMetaCode - [9..10)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInNonVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInNonVerbatimStrings.stree.txt index f0cd49458..c06f7074d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInNonVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInNonVerbatimStrings.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 7 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - ["\""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.StringLiteral;["\""]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..7)::7 - [@("\"")] + CSharpExplicitExpression - [0..7)::7 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..7)::6 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..6)::4 + CSharpExpressionLiteral - [2..6)::4 - ["\""] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;["\""]; + RazorMetaCode - [6..7)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInVerbatimStrings.stree.txt index 302eae7f8..cd3c0cbcf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInVerbatimStrings.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [@""""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.StringLiteral;[@""""]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (7:0,7) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..8)::8 - [@(@"""")] + CSharpExplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..8)::7 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..7)::5 + CSharpExpressionLiteral - [2..7)::5 - [@""""] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;[@""""]; + RazorMetaCode - [7..8)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultiLineVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultiLineVerbatimStrings.stree.txt index 031978a70..37413cbf1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultiLineVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultiLineVerbatimStrings.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 23 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [@"LFFooLFBarLFBazLF"] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.StringLiteral;[@"LFFooLFBarLFBazLF"]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (22:4,1) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..23)::23 - [@(@"LFFooLFBarLFBazLF")] + CSharpExplicitExpression - [0..23)::23 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..23)::22 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..22)::20 + CSharpExpressionLiteral - [2..22)::20 - [@"LFFooLFBarLFBazLF"] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;[@"LFFooLFBarLFBazLF"]; + RazorMetaCode - [22..23)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings.stree.txt index 196693b74..34c432a1d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - ["\"hello, world\""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.StringLiteral;["\"hello, world\""]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..21)::21 - [@("\"hello, world\"")] + CSharpExplicitExpression - [0..21)::21 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..21)::20 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..20)::18 + CSharpExpressionLiteral - [2..20)::18 - ["\"hello, world\""] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;["\"hello, world\""]; + RazorMetaCode - [20..21)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInVerbatimStrings.stree.txt index 3db6a694d..0f798f47a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInVerbatimStrings.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [@"""hello, world"""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.StringLiteral;[@"""hello, world"""]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..22)::22 - [@(@"""hello, world""")] + CSharpExplicitExpression - [0..22)::22 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..22)::21 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..21)::19 + CSharpExpressionLiteral - [2..21)::19 - [@"""hello, world"""] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;[@"""hello, world"""]; + RazorMetaCode - [21..22)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings.stree.txt index 6b9fcb719..e69f9b164 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 10 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [@""""""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.StringLiteral;[@""""""]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (9:0,9) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..10)::10 - [@(@"""""")] + CSharpExplicitExpression - [0..10)::10 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..10)::9 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..9)::7 + CSharpExpressionLiteral - [2..9)::7 - [@""""""] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;[@""""""]; + RazorMetaCode - [9..10)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr.stree.txt index 796bf6930..7d069c8af 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr.stree.txt @@ -1,7 +1,12 @@ -Expression block - Gen - 2 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..2)::2 - [@(] + CSharpExplicitExpression - [0..2)::2 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..2)::1 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..2)::0 + CSharpExpressionLiteral - [2..2)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [2..2)::0 - Gen - SpanEditHandler;Accepts:Any + RightParenthesis;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty.stree.txt index 86c59ee8d..ef8d7b9f4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 3 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (2:0,2) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..3)::3 - [@()] + CSharpExplicitExpression - [0..3)::3 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [1..3)::2 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [2..2)::0 + CSharpExpressionLiteral - [2..2)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [2..3)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt index c833af2ae..dc6218dac 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [हळूँजद॔] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[हळूँजद॔]; +CSharpCodeBlock - [0..8)::8 - [@हळूँजद॔] + CSharpImplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..8)::7 + CSharpCodeBlock - [1..8)::7 + CSharpExpressionLiteral - [1..8)::7 - [हळूँजद॔] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[हळूँजद॔]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.stree.txt index d6126280d..fae52862a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[foo]; +CSharpCodeBlock - [0..4)::4 - [@foo] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [foo] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.stree.txt index ece2fdbfe..330a241ef 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; +CSharpCodeBlock - [0..8)::8 - [@foo.bar] + CSharpImplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..8)::7 + CSharpCodeBlock - [1..8)::7 + CSharpExpressionLiteral - [1..8)::7 - [foo.bar] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.stree.txt index ece2fdbfe..330a241ef 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; +CSharpCodeBlock - [0..8)::8 - [@foo.bar] + CSharpImplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..8)::7 + CSharpCodeBlock - [1..8)::7 + CSharpExpressionLiteral - [1..8)::7 - [foo.bar] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.stree.txt index ece2fdbfe..330a241ef 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; +CSharpCodeBlock - [0..8)::8 - [@foo.bar] + CSharpImplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..8)::7 + CSharpCodeBlock - [1..8)::7 + CSharpExpressionLiteral - [1..8)::7 - [foo.bar] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.stree.txt index ece2fdbfe..330a241ef 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; +CSharpCodeBlock - [0..8)::8 - [@foo.bar] + CSharpImplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..8)::7 + CSharpCodeBlock - [1..8)::7 + CSharpExpressionLiteral - [1..8)::7 - [foo.bar] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.stree.txt index 9b751618b..14504470e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 12 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[baz]; +CSharpCodeBlock - [0..12)::12 - [@foo.bar.baz] + CSharpImplicitExpression - [0..12)::12 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..12)::11 + CSharpCodeBlock - [1..12)::11 + CSharpExpressionLiteral - [1..12)::11 - [foo.bar.baz] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; + Dot;[.]; + Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt index d6126280d..fae52862a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[foo]; +CSharpCodeBlock - [0..4)::4 - [@foo] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [foo] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.stree.txt index f7400b963..3c07560c0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.stree.txt @@ -1,18 +1,23 @@ -Statement block - Gen - 18 - (0:0,0) - Code span - Gen - [if (true) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:8 - SyntaxKind.Keyword;[if]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 4 - (12:0,12) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (13:0,13) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..18)::18 - [if (true) { @foo }] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..12)::12 - [if (true) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [12..16)::4 + CSharpImplicitExpression - [12..16)::4 + CSharpTransition - [12..13)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [13..16)::3 + CSharpCodeBlock - [13..16)::3 + CSharpExpressionLiteral - [13..16)::3 - [foo] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 + Identifier;[foo]; + CSharpStatementLiteral - [16..18)::2 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt index 92f959c82..1bd76d3d0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 13 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [module.foo()] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - SyntaxKind.Identifier;[module]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..13)::13 - [@module.foo()] + CSharpImplicitExpression - [0..13)::13 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..13)::12 + CSharpCodeBlock - [1..13)::12 + CSharpExpressionLiteral - [1..13)::12 - [module.foo()] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[module]; + Dot;[.]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.stree.txt index 40da231bf..ba1a0451b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 1 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..1)::1 - [@] + CSharpImplicitExpression - [0..1)::1 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..1)::0 + CSharpCodeBlock - [1..1)::0 + CSharpExpressionLiteral - [1..1)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.stree.txt index 40da231bf..ba1a0451b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 1 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..1)::1 - [@] + CSharpImplicitExpression - [0..1)::1 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..1)::0 + CSharpCodeBlock - [1..1)::0 + CSharpExpressionLiteral - [1..1)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.stree.txt index 9b751618b..14504470e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 12 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[baz]; +CSharpCodeBlock - [0..12)::12 - [@foo.bar.baz] + CSharpImplicitExpression - [0..12)::12 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..12)::11 + CSharpCodeBlock - [1..12)::11 + CSharpExpressionLiteral - [1..12)::11 - [foo.bar.baz] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; + Dot;[.]; + Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.stree.txt index bf5897cfb..e0ab082b4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.stree.txt @@ -1,10 +1,13 @@ -Expression block - Gen - 9 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[-1]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:6 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Minus;[-]; - SyntaxKind.IntegerLiteral;[1]; - SyntaxKind.RightBracket;[]]; +CSharpCodeBlock - [0..9)::9 - [@val?[-1]] + CSharpImplicitExpression - [0..9)::9 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..9)::8 + CSharpCodeBlock - [1..9)::8 + CSharpExpressionLiteral - [1..9)::8 - [val?[-1]] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Minus;[-]; + IntegerLiteral;[1]; + RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket11.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket11.stree.txt index 646f168e3..dfc4db003 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket11.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket11.stree.txt @@ -1,12 +1,15 @@ -Expression block - Gen - 15 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[abc]?[def] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:8 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[abc]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[def]; +CSharpCodeBlock - [0..15)::15 - [@val?[abc]?[def] + CSharpImplicitExpression - [0..15)::15 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..15)::14 + CSharpCodeBlock - [1..15)::14 + CSharpExpressionLiteral - [1..15)::14 - [val?[abc]?[def] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[abc]; + RightBracket;[]]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[def]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt index fdeae1b84..37ae5f334 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt @@ -1,13 +1,16 @@ -Expression block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[abc]?[2]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[abc]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.IntegerLiteral;[2]; - SyntaxKind.RightBracket;[]]; +CSharpCodeBlock - [0..14)::14 - [@val?[abc]?[2]] + CSharpImplicitExpression - [0..14)::14 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..14)::13 + CSharpCodeBlock - [1..14)::13 + CSharpExpressionLiteral - [1..14)::13 - [val?[abc]?[2]] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[abc]; + RightBracket;[]]; + QuestionMark;[?]; + LeftBracket;[[]; + IntegerLiteral;[2]; + RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt index 6095a9ffe..12942f3d7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt @@ -1,16 +1,19 @@ -Expression block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[abc]?.more?[def]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:12 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[abc]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[more]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[def]; - SyntaxKind.RightBracket;[]]; +CSharpCodeBlock - [0..22)::22 - [@val?[abc]?.more?[def]] + CSharpImplicitExpression - [0..22)::22 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..22)::21 + CSharpCodeBlock - [1..22)::21 + CSharpExpressionLiteral - [1..22)::21 - [val?[abc]?.more?[def]] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[abc]; + RightBracket;[]]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[more]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[def]; + RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt index 051795396..ee022171e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt @@ -1,15 +1,18 @@ -Expression block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[abc]?.more?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:11 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[abc]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[more]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[abc]; +CSharpCodeBlock - [0..21)::21 - [@val?[abc]?.more?.abc] + CSharpImplicitExpression - [0..21)::21 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..21)::20 + CSharpCodeBlock - [1..21)::20 + CSharpExpressionLiteral - [1..21)::20 - [val?[abc]?.more?.abc] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[abc]; + RightBracket;[]]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[more]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[abc]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt index da502209c..1cfcda0fd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt @@ -1,13 +1,16 @@ -Expression block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[null ?? true]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Keyword;[null]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NullCoalesce;[??]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightBracket;[]]; +CSharpCodeBlock - [0..19)::19 - [@val?[null ?? true]] + CSharpImplicitExpression - [0..19)::19 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..19)::18 + CSharpCodeBlock - [1..19)::18 + CSharpExpressionLiteral - [1..19)::18 - [val?[null ?? true]] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Keyword;[null]; + Whitespace;[ ]; + NullCoalesce;[??]; + Whitespace;[ ]; + Keyword;[true]; + RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt index e30c74d59..d6fb60a93 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt @@ -1,17 +1,20 @@ -Expression block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[abc?.gef?[-1]]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:13 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[abc]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[gef]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Minus;[-]; - SyntaxKind.IntegerLiteral;[1]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.RightBracket;[]]; +CSharpCodeBlock - [0..20)::20 - [@val?[abc?.gef?[-1]]] + CSharpImplicitExpression - [0..20)::20 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..20)::19 + CSharpCodeBlock - [1..20)::19 + CSharpExpressionLiteral - [1..20)::19 - [val?[abc?.gef?[-1]]] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[abc]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[gef]; + QuestionMark;[?]; + LeftBracket;[[]; + Minus;[-]; + IntegerLiteral;[1]; + RightBracket;[]]; + RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket3.stree.txt index c0e4634e0..5de915db6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket3.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 6 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; +CSharpCodeBlock - [0..6)::6 - [@val?[] + CSharpImplicitExpression - [0..6)::6 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..6)::5 + CSharpCodeBlock - [1..6)::5 + CSharpExpressionLiteral - [1..6)::5 - [val?[] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket5.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket5.stree.txt index 0fc1f37ef..c588b9550 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket5.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket5.stree.txt @@ -1,8 +1,11 @@ -Expression block - Gen - 10 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[more] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[more]; +CSharpCodeBlock - [0..10)::10 - [@val?[more] + CSharpImplicitExpression - [0..10)::10 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..10)::9 + CSharpCodeBlock - [1..10)::9 + CSharpExpressionLiteral - [1..10)::9 - [val?[more] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[more]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt index ae96d51b0..26101c41b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[0]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.RightBracket;[]]; +CSharpCodeBlock - [0..8)::8 - [@val?[0]] + CSharpImplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..8)::7 + CSharpCodeBlock - [1..8)::7 + CSharpExpressionLiteral - [1..8)::7 - [val?[0]] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + IntegerLiteral;[0]; + RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket7.stree.txt index c0e4634e0..5de915db6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket7.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 6 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; +CSharpCodeBlock - [0..6)::6 - [@val?[] + CSharpImplicitExpression - [0..6)::6 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..6)::5 + CSharpCodeBlock - [1..6)::5 + CSharpExpressionLiteral - [1..6)::5 - [val?[] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket8.stree.txt index c58999c69..2c87b8e47 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket8.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 11 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?[more.] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.Identifier;[more]; - SyntaxKind.Dot;[.]; +CSharpCodeBlock - [0..11)::11 - [@val?[more.] + CSharpImplicitExpression - [0..11)::11 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..11)::10 + CSharpCodeBlock - [1..11)::10 + CSharpExpressionLiteral - [1..11)::10 - [val?[more.] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + LeftBracket;[[]; + Identifier;[more]; + Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.stree.txt index ac416a728..6e31b6d80 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.stree.txt @@ -1,8 +1,11 @@ -Expression block - Gen - 10 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?.more] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[more]; +CSharpCodeBlock - [0..10)::10 - [@val?.more] + CSharpImplicitExpression - [0..10)::10 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..10)::9 + CSharpCodeBlock - [1..10)::9 + CSharpExpressionLiteral - [1..10)::9 - [val?.more] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[more]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.stree.txt index bacea444e..918469033 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.stree.txt @@ -1,13 +1,16 @@ -Expression block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?.more(false)?.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[more]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; +CSharpCodeBlock - [0..19)::19 - [@val?.more(false)?.] + CSharpImplicitExpression - [0..19)::19 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..19)::18 + CSharpCodeBlock - [1..19)::18 + CSharpExpressionLiteral - [1..19)::18 - [val?.more(false)?.] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[more]; + LeftParenthesis;[(]; + Keyword;[false]; + RightParenthesis;[)]; + QuestionMark;[?]; + Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt index aa043d3d7..569911dae 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt @@ -1,14 +1,17 @@ -Expression block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?.more(false)?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:10 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[more]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[abc]; +CSharpCodeBlock - [0..22)::22 - [@val?.more(false)?.abc] + CSharpImplicitExpression - [0..22)::22 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..22)::21 + CSharpCodeBlock - [1..22)::21 + CSharpExpressionLiteral - [1..22)::21 - [val?.more(false)?.abc] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[more]; + LeftParenthesis;[(]; + Keyword;[false]; + RightParenthesis;[)]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[abc]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt index 1aec90588..f7d7e07ff 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt @@ -1,18 +1,21 @@ -Expression block - Gen - 29 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?.more(null ?? true)?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:14 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[more]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[null]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NullCoalesce;[??]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[abc]; +CSharpCodeBlock - [0..29)::29 - [@val?.more(null ?? true)?.abc] + CSharpImplicitExpression - [0..29)::29 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..29)::28 + CSharpCodeBlock - [1..29)::28 + CSharpExpressionLiteral - [1..29)::28 - [val?.more(null ?? true)?.abc] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[more]; + LeftParenthesis;[(]; + Keyword;[null]; + Whitespace;[ ]; + NullCoalesce;[??]; + Whitespace;[ ]; + Keyword;[true]; + RightParenthesis;[)]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[abc]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.stree.txt index f71f1f7ae..c65efbf47 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 6 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; +CSharpCodeBlock - [0..6)::6 - [@val?.] + CSharpImplicitExpression - [0..6)::6 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..6)::5 + CSharpCodeBlock - [1..6)::5 + CSharpExpressionLiteral - [1..6)::5 - [val?.] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.stree.txt index b18c1f269..d192fdd05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[val]; +CSharpCodeBlock - [0..4)::4 - [@val] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [val] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.stree.txt index f71f1f7ae..c65efbf47 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 6 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; +CSharpCodeBlock - [0..6)::6 - [@val?.] + CSharpImplicitExpression - [0..6)::6 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..6)::5 + CSharpCodeBlock - [1..6)::5 + CSharpExpressionLiteral - [1..6)::5 - [val?.] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.stree.txt index f71f1f7ae..c65efbf47 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 6 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; +CSharpCodeBlock - [0..6)::6 - [@val?.] + CSharpImplicitExpression - [0..6)::6 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..6)::5 + CSharpCodeBlock - [1..6)::5 + CSharpExpressionLiteral - [1..6)::5 - [val?.] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.stree.txt index ac416a728..6e31b6d80 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.stree.txt @@ -1,8 +1,11 @@ -Expression block - Gen - 10 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [val?.more] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 - SyntaxKind.Identifier;[val]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[more]; +CSharpCodeBlock - [0..10)::10 - [@val?.more] + CSharpImplicitExpression - [0..10)::10 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..10)::9 + CSharpCodeBlock - [1..10)::9 + CSharpExpressionLiteral - [1..10)::9 - [val?.more] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[val]; + QuestionMark;[?]; + Dot;[.]; + Identifier;[more]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.stree.txt index d6126280d..fae52862a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[foo]; +CSharpCodeBlock - [0..4)::4 - [@foo] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [foo] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.stree.txt index 4a48ef8c5..5fd275a68 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.stree.txt @@ -1,25 +1,28 @@ -Expression block - Gen - 34 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar[4 * (8 + 7)]["fo\"o"].baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:21 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.IntegerLiteral;[4]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Star;[*]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.IntegerLiteral;[8]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Plus;[+]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[7]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.StringLiteral;["fo\"o"]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[baz]; +CSharpCodeBlock - [0..34)::34 - [@foo.bar[4 * (8 + 7)]["fo\"o"].baz] + CSharpImplicitExpression - [0..34)::34 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..34)::33 + CSharpCodeBlock - [1..34)::33 + CSharpExpressionLiteral - [1..34)::33 - [foo.bar[4 * (8 + 7)]["fo\"o"].baz] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; + LeftBracket;[[]; + IntegerLiteral;[4]; + Whitespace;[ ]; + Star;[*]; + Whitespace;[ ]; + LeftParenthesis;[(]; + IntegerLiteral;[8]; + Whitespace;[ ]; + Plus;[+]; + Whitespace;[ ]; + IntegerLiteral;[7]; + RightParenthesis;[)]; + RightBracket;[]]; + LeftBracket;[[]; + StringLiteral;["fo\"o"]; + RightBracket;[]]; + Dot;[.]; + Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt index 24c0b3ea5..f5a664425 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt @@ -1,63 +1,66 @@ -Expression block - Gen - 115 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo().bar("bi\"z", 4)("chained method; call").baz(@"bo""z", '\'', () => { return 4; }, (4+5+new { foo = bar[4] }))] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:59 - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;["bi\"z"]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[4]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;["chained method; call"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;[@"bo""z"]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CharacterLiteral;['\'']; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.GreaterThanEqual;[=>]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[return]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[4]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.IntegerLiteral;[4]; - SyntaxKind.Plus;[+]; - SyntaxKind.IntegerLiteral;[5]; - SyntaxKind.Plus;[+]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftBracket;[[]; - SyntaxKind.IntegerLiteral;[4]; - SyntaxKind.RightBracket;[]]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..115)::115 - [@foo().bar("bi\"z", 4)("chained method; call").baz(@"bo""z", '\'', () => { return 4; }, (4+5+new { foo = bar[4] }))] + CSharpImplicitExpression - [0..115)::115 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..115)::114 + CSharpCodeBlock - [1..115)::114 + CSharpExpressionLiteral - [1..115)::114 - [foo().bar("bi\"z", 4)("chained method; call").baz(@"bo""z", '\'', () => { return 4; }, (4+5+new { foo = bar[4] }))] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Dot;[.]; + Identifier;[bar]; + LeftParenthesis;[(]; + StringLiteral;["bi\"z"]; + Comma;[,]; + Whitespace;[ ]; + IntegerLiteral;[4]; + RightParenthesis;[)]; + LeftParenthesis;[(]; + StringLiteral;["chained method; call"]; + RightParenthesis;[)]; + Dot;[.]; + Identifier;[baz]; + LeftParenthesis;[(]; + StringLiteral;[@"bo""z"]; + Comma;[,]; + Whitespace;[ ]; + CharacterLiteral;['\'']; + Comma;[,]; + Whitespace;[ ]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Whitespace;[ ]; + GreaterThanEqual;[=>]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Keyword;[return]; + Whitespace;[ ]; + IntegerLiteral;[4]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Comma;[,]; + Whitespace;[ ]; + LeftParenthesis;[(]; + IntegerLiteral;[4]; + Plus;[+]; + IntegerLiteral;[5]; + Plus;[+]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + LeftBracket;[[]; + IntegerLiteral;[4]; + RightBracket;[]]; + Whitespace;[ ]; + RightBrace;[}]; + RightParenthesis;[)]; + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/StopsBalancingParenthesesAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/StopsBalancingParenthesesAtEOF.stree.txt index 11fbcd48b..aa7e5347d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/StopsBalancingParenthesesAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/StopsBalancingParenthesesAtEOF.stree.txt @@ -1,8 +1,11 @@ -Expression block - Gen - 7 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo(()] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..7)::7 - [@foo(()] + CSharpImplicitExpression - [0..7)::7 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..7)::6 + CSharpCodeBlock - [1..7)::6 + CSharpExpressionLiteral - [1..7)::6 - [foo(()] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[foo]; + LeftParenthesis;[(]; + LeftParenthesis;[(]; + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt index 1d0244fc8..2154a5e70 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt @@ -1,39 +1,42 @@ -Expression block - Gen - 103 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [DataGridColumn.Template("Years of Service", e => (int)Math.Round((DateTime.Now - dt).TotalDays / 365))] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:35 - SyntaxKind.Identifier;[DataGridColumn]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Template]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;["Years of Service"]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[e]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.GreaterThanEqual;[=>]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Identifier;[Math]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Round]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[DateTime]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Now]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Minus;[-]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[dt]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[TotalDays]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Slash;[/]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[365]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..103)::103 - [@DataGridColumn.Template("Years of Service", e => (int)Math.Round((DateTime.Now - dt).TotalDays / 365))] + CSharpImplicitExpression - [0..103)::103 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..103)::102 + CSharpCodeBlock - [1..103)::102 + CSharpExpressionLiteral - [1..103)::102 - [DataGridColumn.Template("Years of Service", e => (int)Math.Round((DateTime.Now - dt).TotalDays / 365))] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[DataGridColumn]; + Dot;[.]; + Identifier;[Template]; + LeftParenthesis;[(]; + StringLiteral;["Years of Service"]; + Comma;[,]; + Whitespace;[ ]; + Identifier;[e]; + Whitespace;[ ]; + GreaterThanEqual;[=>]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[int]; + RightParenthesis;[)]; + Identifier;[Math]; + Dot;[.]; + Identifier;[Round]; + LeftParenthesis;[(]; + LeftParenthesis;[(]; + Identifier;[DateTime]; + Dot;[.]; + Identifier;[Now]; + Whitespace;[ ]; + Minus;[-]; + Whitespace;[ ]; + Identifier;[dt]; + RightParenthesis;[)]; + Dot;[.]; + Identifier;[TotalDays]; + Whitespace;[ ]; + Slash;[/]; + Whitespace;[ ]; + IntegerLiteral;[365]; + RightParenthesis;[)]; + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt index ece2fdbfe..330a241ef 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt @@ -1,7 +1,10 @@ -Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; +CSharpCodeBlock - [0..8)::8 - [@foo.bar] + CSharpImplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..8)::7 + CSharpCodeBlock - [1..8)::7 + CSharpExpressionLiteral - [1..8)::7 - [foo.bar] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.stree.txt index 72c6d7652..d2344bfa2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.stree.txt @@ -1,11 +1,14 @@ -Expression block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[baz]; +CSharpCodeBlock - [0..14)::14 - [@foo().bar.baz] + CSharpImplicitExpression - [0..14)::14 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..14)::13 + CSharpCodeBlock - [1..14)::13 + CSharpExpressionLiteral - [1..14)::13 - [foo().bar.baz] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Dot;[.]; + Identifier;[bar]; + Dot;[.]; + Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt index 72c6d7652..d2344bfa2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt @@ -1,11 +1,14 @@ -Expression block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[baz]; +CSharpCodeBlock - [0..14)::14 - [@foo().bar.baz] + CSharpImplicitExpression - [0..14)::14 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..14)::13 + CSharpCodeBlock - [1..14)::13 + CSharpExpressionLiteral - [1..14)::13 - [foo().bar.baz] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Dot;[.]; + Identifier;[bar]; + Dot;[.]; + Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt index 72c6d7652..d2344bfa2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt @@ -1,11 +1,14 @@ -Expression block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[baz]; +CSharpCodeBlock - [0..14)::14 - [@foo().bar.baz] + CSharpImplicitExpression - [0..14)::14 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..14)::13 + CSharpCodeBlock - [1..14)::13 + CSharpExpressionLiteral - [1..14)::13 - [foo().bar.baz] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Dot;[.]; + Identifier;[bar]; + Dot;[.]; + Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt index d6126280d..fae52862a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[foo]; +CSharpCodeBlock - [0..4)::4 - [@foo] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [foo] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.stree.txt index db01d146c..8b9c2926b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.stree.txt @@ -1,9 +1,12 @@ -Expression block - Gen - 10 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo.bar()] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..10)::10 - [@foo.bar()] + CSharpImplicitExpression - [0..10)::10 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..10)::9 + CSharpCodeBlock - [1..10)::9 + CSharpExpressionLiteral - [1..10)::9 - [foo.bar()] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; + Dot;[.]; + Identifier;[bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.stree.txt index d6126280d..fae52862a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[foo]; +CSharpCodeBlock - [0..4)::4 - [@foo] + CSharpImplicitExpression - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..4)::3 + CSharpCodeBlock - [1..4)::3 + CSharpExpressionLiteral - [1..4)::3 - [foo] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedCodeBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedCodeBlock.stree.txt index 512300af6..23cef6534 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedCodeBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedCodeBlock.stree.txt @@ -1,29 +1,29 @@ -Statement block - Gen - 35 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [while(true) { { { { foo(); } } } }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:25 - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..35)::35 - [@while(true) { { { { foo(); } } } }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..35)::34 - [while(true) { { { { foo(); } } } }] - Gen - SpanEditHandler;Accepts:None + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedExplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedExplicitExpression.stree.txt index 7431ac802..555f64daf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedExplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedExplicitExpression.stree.txt @@ -1,23 +1,26 @@ -Statement block - Gen - 23 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [while(true) { ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:7 - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 6 - (15:0,15) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [foo] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - SyntaxKind.Identifier;[foo]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..23)::23 - [@while(true) { @(foo) }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..15)::14 - [while(true) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [15..21)::6 + CSharpExplicitExpression - [15..21)::6 + CSharpTransition - [15..16)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [16..21)::5 + RazorMetaCode - [16..17)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [17..20)::3 + CSharpExpressionLiteral - [17..20)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Identifier;[foo]; + RazorMetaCode - [20..21)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; + CSharpStatementLiteral - [21..23)::2 - [ }] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt index 4eee2c3a6..749472b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt @@ -1,19 +1,22 @@ -Statement block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [while(true) { ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:7 - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 4 - (15:0,15) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (16:0,16) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..21)::21 - [@while(true) { @foo }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..15)::14 - [while(true) { ] - Gen - SpanEditHandler;Accepts:Any + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpCodeBlock - [15..19)::4 + CSharpImplicitExpression - [15..19)::4 + CSharpTransition - [15..16)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [16..19)::3 + CSharpCodeBlock - [16..19)::3 + CSharpExpressionLiteral - [16..19)::3 - [foo] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 + Identifier;[foo]; + CSharpStatementLiteral - [19..21)::2 - [ }] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedKeywordStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedKeywordStatement.stree.txt index 8bb927c9e..96fe888bc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedKeywordStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedKeywordStatement.stree.txt @@ -1,43 +1,43 @@ -Statement block - Gen - 55 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [while(true) { for(int i = 0; i < 10; i++) { foo(); } }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:39 - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[for]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Increment;[++]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..55)::55 - [@while(true) { for(int i = 0; i < 10; i++) { foo(); } }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..55)::54 - [while(true) { for(int i = 0; i < 10; i++) { foo(); } }] - Gen - SpanEditHandler;Accepts:None + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Keyword;[for]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + IntegerLiteral;[10]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Increment;[++]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedMarkupBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedMarkupBlock.stree.txt index f7dfcb67d..e914c2afc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedMarkupBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedMarkupBlock.stree.txt @@ -1,30 +1,30 @@ -Statement block - Gen - 29 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [while(true) {] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:6 - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 14 - (14:0,14) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (15:0,15) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [}] - SpanEditHandler;Accepts:None - (28:0,28) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..29)::29 - [@while(true) {

Hello

}] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..14)::13 - [while(true) {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + MarkupBlock - [14..28)::14 + MarkupTextLiteral - [14..15)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [15..18)::3 - [

] + MarkupTextLiteral - [15..18)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [18..23)::5 - [Hello] - Gen - SpanEditHandler;Accepts:Any + Text;[Hello]; + MarkupTagBlock - [23..27)::4 - [

] + MarkupTextLiteral - [23..27)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [27..28)::1 - [ ] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + CSharpStatementLiteral - [28..29)::1 - [}] - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedSimpleStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedSimpleStatement.stree.txt index 9c3cab815..b80423d15 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedSimpleStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedSimpleStatement.stree.txt @@ -1,17 +1,17 @@ -Statement block - Gen - 23 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [while(true) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:13 - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..23)::23 - [@while(true) { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..23)::22 - [while(true) { foo(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/EmptyRazorComment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/EmptyRazorComment.stree.txt index 0fa26e309..4ffe83985 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/EmptyRazorComment.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/EmptyRazorComment.stree.txt @@ -1,16 +1,12 @@ -Markup block - Gen - 4 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Comment block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (2:0,2) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (3:0,3) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (4:0,4) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..4)::4 - [@**@] + MarkupBlock - [0..4)::4 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorComment - [0..4)::4 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupTextLiteral - [4..4)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentInMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentInMarkup.stree.txt index cc542a8c2..b5d71e6e7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentInMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentInMarkup.stree.txt @@ -1,43 +1,34 @@ -Markup block - Gen - 25 - (0:0,0) - Tag block - Gen - 3 - (0:0,0) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (21:3,0) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; +RazorDocument - [0..25)::25 - [

LF @**@ LF@**@LF

] + MarkupBlock - [0..25)::25 + MarkupTagBlock - [0..3)::3 - [

] + MarkupTextLiteral - [0..3)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [3..5)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupEphemeralTextLiteral - [5..7)::2 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [7..11)::4 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupEphemeralTextLiteral - [11..15)::4 - [ LF] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + NewLine;[LF]; + RazorComment - [15..19)::4 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupEphemeralTextLiteral - [19..21)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTagBlock - [21..25)::4 - [

] + MarkupTextLiteral - [21..25)::4 - [

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

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

] - SpanEditHandler;Accepts:Any - (17:2,0) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; +RazorDocument - [0..21)::21 - [

LF@**@ @**@LF

] + MarkupBlock - [0..21)::21 + MarkupTagBlock - [0..3)::3 - [

] + MarkupTextLiteral - [0..3)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [3..5)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + RazorComment - [5..9)::4 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupTextLiteral - [9..9)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + MarkupEphemeralTextLiteral - [9..11)::2 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [11..15)::4 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupEphemeralTextLiteral - [15..17)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTagBlock - [17..21)::4 - [

] + MarkupTextLiteral - [17..21)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.stree.txt index be566bbf0..b92e98930 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.stree.txt @@ -1,25 +1,21 @@ -Markup block - Gen - 33 - (0:0,0) - Tag block - Gen - 6 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.Text;[text]; - SyntaxKind.CloseAngle;[>]; - Tag block - Gen - 7 - (6:0,6) - Markup span - Gen - [ - 19 - (13:0,13) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ razor comment ] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ razor comment ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 - SyntaxKind.CloseAngle;[>]; +RazorDocument - [0..33)::33 - [] + MarkupBlock - [0..33)::33 + MarkupTagBlock - [0..6)::6 - [] + MarkupTextLiteral - [0..6)::6 - [] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[text]; + CloseAngle;[>]; + MarkupTagBlock - [6..13)::7 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[text]; + Whitespace;[ ]; + RazorComment - [13..32)::19 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ razor comment ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupTextLiteral - [32..33)::1 - [>] - Gen - SpanEditHandler;Accepts:Any + CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInImplicitExpressionMethodCall.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInImplicitExpressionMethodCall.stree.txt index 0fa62fac0..59217177a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInImplicitExpressionMethodCall.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInImplicitExpressionMethodCall.stree.txt @@ -1,23 +1,22 @@ -Markup block - Gen - 13 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Expression block - Gen - 13 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo(LF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.NewLine;[LF]; - Comment block - Gen - 4 - (7:1,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (7:1,0) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (8:1,1) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (9:1,2) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (9:1,2) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:1,3) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Code span - Gen - [LF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (11:1,4) - Tokens:1 - SyntaxKind.NewLine;[LF]; +RazorDocument - [0..13)::13 - [@foo(LF@**@LF] + MarkupBlock - [0..13)::13 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..13)::13 + CSharpImplicitExpression - [0..13)::13 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..13)::12 + CSharpCodeBlock - [1..13)::12 + CSharpExpressionLiteral - [1..7)::6 - [foo(LF] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[foo]; + LeftParenthesis;[(]; + NewLine;[LF]; + RazorComment - [7..11)::4 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpExpressionLiteral - [11..13)::2 - [LF] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInMarkup.stree.txt index 1cb473417..365ba65db 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInMarkup.stree.txt @@ -1,27 +1,23 @@ -Markup block - Gen - 15 - (0:0,0) - Tag block - Gen - 3 - (0:0,0) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (11:2,0) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; +RazorDocument - [0..15)::15 - [

LF@**@LF

] + MarkupBlock - [0..15)::15 + MarkupTagBlock - [0..3)::3 - [

] + MarkupTextLiteral - [0..3)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [3..5)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + RazorComment - [5..9)::4 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupEphemeralTextLiteral - [9..11)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTagBlock - [11..15)::4 - [

] + MarkupTextLiteral - [11..15)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt index 7ae337d76..85ccccc8a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt @@ -1,25 +1,21 @@ -Markup block - Gen - 33 - (0:0,0) - Tag block - Gen - 26 - (0:0,0) - Markup span - Gen - [ - 19 - (6:0,6) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (7:0,7) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [ razor comment ] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - SyntaxKind.RazorCommentLiteral;[ razor comment ]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (24:0,24) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - SyntaxKind.CloseAngle;[>]; - Tag block - Gen - 7 - (26:0,26) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[text]; - SyntaxKind.CloseAngle;[>]; +RazorDocument - [0..33)::33 - [] + MarkupBlock - [0..33)::33 + MarkupTagBlock - [0..26)::26 - [] + MarkupTextLiteral - [0..6)::6 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[text]; + Whitespace;[ ]; + RazorComment - [6..25)::19 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ razor comment ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupTextLiteral - [25..26)::1 - [>] - Gen - SpanEditHandler;Accepts:Any + CloseAngle;[>]; + MarkupTagBlock - [26..33)::7 - [] + MarkupTextLiteral - [26..33)::7 - [] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[text]; + CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInVerbatimBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInVerbatimBlock.stree.txt index d7fc7840f..45402df01 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInVerbatimBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInVerbatimBlock.stree.txt @@ -1,35 +1,36 @@ -Markup block - Gen - 26 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Statement block - Gen - 26 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [LF ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (2:0,2) - Tokens:2 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - Markup block - Gen - 18 - (8:1,4) - Tag block - Gen - 5 - (8:1,4) - Transition span - Gen - [ - [LF] - SpanEditHandler;Accepts:None - (13:1,9) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (15:2,0) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Comment block - Gen - 4 - (19:2,4) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (19:2,4) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (20:2,5) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (21:2,6) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (21:2,6) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (22:2,7) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (23:2,8) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [}] - SpanEditHandler;Accepts:Any - (25:3,0) - Tokens:1 - SyntaxKind.Text;[}]; +RazorDocument - [0..26)::26 - [@{LF - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..26)::26 + CSharpStatement - [0..26)::26 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementBody - [1..26)::25 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [2..26)::24 + CSharpStatementLiteral - [2..8)::6 - [LF ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL + NewLine;[LF]; + Whitespace;[ ]; + MarkupBlock - [8..26)::18 + MarkupTagBlock - [8..13)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[text]; + MarkupTextLiteral - [13..15)::2 - [LF] - Gen - SpanEditHandler;Accepts:None + NewLine;[LF]; + MarkupEphemeralTextLiteral - [15..19)::4 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorComment - [19..23)::4 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupEphemeralTextLiteral - [23..25)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTextLiteral - [25..26)::1 - [}] - Gen - SpanEditHandler;Accepts:Any + Text;[}]; + RazorMetaCode - [26..26)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentWithExtraNewLineInMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentWithExtraNewLineInMarkup.stree.txt index 2a4dd88b3..606807056 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentWithExtraNewLineInMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentWithExtraNewLineInMarkup.stree.txt @@ -1,43 +1,34 @@ -Markup block - Gen - 45 - (0:0,0) - Tag block - Gen - 3 - (0:0,0) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (41:7,0) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; +RazorDocument - [0..45)::45 - [

LFLF@* content *@LF@*LFcontentLF*@LFLF

] + MarkupBlock - [0..45)::45 + MarkupTagBlock - [0..3)::3 - [

] + MarkupTextLiteral - [0..3)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [3..7)::4 - [LFLF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + NewLine;[LF]; + RazorComment - [7..20)::13 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ content ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupEphemeralTextLiteral - [20..22)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + RazorComment - [22..37)::15 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[LFcontentLF]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupEphemeralTextLiteral - [37..39)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTextLiteral - [39..41)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTagBlock - [41..45)::4 - [

] + MarkupTextLiteral - [41..45)::4 - [

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

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

] - SpanEditHandler;Accepts:Any - (38:2,0) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; +RazorDocument - [0..42)::42 - [

LF@* hello *@ content @* world *@LF

] + MarkupBlock - [0..42)::42 + MarkupTagBlock - [0..3)::3 - [

] + MarkupTextLiteral - [0..3)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [3..5)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + RazorComment - [5..16)::11 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ hello ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupTextLiteral - [16..25)::9 - [ content ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + Text;[content]; + Whitespace;[ ]; + RazorComment - [25..36)::11 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[ world ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + MarkupTextLiteral - [36..38)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTagBlock - [38..42)::4 - [

] + MarkupTextLiteral - [38..42)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorMultilineCommentInBlock.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorMultilineCommentInBlock.cspans.txt new file mode 100644 index 000000000..7f93c44b8 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorMultilineCommentInBlock.cspans.txt @@ -0,0 +1,12 @@ +Markup span at (0:0,0 [2] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [44] ) +Transition span at (2:1,0 [1] ) (Accepts:None) - Parent: Statement block at (2:1,0 [40] ) +MetaCode span at (3:1,1 [1] ) (Accepts:None) - Parent: Statement block at (2:1,0 [40] ) +Code span at (4:1,2 [6] ) (Accepts:Any) - Parent: Statement block at (2:1,0 [40] ) +Transition span at (10:2,4 [1] ) (Accepts:None) - Parent: Comment block at (10:2,4 [29] ) +MetaCode span at (11:2,5 [1] ) (Accepts:None) - Parent: Comment block at (10:2,4 [29] ) +Comment span at (12:2,6 [25] ) (Accepts:Any) - Parent: Comment block at (10:2,4 [29] ) +MetaCode span at (37:4,4 [1] ) (Accepts:None) - Parent: Comment block at (10:2,4 [29] ) +Transition span at (38:4,5 [1] ) (Accepts:None) - Parent: Comment block at (10:2,4 [29] ) +Code span at (39:4,6 [2] ) (Accepts:Any) - Parent: Statement block at (2:1,0 [40] ) +MetaCode span at (41:5,0 [1] ) (Accepts:None) - Parent: Statement block at (2:1,0 [40] ) +Markup span at (42:5,1 [2] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [44] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorMultilineCommentInBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorMultilineCommentInBlock.stree.txt new file mode 100644 index 000000000..fa32dc202 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorMultilineCommentInBlock.stree.txt @@ -0,0 +1,27 @@ +RazorDocument - [0..44)::44 - [LF@{LF @*LFThis is a commentLF *@LF}LF] + MarkupBlock - [0..44)::44 + MarkupTextLiteral - [0..2)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + CSharpCodeBlock - [2..42)::40 + CSharpStatement - [2..42)::40 + CSharpTransition - [2..3)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementBody - [3..42)::39 + RazorMetaCode - [3..4)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [4..41)::37 + CSharpStatementLiteral - [4..10)::6 - [LF ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + NewLine;[LF]; + Whitespace;[ ]; + RazorComment - [10..39)::29 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[LFThis is a commentLF ]; + RazorCommentStar;[*]; + RazorCommentTransition;[@]; + CSharpStatementLiteral - [39..41)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + RazorMetaCode - [41..42)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupEphemeralTextLiteral - [42..44)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorComment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorComment.stree.txt index e205d34ac..60adcc438 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorComment.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorComment.stree.txt @@ -1,10 +1,10 @@ -Markup block - Gen - 2 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Comment block - Gen - 2 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..2)::2 - [@*] + MarkupBlock - [0..2)::2 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorComment - [0..2)::2 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[];RZ1028(0:0,0 [2] ) + RazorCommentTransition;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInImplicitExpressionMethodCall.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInImplicitExpressionMethodCall.stree.txt index edad21446..dc61b6339 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInImplicitExpressionMethodCall.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInImplicitExpressionMethodCall.stree.txt @@ -1,16 +1,19 @@ -Markup block - Gen - 7 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Expression block - Gen - 7 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foo(] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:2 - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - Comment block - Gen - 2 - (5:0,5) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (5:0,5) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (7:0,7) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..7)::7 - [@foo(@*] + MarkupBlock - [0..7)::7 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..7)::7 + CSharpImplicitExpression - [0..7)::7 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..7)::6 + CSharpCodeBlock - [1..7)::6 + CSharpExpressionLiteral - [1..5)::4 - [foo(] - Gen - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 + Identifier;[foo]; + LeftParenthesis;[(]; + RazorComment - [5..7)::2 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[];RZ1028(5:0,5 [2] ) + RazorCommentTransition;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInVerbatimBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInVerbatimBlock.stree.txt index 943ac7f11..6e7b2b405 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInVerbatimBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInVerbatimBlock.stree.txt @@ -1,17 +1,22 @@ -Markup block - Gen - 4 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Statement block - Gen - 4 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (2:0,2) - Tokens:1 - SyntaxKind.Unknown;[]; - Comment block - Gen - 2 - (2:0,2) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (2:0,2) - Tokens:1 - SyntaxKind.RazorCommentTransition;[@]; - MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (3:0,3) - Tokens:1 - SyntaxKind.RazorCommentStar;[*]; - Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (4:0,4) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..4)::4 - [@{@*] + MarkupBlock - [0..4)::4 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..4)::4 + CSharpStatement - [0..4)::4 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementBody - [1..4)::3 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [2..4)::2 + CSharpStatementLiteral - [2..2)::0 - [] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL + Marker;[]; + RazorComment - [2..4)::2 + RazorCommentTransition;[@]; + RazorCommentStar;[*]; + RazorCommentLiteral;[]; + RazorCommentStar;[];RZ1028(2:0,2 [2] ) + RazorCommentTransition;[]; + RazorMetaCode - [4..4)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWord.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWord.stree.txt index 33f420330..3baba18c5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWord.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWord.stree.txt @@ -1,3 +1,7 @@ -Directive block - Gen - 9 - (0:0,0) - MetaCode span - Gen - [namespace] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Keyword;[namespace]; +CSharpCodeBlock - [0..9)::9 - [namespace] + RazorDirective - [0..9)::9 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + RazorDirectiveBody - [0..9)::9 + RazorMetaCode - [0..9)::9 - Gen - SpanEditHandler;Accepts:None + Keyword;[namespace]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt index d13f855c0..d87e2a2d2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt @@ -1,3 +1,8 @@ -Expression block - Gen - 9 - (0:0,0) - Code span - Gen - [NameSpace] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:1 - SyntaxKind.Identifier;[NameSpace]; +CSharpCodeBlock - [0..9)::9 - [NameSpace] + CSharpImplicitExpression - [0..9)::9 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpImplicitExpressionBody - [0..9)::9 + CSharpCodeBlock - [0..9)::9 + CSharpExpressionLiteral - [0..9)::9 - [NameSpace] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Identifier;[NameSpace]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.stree.txt index 2dfc96732..1f9ceb88e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.stree.txt @@ -1,44 +1,48 @@ -Markup block - Gen - 46 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 46 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ LFLFLFLFLFLF] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:7 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.NewLine;[LF]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (30:6,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 14 - (31:6,1) - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (31:6,1) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Tag block - Gen - 3 - (33:7,0) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (39:7,6) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (43:7,10) - Tokens:1 - SyntaxKind.NewLine;[LF]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (45:8,0) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (46:8,1) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..46)::46 - [@section foo LFLFLFLFLFLF{LF

Foo

LF}] + MarkupBlock - [0..46)::46 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..46)::46 + RazorDirective - [0..46)::46 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..46)::45 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..46)::38 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..30)::18 - [ LFLFLFLFLFLF] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + NewLine;[LF]; + NewLine;[LF]; + NewLine;[LF]; + NewLine;[LF]; + NewLine;[LF]; + NewLine;[LF]; + RazorMetaCode - [30..31)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [31..45)::14 + MarkupTextLiteral - [31..33)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTagBlock - [33..36)::3 - [

] + MarkupTextLiteral - [33..36)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [36..39)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [39..43)::4 - [

] + MarkupTextLiteral - [39..43)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [43..45)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + RazorMetaCode - [45..46)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [46..46)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt index be93416c6..d46f43c9a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt @@ -1,58 +1,65 @@ -Markup block - Gen - 76 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 76 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 61 - (14:0,14) - Markup span - Gen - [ I really want to render a close brace, so here I go: ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:25 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[I]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[really]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[want]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[to]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[render]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[a]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[close]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[brace,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[so]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[here]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[I]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[go:]; - SyntaxKind.Whitespace;[ ]; - Expression block - Gen - 6 - (68:0,68) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (68:0,68) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (69:0,69) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - ["}"] - SpanEditHandler;Accepts:Any - (70:0,70) - Tokens:1 - SyntaxKind.StringLiteral;["}"]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (73:0,73) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (74:0,74) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (75:0,75) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (76:0,76) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..76)::76 - [@section foo { I really want to render a close brace, so here I go: @("}") }] + MarkupBlock - [0..76)::76 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..76)::76 + RazorDirective - [0..76)::76 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..76)::75 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..76)::68 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..75)::61 + MarkupTextLiteral - [14..68)::54 - [ I really want to render a close brace, so here I go: ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + Text;[I]; + Whitespace;[ ]; + Text;[really]; + Whitespace;[ ]; + Text;[want]; + Whitespace;[ ]; + Text;[to]; + Whitespace;[ ]; + Text;[render]; + Whitespace;[ ]; + Text;[a]; + Whitespace;[ ]; + Text;[close]; + Whitespace;[ ]; + Text;[brace,]; + Whitespace;[ ]; + Text;[so]; + Whitespace;[ ]; + Text;[here]; + Whitespace;[ ]; + Text;[I]; + Whitespace;[ ]; + Text;[go:]; + Whitespace;[ ]; + CSharpCodeBlock - [68..74)::6 + CSharpExplicitExpression - [68..74)::6 + CSharpTransition - [68..69)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpExplicitExpressionBody - [69..74)::5 + RazorMetaCode - [69..70)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [70..73)::3 + CSharpExpressionLiteral - [70..73)::3 - ["}"] - Gen - SpanEditHandler;Accepts:Any + StringLiteral;["}"]; + RazorMetaCode - [73..74)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; + MarkupTextLiteral - [74..75)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorMetaCode - [75..76)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [76..76)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt index f8333a79a..65d0a4527 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt @@ -1,48 +1,52 @@ -Markup block - Gen - 67 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 67 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 52 - (14:0,14) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 8 - (15:0,15) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (56:0,56) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[script]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (65:0,65) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (66:0,66) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (67:0,67) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..67)::67 - [@section foo { }] + MarkupBlock - [0..67)::67 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..67)::67 + RazorDirective - [0..67)::67 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..67)::66 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..67)::59 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..66)::52 + MarkupTextLiteral - [14..15)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [15..23)::8 - [] + MarkupTextLiteral - [56..65)::9 - [] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[script]; + CloseAngle;[>]; + MarkupTextLiteral - [65..66)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorMetaCode - [66..67)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [67..67)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt index 98001e766..d336694b9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt @@ -1,12 +1,16 @@ -Markup block - Gen - 10 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 - SyntaxKind.Unknown;[]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - SyntaxKind.NewLine;[LF]; +RazorDocument - [0..10)::10 - [@sectionLF] + MarkupBlock - [0..10)::10 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..8)::8 + RazorDirective - [0..8)::8 - Directive:{section;RazorBlock;Unrestricted} [RZ1015(8:0,8 [2] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..8)::7 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..8)::0 + CSharpStatementLiteral - [8..8)::0 - [] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Marker;[]; + MarkupTextLiteral - [8..10)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt index 501cdd5ac..7f547e817 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt @@ -1,15 +1,19 @@ -Markup block - Gen - 23 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (17:0,17) - Tokens:1 - SyntaxKind.Unknown;[]; - Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:2 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; +RazorDocument - [0..23)::23 - [@section LF ] + MarkupBlock - [0..23)::23 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..17)::17 + RazorDirective - [0..17)::17 - Directive:{section;RazorBlock;Unrestricted} [RZ1015(17:0,17 [2] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..17)::16 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..17)::9 + CSharpStatementLiteral - [8..17)::9 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [17..17)::0 - [] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Marker;[]; + MarkupTextLiteral - [17..23)::6 - [LF ] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt index 46ed3a8aa..4a016b636 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt @@ -1,18 +1,22 @@ -Markup block - Gen - 27 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 27 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[Foo]; - Markup span - Gen - [ LF ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (27:1,4) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..27)::27 - [@section Foo LF ] + MarkupBlock - [0..27)::27 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..27)::27 + RazorDirective - [0..27)::27 - Directive:{section;RazorBlock;Unrestricted} [RZ1012(27:1,4 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..27)::26 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..27)::19 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [Foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[Foo]; + MarkupTextLiteral - [12..27)::15 - [ LF ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + NewLine;[LF]; + Whitespace;[ ]; + MarkupTextLiteral - [27..27)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt index b128a9324..d0c86639d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt @@ -1,45 +1,49 @@ -Markup block - Gen - 33 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 33 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 20 - (12:0,12) - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Tag block - Gen - 4 - (14:1,0) - Markup span - Gen - [ - 14 - (18:2,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:None - (29:2,11) - Tokens:2 - SyntaxKind.DoubleHyphen;[--]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (32:2,14) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (32:2,14) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (33:2,15) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..33)::33 - [@section s {LF " '-->}] + MarkupBlock - [0..33)::33 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..33)::33 + RazorDirective - [0..33)::33 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..33)::32 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..33)::25 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..10)::1 - [s] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[s]; + MarkupTextLiteral - [10..11)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [11..12)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [12..32)::20 + MarkupTextLiteral - [12..14)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + MarkupTagBlock - [14..18)::4 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[a]; + NewLine;[LF]; + MarkupCommentBlock - [18..32)::14 + MarkupTextLiteral - [18..22)::4 - [] - Gen - SpanEditHandler;Accepts:None + DoubleHyphen;[--]; + CloseAngle;[>]; + MarkupTextLiteral - [32..32)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [32..33)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [33..33)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt index 887190ddb..3a0384fa9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt @@ -1,23 +1,27 @@ -Markup block - Gen - 24 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 24 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 9 - (14:0,14) - Markup span - Gen - [something] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Text;[something]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..24)::24 - [@section foo {something}] + MarkupBlock - [0..24)::24 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..24)::24 + RazorDirective - [0..24)::24 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..24)::23 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..24)::16 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..23)::9 + MarkupTextLiteral - [14..23)::9 - [something] - Gen - SpanEditHandler;Accepts:Any + Text;[something]; + RazorMetaCode - [23..24)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [24..24)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt index 86004e805..3e0313100 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt @@ -1,36 +1,40 @@ -Markup block - Gen - 26 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 26 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (12:0,12) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 12 - (13:0,13) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (14:0,14) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..26)::26 - [@section foo{

Foo

}] + MarkupBlock - [0..26)::26 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..26)::26 + RazorDirective - [0..26)::26 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..26)::25 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..26)::18 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + RazorMetaCode - [12..13)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [13..25)::12 + MarkupTextLiteral - [13..14)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [14..17)::3 - [

] + MarkupTextLiteral - [14..17)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [17..20)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [20..24)::4 - [

] + MarkupTextLiteral - [20..24)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [24..25)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorMetaCode - [25..26)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [26..26)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt index 210e0a990..70844ba97 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt @@ -1,19 +1,25 @@ -Markup block - Gen - 14 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 0 - (14:0,14) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..14)::14 - [@section foo {] + MarkupBlock - [0..14)::14 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..14)::14 + RazorDirective - [0..14)::14 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(13:0,13 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..14)::13 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..14)::6 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..14)::0 + MarkupTextLiteral - [14..14)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [14..14)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt index 94ffd5450..d31d5a603 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt @@ -1,19 +1,25 @@ -Markup block - Gen - 15 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 15 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 1 - (14:0,14) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; +RazorDocument - [0..15)::15 - [@section foo { ] + MarkupBlock - [0..15)::15 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..15)::15 + RazorDirective - [0..15)::15 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(13:0,13 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..15)::14 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..15)::7 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..15)::1 + MarkupTextLiteral - [14..15)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorMetaCode - [15..15)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt index ba6aae139..26a885501 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt @@ -1,19 +1,25 @@ -Markup block - Gen - 16 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 2 - (14:0,14) - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.NewLine;[LF]; +RazorDocument - [0..16)::16 - [@section foo {LF] + MarkupBlock - [0..16)::16 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..16)::16 + RazorDirective - [0..16)::16 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(13:0,13 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..16)::15 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..16)::8 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..16)::2 + MarkupTextLiteral - [14..16)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + RazorMetaCode - [16..16)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt index 2bbc778d1..9167042d5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt @@ -1,19 +1,25 @@ -Markup block - Gen - 17 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 3 - (14:0,14) - Markup span - Gen - [abc] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Text;[abc]; +RazorDocument - [0..17)::17 - [@section foo {abc] + MarkupBlock - [0..17)::17 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..17)::17 + RazorDirective - [0..17)::17 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(13:0,13 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..17)::16 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..17)::9 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..17)::3 + MarkupTextLiteral - [14..17)::3 - [abc] - Gen - SpanEditHandler;Accepts:Any + Text;[abc]; + RazorMetaCode - [17..17)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.stree.txt index ec24dcca8..61a640177 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.stree.txt @@ -1,21 +1,27 @@ -Markup block - Gen - 20 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 6 - (14:0,14) - Markup span - Gen - [LF abc] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:3 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[abc]; +RazorDocument - [0..20)::20 - [@section foo {LF abc] + MarkupBlock - [0..20)::20 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..20)::20 + RazorDirective - [0..20)::20 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(13:0,13 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..20)::19 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..20)::12 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..20)::6 + MarkupTextLiteral - [14..20)::6 - [LF abc] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + Whitespace;[ ]; + Text;[abc]; + RazorMetaCode - [20..20)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.stree.txt index 967219c4b..e24841e4e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.stree.txt @@ -1,35 +1,40 @@ -Markup block - Gen - 27 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 27 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 13 - (14:0,14) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (15:0,15) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; +RazorDocument - [0..27)::27 - [@section foo {

Foo{}

] + MarkupBlock - [0..27)::27 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..27)::27 + RazorDirective - [0..27)::27 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(13:0,13 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..27)::26 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..27)::19 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..27)::13 + MarkupTextLiteral - [14..15)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [15..18)::3 - [

] + MarkupTextLiteral - [15..18)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [18..23)::5 - [Foo{}] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + Text;[{]; + Text;[}]; + MarkupTagBlock - [23..27)::4 - [

] + MarkupTextLiteral - [23..27)::4 - [

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

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

] - SpanEditHandler;Accepts:None - (62:4,22) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (66:4,26) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (68:5,0) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +RazorDocument - [0..73)::73 - [@section TestLF{LF @if(true)LF {LF

Hello World

LF }] + MarkupBlock - [0..73)::73 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..73)::73 + RazorDirective - [0..73)::73 - Directive:{section;RazorBlock;Unrestricted} [RZ1006(15:1,0 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..73)::72 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..73)::65 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..13)::4 - [Test] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[Test]; + MarkupTextLiteral - [13..15)::2 - [LF] - Gen - SpanEditHandler;Accepts:AllWhitespace + NewLine;[LF]; + RazorMetaCode - [15..16)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd + LeftBrace;[{]; + MarkupBlock - [16..73)::57 + MarkupTextLiteral - [16..18)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + CSharpCodeBlock - [18..73)::55 + CSharpStatementLiteral - [18..22)::4 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + CSharpTransition - [22..23)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [23..40)::17 - [if(true)LF {LF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + NewLine;[LF]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + MarkupBlock - [40..68)::28 + MarkupTextLiteral - [40..48)::8 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [48..51)::3 - [

] + MarkupTextLiteral - [48..51)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [51..62)::11 - [Hello World] - Gen - SpanEditHandler;Accepts:Any + Text;[Hello]; + Whitespace;[ ]; + Text;[World]; + MarkupTagBlock - [62..66)::4 - [

] + MarkupTextLiteral - [62..66)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [66..68)::2 - [LF] - Gen - SpanEditHandler;Accepts:None + NewLine;[LF]; + CSharpStatementLiteral - [68..73)::5 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RightBrace;[}]; + RazorMetaCode - [73..73)::0 - Gen - SpanEditHandler;Accepts:Any + RightBrace;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt index 88d593093..8f8cb089b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt @@ -1,11 +1,15 @@ -Markup block - Gen - 12 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Expression block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [Section] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K15 - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[Section]; - Markup span - Gen - [ foo] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; +RazorDocument - [0..12)::12 - [@Section foo] + MarkupBlock - [0..12)::12 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..8)::8 + CSharpImplicitExpression - [0..8)::8 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..8)::7 + CSharpCodeBlock - [1..8)::7 + CSharpExpressionLiteral - [1..8)::7 - [Section] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K15 + Identifier;[Section]; + MarkupTextLiteral - [8..12)::4 - [ foo] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + Text;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.stree.txt index f5a31332c..56f2e9267 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.stree.txt @@ -1,58 +1,65 @@ -Markup block - Gen - 44 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 44 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 29 - (14:0,14) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Directive block - Gen - 27 - (15:0,15) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (23:0,23) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [bar] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (24:0,24) - Tokens:1 - SyntaxKind.Identifier;[bar]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (27:0,27) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (28:0,28) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 12 - (29:0,29) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (30:0,30) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (40:0,40) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (41:0,41) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (42:0,42) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (43:0,43) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:0,44) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..44)::44 - [@section foo { @section bar {

Foo

} }] + MarkupBlock - [0..44)::44 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..44)::44 + RazorDirective - [0..44)::44 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..44)::43 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..44)::36 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..43)::29 + MarkupTextLiteral - [14..15)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + CSharpCodeBlock - [15..42)::27 + RazorDirective - [15..42)::27 - Directive:{section;RazorBlock;Unrestricted} [RZ2005(16:0,16 [7] ), RZ2002(15:0,15 [8] )] + CSharpTransition - [15..16)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [16..42)::26 + RazorMetaCode - [16..23)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [23..42)::19 + CSharpStatementLiteral - [23..24)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [24..27)::3 - [bar] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[bar]; + MarkupTextLiteral - [27..28)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [28..29)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [29..41)::12 + MarkupTextLiteral - [29..30)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [30..33)::3 - [

] + MarkupTextLiteral - [30..33)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [33..36)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [36..40)::4 - [

] + MarkupTextLiteral - [36..40)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [40..41)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorMetaCode - [41..42)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [42..43)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorMetaCode - [43..44)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [44..44)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt index 79ae5a2bf..ff9823b96 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt @@ -1,33 +1,37 @@ -Markup block - Gen - 21 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 8 - (12:0,12) - HtmlComment block - Gen - 8 - (12:0,12) - Markup span - Gen - [] - SpanEditHandler;Accepts:None - (17:0,17) - Tokens:2 - SyntaxKind.DoubleHyphen;[--]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..21)::21 - [@section s {}] + MarkupBlock - [0..21)::21 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..21)::21 + RazorDirective - [0..21)::21 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..21)::20 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..21)::13 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..10)::1 - [s] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[s]; + MarkupTextLiteral - [10..11)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [11..12)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [12..20)::8 + MarkupCommentBlock - [12..20)::8 + MarkupTextLiteral - [12..16)::4 - [] - Gen - SpanEditHandler;Accepts:None + DoubleHyphen;[--]; + CloseAngle;[>]; + MarkupTextLiteral - [20..20)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [20..21)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [21..21)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt index 72698062e..414e5b368 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt @@ -1,38 +1,42 @@ -Markup block - Gen - 26 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 26 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 13 - (12:0,12) - HtmlComment block - Gen - 13 - (12:0,12) - Markup span - Gen - [] - SpanEditHandler;Accepts:None - (22:0,22) - Tokens:2 - SyntaxKind.DoubleHyphen;[--]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - SyntaxKind.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..26)::26 - [@section s {}] + MarkupBlock - [0..26)::26 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..26)::26 + RazorDirective - [0..26)::26 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..26)::25 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..26)::18 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..10)::1 - [s] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[s]; + MarkupTextLiteral - [10..11)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [11..12)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [12..25)::13 + MarkupCommentBlock - [12..25)::13 + MarkupTextLiteral - [12..16)::4 - [] - Gen - SpanEditHandler;Accepts:None + DoubleHyphen;[--]; + CloseAngle;[>]; + MarkupTextLiteral - [25..25)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + RazorMetaCode - [25..26)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [26..26)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt index be21d3746..68d3659c3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt @@ -1,38 +1,42 @@ -Markup block - Gen - 27 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 27 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 12 - (14:0,14) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (15:0,15) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..27)::27 - [@section foo {

Foo

}] + MarkupBlock - [0..27)::27 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..27)::27 + RazorDirective - [0..27)::27 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..27)::26 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..27)::19 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..26)::12 + MarkupTextLiteral - [14..15)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [15..18)::3 - [

] + MarkupTextLiteral - [15..18)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [18..21)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [21..25)::4 - [

] + MarkupTextLiteral - [21..25)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [25..26)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + RazorMetaCode - [26..27)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [27..27)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt index 290add3da..69ed3ab18 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt @@ -1,32 +1,36 @@ -Markup block - Gen - 28 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 28 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 15 - (12:0,12) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:10 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.OpenAngle;[<]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[xml]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[bleh]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.QuestionMark;[?]; - SyntaxKind.CloseAngle;[>]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..28)::28 - [@section s { }] + MarkupBlock - [0..28)::28 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..28)::28 + RazorDirective - [0..28)::28 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..28)::27 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..28)::20 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..10)::1 - [s] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[s]; + MarkupTextLiteral - [10..11)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [11..12)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [12..27)::15 + MarkupTextLiteral - [12..27)::15 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + OpenAngle;[<]; + QuestionMark;[?]; + Whitespace;[ ]; + Text;[xml]; + Whitespace;[ ]; + Text;[bleh]; + Whitespace;[ ]; + QuestionMark;[?]; + CloseAngle;[>]; + RazorMetaCode - [27..28)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [28..28)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt index d94e0cb85..cfb10ee1c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt @@ -1,17 +1,21 @@ -Markup block - Gen - 20 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[foo]; - Markup span - Gen - [ LF] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.NewLine;[LF]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:1,0) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..20)::20 - [@section foo LF] + MarkupBlock - [0..20)::20 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..20)::20 + RazorDirective - [0..20)::20 - Directive:{section;RazorBlock;Unrestricted} [RZ1012(20:1,0 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..20)::19 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..20)::12 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..20)::8 - [ LF] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + NewLine;[LF]; + MarkupTextLiteral - [20..20)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt index 35badf145..194ad66d1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt @@ -1,31 +1,35 @@ -Markup block - Gen - 25 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 9 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Markup span - Gen - [9 { ] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:4 - SyntaxKind.Text;[9]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[{]; - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (13:0,13) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ }] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[}]; +RazorDocument - [0..25)::25 - [@section 9 {

Foo

}] + MarkupBlock - [0..25)::25 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..9)::9 + RazorDirective - [0..9)::9 - Directive:{section;RazorBlock;Unrestricted} [RZ1015(9:0,9 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..9)::8 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..9)::1 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + MarkupTextLiteral - [9..13)::4 - [9 { ] - Gen - SpanEditHandler;Accepts:Any + Text;[9]; + Whitespace;[ ]; + Text;[{]; + Whitespace;[ ]; + MarkupTagBlock - [13..16)::3 - [

] + MarkupTextLiteral - [13..16)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [16..19)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [19..23)::4 - [

] + MarkupTextLiteral - [19..23)::4 - [

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

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

] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [ }] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[}]; +RazorDocument - [0..31)::31 - [@section foo-bar {

Foo

}] + MarkupBlock - [0..31)::31 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..12)::12 + RazorDirective - [0..12)::12 - Directive:{section;RazorBlock;Unrestricted} [RZ1017(12:0,12 [1] )] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..12)::11 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..12)::4 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[foo]; + MarkupTextLiteral - [12..19)::7 - [-bar { ] - Gen - SpanEditHandler;Accepts:Any + Text;[-bar]; + Whitespace;[ ]; + Text;[{]; + Whitespace;[ ]; + MarkupTagBlock - [19..22)::3 - [

] + MarkupTextLiteral - [19..22)::3 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [22..25)::3 - [Foo] - Gen - SpanEditHandler;Accepts:Any + Text;[Foo]; + MarkupTagBlock - [25..29)::4 - [

] + MarkupTextLiteral - [25..29)::4 - [

] - Gen - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [29..31)::2 - [ }] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.stree.txt index 4f36cca4c..21ee945f2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.stree.txt @@ -1,35 +1,39 @@ -Markup block - Gen - 31 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 31 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[Foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 16 - (14:0,14) - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Statement block - Gen - 14 - (16:1,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (16:1,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [if(true) {LF}] - SpanEditHandler;Accepts:Any - (17:1,1) - Tokens:8 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (30:2,1) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (31:2,2) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..31)::31 - [@section Foo {LF@if(true) {LF}}] + MarkupBlock - [0..31)::31 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..31)::31 + RazorDirective - [0..31)::31 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..31)::30 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..31)::23 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [Foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[Foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..30)::16 + MarkupTextLiteral - [14..16)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + CSharpCodeBlock - [16..30)::14 + CSharpTransition - [16..17)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [17..30)::13 - [if(true) {LF}] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + RightBrace;[}]; + RazorMetaCode - [30..31)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [31..31)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt index d536400d5..5ceee908d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt @@ -1,36 +1,40 @@ -Markup block - Gen - 33 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 33 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[Foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 18 - (14:0,14) - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Statement block - Gen - 16 - (16:1,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (16:1,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [if(true) {LF}LF] - SpanEditHandler;Accepts:Any - (17:1,1) - Tokens:9 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (32:3,0) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (33:3,1) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..33)::33 - [@section Foo {LF@if(true) {LF}LF}] + MarkupBlock - [0..33)::33 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..33)::33 + RazorDirective - [0..33)::33 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..33)::32 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..33)::25 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..12)::3 - [Foo] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[Foo]; + MarkupTextLiteral - [12..13)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [13..14)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [14..32)::18 + MarkupTextLiteral - [14..16)::2 - [LF] - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; + CSharpCodeBlock - [16..32)::16 + CSharpTransition - [16..17)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [17..32)::15 - [if(true) {LF}LF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + RightBrace;[}]; + NewLine;[LF]; + RazorMetaCode - [32..33)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [33..33)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt index df9f966f0..17e8f806f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt @@ -1,42 +1,49 @@ -Markup block - Gen - 30 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 30 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 17 - (12:0,12) - Tag block - Gen - 17 - (12:0,12) - Markup span - Gen - [ - 9 - (17:0,17) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 2 - (23:0,23) - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (24:0,24) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (29:0,29) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..30)::30 - [@section s {}] + MarkupBlock - [0..30)::30 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..30)::30 + RazorDirective - [0..30)::30 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..30)::29 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..30)::22 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..10)::1 - [s] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[s]; + MarkupTextLiteral - [10..11)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [11..12)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [12..29)::17 + MarkupTagBlock - [12..29)::17 - [] + MarkupTextLiteral - [12..17)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [17..26)::9 - [ foo='@@'] + MarkupTextLiteral - [17..18)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [18..21)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [22..23)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [23..25)::2 + MarkupBlock - [23..25)::2 + MarkupTextLiteral - [23..24)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupEphemeralTextLiteral - [24..25)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTextLiteral - [25..26)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [26..29)::3 - [ />] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + RazorMetaCode - [29..30)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [30..30)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt index 32ae46f82..da412d6aa 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt @@ -1,51 +1,62 @@ -Markup block - Gen - 44 - (0:0,0) - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - SyntaxKind.Unknown;[]; - Directive block - Gen - 44 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 - SyntaxKind.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Markup block - Gen - 31 - (12:0,12) - Tag block - Gen - 31 - (12:0,12) - Markup span - Gen - [ - 23 - (17:0,17) - Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:4 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Text;[foo]; - SyntaxKind.Equals;[=]; - SyntaxKind.SingleQuote;[']; - Markup block - Gen - 13 - (23:0,23) - Expression block - Gen - 13 - (23:0,23) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K15 - (24:0,24) - Tokens:3 - SyntaxKind.Identifier;[DateTime]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Now]; - Markup block - Gen - 3 - (36:0,36) - Markup span - Gen - [ @] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:2 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Transition;[@]; - Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:1 - SyntaxKind.Transition;[@]; - Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - SyntaxKind.SingleQuote;[']; - Markup span - Gen - [ />] - SpanEditHandler;Accepts:Any - (40:0,40) - Tokens:3 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.CloseAngle;[>]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (43:0,43) - Tokens:1 - SyntaxKind.RightBrace;[}]; - Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:0,44) - Tokens:1 - SyntaxKind.Unknown;[]; +RazorDocument - [0..44)::44 - [@section s {}] + MarkupBlock - [0..44)::44 + MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; + CSharpCodeBlock - [0..44)::44 + RazorDirective - [0..44)::44 - Directive:{section;RazorBlock;Unrestricted} + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..44)::43 + RazorMetaCode - [1..8)::7 - Gen - SpanEditHandler;Accepts:None + Identifier;[section]; + CSharpCodeBlock - [8..44)::36 + CSharpStatementLiteral - [8..9)::1 - [ ] - Gen - SpanEditHandler;Accepts:Whitespace + Whitespace;[ ]; + CSharpStatementLiteral - [9..10)::1 - [s] - Gen - DirectiveTokenEditHandler;Accepts:NonWhitespace + Identifier;[s]; + MarkupTextLiteral - [10..11)::1 - [ ] - Gen - SpanEditHandler;Accepts:AllWhitespace + Whitespace;[ ]; + RazorMetaCode - [11..12)::1 - Gen - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd + LeftBrace;[{]; + MarkupBlock - [12..43)::31 + MarkupTagBlock - [12..43)::31 - [] + MarkupTextLiteral - [12..17)::5 - [ - SpanEditHandler;Accepts:Any + OpenAngle;[<]; + Text;[span]; + MarkupAttributeBlock - [17..40)::23 - [ foo='@DateTime.Now @@'] + MarkupTextLiteral - [17..18)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTextLiteral - [18..21)::3 - [foo] - Gen - SpanEditHandler;Accepts:Any + Text;[foo]; + Equals;[=]; + MarkupTextLiteral - [22..23)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + GenericBlock - [23..39)::16 + MarkupDynamicAttributeValue - [23..36)::13 - [@DateTime.Now] + GenericBlock - [23..36)::13 + CSharpCodeBlock - [23..36)::13 + CSharpImplicitExpression - [23..36)::13 + CSharpTransition - [23..24)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [24..36)::12 + CSharpCodeBlock - [24..36)::12 + CSharpExpressionLiteral - [24..36)::12 - [DateTime.Now] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K15 + Identifier;[DateTime]; + Dot;[.]; + Identifier;[Now]; + MarkupBlock - [36..39)::3 + MarkupTextLiteral - [36..38)::2 - [ @] - Gen - SpanEditHandler;Accepts:None + Whitespace;[ ]; + Transition;[@]; + MarkupEphemeralTextLiteral - [38..39)::1 - [@] - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + MarkupTextLiteral - [39..40)::1 - ['] - Gen - SpanEditHandler;Accepts:Any + SingleQuote;[']; + MarkupTextLiteral - [40..43)::3 - [ />] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + RazorMetaCode - [43..44)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; + MarkupTextLiteral - [44..44)::0 - [] - Gen - SpanEditHandler;Accepts:Any + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode.stree.txt index ec75baf7a..78700a99c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode.stree.txt @@ -1,26 +1,31 @@ -Statement block - Gen - 52 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [foo"b}ar" if(condition) { string.Format("{0}"); } ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:20 - SyntaxKind.Identifier;[foo]; - SyntaxKind.StringLiteral;["b}ar"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[condition]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Format]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;["{0}"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (51:0,51) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..52)::52 - [{foo"b}ar" if(condition) { string.Format("{0}"); } }] + CSharpStatement - [0..52)::52 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..52)::52 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..51)::50 + CSharpStatementLiteral - [1..51)::50 - [foo"b}ar" if(condition) { string.Format("{0}"); } ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + Identifier;[foo]; + StringLiteral;["b}ar"]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[condition]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Keyword;[string]; + Dot;[.]; + Identifier;[Format]; + LeftParenthesis;[(]; + StringLiteral;["{0}"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorMetaCode - [51..52)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr.stree.txt index 91c655daa..8da45d9d0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr.stree.txt @@ -1,26 +1,31 @@ -Expression block - Gen - 52 - (0:0,0) - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [foo"b)ar" if(condition) { string.Format("{0}"); } ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:20 - SyntaxKind.Identifier;[foo]; - SyntaxKind.StringLiteral;["b)ar"]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[condition]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Format]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.StringLiteral;["{0}"]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (51:0,51) - Tokens:1 - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..52)::52 - [(foo"b)ar" if(condition) { string.Format("{0}"); } )] + CSharpExplicitExpression - [0..52)::52 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpExplicitExpressionBody - [0..52)::52 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftParenthesis;[(]; + CSharpCodeBlock - [1..51)::50 + CSharpExpressionLiteral - [1..51)::50 - [foo"b)ar" if(condition) { string.Format("{0}"); } ] - Gen - SpanEditHandler;Accepts:Any + Identifier;[foo]; + StringLiteral;["b)ar"]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Identifier;[condition]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Keyword;[string]; + Dot;[.]; + Identifier;[Format]; + LeftParenthesis;[(]; + StringLiteral;["{0}"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + RazorMetaCode - [51..52)::1 - Gen - SpanEditHandler;Accepts:None + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NamespaceImportInsideCodeBlockCausesError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NamespaceImportInsideCodeBlockCausesError.stree.txt index 7c4b8764f..444e68553 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NamespaceImportInsideCodeBlockCausesError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NamespaceImportInsideCodeBlockCausesError.stree.txt @@ -1,25 +1,30 @@ -Statement block - Gen - 37 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [ using Foo.Bar.Baz; var foo = bar; ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:19 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..37)::37 - [{ using Foo.Bar.Baz; var foo = bar; }] + CSharpStatement - [0..37)::37 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..37)::37 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..36)::35 + CSharpStatementLiteral - [1..36)::35 - [ using Foo.Bar.Baz; var foo = bar; ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + Whitespace;[ ]; + Keyword;[using]; + Whitespace;[ ]; + Identifier;[Foo]; + Dot;[.]; + Identifier;[Bar]; + Dot;[.]; + Identifier;[Baz]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RazorMetaCode - [36..37)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NonKeywordStatementInCodeBlockIsHandledCorrectly.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NonKeywordStatementInCodeBlockIsHandledCorrectly.stree.txt index d11ffc889..2d82057e4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NonKeywordStatementInCodeBlockIsHandledCorrectly.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NonKeywordStatementInCodeBlockIsHandledCorrectly.stree.txt @@ -1,26 +1,31 @@ -Statement block - Gen - 56 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [LF List photos = gallery.Photo.ToList();LF] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:20 - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[List]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Identifier;[dynamic]; - SyntaxKind.GreaterThan;[>]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[photos]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[gallery]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Photo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ToList]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (55:2,0) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..56)::56 - [{LF List photos = gallery.Photo.ToList();LF}] + CSharpStatement - [0..56)::56 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..56)::56 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..55)::54 + CSharpStatementLiteral - [1..55)::54 - [LF List photos = gallery.Photo.ToList();LF] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[List]; + LessThan;[<]; + Identifier;[dynamic]; + GreaterThan;[>]; + Whitespace;[ ]; + Identifier;[photos]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[gallery]; + Dot;[.]; + Identifier;[Photo]; + Dot;[.]; + Identifier;[ToList]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RazorMetaCode - [55..56)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt index 40da231bf..ba1a0451b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 1 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Unknown;[]; +CSharpCodeBlock - [0..1)::1 - [@] + CSharpImplicitExpression - [0..1)::1 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..1)::0 + CSharpCodeBlock - [1..1)::0 + CSharpExpressionLiteral - [1..1)::0 - [] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Marker;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockTerminatesSingleLineCommentAtEndOfLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockTerminatesSingleLineCommentAtEndOfLine.stree.txt index 828955805..ffb5683f6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockTerminatesSingleLineCommentAtEndOfLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockTerminatesSingleLineCommentAtEndOfLine.stree.txt @@ -1,38 +1,40 @@ -Statement block - Gen - 48 - (0:0,0) - Code span - Gen - [if(!false) {LF // FooLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:11 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Not;[!]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.CSharpComment;[// Foo]; - SyntaxKind.NewLine;[LF]; - Markup block - Gen - 21 - (26:2,0) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (26:2,0) - Tokens:1 - SyntaxKind.Whitespace;[ ]; - Tag block - Gen - 3 - (27:2,1) - Markup span - Gen - [

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

] - SpanEditHandler;Accepts:None - (41:2,15) - Tokens:4 - SyntaxKind.OpenAngle;[<]; - SyntaxKind.ForwardSlash;[/]; - SyntaxKind.Text;[p]; - SyntaxKind.CloseAngle;[>]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (45:2,19) - Tokens:1 - SyntaxKind.NewLine;[LF]; - Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (47:3,0) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..48)::48 - [if(!false) {LF // FooLF

A real tag!

LF}] + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementLiteral - [0..26)::26 - [if(!false) {LF // FooLF] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Not;[!]; + Keyword;[false]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + NewLine;[LF]; + Whitespace;[ ]; + CSharpComment;[// Foo]; + NewLine;[LF]; + MarkupBlock - [26..47)::21 + MarkupTextLiteral - [26..27)::1 - [ ] - Gen - SpanEditHandler;Accepts:Any + Whitespace;[ ]; + MarkupTagBlock - [27..30)::3 - [

] + MarkupTextLiteral - [27..30)::3 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [30..41)::11 - [A real tag!] - Gen - SpanEditHandler;Accepts:Any + Text;[A]; + Whitespace;[ ]; + Text;[real]; + Whitespace;[ ]; + Text;[tag]; + Bang;[!]; + MarkupTagBlock - [41..45)::4 - [

] + MarkupTextLiteral - [41..45)::4 - [

] - Gen - SpanEditHandler;Accepts:None + OpenAngle;[<]; + ForwardSlash;[/]; + Text;[p]; + CloseAngle;[>]; + MarkupTextLiteral - [45..47)::2 - [LF] - Gen - SpanEditHandler;Accepts:None + NewLine;[LF]; + CSharpStatementLiteral - [47..48)::1 - [}] - Gen - SpanEditHandler;Accepts:Any + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/TypeAliasInsideCodeBlockIsNotHandledSpecially.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/TypeAliasInsideCodeBlockIsNotHandledSpecially.stree.txt index 566c40d08..a4f2cecf5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/TypeAliasInsideCodeBlockIsNotHandledSpecially.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/TypeAliasInsideCodeBlockIsNotHandledSpecially.stree.txt @@ -1,27 +1,32 @@ -Statement block - Gen - 39 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [ using Foo = Bar.Baz; var foo = bar; ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:21 - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Baz]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..39)::39 - [{ using Foo = Bar.Baz; var foo = bar; }] + CSharpStatement - [0..39)::39 + CSharpTransition - [0..0)::0 - Gen - SpanEditHandler;Accepts:None + Transition;[]; + CSharpStatementBody - [0..39)::39 + RazorMetaCode - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [1..38)::37 + CSharpStatementLiteral - [1..38)::37 - [ using Foo = Bar.Baz; var foo = bar; ] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + Whitespace;[ ]; + Keyword;[using]; + Whitespace;[ ]; + Identifier;[Foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[Bar]; + Dot;[.]; + Identifier;[Baz]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[bar]; + Semicolon;[;]; + Whitespace;[ ]; + RazorMetaCode - [38..39)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/CatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/CatchClause.stree.txt index bd9e33585..0083bef98 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/CatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/CatchClause.stree.txt @@ -1,46 +1,46 @@ -Statement block - Gen - 94 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { foo(); } catch(IOException ioex) { handleIO(); } catch(Exception ex) { handleOther(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:42 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[IOException]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[ioex]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[handleIO]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[ex]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[handleOther]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..94)::94 - [@try { foo(); } catch(IOException ioex) { handleIO(); } catch(Exception ex) { handleOther(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..94)::93 - [try { foo(); } catch(IOException ioex) { handleIO(); } catch(Exception ex) { handleOther(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[IOException]; + Whitespace;[ ]; + Identifier;[ioex]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[handleIO]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + Whitespace;[ ]; + Identifier;[ex]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[handleOther]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/DoStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/DoStatement.stree.txt index 864f9a5c1..b0cc1c3e5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/DoStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/DoStatement.stree.txt @@ -1,20 +1,20 @@ -Statement block - Gen - 27 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [do { foo(); } while(true);] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:16 - SyntaxKind.Keyword;[do]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; +CSharpCodeBlock - [0..27)::27 - [@do { foo(); } while(true);] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..27)::26 - [do { foo(); } while(true);] - Gen - SpanEditHandler;Accepts:None + Keyword;[do]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseClause.stree.txt index 9e2f4273e..e59ccec39 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseClause.stree.txt @@ -1,28 +1,28 @@ -Statement block - Gen - 36 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [if(true) { foo(); } else { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:24 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..36)::36 - [@if(true) { foo(); } else { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..36)::35 - [if(true) { foo(); } else { foo(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseIfClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseIfClause.stree.txt index 736d35fc5..ffbd6b3e2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseIfClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseIfClause.stree.txt @@ -1,50 +1,50 @@ -Statement block - Gen - 73 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [if(true) { foo(); } else if(false) { foo(); } else if(!false) { foo(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:46 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[else]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Not;[!]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..73)::73 - [@if(true) { foo(); } else if(false) { foo(); } else if(!false) { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..73)::72 - [if(true) { foo(); } else if(false) { foo(); } else if(!false) { foo(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[false]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[else]; + Whitespace;[ ]; + Keyword;[if]; + LeftParenthesis;[(]; + Not;[!]; + Keyword;[false]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteBody.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteBody.stree.txt index 09016c9a8..0d29de909 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteBody.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteBody.stree.txt @@ -1,27 +1,27 @@ -Statement block - Gen - 53 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { someMethod(); } catch(Exception) when (true) {] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:23 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[someMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; +CSharpCodeBlock - [0..53)::53 - [@try { someMethod(); } catch(Exception) when (true) {] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..53)::52 - [try { someMethod(); } catch(Exception) when (true) {] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[someMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteCondition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteCondition.stree.txt index 25415c2f9..04f717693 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteCondition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteCondition.stree.txt @@ -1,23 +1,23 @@ -Statement block - Gen - 46 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { someMethod(); } catch(Exception) when (] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:19 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[someMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; +CSharpCodeBlock - [0..46)::46 - [@try { someMethod(); } catch(Exception) when (] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..46)::45 - [try { someMethod(); } catch(Exception) when (] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[someMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchNoBodyWhen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchNoBodyWhen.stree.txt index 2b4fbb308..1ea6c97bc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchNoBodyWhen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchNoBodyWhen.stree.txt @@ -1,30 +1,30 @@ -Statement block - Gen - 65 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { someMethod(); } catch(Exception) when { anotherMethod(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:26 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[someMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[anotherMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..65)::65 - [@try { someMethod(); } catch(Exception) when { anotherMethod(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..65)::64 - [try { someMethod(); } catch(Exception) when { anotherMethod(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[someMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[anotherMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhen.stree.txt index 4bcac7751..4dbd4c9b4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhen.stree.txt @@ -1,21 +1,21 @@ -Statement block - Gen - 44 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { someMethod(); } catch(Exception) when] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:17 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[someMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; +CSharpCodeBlock - [0..44)::44 - [@try { someMethod(); } catch(Exception) when] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..44)::43 - [try { someMethod(); } catch(Exception) when] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[someMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhenNoBodies.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhenNoBodies.stree.txt index 807d4bf6b..028b86786 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhenNoBodies.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhenNoBodies.stree.txt @@ -1,25 +1,25 @@ -Statement block - Gen - 51 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { someMethod(); } catch(Exception) when (true)] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:21 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[someMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; +CSharpCodeBlock - [0..51)::51 - [@try { someMethod(); } catch(Exception) when (true)] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..51)::50 - [try { someMethod(); } catch(Exception) when (true)] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[someMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryWhen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryWhen.stree.txt index de0038c43..a4716915f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryWhen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryWhen.stree.txt @@ -1,14 +1,14 @@ -Statement block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { someMethod(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:10 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[someMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..22)::22 - [@try { someMethod(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..22)::21 - [try { someMethod(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[someMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_MultiLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_MultiLine.stree.txt index 89b302ea0..47032c337 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_MultiLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_MultiLine.stree.txt @@ -1,54 +1,54 @@ -Statement block - Gen - 103 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [tryLF{LFA();LF}LFcatch(Exception) when (true)LF{LFB();LF}LFcatch(IOException) when (false)LF{LFC();LF}] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:50 - SyntaxKind.Keyword;[try]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[A]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[B]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[IOException]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.Identifier;[C]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.NewLine;[LF]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..103)::103 - [@tryLF{LFA();LF}LFcatch(Exception) when (true)LF{LFB();LF}LFcatch(IOException) when (false)LF{LFC();LF}] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..103)::102 - [tryLF{LFA();LF}LFcatch(Exception) when (true)LF{LFB();LF}LFcatch(IOException) when (false)LF{LFC();LF}] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + NewLine;[LF]; + LeftBrace;[{]; + NewLine;[LF]; + Identifier;[A]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + NewLine;[LF]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + NewLine;[LF]; + LeftBrace;[{]; + NewLine;[LF]; + Identifier;[B]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; + NewLine;[LF]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[IOException]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[false]; + RightParenthesis;[)]; + NewLine;[LF]; + LeftBrace;[{]; + NewLine;[LF]; + Identifier;[C]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + NewLine;[LF]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_NestedTryCatchWhen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_NestedTryCatchWhen.stree.txt index f6d20f248..0f8443577 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_NestedTryCatchWhen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_NestedTryCatchWhen.stree.txt @@ -1,38 +1,41 @@ -Statement block - Gen - 69 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - SyntaxKind.LeftBrace;[{]; - Code span - Gen - [try { someMethod(); } catch(Exception) when (true) { handleIO(); }] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (2:0,2) - Tokens:30 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[someMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[handleIO]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (68:0,68) - Tokens:1 - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..69)::69 - [@{try { someMethod(); } catch(Exception) when (true) { handleIO(); }}] + CSharpStatement - [0..69)::69 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementBody - [1..69)::68 + RazorMetaCode - [1..2)::1 - Gen - SpanEditHandler;Accepts:None + LeftBrace;[{]; + CSharpCodeBlock - [2..68)::66 + CSharpStatementLiteral - [2..68)::66 - [try { someMethod(); } catch(Exception) when (true) { handleIO(); }] - Gen - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[someMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[handleIO]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + RazorMetaCode - [68..69)::1 - Gen - SpanEditHandler;Accepts:None + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenCatchWhenComplete_SingleLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenCatchWhenComplete_SingleLine.stree.txt index 5f93680e4..05378ee5c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenCatchWhenComplete_SingleLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenCatchWhenComplete_SingleLine.stree.txt @@ -1,54 +1,54 @@ -Statement block - Gen - 92 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { A(); } catch(Exception) when (true) { B(); } catch(IOException) when (false) { C(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:50 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[A]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[B]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[IOException]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[false]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[C]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..92)::92 - [@try { A(); } catch(Exception) when (true) { B(); } catch(IOException) when (false) { C(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..92)::91 - [try { A(); } catch(Exception) when (true) { B(); } catch(IOException) when (false) { C(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[A]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[B]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[IOException]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[false]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[C]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenComplete_SingleLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenComplete_SingleLine.stree.txt index c07143387..d17ac8b9d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenComplete_SingleLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenComplete_SingleLine.stree.txt @@ -1,34 +1,34 @@ -Statement block - Gen - 67 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { someMethod(); } catch(Exception) when (true) { handleIO(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:30 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[someMethod]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[handleIO]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..67)::67 - [@try { someMethod(); } catch(Exception) when (true) { handleIO(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..67)::66 - [try { someMethod(); } catch(Exception) when (true) { handleIO(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[someMethod]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[handleIO]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenFinallyComplete_SingleLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenFinallyComplete_SingleLine.stree.txt index 0e2806809..7d1cb95bb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenFinallyComplete_SingleLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenFinallyComplete_SingleLine.stree.txt @@ -1,45 +1,45 @@ -Statement block - Gen - 68 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { A(); } catch(Exception) when (true) { B(); } finally { C(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:41 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[A]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[catch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[Exception]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[when]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[B]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[C]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..68)::68 - [@try { A(); } catch(Exception) when (true) { B(); } finally { C(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..68)::67 - [try { A(); } catch(Exception) when (true) { B(); } finally { C(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[A]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[catch]; + LeftParenthesis;[(]; + Identifier;[Exception]; + RightParenthesis;[)]; + Whitespace;[ ]; + Keyword;[when]; + Whitespace;[ ]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[B]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[C]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/FinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/FinallyClause.stree.txt index 82427e556..dc9615898 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/FinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/FinallyClause.stree.txt @@ -1,25 +1,25 @@ -Statement block - Gen - 38 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { foo(); } finally { Dispose(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:21 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[finally]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Dispose]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..38)::38 - [@try { foo(); } finally { Dispose(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..38)::37 - [try { foo(); } finally { Dispose(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; + Whitespace;[ ]; + Keyword;[finally]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[Dispose]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForEachStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForEachStatement.stree.txt index df4a2559f..ec6233e29 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForEachStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForEachStatement.stree.txt @@ -1,23 +1,23 @@ -Statement block - Gen - 35 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [foreach(var foo in bar) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:19 - SyntaxKind.Keyword;[foreach]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[in]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[bar]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..35)::35 - [@foreach(var foo in bar) { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..35)::34 - [foreach(var foo in bar) { foo(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[foreach]; + LeftParenthesis;[(]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Keyword;[in]; + Whitespace;[ ]; + Identifier;[bar]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForStatement.stree.txt index 7453adeb1..fdf8533db 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForStatement.stree.txt @@ -1,34 +1,34 @@ -Statement block - Gen - 43 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [for(int i = 0; i++; i < length) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:30 - SyntaxKind.Keyword;[for]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[int]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.IntegerLiteral;[0]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Increment;[++]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[i]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[length]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..43)::43 - [@for(int i = 0; i++; i < length) { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..43)::42 - [for(int i = 0; i++; i < length) { foo(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[for]; + LeftParenthesis;[(]; + Keyword;[int]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[0]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Increment;[++]; + Semicolon;[;]; + Whitespace;[ ]; + Identifier;[i]; + Whitespace;[ ]; + LessThan;[<]; + Whitespace;[ ]; + Identifier;[length]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/IfStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/IfStatement.stree.txt index 6d9974589..1e5dc0955 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/IfStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/IfStatement.stree.txt @@ -1,17 +1,17 @@ -Statement block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [if(true) { foo(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:13 - SyntaxKind.Keyword;[if]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..20)::20 - [@if(true) { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..20)::19 - [if(true) { foo(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[if]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/LockStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/LockStatement.stree.txt index eddbbb0fc..97d8f9ff4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/LockStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/LockStatement.stree.txt @@ -1,17 +1,17 @@ -Statement block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [lock(baz) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:13 - SyntaxKind.Keyword;[lock]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[baz]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..21)::21 - [@lock(baz) { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..21)::20 - [lock(baz) { foo(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[lock]; + LeftParenthesis;[(]; + Identifier;[baz]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt index 7b91a6e36..96e3d8c85 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt @@ -1,5 +1,8 @@ -Expression block - Gen - 3 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [is] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - SyntaxKind.Keyword;[is]; +CSharpCodeBlock - [0..3)::3 - [@is] + CSharpImplicitExpression - [0..3)::3 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpImplicitExpressionBody - [1..3)::2 + CSharpCodeBlock - [1..3)::2 + CSharpExpressionLiteral - [1..3)::2 - [is] - Gen - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 + Keyword;[is]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_Complete_Spaced.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_Complete_Spaced.stree.txt index 659aa732f..d3cb56db9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_Complete_Spaced.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_Complete_Spaced.stree.txt @@ -1,13 +1,15 @@ -Directive block - Gen - 40 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [using static global::System.Console] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:9 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[static]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[global]; - SyntaxKind.DoubleColon;[::]; - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Console]; +CSharpCodeBlock - [0..40)::40 - [@using static global::System.Console] + RazorDirective - [0..40)::40 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..40)::39 + CSharpStatementLiteral - [1..40)::39 - [using static global::System.Console] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Keyword;[static]; + Whitespace;[ ]; + Identifier;[global]; + DoubleColon;[::]; + Identifier;[System]; + Dot;[.]; + Identifier;[Console]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_GlobalPrefix.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_GlobalPrefix.stree.txt index ca4687394..38c128b52 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_GlobalPrefix.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_GlobalPrefix.stree.txt @@ -1,13 +1,15 @@ -Directive block - Gen - 36 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [using static global::System.Console] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:9 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[static]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[global]; - SyntaxKind.DoubleColon;[::]; - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Console]; +CSharpCodeBlock - [0..36)::36 - [@using static global::System.Console] + RazorDirective - [0..36)::36 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..36)::35 + CSharpStatementLiteral - [1..36)::35 - [using static global::System.Console] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Keyword;[static]; + Whitespace;[ ]; + Identifier;[global]; + DoubleColon;[::]; + Identifier;[System]; + Dot;[.]; + Identifier;[Console]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_MultipleIdentifiers.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_MultipleIdentifiers.stree.txt index fb3e4bc32..9c2437595 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_MultipleIdentifiers.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_MultipleIdentifiers.stree.txt @@ -1,11 +1,13 @@ -Directive block - Gen - 28 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [using static System.Console] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:7 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[static]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Console]; +CSharpCodeBlock - [0..28)::28 - [@using static System.Console] + RazorDirective - [0..28)::28 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..28)::27 + CSharpStatementLiteral - [1..28)::27 - [using static System.Console] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Keyword;[static]; + Whitespace;[ ]; + Identifier;[System]; + Dot;[.]; + Identifier;[Console]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_NoUsing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_NoUsing.stree.txt index 8c7fe292a..1cd305cda 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_NoUsing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_NoUsing.stree.txt @@ -1,7 +1,9 @@ -Directive block - Gen - 13 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [using static] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:3 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[static]; +CSharpCodeBlock - [0..13)::13 - [@using static] + RazorDirective - [0..13)::13 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..13)::12 + CSharpStatementLiteral - [1..13)::12 - [using static] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Keyword;[static]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_SingleIdentifier.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_SingleIdentifier.stree.txt index d618dfba5..d3679a827 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_SingleIdentifier.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_SingleIdentifier.stree.txt @@ -1,9 +1,11 @@ -Directive block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [using static System] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:5 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[static]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[System]; +CSharpCodeBlock - [0..20)::20 - [@using static System] + RazorDirective - [0..20)::20 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..20)::19 + CSharpStatementLiteral - [1..20)::19 - [using static System] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Keyword;[static]; + Whitespace;[ ]; + Identifier;[System]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/SwitchStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/SwitchStatement.stree.txt index 74740937b..6ef926a78 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/SwitchStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/SwitchStatement.stree.txt @@ -1,17 +1,17 @@ -Statement block - Gen - 23 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [switch(foo) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:13 - SyntaxKind.Keyword;[switch]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..23)::23 - [@switch(foo) { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..23)::22 - [switch(foo) { foo(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[switch]; + LeftParenthesis;[(]; + Identifier;[foo]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/TryStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/TryStatement.stree.txt index 96b61f4e1..30c107960 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/TryStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/TryStatement.stree.txt @@ -1,14 +1,14 @@ -Statement block - Gen - 15 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [try { foo(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:10 - SyntaxKind.Keyword;[try]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..15)::15 - [@try { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..15)::14 - [try { foo(); }] - Gen - SpanEditHandler;Accepts:Any + Keyword;[try]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingNamespaceImport.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingNamespaceImport.stree.txt index a99f6b2bc..46b7c7789 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingNamespaceImport.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingNamespaceImport.stree.txt @@ -1,13 +1,15 @@ -Directive block - Gen - 41 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [using System.Text.Encoding.ASCIIEncoding] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:9 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Text]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Encoding]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[ASCIIEncoding]; +CSharpCodeBlock - [0..41)::41 - [@using System.Text.Encoding.ASCIIEncoding] + RazorDirective - [0..41)::41 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..41)::40 + CSharpStatementLiteral - [1..41)::40 - [using System.Text.Encoding.ASCIIEncoding] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Identifier;[System]; + Dot;[.]; + Identifier;[Text]; + Dot;[.]; + Identifier;[Encoding]; + Dot;[.]; + Identifier;[ASCIIEncoding]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingStatement.stree.txt index 652d8c2a3..2dcb752ea 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingStatement.stree.txt @@ -1,29 +1,29 @@ -Statement block - Gen - 42 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [using(var foo = new Foo()) { foo.Bar(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:25 - SyntaxKind.Keyword;[using]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Identifier;[var]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[new]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[Foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Bar]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..42)::42 - [@using(var foo = new Foo()) { foo.Bar(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..42)::41 - [using(var foo = new Foo()) { foo.Bar(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[using]; + LeftParenthesis;[(]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[foo]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + Identifier;[Foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + Dot;[.]; + Identifier;[Bar]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingTypeAlias.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingTypeAlias.stree.txt index 3940d00b6..09a892605 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingTypeAlias.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingTypeAlias.stree.txt @@ -1,23 +1,25 @@ -Directive block - Gen - 79 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen;> - [using StringDictionary = System.Collections.Generic.Dictionary] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:19 - SyntaxKind.Keyword;[using]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[StringDictionary]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Assign;[=]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[System]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Collections]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Generic]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Dictionary]; - SyntaxKind.LessThan;[<]; - SyntaxKind.Keyword;[string]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Keyword;[string]; - SyntaxKind.GreaterThan;[>]; +CSharpCodeBlock - [0..79)::79 - [@using StringDictionary = System.Collections.Generic.Dictionary] + RazorDirective - [0..79)::79 + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + RazorDirectiveBody - [1..79)::78 + CSharpStatementLiteral - [1..79)::78 - [using StringDictionary = System.Collections.Generic.Dictionary] - Gen;> - SpanEditHandler;Accepts:AnyExceptNewline + Keyword;[using]; + Whitespace;[ ]; + Identifier;[StringDictionary]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[System]; + Dot;[.]; + Identifier;[Collections]; + Dot;[.]; + Identifier;[Generic]; + Dot;[.]; + Identifier;[Dictionary]; + LessThan;[<]; + Keyword;[string]; + Comma;[,]; + Whitespace;[ ]; + Keyword;[string]; + GreaterThan;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/WhileStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/WhileStatement.stree.txt index 9c3cab815..b80423d15 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/WhileStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/WhileStatement.stree.txt @@ -1,17 +1,17 @@ -Statement block - Gen - 23 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.Transition;[@]; - Code span - Gen - [while(true) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:13 - SyntaxKind.Keyword;[while]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.Keyword;[true]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.LeftBrace;[{]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.Identifier;[foo]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.RightParenthesis;[)]; - SyntaxKind.Semicolon;[;]; - SyntaxKind.Whitespace;[ ]; - SyntaxKind.RightBrace;[}]; +CSharpCodeBlock - [0..23)::23 - [@while(true) { foo(); }] + CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None + Transition;[@]; + CSharpStatementLiteral - [1..23)::22 - [while(true) { foo(); }] - Gen - SpanEditHandler;Accepts:None + Keyword;[while]; + LeftParenthesis;[(]; + Keyword;[true]; + RightParenthesis;[)]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + Identifier;[foo]; + LeftParenthesis;[(]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt index 497fa3ec8..bf9bec131 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt @@ -1,39 +1,47 @@ -Expression block - Gen - 37 - (0:0,0) - MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - SyntaxKind.LeftParenthesis;[(]; - Code span - Gen - [Html.Repeat(10, ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:7 - SyntaxKind.Identifier;[Html]; - SyntaxKind.Dot;[.]; - SyntaxKind.Identifier;[Repeat]; - SyntaxKind.LeftParenthesis;[(]; - SyntaxKind.IntegerLiteral;[10]; - SyntaxKind.Comma;[,]; - SyntaxKind.Whitespace;[ ]; - Template block - Gen