From 3e3df58ac3ea4065c43c731d29840d0d6d6d2dd4 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Tue, 13 Nov 2018 14:17:44 -0800 Subject: [PATCH 1/6] Razor parser rewrite - Rewrite CSharp parser - Basic rewrite of HTML parser (More improvements to follow) - Define and generate syntax nodes and boilerplate - Rewrite ClassifiedSpan and TagHelperSpan generation logic - Rewrite TagHelper phase - Rewrite Intermediate phase - Rewrite other miscellaneous features and bug fixes - Rewrite partial parsing - Added some syntax manipulation APIs - Removed unused legacy types --- .../ClassifiedSpanVisitor.cs | 336 ++ .../DefaultDirectiveSyntaxTreePass.cs | 36 +- ...faultRazorIntermediateNodeLoweringPhase.cs | 892 ++-- .../DefaultRazorSyntaxTree.cs | 6 +- .../DefaultRazorTagHelperBinderPhase.cs | 155 +- .../DirectiveTokenEditHandler.cs | 7 +- .../HtmlNodeOptimizationPass.cs | 9 +- .../Legacy/AddImportChunkGenerator.cs | 17 - .../Legacy/AddTagHelperChunkGenerator.cs | 5 - .../Legacy/AttributeBlockChunkGenerator.cs | 19 - .../Legacy/AutoCompleteEditHandler.cs | 10 +- .../Legacy/Block.cs | 288 -- .../Legacy/BlockBuilder.cs | 40 - .../Legacy/BlockExtensions.cs | 28 - .../Legacy/CSharpCodeParser.cs | 3274 ++++++++------- .../Legacy/CSharpLanguageCharacteristics.cs | 8 +- .../Legacy/CSharpTokenizer.cs | 2 +- .../Legacy/ChunkGeneratorContext.cs | 25 - .../Legacy/CodeBlockEditHandler.cs | 16 +- .../Legacy/ConditionalAttributeCollapser.cs | 67 - .../Legacy/DirectiveChunkGenerator.cs | 5 - .../Legacy/DirectiveTokenChunkGenerator.cs | 5 - .../DynamicAttributeBlockChunkGenerator.cs | 17 - .../Legacy/EditResult.cs | 8 +- .../Legacy/ExpressionChunkGenerator.cs | 25 - .../Legacy/HtmlLanguageCharacteristics.cs | 8 +- .../Legacy/HtmlMarkupParser.cs | 2021 ++++----- .../Legacy/HtmlTokenizer.cs | 2 +- .../Legacy/IParentChunkGenerator.cs | 4 - .../Legacy/ISpanChunkGenerator.cs | 3 - .../Legacy/ImplicitExpressionEditHandler.cs | 117 +- .../Legacy/KnownTokenType.cs | 2 +- .../Legacy/LanguageCharacteristics.cs | 4 +- .../Legacy/LiteralAttributeChunkGenerator.cs | 23 - .../Legacy/MarkupChunkGenerator.cs | 10 - .../Legacy/MarkupRewriter.cs | 76 - .../Legacy/ParentChunkGenerator.cs | 23 - .../Legacy/ParserBase.cs | 4 - .../Legacy/ParserContext.cs | 7 +- .../Legacy/ParserVisitor.cs | 121 - .../Legacy/RazorCommentChunkGenerator.cs | 5 - .../Legacy/RazorParser.cs | 6 +- .../Legacy/RazorSyntaxTreeExtensions.cs | 104 +- .../Legacy/RemoveTagHelperChunkGenerator.cs | 5 - .../Legacy/Span.cs | 227 - .../Legacy/SpanBuilder.cs | 135 - .../Legacy/SpanChunkGenerator.cs | 15 - .../Legacy/SpanContext.cs | 52 + .../Legacy/SpanEditHandler.cs | 93 +- .../Legacy/StatementChunkGenerator.cs | 10 - .../Legacy/SyntaxConstants.cs | 1 + .../Legacy/SyntaxTreeBuilder.cs | 96 - .../Legacy/SyntaxTreeNode.cs | 49 - .../Legacy/TagHelperAttributeInfo.cs | 24 + .../Legacy/TagHelperAttributeNode.cs | 8 +- .../Legacy/TagHelperBlock.cs | 233 -- .../Legacy/TagHelperBlockBuilder.cs | 136 - .../Legacy/TagHelperBlockRewriter.cs | 1003 ++--- .../Legacy/TagHelperChunkGenerator.cs | 69 - .../Legacy/TagHelperInfo.cs | 24 + .../Legacy/TagHelperParseTreeRewriter.cs | 1120 ++--- .../TagHelperPrefixDirectiveChunkGenerator.cs | 5 - .../Legacy/TemplateBlockChunkGenerator.cs | 15 - .../Legacy/TokenizerBackedParser.cs | 618 +-- .../Legacy/WhiteSpaceRewriter.cs | 70 +- .../RazorSyntaxTree.cs | 5 +- .../SourceChange.cs | 41 +- .../Syntax/ChildSyntaxList.cs | 710 ++++ .../Syntax.xml.Internal.Generated.cs | 3712 +++++++++++++++-- .../Generated/Syntax.xml.Main.Generated.cs | 1065 ++++- .../Generated/Syntax.xml.Syntax.Generated.cs | 2491 ++++++++++- .../Syntax/GreenNode.cs | 32 +- .../Syntax/GreenNodeExtensions.cs | 6 +- .../InternalSyntax/RazorDirectiveSyntax.cs | 34 + .../Syntax/InternalSyntax/RazorSyntaxNode.cs | 27 + .../Syntax/InternalSyntax/SyntaxFactory.cs | 5 + .../Syntax/InternalSyntax/SyntaxListOfT.cs | 102 +- .../Syntax/InternalSyntax/SyntaxListPool.cs | 100 + .../Syntax/InternalSyntax/SyntaxRewriter.cs | 56 + .../Syntax/InternalSyntax/SyntaxToken.cs | 61 +- .../Syntax/LegacySyntaxNodeExtensions.cs | 248 ++ .../Syntax/MarkupElementRewriter.cs | 290 ++ ...MarkupMinimizedTagHelperAttributeSyntax.cs | 34 + .../Syntax/MarkupTagHelperAttributeSyntax.cs | 34 + .../Syntax/MarkupTagHelperElementSyntax.cs | 34 + .../Syntax/ParserState.cs | 14 - .../Syntax/RazorDirectiveSyntax.cs | 33 + .../Syntax/RazorSyntaxNode.cs | 13 + .../Syntax/Syntax.xml | 198 +- .../Syntax/SyntaxAnnotation.cs | 4 +- .../Syntax/SyntaxExtensions.cs | 53 + .../Syntax/SyntaxFactory.cs | 5 + .../Syntax/SyntaxKind.cs | 52 +- .../Syntax/SyntaxNode.Iterators.cs | 126 + .../Syntax/SyntaxNode.cs | 120 +- .../Syntax/SyntaxNodeExtensions.cs | 328 +- .../Syntax/SyntaxReplacer.cs | 207 + .../Syntax/SyntaxRewriter.cs | 148 + .../Syntax/SyntaxSerializer.cs | 304 ++ .../Syntax/SyntaxToken.cs | 58 +- .../TagHelperSpanVisitor.cs | 30 + .../DefaultRazorCompletionFactsService.cs | 14 +- .../BraceSmartIndenter.cs | 24 +- .../DefaultRazorIndentationFactsService.cs | 31 +- .../RazorSyntaxTreePartialParser.cs | 48 +- 105 files changed, 15300 insertions(+), 7445 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/Block.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/BlockBuilder.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/BlockExtensions.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/ChunkGeneratorContext.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/ConditionalAttributeCollapser.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/MarkupRewriter.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/ParserVisitor.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanBuilder.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanContext.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/SyntaxTreeBuilder.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/SyntaxTreeNode.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperAttributeInfo.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperBlock.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperBlockBuilder.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperInfo.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/ChildSyntaxList.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/RazorDirectiveSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/RazorSyntaxNode.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListPool.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxRewriter.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/LegacySyntaxNodeExtensions.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/MarkupElementRewriter.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/MarkupMinimizedTagHelperAttributeSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/MarkupTagHelperAttributeSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/MarkupTagHelperElementSyntax.cs delete mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/ParserState.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/RazorDirectiveSyntax.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/RazorSyntaxNode.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxExtensions.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.Iterators.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxReplacer.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxRewriter.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxSerializer.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/TagHelperSpanVisitor.cs diff --git a/src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs b/src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs new file mode 100644 index 000000000..024dfc172 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/ClassifiedSpanVisitor.cs @@ -0,0 +1,336 @@ +// 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 : SyntaxRewriter + { + 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 SyntaxNode VisitRazorCommentBlock(RazorCommentBlockSyntax node) + { + return 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); + + return razorCommentSyntax; + }); + } + + public override SyntaxNode 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)) + { + return base.VisitCSharpCodeBlock(node); + } + + return WriteBlock(node, BlockKindInternal.Statement, base.VisitCSharpCodeBlock); + } + + public override SyntaxNode VisitCSharpStatement(CSharpStatementSyntax node) + { + return WriteBlock(node, BlockKindInternal.Statement, base.VisitCSharpStatement); + } + + public override SyntaxNode VisitCSharpExplicitExpression(CSharpExplicitExpressionSyntax node) + { + return WriteBlock(node, BlockKindInternal.Expression, base.VisitCSharpExplicitExpression); + } + + public override SyntaxNode VisitCSharpImplicitExpression(CSharpImplicitExpressionSyntax node) + { + return WriteBlock(node, BlockKindInternal.Expression, base.VisitCSharpImplicitExpression); + } + + public override SyntaxNode VisitRazorDirective(RazorDirectiveSyntax node) + { + return WriteBlock(node, BlockKindInternal.Directive, base.VisitRazorDirective); + } + + public override SyntaxNode VisitCSharpTemplateBlock(CSharpTemplateBlockSyntax node) + { + return WriteBlock(node, BlockKindInternal.Template, base.VisitCSharpTemplateBlock); + } + + public override SyntaxNode VisitMarkupBlock(MarkupBlockSyntax node) + { + return WriteBlock(node, BlockKindInternal.Markup, base.VisitMarkupBlock); + } + + public override SyntaxNode VisitGenericBlock(GenericBlockSyntax node) + { + if (!(node.Parent is MarkupTagHelperAttributeValueSyntax) && + node.FirstAncestorOrSelf(n => n is MarkupTagHelperAttributeValueSyntax) != null) + { + return WriteBlock(node, BlockKindInternal.Expression, base.VisitGenericBlock); + } + + return base.VisitGenericBlock(node); + } + + public override SyntaxNode VisitMarkupTagHelperAttributeValue(MarkupTagHelperAttributeValueSyntax node) + { + // We don't generate a classified span when the attribute value is a simple literal value. + if (node.Children.Count > 1 || + (node.Children.Count == 1 && node.Children[0] is MarkupDynamicAttributeValueSyntax)) + { + return WriteBlock(node, BlockKindInternal.Markup, base.VisitMarkupTagHelperAttributeValue); + } + + return base.VisitMarkupTagHelperAttributeValue(node); + } + + public override SyntaxNode VisitMarkupTagBlock(MarkupTagBlockSyntax node) + { + return WriteBlock(node, BlockKindInternal.Tag, base.VisitMarkupTagBlock); + } + + public override SyntaxNode VisitMarkupTagHelperElement(MarkupTagHelperElementSyntax node) + { + return WriteBlock(node, BlockKindInternal.Tag, base.VisitMarkupTagHelperElement); + } + + public override SyntaxNode VisitMarkupTagHelperStartTag(MarkupTagHelperStartTagSyntax node) + { + var rewritten = new List(); + foreach (var child in node.Children) + { + if (child is MarkupTagHelperAttributeSyntax attribute) + { + var rewrittenAttribute = (MarkupTagHelperAttributeSyntax)Visit(attribute); + rewritten.Add(rewrittenAttribute); + } + else + { + rewritten.Add(child); + } + } + + return node.Update(new SyntaxList(rewritten)); + } + + public override SyntaxNode VisitMarkupTagHelperEndTag(MarkupTagHelperEndTagSyntax node) + { + return node; + } + + public override SyntaxNode VisitMarkupAttributeBlock(MarkupAttributeBlockSyntax node) + { + return 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); + + return n; + }); + } + + public override SyntaxNode VisitMarkupTagHelperAttribute(MarkupTagHelperAttributeSyntax node) + { + var rewrittenValue = (MarkupTagHelperAttributeValueSyntax)Visit(node.Value); + + return node.Update(node.NamePrefix, node.Name, node.NameSuffix, node.EqualsToken, node.ValuePrefix, rewrittenValue, node.ValueSuffix); + } + + public override SyntaxNode VisitMarkupMinimizedAttributeBlock(MarkupMinimizedAttributeBlockSyntax node) + { + return WriteBlock(node, BlockKindInternal.Markup, n => + { + var mergedAttributePrefix = MergeTextLiteralSpans(node.NamePrefix, node.Name); + Visit(mergedAttributePrefix); + + return n; + }); + } + + public override SyntaxNode VisitMarkupCommentBlock(MarkupCommentBlockSyntax node) + { + return WriteBlock(node, BlockKindInternal.HtmlComment, base.VisitMarkupCommentBlock); + } + + public override SyntaxNode VisitMarkupDynamicAttributeValue(MarkupDynamicAttributeValueSyntax node) + { + return WriteBlock(node, BlockKindInternal.Markup, base.VisitMarkupDynamicAttributeValue); + } + + public override SyntaxNode VisitRazorMetaCode(RazorMetaCodeSyntax node) + { + WriteSpan(node, SpanKindInternal.MetaCode); + return base.VisitRazorMetaCode(node); + } + + public override SyntaxNode VisitCSharpTransition(CSharpTransitionSyntax node) + { + WriteSpan(node, SpanKindInternal.Transition); + return base.VisitCSharpTransition(node); + } + + public override SyntaxNode VisitMarkupTransition(MarkupTransitionSyntax node) + { + WriteSpan(node, SpanKindInternal.Transition); + return base.VisitMarkupTransition(node); + } + + public override SyntaxNode VisitCSharpStatementLiteral(CSharpStatementLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.Code); + return base.VisitCSharpStatementLiteral(node); + } + + public override SyntaxNode VisitCSharpExpressionLiteral(CSharpExpressionLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.Code); + return base.VisitCSharpExpressionLiteral(node); + } + + public override SyntaxNode VisitCSharpEphemeralTextLiteral(CSharpEphemeralTextLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.Code); + return base.VisitCSharpEphemeralTextLiteral(node); + } + + public override SyntaxNode VisitUnclassifiedTextLiteral(UnclassifiedTextLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.None); + return base.VisitUnclassifiedTextLiteral(node); + } + + public override SyntaxNode VisitMarkupLiteralAttributeValue(MarkupLiteralAttributeValueSyntax node) + { + WriteSpan(node, SpanKindInternal.Markup); + return base.VisitMarkupLiteralAttributeValue(node); + } + + public override SyntaxNode VisitMarkupTextLiteral(MarkupTextLiteralSyntax node) + { + if (node.Parent is MarkupLiteralAttributeValueSyntax) + { + return base.VisitMarkupTextLiteral(node); + } + + WriteSpan(node, SpanKindInternal.Markup); + return base.VisitMarkupTextLiteral(node); + } + + public override SyntaxNode VisitMarkupEphemeralTextLiteral(MarkupEphemeralTextLiteralSyntax node) + { + WriteSpan(node, SpanKindInternal.Markup); + return base.VisitMarkupEphemeralTextLiteral(node); + } + + private SyntaxNode WriteBlock(TNode node, BlockKindInternal kind, Func handler) where TNode : SyntaxNode + { + var previousBlock = _currentBlock; + var previousKind = _currentBlockKind; + + _currentBlock = node; + _currentBlockKind = kind; + + var result = handler(node); + + _currentBlock = previousBlock; + _currentBlockKind = previousKind; + + return result; + } + + 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..f1d46a60a 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 : SyntaxRewriter { protected readonly IntermediateNodeBuilder _builder; protected readonly DocumentIntermediateNode _document; @@ -206,195 +207,220 @@ 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 SyntaxNode VisitRazorDirective(RazorDirectiveSyntax node) { IntermediateNode directiveNode; - if (IsMalformed(chunkGenerator.Diagnostics)) + var diagnostics = node.GetDiagnostics(); + var descriptor = node.DirectiveDescriptor; + + if (descriptor != null) { - directiveNode = new MalformedDirectiveIntermediateNode() + // 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), - }; - } + directiveNode = new DirectiveIntermediateNode() + { + DirectiveName = descriptor.Directive, + Directive = descriptor, + Source = BuildSourceSpanFromNode(node), + }; + } - for (var i = 0; i < chunkGenerator.Diagnostics.Count; i++) - { - directiveNode.Diagnostics.Add(chunkGenerator.Diagnostics[i]); - } + for (var i = 0; i < diagnostics.Length; i++) + { + directiveNode.Diagnostics.Add(diagnostics[i]); + } - _builder.Push(directiveNode); + _builder.Push(directiveNode); + } - VisitDefault(block); + Visit(node.Body); - _builder.Pop(); - } + if (descriptor != null) + { + _builder.Pop(); + } - public override void VisitImportSpan(AddImportChunkGenerator chunkGenerator, Span span) - { - var namespaceImport = chunkGenerator.Namespace.Trim(); - var namespaceSpan = BuildSourceSpanFromNode(span); - _usings.Add(new UsingReference(namespaceImport, namespaceSpan)); + return node; } - public override void VisitAddTagHelperSpan(AddTagHelperChunkGenerator chunkGenerator, Span span) + public override SyntaxNode 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), - }; + return base.VisitCSharpStatementLiteral(node); } - 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(); + } + + return 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; + if (node.Position == SourceDocument.Length) + { + // This can happen when we have a marker symbol at the end of the syntax tree. + var location = SourceDocument.Lines.GetLocation(node.Position - 1); + return new SourceSpan( + SourceDocument.FilePath, + location.AbsoluteIndex + 1, + location.LineIndex, + location.CharacterIndex + 1, + length: 0); + } + + 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 +434,149 @@ public MainSourceVisitor(DocumentIntermediateNode document, IntermediateNodeBuil // Name=checked // Prefix= checked=" // Suffix=" - public override void VisitAttributeBlock(AttributeBlockChunkGenerator chunkGenerator, Block block) + public override SyntaxNode 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(); + } + } + + return node; + } + + public override SyntaxNode VisitMarkupMinimizedAttributeBlock(MarkupMinimizedAttributeBlockSyntax node) + { + var name = node.Name.GetContent(); + if (name.StartsWith("data-", StringComparison.OrdinalIgnoreCase) && + !_featureFlags.EXPERIMENTAL_AllowConditionalDataDashAttributes) + { + return base.VisitMarkupMinimizedAttributeBlock(node); + } + + // 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); + + return Visit(literal); } // Example // // Prefix= (space) // Children will contain a token for @false. - public override void VisitDynamicAttributeBlock(DynamicAttributeBlockChunkGenerator chunkGenerator, Block block) + public override SyntaxNode 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(); + + return node; } - public override void VisitLiteralAttributeSpan(LiteralAttributeChunkGenerator chunkGenerator, Span span) + public override SyntaxNode 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(); + + return node; } - public override void VisitTemplateBlock(TemplateBlockChunkGenerator chunkGenerator, Block block) + public override SyntaxNode VisitCSharpTemplateBlock(CSharpTemplateBlockSyntax node) { var templateNode = new TemplateIntermediateNode(); _builder.Push(templateNode); - VisitDefault(block); + var result = base.VisitCSharpTemplateBlock(node); _builder.Pop(); @@ -503,13 +592,15 @@ 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, contentLength); } } + + return result; } // CSharp expressions are broken up into blocks and spans because Razor allows Razor comments @@ -518,19 +609,18 @@ 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 SyntaxNode VisitCSharpExplicitExpression(CSharpExplicitExpressionSyntax node) { if (_builder.Current is CSharpExpressionAttributeValueIntermediateNode) { - VisitDefault(block); - return; + return base.VisitCSharpExplicitExpression(node); } var expressionNode = new CSharpExpressionIntermediateNode(); _builder.Push(expressionNode); - VisitDefault(block); + var result = base.VisitCSharpExplicitExpression(node); _builder.Pop(); @@ -546,66 +636,127 @@ 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, contentLength); } } + + return result; } - public override void VisitExpressionSpan(ExpressionChunkGenerator chunkGenerator, Span span) + public override SyntaxNode VisitCSharpImplicitExpression(CSharpImplicitExpressionSyntax node) { - _builder.Add(new IntermediateToken() + if (_builder.Current is CSharpExpressionAttributeValueIntermediateNode) { - Content = span.Content, - Kind = TokenKind.CSharp, - Source = BuildSourceSpanFromNode(span), - }); - } + return base.VisitCSharpImplicitExpression(node); + } - public override void VisitStatementSpan(StatementChunkGenerator chunkGenerator, Span span) - { - var isAttributeValue = _builder.Current is CSharpCodeAttributeValueIntermediateNode; + var expressionNode = new CSharpExpressionIntermediateNode(); + + _builder.Push(expressionNode); + + var result = base.VisitCSharpImplicitExpression(node); - if (!isAttributeValue) + _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); + } + } + + return result; + } + + public override SyntaxNode 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. + var markupLiteral = SyntaxFactory.MarkupTextLiteral(node.LiteralTokens).Green.CreateRed(node.Parent, node.Position); + return Visit(markupLiteral); } _builder.Add(new IntermediateToken() { - Content = span.Content, + Content = node.GetContent(), Kind = TokenKind.CSharp, - Source = BuildSourceSpanFromNode(span), + Source = BuildSourceSpanFromNode(node), }); - if (!isAttributeValue) + return base.VisitCSharpExpressionLiteral(node); + } + + public override SyntaxNode 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(); + } } + + return base.VisitCSharpStatementLiteral(node); } - public override void VisitMarkupSpan(MarkupChunkGenerator chunkGenerator, Span span) + public override SyntaxNode VisitMarkupTextLiteral(MarkupTextLiteralSyntax node) { - if (span.Tokens.Count == 1) + var context = node.GetSpanContext(); + if (context != null && context.ChunkGenerator == SpanChunkGenerator.Null) { - var token = span.Tokens[0]; + return base.VisitMarkupTextLiteral(node); + } + + if (node.LiteralTokens.Count == 1) + { + 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. - return; + return base.VisitMarkupTextLiteral(node); } } - var source = BuildSourceSpanFromNode(span); + var source = BuildSourceSpanFromNode(node); var currentChildren = _builder.Current.Children; if (currentChildren.Count > 0 && currentChildren[currentChildren.Count - 1] is HtmlContentIntermediateNode) { @@ -613,8 +764,8 @@ public override void VisitMarkupSpan(MarkupChunkGenerator chunkGenerator, Span s if (existingHtmlContent.Source == null && source == null) { - Combine(existingHtmlContent, span); - return; + Combine(existingHtmlContent, node); + return base.VisitMarkupTextLiteral(node); } if (source != null && @@ -622,8 +773,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); - return; + Combine(existingHtmlContent, node); + return base.VisitMarkupTextLiteral(node); } } @@ -635,23 +786,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(); + + return base.VisitMarkupTextLiteral(node); } - public override void VisitTagHelperBlock(TagHelperChunkGenerator chunkGenerator, Block block) + public override SyntaxNode 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 +808,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 +821,229 @@ public override void VisitTagHelperBlock(TagHelperChunkGenerator chunkGenerator, _builder.Push(new TagHelperBodyIntermediateNode()); - VisitDefault(block); + VisitList(node.Body); _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(); + + return node; + } + + public override SyntaxNode VisitMarkupTagHelperStartTag(MarkupTagHelperStartTagSyntax node) + { + foreach (var child in node.Children) + { + if (child is MarkupTagHelperAttributeSyntax || child is MarkupMinimizedTagHelperAttributeSyntax) + { + Visit(child); + } + } + + return node; } - private void Combine(HtmlContentIntermediateNode node, Span span) + public override SyntaxNode 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 node; + } + + 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 node; + } + + 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); + } + + return node; + } + + public override SyntaxNode 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(); + } + + return node; + } + + 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 +1055,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 +1131,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 index de77a1746..822368206 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AttributeBlockChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AttributeBlockChunkGenerator.cs @@ -22,25 +22,6 @@ public AttributeBlockChunkGenerator(string name, LocationTagged prefix, 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); 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..6155fed77 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,1618 +450,1915 @@ 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(GetExpectedToken(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() + private void ParseStatement(in SyntaxListBuilder builder, Block block) { - 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() - { - Output(SpanKindInternal.Code); - - var wasNested = IsNested; - IsNested = true; - using (PushSpanConfig()) - { - ParseBlock(); - } - - Span.Start = CurrentLocation; - Initialize(Span); - IsNested = wasNested; - NextToken(); - } - - 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)); - } - - protected override void HandleEmbeddedTransition() - { - if (Language.IsTransition(CurrentToken)) - { - PutCurrentBack(); - Template(); - } - else if (Language.IsCommentStart(CurrentToken)) + 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) { - RazorComment(); - } - } - - private void ParseWithOtherParser(Action parseAction) - { - // 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; + if (lastWhitespace != null) + { + Accept(lastWhitespace); + } - using (PushSpanConfig()) - { - parseAction(HtmlParser); + builder.Add(OutputTokensAsStatementLiteral()); + return; } - Span.Start = CurrentLocation; - Initialize(Span); - - IsNested = wasNested; - - NextToken(); - } - - 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); - } - - 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); - } - - private void KeywordBlock(bool topLevel) - { - HandleKeyword(topLevel, () => - { - Context.Builder.CurrentBlock.Type = BlockKindInternal.Expression; - Context.Builder.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); - ImplicitExpression(); - }); - } - - 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); - } + var kind = CurrentToken.Kind; + var location = CurrentStart; - private void DoStatement(bool topLevel) - { - Assert(CSharpKeyword.Do); - UnconditionalBlock(); - WhileClause(); - if (topLevel) - { - CompleteBlock(); - } - } + // 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)); - private void WhileClause() - { - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; - var whitespace = SkipToNextImportantToken(); + var isMarkup = isSingleLineMarkup || + kind == SyntaxKind.LessThan || + (kind == SyntaxKind.Transition && NextIs(SyntaxKind.LessThan)); - if (At(CSharpKeyword.While)) + if (Context.DesignTimeMode || !isMarkup) { - Accept(whitespace); - Assert(CSharpKeyword.While); - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (AcceptCondition() && Optional(SyntaxKind.Semicolon)) + // CODE owns whitespace, MARKUP owns it ONLY in DesignTimeMode. + if (lastWhitespace != null) { - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + Accept(lastWhitespace); } } else { - PutCurrentBack(); - PutBack(whitespace); - } - } + var nextToken = Lookahead(1); - private void UsingKeyword(bool topLevel) - { - Assert(CSharpKeyword.Using); - var block = new Block(CurrentToken, CurrentStart); - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + // MARKUP owns whitespace EXCEPT in DesignTimeMode. + PutCurrentBack(); - if (At(SyntaxKind.LeftParenthesis)) - { - // using ( ==> Using Statement - UsingStatement(block); - } - else if (At(SyntaxKind.Identifier) || At(CSharpKeyword.Static)) - { - // using Identifier ==> Using Declaration - if (!topLevel) + // Put back the whitespace unless it precedes a '' tag. + if (nextToken != null && + !string.Equals(nextToken.Content, SyntaxConstants.TextTagName, StringComparison.Ordinal)) { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_NamespaceImportAndTypeAliasCannotExistWithinCodeBlock( - new SourceSpan(block.Start, block.Name.Length))); - StandardStatement(); + PutBack(lastWhitespace); } else { - UsingDeclaration(); + // If it precedes a '' tag, it should be accepted as code. + Accept(lastWhitespace); } } - if (topLevel) - { - CompleteBlock(); - } - } - - private void UsingDeclaration() - { - // Set block type to directive - Context.Builder.CurrentBlock.Type = BlockKindInternal.Directive; - - var start = CurrentStart; - if (At(SyntaxKind.Identifier)) + if (isMarkup) { - // non-static using - NamespaceOrTypeName(); - var whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (At(SyntaxKind.Assign)) + if (kind == SyntaxKind.Transition && !isSingleLineMarkup) { - // Alias - Accept(whitespace); - Assert(SyntaxKind.Assign); - AcceptAndMoveNext(); - - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - - // One more namespace or type name - NamespaceOrTypeName(); + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart( + new SourceSpan(location, contentLength: 1 /* @ */))); } - else + + // Markup block + builder.Add(OutputTokensAsStatementLiteral()); + if (Context.DesignTimeMode && CurrentToken != null && + (CurrentToken.Kind == SyntaxKind.LessThan || CurrentToken.Kind == SyntaxKind.Transition)) { PutCurrentBack(); - PutBack(whitespace); } + OtherParserBlock(builder); } - else if (At(CSharpKeyword.Static)) - { - // static using - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - NamespaceOrTypeName(); - } - - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.AnyExceptNewline; - Span.ChunkGenerator = new AddImportChunkGenerator(new LocationTagged( - string.Concat(Span.Tokens.Skip(1).Select(s => s.Content)), - start)); - - // Optional ";" - if (EnsureCurrent()) + else { - Optional(SyntaxKind.Semicolon); + // 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; + } } } - // Used for parsing a qualified name like that which follows the `namespace` keyword. - // - // qualified-identifier: - // identifier - // qualified-identifier . identifier - protected bool QualifiedIdentifier(out int identifierLength) + private void ParseEmbeddedExpression(in SyntaxListBuilder builder) { - var currentIdentifierLength = 0; - var expectingDot = false; - var tokens = ReadWhile(token => - { - var type = token.Kind; - if ((expectingDot && type == SyntaxKind.Dot) || - (!expectingDot && type == SyntaxKind.Identifier)) - { - expectingDot = !expectingDot; - return true; - } + // First, verify the type of the block + Assert(SyntaxKind.Transition); + var transition = CurrentToken; + NextToken(); - if (type != SyntaxKind.Whitespace && - type != SyntaxKind.NewLine) - { - expectingDot = false; - currentIdentifierLength += token.Content.Length; - } + if (At(SyntaxKind.Transition)) + { + // Escaped "@" + builder.Add(OutputTokensAsStatementLiteral()); - return false; - }); + // Output "@" as hidden span + Accept(transition); + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + builder.Add(OutputTokensAsEphemeralLiteral()); - identifierLength = currentIdentifierLength; - var validQualifiedIdentifier = expectingDot; - if (validQualifiedIdentifier) + Assert(SyntaxKind.Transition); + AcceptAndMoveNext(); + ParseStandardStatement(builder); + } + else { - foreach (var token in tokens) + // Throw errors as necessary, but continue parsing + if (At(SyntaxKind.LeftBrace)) { - identifierLength += token.Content.Length; - Accept(token); + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedNestedCodeBlock( + new SourceSpan(CurrentStart, contentLength: 1 /* { */))); } - return true; - } - else - { + // @( or @foo - Nested expression, parse a child block PutCurrentBack(); + PutBack(transition); - foreach (var token in tokens) - { - identifierLength += token.Content.Length; - PutBack(token); - } + // Before exiting, add a marker span if necessary + AcceptMarkerTokenIfNecessary(); + builder.Add(OutputTokensAsStatementLiteral()); - EnsureCurrent(); - return false; + var nestedBlock = ParseNestedBlock(); + builder.Add(nestedBlock); } } - protected bool NamespaceOrTypeName() + private RazorSyntaxNode ParseNestedBlock() { - if (Optional(SyntaxKind.LeftParenthesis)) + var wasNested = IsNested; + IsNested = true; + + RazorSyntaxNode nestedBlock; + using (PushSpanContextConfig()) { - while (!Optional(SyntaxKind.RightParenthesis) && !EndOfFile) - { - Optional(SyntaxKind.Whitespace); + nestedBlock = ParseBlock(); + } - if (!NamespaceOrTypeName()) - { - return false; - } + InitializeContext(SpanContext); + IsNested = wasNested; + NextToken(); - Optional(SyntaxKind.Whitespace); - Optional(SyntaxKind.Identifier); - Optional(SyntaxKind.Whitespace); - Optional(SyntaxKind.Comma); - } + return nestedBlock; + } - if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) - { - // Only accept the whitespace if we are going to consume the next token. + private void ParseStandardStatement(in SyntaxListBuilder builder) + { + while (!EndOfFile) + { + 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)) + { + Optional(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; + } + } + } - Optional(SyntaxKind.QuestionMark); // Nullable + private void ParseTemplate(in SyntaxListBuilder builder) + { + if (Context.InTemplateContext) + { + 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(); + OtherParserBlock(templateBuilder); + var template = SyntaxFactory.CSharpTemplateBlock(templateBuilder.ToList()); + builder.Add(template); + + Context.InTemplateContext = false; + } + } + + protected bool TryParseDirective(in SyntaxListBuilder builder, CSharpTransitionSyntax transition, string directive) + { + if (_directiveParserMap.TryGetValue(directive, out var handler)) + { + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + handler(builder, transition); return true; } - else if (Optional(SyntaxKind.Identifier) || Optional(SyntaxKind.Keyword)) + + return false; + } + + private void SetupDirectiveParsers(IEnumerable directiveDescriptors) + { + var allDirectives = directiveDescriptors.Concat(DefaultDirectiveDescriptors).ToList(); + + for (var i = 0; i < allDirectives.Count; i++) { - if (Optional(SyntaxKind.DoubleColon)) + var directiveDescriptor = allDirectives[i]; + CurrentKeywords.Add(directiveDescriptor.Directive); + MapDirectives((builder, transition) => ParseExtensibleDirective(builder, transition, directiveDescriptor), directiveDescriptor.Directive); + } + + MapDirectives(ParseTagHelperPrefixDirective, SyntaxConstants.CSharp.TagHelperPrefixKeyword); + MapDirectives(ParseAddTagHelperDirective, SyntaxConstants.CSharp.AddTagHelperKeyword); + MapDirectives(ParseRemoveTagHelperDirective, SyntaxConstants.CSharp.RemoveTagHelperKeyword); + } + + 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) { - if (!Optional(SyntaxKind.Identifier)) + var @char = Context.SourceDocument[index]; + + if (!char.IsWhiteSpace(@char)) { - Optional(SyntaxKind.Keyword); + var currentDirective = CurrentToken.Content; + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_DirectiveMustAppearAtStartOfLine( + new SourceSpan(CurrentStart, currentDirective.Length), currentDirective)); + break; } } - if (At(SyntaxKind.LessThan)) + } + } + + protected void MapDirectives(Action, CSharpTransitionSyntax> handler, params string[] directives) + { + foreach (var directive in directives) + { + _directiveParserMap.Add(directive, (builder, transition) => { - TypeArgumentList(); + 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); } - if (Optional(SyntaxKind.Dot)) + 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); + } + + 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); + } + + 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 { - NamespaceOrTypeName(); + 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) + { + 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; + var directiveChunkGenerator = new DirectiveChunkGenerator(descriptor); + 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()); + + Optional(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 + { + if (directiveErrorSink.Errors.Count > 0) + { + directiveChunkGenerator.Diagnostics.AddRange(directiveErrorSink.Errors); + } + + 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; + } + } + } + + // Used for parsing a qualified name like that which follows the `namespace` keyword. + // + // qualified-identifier: + // identifier + // qualified-identifier . identifier + protected bool TryParseQualifiedIdentifier(out int identifierLength) + { + var currentIdentifierLength = 0; + var expectingDot = false; + var tokens = ReadWhile(token => + { + var type = token.Kind; + if ((expectingDot && type == SyntaxKind.Dot) || + (!expectingDot && type == SyntaxKind.Identifier)) + { + expectingDot = !expectingDot; + return true; } - if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) + if (type != SyntaxKind.Whitespace && + type != SyntaxKind.NewLine) { - // Only accept the whitespace if we are going to consume the next token. - AcceptAndMoveNext(); + expectingDot = false; + currentIdentifierLength += token.Content.Length; } - Optional(SyntaxKind.QuestionMark); // Nullable + return false; + }); - if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.LeftBracket)) + identifierLength = currentIdentifierLength; + var validQualifiedIdentifier = expectingDot; + if (validQualifiedIdentifier) + { + foreach (var token in tokens) { - // Only accept the whitespace if we are going to consume the next token. - AcceptAndMoveNext(); + identifierLength += token.Content.Length; + Accept(token); } - while (At(SyntaxKind.LeftBracket)) - { - Balance(BalancingModes.None); - Optional(SyntaxKind.RightBracket); - } return true; } else { - return false; - } - } - - private void TypeArgumentList() - { - Assert(SyntaxKind.LessThan); - Balance(BalancingModes.None); - Optional(SyntaxKind.GreaterThan); - } - - private void UsingStatement(Block block) - { - Assert(SyntaxKind.LeftParenthesis); - - // Parse condition - if (AcceptCondition()) - { - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - - // Parse code block - ExpectCodeBlock(block); - } - } + PutCurrentBack(); - private void TryStatement(bool topLevel) - { - Assert(CSharpKeyword.Try); - UnconditionalBlock(); - AfterTryClause(); - if (topLevel) - { - CompleteBlock(); - } - } + foreach (var token in tokens) + { + identifierLength += token.Content.Length; + PutBack(token); + } - private void IfStatement(bool topLevel) - { - Assert(CSharpKeyword.If); - ConditionalBlock(topLevel: false); - AfterIfClause(); - if (topLevel) - { - CompleteBlock(); + EnsureCurrent(); + return false; } } - private void AfterTryClause() + private void ParseDirectiveBlock(in SyntaxListBuilder builder, DirectiveDescriptor descriptor, Action, SourceLocation> parseChildren) { - // Grab whitespace - var whitespace = SkipToNextImportantToken(); - - // Check for a catch or finally part - if (At(CSharpKeyword.Catch)) + if (EndOfFile) { - Accept(whitespace); - Assert(CSharpKeyword.Catch); - FilterableCatchBlock(); - AfterTryClause(); + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( + new SourceSpan(CurrentStart, contentLength: 1 /* { */), descriptor.Directive, "{")); } - else if (At(CSharpKeyword.Finally)) + else if (!At(SyntaxKind.LeftBrace)) { - Accept(whitespace); - Assert(CSharpKeyword.Finally); - UnconditionalBlock(); + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_UnexpectedDirectiveLiteral( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, "{")); } else { - // Return whitespace and end the block - PutCurrentBack(); - PutBack(whitespace); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; - } - } + var editHandler = new AutoCompleteEditHandler(Language.TokenizeString, autoCompleteAtEndOfSpan: true); + SpanContext.EditHandler = editHandler; + var startingBraceLocation = CurrentStart; + Accept(CurrentToken); + builder.Add(OutputAsMetaCode(Output())); - private void AfterIfClause() - { - // Grab whitespace and razor comments - var whitespace = SkipToNextImportantToken(); + using (var pooledResult = Pool.Allocate()) + { + var childBuilder = pooledResult.Builder; + parseChildren(childBuilder, startingBraceLocation); + if (childBuilder.Count > 0) + { + builder.Add(SyntaxFactory.CSharpCodeBlock(childBuilder.ToList())); + } + } - // 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; + SpanContext.ChunkGenerator = SpanChunkGenerator.Null; + if (!Optional(SyntaxKind.RightBrace)) + { + editHandler.AutoCompleteString = "}"; + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( + new SourceSpan(startingBraceLocation, contentLength: 1 /* } */), descriptor.Directive, "}", "{")); + + Accept(SyntaxFactory.MissingToken(SyntaxKind.RightBrace)); + } + else + { + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + } + CompleteBlock(insertMarkerIfNecessary: false, captureWhitespaceToEndOfLine: true); + builder.Add(OutputAsMetaCode(Output(), SpanContext.EditHandler.AcceptedCharacters)); } } - private void ElseClause() + private bool TryParseKeyword(in SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - if (!At(CSharpKeyword.Else)) + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && result.HasValue); + if (_keywordParserMap.TryGetValue(result.Value, out var handler)) { - return; + handler(builder, transition); + return true; } - 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); - } + return false; } - private void ExpectCodeBlock(Block block) + private void SetupExpressionParsers() { - if (!EndOfFile) - { - // Check for "{" to make sure we're at a block - if (!At(SyntaxKind.LeftBrace)) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_SingleLineControlFlowStatementsNotAllowed( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), - Language.GetSample(SyntaxKind.LeftBrace), - CurrentToken.Content)); - } - - // Parse the statement and then we're done - Statement(block); - } + MapExpressionKeyword(ParseAwaitExpression, CSharpKeyword.Await); } - private void UnconditionalBlock() + private void SetupKeywordParsers() { - Assert(SyntaxKind.Keyword); - var block = new Block(CurrentToken, CurrentStart); - AcceptAndMoveNext(); - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - ExpectCodeBlock(block); + 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 FilterableCatchBlock() + private void MapExpressionKeyword(Action, CSharpTransitionSyntax> handler, CSharpKeyword keyword) { - Assert(CSharpKeyword.Catch); + _keywordParserMap.Add(keyword, handler); - var block = new Block(CurrentToken, CurrentStart); + // Expression keywords don't belong in the regular keyword list + } - // Accept "catch" - AcceptAndMoveNext(); - AcceptWhile(IsValidStatementSpacingToken); + private void MapKeywords(Action, CSharpTransitionSyntax> handler, params CSharpKeyword[] keywords) + { + MapKeywords(handler, topLevel: true, keywords: keywords); + } - // Parse the catch condition if present. If not present, let the C# compiler complain. - if (AcceptCondition()) + private void MapKeywords(Action, CSharpTransitionSyntax> handler, bool topLevel, params CSharpKeyword[] keywords) + { + foreach (var keyword in keywords) { - AcceptWhile(IsValidStatementSpacingToken); - - if (At(CSharpKeyword.When)) + _keywordParserMap.Add(keyword, handler); + if (topLevel) { - // 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); + Keywords.Add(CSharpLanguageCharacteristics.GetKeyword(keyword)); } - - ExpectCodeBlock(block); } } - private void ConditionalBlock(bool topLevel) + private void ParseAwaitExpression(SyntaxListBuilder builder, CSharpTransitionSyntax transition) { - Assert(SyntaxKind.Keyword); - var block = new Block(CurrentToken, CurrentStart); - ConditionalBlock(block); - if (topLevel) - { - CompleteBlock(); - } - } + // Ensure that we're on the await statement (only runs in debug) + Assert(CSharpKeyword.Await); - private void ConditionalBlock(Block block) - { + // Accept the "await" and move on 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); - } - } + // Accept 1 or more spaces between the await and the following code. + AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - private bool AcceptCondition() - { - if (At(SyntaxKind.LeftParenthesis)) + // 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) { - 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); + Optional(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); + Optional(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) && Optional(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()) + { + Optional(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 (Optional(SyntaxKind.LeftParenthesis)) + { + while (!Optional(SyntaxKind.RightParenthesis) && !EndOfFile) + { + Optional(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); + Optional(SyntaxKind.Whitespace); + Optional(SyntaxKind.Identifier); + Optional(SyntaxKind.Whitespace); + Optional(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); + // Only accept the whitespace if we are going to consume the next token. + AcceptAndMoveNext(); + } - Optional(SyntaxKind.Semicolon); - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.Whitespace); + Optional(SyntaxKind.QuestionMark); // Nullable - AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); + return true; + } + else if (Optional(SyntaxKind.Identifier) || Optional(SyntaxKind.Keyword)) + { + if (Optional(SyntaxKind.DoubleColon)) + { + if (!Optional(SyntaxKind.Identifier)) + { + Optional(SyntaxKind.Keyword); + } + } + if (At(SyntaxKind.LessThan)) + { + ParseTypeArgumentList(builder); + } + if (Optional(SyntaxKind.Dot)) + { + TryParseNamespaceOrTypeName(builder); + } - 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)); - } + if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) + { + // Only accept the whitespace if we are going to consume the next token. + AcceptAndMoveNext(); + } - Span.ChunkGenerator = SpanChunkGenerator.Null; + Optional(SyntaxKind.QuestionMark); // Nullable - // 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); + if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.LeftBracket)) + { + // Only accept the whitespace if we are going to consume the next token. + AcceptAndMoveNext(); + } - 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; + while (At(SyntaxKind.LeftBracket)) + { + Balance(builder, BalancingModes.None); + if (!Optional(SyntaxKind.RightBracket)) + { + Accept(SyntaxFactory.MissingToken(SyntaxKind.RightBracket)); + } + } + return true; + } + else + { + return false; + } + } - using (PushSpanConfig()) - { - HtmlParser.ParseRazorBlock(Tuple.Create("{", "}"), caseSensitive: true); - } + private void ParseTypeArgumentList(in SyntaxListBuilder builder) + { + Assert(SyntaxKind.LessThan); + Balance(builder, BalancingModes.None); + if (!Optional(SyntaxKind.GreaterThan)) + { + Accept(SyntaxFactory.MissingToken(SyntaxKind.GreaterThan)); + } + } - Span.Start = CurrentLocation; - Initialize(Span); + private void ParseReservedDirective(SyntaxListBuilder builder, CSharpTransitionSyntax transition) + { + Context.ErrorSink.OnError( + RazorDiagnosticFactory.CreateParsing_ReservedWord( + new SourceSpan(CurrentStart, CurrentToken.Content.Length), CurrentToken.Content)); - IsNested = wasNested; + 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); + } - NextToken(); - }); - break; - case DirectiveKind.CodeBlock: - AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.AllWhitespace); + protected void CompleteBlock() + { + CompleteBlock(insertMarkerIfNecessary: true); + } - 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); + protected void CompleteBlock(bool insertMarkerIfNecessary) + { + CompleteBlock(insertMarkerIfNecessary, captureWhitespaceToEndOfLine: insertMarkerIfNecessary); + } - AddMarkerTokenIfNecessary(); + protected void CompleteBlock(bool insertMarkerIfNecessary, bool captureWhitespaceToEndOfLine) + { + if (insertMarkerIfNecessary && Context.LastAcceptedCharacters != AcceptedCharactersInternal.Any) + { + AcceptMarkerTokenIfNecessary(); + } - Output(SpanKindInternal.Code); + EnsureCurrent(); - Span.EditHandler = existingEditHandler; - }); - break; - } + // 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) + { + CaptureWhitespaceAtEndOfCodeOnlyLine(); + } + else + { + PutCurrentBack(); } - finally + } + + private IEnumerable SkipToNextImportantToken(in SyntaxListBuilder builder) + { + while (!EndOfFile) { - if (directiveErrorSink.Errors.Count > 0) + var whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); + if (At(SyntaxKind.RazorCommentTransition)) + { + Accept(whitespace); + SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; + AcceptMarkerTokenIfNecessary(); + builder.Add(OutputTokensAsStatementLiteral()); + var comment = ParseRazorComment(); + builder.Add(comment); + } + else { - directiveChunkGenerator.Diagnostics.AddRange(directiveErrorSink.Errors); + return whitespace; } - - Context.ErrorSink = savedErrorSink; } + return Enumerable.Empty(); } - - private void ValidateDirectiveUsage(DirectiveDescriptor descriptor) + private void CaptureWhitespaceAtEndOfCodeOnlyLine() { - if (descriptor.Usage == DirectiveUsage.FileScopedSinglyOccurring) + var whitespace = ReadWhile(token => token.Kind == SyntaxKind.Whitespace); + if (At(SyntaxKind.NewLine)) { - 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)); - - return; - } + Accept(whitespace); + AcceptAndMoveNext(); + PutCurrentBack(); + } + else + { + PutCurrentBack(); + PutBack(whitespace); } } - private void ParseDirectiveBlock(DirectiveDescriptor descriptor, Action parseChildren) + protected override bool IsAtEmbeddedTransition(bool allowTemplatesAndComments, bool allowTransitions) { - if (EndOfFile) - { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( - new SourceSpan(CurrentStart, contentLength: 1 /* { */), descriptor.Directive, "{")); - } - else if (!At(SyntaxKind.LeftBrace)) + // No embedded transitions in C#, so ignore that param + return allowTemplatesAndComments + && ((Language.IsTransition(CurrentToken) + && NextIs(SyntaxKind.LessThan, SyntaxKind.Colon, SyntaxKind.DoubleColon)) + || Language.IsCommentStart(CurrentToken)); + } + + protected override void ParseEmbeddedTransition(in SyntaxListBuilder builder) + { + if (Language.IsTransition(CurrentToken)) { - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_UnexpectedDirectiveLiteral( - new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, "{")); + PutCurrentBack(); + ParseTemplate(builder); } - else + else if (Language.IsCommentStart(CurrentToken)) { - 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); - - Span.ChunkGenerator = SpanChunkGenerator.Null; - if (!Optional(SyntaxKind.RightBrace)) + // Output tokens before parsing the comment. + AcceptMarkerTokenIfNecessary(); + if (SpanContext.ChunkGenerator is ExpressionChunkGenerator) { - editHandler.AutoCompleteString = "}"; - Context.ErrorSink.OnError( - RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( - new SourceSpan(startingBraceLocation, contentLength: 1 /* } */), descriptor.Directive, "}", "{")); + builder.Add(OutputTokensAsExpressionLiteral()); } else { - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; + builder.Add(OutputTokensAsStatementLiteral()); } - CompleteBlock(insertMarkerIfNecessary: false, captureWhitespaceToEndOfLine: true); - Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.None); + + var comment = ParseRazorComment(); + builder.Add(comment); } } - 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); - - return new TagHelperPrefixDirectiveChunkGenerator( - prefix, - parsedDirective.DirectiveText, - errors); - }); + spanContext.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); + spanContext.ChunkGenerator = new StatementChunkGenerator(); } - // Internal for testing. - internal void ValidateTagHelperPrefix( - string prefix, - SourceLocation directiveLocation, - List diagnostics) + private void ExplicitExpressionSpanContextConfig(SpanContextBuilder spanContext) { - 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; - } - } + spanContext.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); + spanContext.ChunkGenerator = new ExpressionChunkGenerator(); } - private ParsedDirective ParseDirective( - string directiveText, - SourceLocation directiveLocation, - TagHelperDirectiveType directiveType, - List errors) + private CSharpStatementLiteralSyntax OutputTokensAsStatementLiteral() { - 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.CSharpStatementLiteral(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 CSharpExpressionLiteralSyntax OutputTokensAsExpressionLiteral() + { + var tokens = Output(); + if (tokens.Count == 0) + { + return null; } - var parsedDirective = new ParsedDirective() - { - DirectiveText = directiveText - }; + return GetNodeWithSpanContext(SyntaxFactory.CSharpExpressionLiteral(tokens)); + } - if (directiveType == TagHelperDirectiveType.TagHelperPrefix) + private CSharpEphemeralTextLiteralSyntax OutputTokensAsEphemeralLiteral() + { + var tokens = Output(); + if (tokens.Count == 0) { - ValidateTagHelperPrefix(parsedDirective.DirectiveText, directiveLocation, errors); - - return parsedDirective; + return null; } - return ParseAddOrRemoveDirective(parsedDirective, directiveLocation, errors); + return GetNodeWithSpanContext(SyntaxFactory.CSharpEphemeralTextLiteral(tokens)); } - // Internal for testing. - internal ParsedDirective ParseAddOrRemoveDirective(ParsedDirective directive, SourceLocation directiveLocation, List errors) + private UnclassifiedTextLiteralSyntax OutputTokensAsUnclassifiedLiteral() { - 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("'")) + var tokens = Output(); + if (tokens.Count == 0) { - errors.Add( - RazorDiagnosticFactory.CreateParsing_InvalidTagHelperLookupText( - new SourceSpan(directiveLocation, Math.Max(text.Length, 1)), text)); - - return directive; + return null; } - 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; + return GetNodeWithSpanContext(SyntaxFactory.UnclassifiedTextLiteral(tokens)); } - protected virtual void AddTagHelperDirective() + private void OtherParserBlock(in SyntaxListBuilder builder) { - TagHelperDirective( - SyntaxConstants.CSharp.AddTagHelperKeyword, - (lookupText, errors) => - { - var parsedDirective = ParseDirective(lookupText, Span.Start, TagHelperDirectiveType.AddTagHelper, errors); + // 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; - return new AddTagHelperChunkGenerator( - lookupText, - parsedDirective.DirectiveText, - parsedDirective.TypePattern, - parsedDirective.AssemblyName, - errors); - }); - } + RazorSyntaxNode htmlBlock = null; + using (PushSpanContextConfig()) + { + htmlBlock = HtmlParser.ParseBlock(); + } - protected virtual void RemoveTagHelperDirective() - { - TagHelperDirective( - SyntaxConstants.CSharp.RemoveTagHelperKeyword, - (lookupText, errors) => - { - var parsedDirective = ParseDirective(lookupText, Span.Start, TagHelperDirectiveType.RemoveTagHelper, errors); + builder.Add(htmlBlock); + InitializeContext(SpanContext); - return new RemoveTagHelperChunkGenerator( - lookupText, - parsedDirective.DirectiveText, - parsedDirective.TypePattern, - parsedDirective.AssemblyName, - errors); - }); + IsNested = wasNested; + NextToken(); } [Conditional("DEBUG")] - protected void AssertDirective(string directive) + internal void Assert(CSharpKeyword expectedKeyword) { - Debug.Assert(CurrentToken.Kind == SyntaxKind.Identifier || CurrentToken.Kind == SyntaxKind.Keyword); - Debug.Assert(string.Equals(CurrentToken.Content, directive, StringComparison.Ordinal)); + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && + result.HasValue && + result.Value == expectedKeyword); } - private void TagHelperDirective(string keyword, Func, ISpanChunkGenerator> chunkGeneratorFactory) + protected internal bool At(CSharpKeyword keyword) { - AssertDirective(keyword); - - var savedErrorSink = Context.ErrorSink; - var directiveErrorSink = new ErrorSink(); - Context.ErrorSink = directiveErrorSink; - - string directiveValue = null; - try - { - 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)) - { - 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. - var startLocation = 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(Span.Tokens.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(startLocation, rawValue.Length), keyword)); - } - - directiveValue = rawValue; - } - } - finally - { - Span.ChunkGenerator = chunkGeneratorFactory(directiveValue, directiveErrorSink.Errors.ToList()); - Context.ErrorSink = savedErrorSink; - } + 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 index 19a6bad46..780c3bc00 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveChunkGenerator.cs @@ -34,11 +34,6 @@ public List Diagnostics } } - public override void Accept(ParserVisitor visitor, Block block) - { - visitor.VisitDirectiveBlock(this, block); - } - public override bool Equals(object obj) { var other = obj as DirectiveChunkGenerator; 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 index 5b8c31efa..c9dfa8fed 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DynamicAttributeBlockChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DynamicAttributeBlockChunkGenerator.cs @@ -23,23 +23,6 @@ public DynamicAttributeBlockChunkGenerator(LocationTagged prefix, Source 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); 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..7c77c7032 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ExpressionChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ExpressionChunkGenerator.cs @@ -9,31 +9,6 @@ internal class ExpressionChunkGenerator : ISpanChunkGenerator, IParentChunkGener { 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..d5c27038b 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/TagHelperSpanVisitor.cs b/src/Microsoft.AspNetCore.Razor.Language/TagHelperSpanVisitor.cs new file mode 100644 index 000000000..35b1e0ee7 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/TagHelperSpanVisitor.cs @@ -0,0 +1,30 @@ +// 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 : SyntaxRewriter + { + private RazorSourceDocument _source; + private List _spans; + + public TagHelperSpanVisitor(RazorSourceDocument source) + { + _source = source; + _spans = new List(); + } + + public IReadOnlyList TagHelperSpans => _spans; + + public override SyntaxNode VisitMarkupTagHelperElement(MarkupTagHelperElementSyntax node) + { + var span = new TagHelperSpanInternal(node.GetSourceSpan(_source), node.TagHelperInfo.BindingResult); + _spans.Add(span); + return 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..ade338d45 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs @@ -4,9 +4,8 @@ using System; 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 +62,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 +73,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 +96,7 @@ internal class DefaultRazorIndentationFactsService : RazorIndentationFactsServic return desiredIndentation; } - owningChild = owningParent; + owner = owner.Parent; } // Couldn't determine indentation @@ -139,11 +137,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; + } + } + } } } From 7ad96de24269660088d56c228ba6572043726904 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Tue, 13 Nov 2018 14:20:30 -0800 Subject: [PATCH 2/6] Test changes - Update parser test infrastructure - Update tests - Regenerated baselines - Removed unused legacy types --- .../BasicTest.codegen.cs | 2 +- .../BasicTest.ir.txt | 2 +- .../BasicTest.codegen.cs | 2 +- .../BasicTest.ir.txt | 2 +- .../DefaultRazorTagHelperBinderPhaseTest.cs | 86 +- .../DirectiveTokenEditHandlerTest.cs | 44 +- .../HtmlNodeOptimizationPassTest.cs | 30 +- .../TagHelpersIntegrationTest.cs | 2 + .../Legacy/BlockTest.cs | 119 -- .../Legacy/CSharpCodeParserTest.cs | 6 +- .../Legacy/CSharpRazorCommentsTest.cs | 12 + .../Legacy/CSharpTokenizerTestBase.cs | 2 +- .../Legacy/CodeBlockEditHandlerTest.cs | 11 +- .../Legacy/CsHtmlCodeParserTestBase.cs | 5 - .../Legacy/CsHtmlMarkupParserTestBase.cs | 5 - .../Legacy/HtmlAttributeTest.cs | 84 -- .../Legacy/HtmlDocumentTest.cs | 1 - .../Legacy/HtmlMarkupParserTests.cs | 12 +- .../Legacy/HtmlToCodeSwitchTest.cs | 1 - .../Legacy/HtmlTokenizerTestBase.cs | 2 +- .../ImplicitExpressionEditHandlerTest.cs | 50 +- .../Legacy/MarkupElementRewriterTest.cs | 154 +++ .../Legacy/RazorDirectivesTest.cs | 2 +- .../Legacy/RazorParserTest.cs | 76 +- .../Legacy/SpanTest.cs | 79 -- .../Legacy/TagHelperBlockTest.cs | 207 --- .../Legacy/TagHelperParseTreeRewriterTest.cs | 24 +- .../Legacy/TagHelperRewritingTestBase.cs | 49 +- .../Legacy/TokenizerLookaheadTest.cs | 5 - .../Legacy/WhiteSpaceRewriterTest.cs | 13 +- .../RazorSyntaxTreeTest.cs | 34 +- .../SourceChangeTest.cs | 54 +- .../TagHelperParseTreeRewriterTests.cs | 26 - .../ComplexTagHelpers_DesignTime.ir.txt | 2 +- .../ComplexTagHelpers_Runtime.codegen.cs | 2 +- .../ComplexTagHelpers_Runtime.ir.txt | 2 +- ...ctorTagHelperAttributes_Runtime.codegen.cs | 2 +- ...SelectorTagHelperAttributes_Runtime.ir.txt | 2 +- ...icateAttributeTagHelpers_DesignTime.ir.txt | 4 +- ...cateAttributeTagHelpers_Runtime.codegen.cs | 15 +- ...uplicateAttributeTagHelpers_Runtime.ir.txt | 15 +- .../FunctionsBlockMinimal_Runtime.ir.txt | 4 +- .../NestedTagHelpers_DesignTime.ir.txt | 2 +- .../NestedTagHelpers_Runtime.codegen.cs | 2 +- .../NestedTagHelpers_Runtime.ir.txt | 2 +- ...hWeirdlySpacedAttributes_DesignTime.ir.txt | 6 +- ...WeirdlySpacedAttributes_Runtime.codegen.cs | 4 +- ...WithWeirdlySpacedAttributes_Runtime.ir.txt | 4 +- .../NestedTagHelpers.ir.txt | 2 +- ...ctionsDirectiveAutoCompleteAtEOF.stree.txt | 24 +- ...rectiveAutoCompleteAtStartOfFile.stree.txt | 26 +- ...ectionDirectiveAutoCompleteAtEOF.stree.txt | 37 +- ...rectiveAutoCompleteAtStartOfFile.stree.txt | 63 +- .../VerbatimBlockAutoCompleteAtEOF.stree.txt | 19 +- ...imBlockAutoCompleteAtStartOfFile.stree.txt | 47 +- .../AcceptsElseIfWithNoCondition.stree.txt | 122 +- ...icitExpressionWhenEmbeddedInCode.stree.txt | 41 +- .../AllowsEmptyBlockStatement.stree.txt | 22 +- ...ringLiteralCharactersAndBrackets.stree.txt | 40 +- ...rsAndBracketsInsideBlockComments.stree.txt | 44 +- .../CapturesNewlineAfterUsing.stree.txt | 16 +- .../CorrectlyParsesDoWhileBlock.stree.txt | 54 +- ...rsesDoWhileBlockMissingSemicolon.stree.txt | 52 +- ...eBlockMissingWhileClauseEntirely.stree.txt | 34 +- ...oWhileBlockMissingWhileCondition.stree.txt | 38 +- ...ssingWhileConditionWithSemicolon.stree.txt | 40 +- ...rectlyParsesMarkupInDoWhileBlock.stree.txt | 100 +- ...oesNotAllowMultipleFinallyBlocks.stree.txt | 76 +- ...terNotFollowedByOpenAngleOrColon.stree.txt | 36 +- ...oesntCaptureWhitespaceAfterUsing.stree.txt | 14 +- ...IfNamespaceAliasMissingSemicolon.stree.txt | 30 +- ...fNamespaceImportMissingSemicolon.stree.txt | 22 +- ...dCodeBlockWithAtDoesntCauseError.stree.txt | 52 +- .../NestedCodeBlockWithCSharpAt.stree.txt | 87 +- ...deBlockWithMarkupSetsDotAsMarkup.stree.txt | 105 +- .../ParsersCanNestRecursively.stree.txt | 373 +++--- ...arsesElseIfBranchesOfIfStatement.stree.txt | 192 +-- ...aracterFollowedByIdentifierStart.stree.txt | 53 +- ...itchCharacterFollowedByOpenParen.stree.txt | 55 +- ...tipleElseIfBranchesOfIfStatement.stree.txt | 480 +++---- ...StatementFollowedByOneElseBranch.stree.txt | 316 ++--- ...ForUsingKeywordIfIsInValidFormat.stree.txt | 24 +- ...ForUsingKeywordIfIsInValidFormat.stree.txt | 24 +- ...cesIfFirstIdentifierIsForKeyword.stree.txt | 94 +- ...fFirstIdentifierIsForeachKeyword.stree.txt | 94 +- ...ierIsIfKeywordWithNoElseBranches.stree.txt | 94 +- ...IfFirstIdentifierIsSwitchKeyword.stree.txt | 110 +- ...sIfFirstIdentifierIsWhileKeyword.stree.txt | 94 +- ...IdentifierIsUsingFollowedByParen.stree.txt | 94 +- ...ingCatchClausesAfterFinallyBlock.stree.txt | 76 +- .../StopsParsingCodeAfterElseBranch.stree.txt | 220 +-- ...ngIfIfStatementNotFollowedByElse.stree.txt | 96 +- ...mentBetweenCatchAndFinallyClause.stree.txt | 84 +- ...ckCommentBetweenDoAndWhileClause.stree.txt | 54 +- ...ommentBetweenElseIfAndElseClause.stree.txt | 94 +- ...ockCommentBetweenIfAndElseClause.stree.txt | 62 +- ...kCommentBetweenIfAndElseIfClause.stree.txt | 72 +- ...kCommentBetweenTryAndCatchClause.stree.txt | 62 +- ...ommentBetweenTryAndFinallyClause.stree.txt | 56 +- ...upportsExceptionLessCatchClauses.stree.txt | 76 +- ...mentBetweenCatchAndFinallyClause.stree.txt | 84 +- ...neCommentBetweenDoAndWhileClause.stree.txt | 54 +- ...ommentBetweenElseIfAndElseClause.stree.txt | 94 +- ...ineCommentBetweenIfAndElseClause.stree.txt | 62 +- ...eCommentBetweenIfAndElseIfClause.stree.txt | 72 +- ...eCommentBetweenTryAndCatchClause.stree.txt | 62 +- ...ommentBetweenTryAndFinallyClause.stree.txt | 56 +- ...rkupWithinAdditionalCatchClauses.stree.txt | 202 +-- .../SupportsMarkupWithinCatchClause.stree.txt | 102 +- ...upportsMarkupWithinFinallyClause.stree.txt | 88 +- .../SupportsMarkupWithinTryClause.stree.txt | 52 +- ...mentBetweenCatchAndFinallyClause.stree.txt | 118 +- ...orCommentBetweenDoAndWhileClause.stree.txt | 88 +- ...ommentBetweenElseIfAndElseClause.stree.txt | 128 +- ...zorCommentBetweenIfAndElseClause.stree.txt | 96 +- ...rCommentBetweenIfAndElseIfClause.stree.txt | 106 +- ...rCommentBetweenTryAndCatchClause.stree.txt | 94 +- ...ommentBetweenTryAndFinallyClause.stree.txt | 90 +- ...rtsTryStatementWithFinallyClause.stree.txt | 76 +- ...StatementWithMultipleCatchClause.stree.txt | 190 +-- ...StatementWithNoAdditionalClauses.stree.txt | 40 +- ...tsTryStatementWithOneCatchClause.stree.txt | 90 +- ...rtsUsingsNestedWithinOtherBlocks.stree.txt | 112 +- ...erminatesBlockCommentAtEndOfFile.stree.txt | 34 +- .../TerminatesParenBalancingAtEOF.stree.txt | 25 +- ...atesSingleLineCommentAtEndOfFile.stree.txt | 34 +- ...TerminatesSingleSlashAtEndOfFile.stree.txt | 46 +- ...wordAtEOFAndOutputsFileCodeBlock.stree.txt | 8 +- ...esIfFirstIdentifierIsLockKeyword.stree.txt | 38 +- ...FirstPairAsPartOfCSharpStatement.stree.txt | 46 +- ...EscapeSequenceIfAtStatementStart.stree.txt | 42 +- ...ingOfAttributeValue_DoesNotThrow.stree.txt | 71 +- ...EndOfAttributeValue_DoesNotThrow.stree.txt | 71 +- ...tweenAttributeValue_DoesNotThrow.stree.txt | 81 +- ...ionInAttributeValue_DoesNotThrow.stree.txt | 66 +- ...leTransitionInEmail_DoesNotThrow.stree.txt | 96 +- ...leTransitionInRegex_DoesNotThrow.stree.txt | 160 +-- ...WithExpressionBlock_DoesNotThrow.stree.txt | 332 +++-- ...oubleTransition_EndOfFile_Throws.stree.txt | 52 +- ...ansitionsInAttributeValue_Throws.stree.txt | 92 +- ...eRequiresDoubleQuotesAroundValue.stree.txt | 15 - ...tive_InvalidLookupText_AddsError.stree.txt | 14 - ...gHelperDirective_NoValue_Invalid.stree.txt | 14 - ...TagHelperDirective_RequiresValue.stree.txt | 14 - ...Directive_SingleQuotes_AddsError.stree.txt | 14 - ...eRequiresDoubleQuotesAroundValue.stree.txt | 14 - ...agHelperDirective_SupportsSpaces.stree.txt | 18 - ...otes_InvalidLookupText_AddsError.stree.txt | 14 - ...AtStartOfLineBecauseOfWhitespace.stree.txt | 16 - ...irectiveErrorsIfNotAtStartOfLine.stree.txt | 16 - ...veDescriptor_AllowsNullableTypes.stree.txt | 76 -- ...ctiveDescriptor_AllowsTupleTypes.stree.txt | 160 --- ...eTypes_IgnoresTrailingWhitespace.stree.txt | 22 - ...tor_AllowsWhiteSpaceAroundTokens.stree.txt | 26 - ...ndleEOFIncompleteNamespaceTokens.stree.txt | 12 - ...nHandleEOFInvalidNamespaceTokens.stree.txt | 15 - ...nHandleIncompleteNamespaceTokens.stree.txt | 13 - ..._CanHandleInvalidNamespaceTokens.stree.txt | 16 - ...ErrorsExtraContentAfterDirective.stree.txt | 18 - ...tor_ErrorsForInvalidMemberTokens.stree.txt | 12 - ...WhenEOFBeforeDirectiveBlockStart.stree.txt | 14 - ...WhenExtraContentBeforeBlockStart.stree.txt | 24 - ...riptor_ErrorsWhenMissingEndBrace.stree.txt | 18 - ...tipleOccurring_CanHaveDuplicates.stree.txt | 39 - ...inglyOccurring_ErrorsIfDuplicate.stree.txt | 39 - ...oped_CanBeBeneathOtherDirectives.stree.txt | 33 - ...rWhiteSpaceCommentsAndDirectives.stree.txt | 66 - ..._NoErrorsSemicolonAfterDirective.stree.txt | 20 - ...ken_ParserErrorForNonStringValue.stree.txt | 14 - ...ParserErrorForPartialQuotedValue.stree.txt | 13 - ..._ParserErrorForSingleQuotedValue.stree.txt | 14 - ...oken_ParserErrorForUnquotedValue.stree.txt | 12 - ...tor_TokensMustBeSeparatedBySpace.stree.txt | 16 - ...Descriptor_UnderstandsCodeBlocks.stree.txt | 32 - ...scriptor_UnderstandsMemberTokens.stree.txt | 14 - ...riptor_UnderstandsMultipleTokens.stree.txt | 28 - ...escriptor_UnderstandsRazorBlocks.stree.txt | 43 - ...scriptor_UnderstandsStringTokens.stree.txt | 14 - ...Descriptor_UnderstandsTypeTokens.stree.txt | 20 - ...ectives_CanUseReservedWord_Class.stree.txt | 10 - ...ves_CanUseReservedWord_Namespace.stree.txt | 10 - .../EmptyFunctionsDirective.stree.txt | 18 - ...AtStartOfLineBecauseOfWhitespace.stree.txt | 22 - ...irectiveErrorsIfNotAtStartOfLine.stree.txt | 23 - .../InheritsDirectiveSupportsArrays.stree.txt | 20 - ...sDirectiveSupportsNestedGenerics.stree.txt | 30 - ...itsDirectiveSupportsTypeKeywords.stree.txt | 14 - ...tionalDirectiveTokens_AreSkipped.stree.txt | 12 - ...ctiveTokens_WithBraces_AreParsed.stree.txt | 14 - ...MultipleOptionalTokens_AreParsed.stree.txt | 20 - ...okens_WithSimpleTokens_AreParsed.stree.txt | 14 - ...ens_WithMemberSpecified_IsParsed.stree.txt | 14 - ...okens_WithMissingMember_IsParsed.stree.txt | 14 - .../Parse_FunctionsDirective.stree.txt | 28 - .../Parse_SectionDirective.stree.txt | 43 - ...ectiveToken_WithMultipleSegments.stree.txt | 18 - ...DirectiveToken_WithSingleSegment.stree.txt | 14 - ...eRequiresDoubleQuotesAroundValue.stree.txt | 15 - ...tive_InvalidLookupText_AddsError.stree.txt | 14 - ...gHelperDirective_NoValue_Invalid.stree.txt | 14 - ...TagHelperDirective_RequiresValue.stree.txt | 14 - ...Directive_SingleQuotes_AddsError.stree.txt | 14 - ...eRequiresDoubleQuotesAroundValue.stree.txt | 14 - ...agHelperDirective_SupportsSpaces.stree.txt | 18 - ...otes_InvalidLookupText_AddsError.stree.txt | 14 - ...eRequiresDoubleQuotesAroundValue.stree.txt | 16 - ...rPrefixDirective_NoValueSucceeds.stree.txt | 14 - ...perPrefixDirective_RequiresValue.stree.txt | 14 - ...eRequiresDoubleQuotesAroundValue.stree.txt | 14 - ...agHelperPrefixDirective_Succeeds.stree.txt | 14 - ...fixDirective_WithQuotes_Succeeds.stree.txt | 14 - ...alidUsingStmtAndTreatsAsFileCode.stree.txt | 10 +- ...ImplicitExpressionParensUnclosed.stree.txt | 15 +- ...ctlyParsesAtSignInDelimitedBlock.stree.txt | 39 +- ...rectyAssumedToBeWithinAStatement.stree.txt | 95 +- ...CloseParenInExpressionWithinCode.stree.txt | 53 +- .../HandlesQuotesAfterTransition.stree.txt | 13 +- ...atementControlFlowStatementError.stree.txt | 42 +- ...panIfEofFoundAfterOpenCurlyBrace.stree.txt | 17 +- ...gthCodeSpanIfStatementBlockEmpty.stree.txt | 19 +- ...NotIdentifierStartOrParenOrBrace.stree.txt | 13 +- ...erTransitionInEmbeddedExpression.stree.txt | 36 +- ...sErrorIfNewlineFollowsTransition.stree.txt | 13 +- ...itionAndBlockStartInEmbeddedExpr.stree.txt | 44 +- ...edByLessThanSignAtStatementStart.stree.txt | 62 +- ...rorIfCatchBlockUnterminatedAtEOF.stree.txt | 96 +- ...rorIfClassBlockUnterminatedAtEOF.stree.txt | 80 +- ...sErrorIfDoBlockUnterminatedAtEOF.stree.txt | 68 +- ...rrorIfElseBlockUnterminatedAtEOF.stree.txt | 96 +- ...orIfElseIfBlockUnterminatedAtEOF.stree.txt | 100 +- ...plicitCodeBlockUnterminatedAtEOF.stree.txt | 71 +- ...rIfFinallyBlockUnterminatedAtEOF.stree.txt | 90 +- ...ErrorIfForBlockUnterminatedAtEOF.stree.txt | 76 +- ...rIfForeachBlockUnterminatedAtEOF.stree.txt | 76 +- ...sErrorIfIfBlockUnterminatedAtEOF.stree.txt | 76 +- ...rrorIfLockBlockUnterminatedAtEOF.stree.txt | 76 +- ...orIfSwitchBlockUnterminatedAtEOF.stree.txt | 76 +- ...ErrorIfTryBlockUnterminatedAtEOF.stree.txt | 68 +- ...rorIfUsingBlockUnterminatedAtEOF.stree.txt | 76 +- ...rorIfWhileBlockUnterminatedAtEOF.stree.txt | 76 +- ...ontrolFlowStatementsToHaveBraces.stree.txt | 134 +- ...ResumesIfStatementAfterOpenParen.stree.txt | 58 +- ...cketInImplicitExpressionUnclosed.stree.txt | 29 +- ...FIfIfParenInExplicitExprUnclosed.stree.txt | 25 +- ...EOFIfParenInImplicitExprUnclosed.stree.txt | 29 +- ...pIfBracketInImplicitExprUnclosed.stree.txt | 27 +- ...pIfIfParenInExplicitExprUnclosed.stree.txt | 23 +- ...arenInImplicitExpressionUnclosed.stree.txt | 27 +- ...nRecoveringFromMissingCloseParen.stree.txt | 18 +- ...nRecoveringFromMissingCloseParen.stree.txt | 18 +- ...arpStringsAtEOLIfEndQuoteMissing.stree.txt | 44 +- ...erminatesNormalStringAtEndOfFile.stree.txt | 34 +- ...nRecoveringFromMissingCloseParen.stree.txt | 18 +- ...minatesVerbatimStringAtEndOfFile.stree.txt | 34 +- ...nRecoveringFromMissingCloseParen.stree.txt | 30 +- ...WithHelperDirectiveProducesError.stree.txt | 13 +- ...WithNestedCodeBlockProducesError.stree.txt | 43 +- ...scapedQuotesInNonVerbatimStrings.stree.txt | 21 +- ...veEscapedQuotesInVerbatimStrings.stree.txt | 21 +- ...EscapedQuoteInNonVerbatimStrings.stree.txt | 21 +- ...eptEscapedQuoteInVerbatimStrings.stree.txt | 21 +- ...ldAcceptMultiLineVerbatimStrings.stree.txt | 21 +- ...scapedQuotesInNonVerbatimStrings.stree.txt | 21 +- ...leEscapedQuotesInVerbatimStrings.stree.txt | 21 +- ...tedEscapedQuoteInVerbatimStrings.stree.txt | 21 +- ...OFOccursAfterStartOfExplicitExpr.stree.txt | 19 +- ...eSpanIfExplicitExpressionIsEmpty.stree.txt | 21 +- ...haractersThatAreValidIdentifiers.stree.txt | 13 +- ...ExpressionTerminatedByWhitespace.stree.txt | 13 +- ...ludeDotAtEOFInImplicitExpression.stree.txt | 17 +- ...lidIdentifierCharInImplicitExpr1.stree.txt | 17 +- ...lidIdentifierCharInImplicitExpr2.stree.txt | 17 +- .../DoesNotIncludeSemicolonAfterDot.stree.txt | 17 +- ...emicolonAtEndOfDottedIdentifiers.stree.txt | 21 +- ...nAtEndOfSimpleImplicitExpression.stree.txt | 13 +- .../NestedImplicitExpression.stree.txt | 41 +- ...nIfModuleTokenNotFollowedByBrace.stree.txt | 21 +- ...deSpanIfEOFOccursAfterTransition.stree.txt | 13 +- ...nvalidCharacterFollowsTransition.stree.txt | 13 +- ...dIdentifiersAsImplicitExpression.stree.txt | 21 +- ...ratorImplicitExpression_Bracket1.stree.txt | 13 +- ...atorImplicitExpression_Bracket10.stree.txt | 23 +- ...atorImplicitExpression_Bracket11.stree.txt | 27 +- ...atorImplicitExpression_Bracket12.stree.txt | 29 +- ...atorImplicitExpression_Bracket13.stree.txt | 35 +- ...atorImplicitExpression_Bracket14.stree.txt | 33 +- ...atorImplicitExpression_Bracket15.stree.txt | 29 +- ...atorImplicitExpression_Bracket16.stree.txt | 37 +- ...ratorImplicitExpression_Bracket2.stree.txt | 13 +- ...ratorImplicitExpression_Bracket3.stree.txt | 17 +- ...ratorImplicitExpression_Bracket4.stree.txt | 13 +- ...ratorImplicitExpression_Bracket5.stree.txt | 19 +- ...ratorImplicitExpression_Bracket6.stree.txt | 21 +- ...ratorImplicitExpression_Bracket7.stree.txt | 17 +- ...ratorImplicitExpression_Bracket8.stree.txt | 21 +- ...ratorImplicitExpression_Bracket9.stree.txt | 13 +- ...lOperatorImplicitExpression_Dot1.stree.txt | 13 +- ...OperatorImplicitExpression_Dot10.stree.txt | 19 +- ...OperatorImplicitExpression_Dot11.stree.txt | 13 +- ...OperatorImplicitExpression_Dot12.stree.txt | 29 +- ...OperatorImplicitExpression_Dot13.stree.txt | 31 +- ...OperatorImplicitExpression_Dot14.stree.txt | 39 +- ...lOperatorImplicitExpression_Dot2.stree.txt | 13 +- ...lOperatorImplicitExpression_Dot3.stree.txt | 13 +- ...lOperatorImplicitExpression_Dot4.stree.txt | 13 +- ...lOperatorImplicitExpression_Dot5.stree.txt | 17 +- ...lOperatorImplicitExpression_Dot6.stree.txt | 13 +- ...lOperatorImplicitExpression_Dot7.stree.txt | 17 +- ...lOperatorImplicitExpression_Dot8.stree.txt | 17 +- ...lOperatorImplicitExpression_Dot9.stree.txt | 19 +- ...leIdentifierAsImplicitExpression.stree.txt | 13 +- ...BalancesThemInImplicitExpression.stree.txt | 53 +- ...BalancesThemInImplicitExpression.stree.txt | 129 +- .../StopsBalancingParenthesesAtEOF.stree.txt | 19 +- ...WithinComplexImplicitExpressions.stree.txt | 81 +- ...llowedByDotOrParenInImplicitExpr.stree.txt | 17 +- ...NotFollowedByIdentifierStartChar.stree.txt | 25 +- ...esImplicitExpressionAtHtmlEndTag.stree.txt | 25 +- ...ImplicitExpressionAtHtmlStartTag.stree.txt | 25 +- ...idPointIfDotFollowedByWhitespace.stree.txt | 13 +- ...loseParenFollowedByAnyWhiteSpace.stree.txt | 21 +- ...dentifierFollowedByAnyWhiteSpace.stree.txt | 13 +- .../NestedCodeBlock.stree.txt | 58 +- .../NestedExplicitExpression.stree.txt | 49 +- .../NestedImplicitExpression.stree.txt | 41 +- .../NestedKeywordStatement.stree.txt | 86 +- .../NestedMarkupBlock.stree.txt | 60 +- .../NestedSimpleStatement.stree.txt | 34 +- .../EmptyRazorComment.stree.txt | 28 +- .../MultipleRazorCommentInMarkup.stree.txt | 77 +- ...eRazorCommentsInSameLineInMarkup.stree.txt | 75 +- .../RazorCommentInClosingTagBlock.stree.txt | 46 +- ...ntInImplicitExpressionMethodCall.stree.txt | 45 +- .../RazorCommentInMarkup.stree.txt | 50 +- .../RazorCommentInOpeningTagBlock.stree.txt | 46 +- .../RazorCommentInVerbatimBlock.stree.txt | 71 +- ...rCommentWithExtraNewLineInMarkup.stree.txt | 77 +- .../RazorCommentsSurroundingMarkup.stree.txt | 75 +- .../RazorMultilineCommentInBlock.cspans.txt | 12 + .../RazorMultilineCommentInBlock.stree.txt | 27 + .../UnterminatedRazorComment.stree.txt | 20 +- ...ntInImplicitExpressionMethodCall.stree.txt | 35 +- ...natedRazorCommentInVerbatimBlock.stree.txt | 39 +- .../ReservedWord.stree.txt | 10 +- .../ReservedWordIsCaseSensitive.stree.txt | 11 +- ...aceMultipleLinesBelowSectionName.stree.txt | 92 +- .../AllowsBracesInCSharpExpression.stree.txt | 123 +- .../BalancesBraces.stree.txt | 100 +- ...turesNewlineImmediatelyFollowing.stree.txt | 28 +- ...ineInSectionStatementMissingName.stree.txt | 34 +- ...SectionStatementMissingOpenBrace.stree.txt | 40 +- .../CommentRecoversFromUnclosedTag.stree.txt | 94 +- ...oseBraceImmediatelyFollowsMarkup.stree.txt | 50 +- ...ceBetweenSectionNameAndOpenBrace.stree.txt | 76 +- .../HandlesEOFAfterOpenBrace.stree.txt | 44 +- .../HandlesEOFAfterOpenContent1.stree.txt | 44 +- .../HandlesEOFAfterOpenContent2.stree.txt | 44 +- .../HandlesEOFAfterOpenContent3.stree.txt | 44 +- .../HandlesEOFAfterOpenContent4.stree.txt | 48 +- .../HandlesUnterminatedSection.stree.txt | 75 +- ...sUnterminatedSectionWithNestedIf.stree.txt | 118 +- ...IgnoresSectionUnlessAllLowerCase.stree.txt | 26 +- ...rserOutputsErrorOnNestedSections.stree.txt | 123 +- .../CSharpSectionTest/ParsesComment.stree.txt | 70 +- .../ParsesCommentWithDelimiters.stree.txt | 80 +- .../ParsesNamedSectionCorrectly.stree.txt | 80 +- .../ParsesXmlProcessingInstruction.stree.txt | 68 +- ...LIfSectionNotFollowedByOpenBrace.stree.txt | 38 +- ...NotFollowedByIdentifierStartChar.stree.txt | 66 +- ...lockIfNameNotFollowedByOpenBrace.stree.txt | 70 +- ...raceFollowsCodeBlockNoWhitespace.stree.txt | 74 +- ...BraceImmediatelyFollowsCodeBlock.stree.txt | 76 +- .../_WithDoubleTransition1.stree.txt | 91 +- .../_WithDoubleTransition2.stree.txt | 113 +- ...rIsBraceAndReturnsSpanOfTypeCode.stree.txt | 57 +- ...rIsParenAndReturnsSpanOfTypeExpr.stree.txt | 57 +- ...ImportInsideCodeBlockCausesError.stree.txt | 55 +- ...entInCodeBlockIsHandledCorrectly.stree.txt | 57 +- ...seBlockIgnoresSingleSlashAtStart.stree.txt | 13 +- ...atesSingleLineCommentAtEndOfLine.stree.txt | 78 +- ...deCodeBlockIsNotHandledSpecially.stree.txt | 59 +- .../CSharpStatementTest/CatchClause.stree.txt | 92 +- .../CSharpStatementTest/DoStatement.stree.txt | 40 +- .../CSharpStatementTest/ElseClause.stree.txt | 56 +- .../ElseIfClause.stree.txt | 100 +- ...rror_TryCatchWhen_InCompleteBody.stree.txt | 54 +- ...TryCatchWhen_InCompleteCondition.stree.txt | 46 +- ...ter_IncompleteTryCatchNoBodyWhen.stree.txt | 60 +- ...ionFilter_IncompleteTryCatchWhen.stree.txt | 42 +- ...r_IncompleteTryCatchWhenNoBodies.stree.txt | 50 +- ...xceptionFilter_IncompleteTryWhen.stree.txt | 28 +- .../ExceptionFilter_MultiLine.stree.txt | 108 +- ...ceptionFilter_NestedTryCatchWhen.stree.txt | 79 +- ...WhenCatchWhenComplete_SingleLine.stree.txt | 108 +- ..._TryCatchWhenComplete_SingleLine.stree.txt | 68 +- ...chWhenFinallyComplete_SingleLine.stree.txt | 90 +- .../FinallyClause.stree.txt | 50 +- .../ForEachStatement.stree.txt | 46 +- .../ForStatement.stree.txt | 68 +- .../CSharpStatementTest/IfStatement.stree.txt | 34 +- .../LockStatement.stree.txt | 34 +- ...ywordTreatedAsImplicitExpression.stree.txt | 13 +- .../StaticUsing_Complete_Spaced.stree.txt | 28 +- .../StaticUsing_GlobalPrefix.stree.txt | 28 +- .../StaticUsing_MultipleIdentifiers.stree.txt | 24 +- .../StaticUsing_NoUsing.stree.txt | 16 +- .../StaticUsing_SingleIdentifier.stree.txt | 20 +- .../SwitchStatement.stree.txt | 34 +- .../TryStatement.stree.txt | 28 +- .../UsingNamespaceImport.stree.txt | 28 +- .../UsingStatement.stree.txt | 58 +- .../UsingTypeAlias.stree.txt | 48 +- .../WhileStatement.stree.txt | 34 +- ...mplateInExplicitExpressionParens.stree.txt | 86 +- ...mplateInImplicitExpressionParens.stree.txt | 78 +- ...mplateInStatementWithinCodeBlock.stree.txt | 103 +- ...eInStatementWithinStatementBlock.stree.txt | 110 +- ...mmediatelyFollowingStatementChar.stree.txt | 43 +- .../HandlesSingleLineTemplate.stree.txt | 57 +- ...platesInImplicitExpressionParens.stree.txt | 135 +- ...platesInStatementWithinCodeBlock.stree.txt | 160 +-- ...sInStatementWithinStatementBlock.stree.txt | 167 +-- ...stedTemplateInImplicitExprParens.stree.txt | 141 +- ...tedTemplateInStmtWithinCodeBlock.stree.txt | 166 +-- ...tedTemplateInStmtWithinStmtBlock.stree.txt | 173 +-- ...ithDoubleTransition_DoesNotThrow.stree.txt | 141 +- .../AllowsMarkupInIfBodyWithBraces.stree.txt | 164 +-- ...nIfBodyWithBracesWithinCodeBlock.stree.txt | 179 +-- ...urnsFromMarkupBlockWithPseudoTag.stree.txt | 64 +- ...kupBlockWithPseudoTagInCodeBlock.stree.txt | 79 +- ...neToMarkupExclPreceedingNewline.cspans.txt | 6 +- ...ineToMarkupExclPreceedingNewline.stree.txt | 153 +-- ...mplateTransitionInDesignTimeMode.stree.txt | 55 +- ...tColonTransitionInDesignTimeMode.stree.txt | 57 +- ...mplateTransitionInDesignTimeMode.stree.txt | 55 +- ...dAtTagTransitionInDesignTimeMode.stree.txt | 59 +- ...eOnTagTransitionInDesignTimeMode.stree.txt | 55 +- ...arkupStatementOnOpenAngleBracket.stree.txt | 92 +- ...entOnOpenAngleBracketInCodeBlock.stree.txt | 107 +- ...OnSwitchCharacterFollowedByColon.stree.txt | 42 +- ...racterFollowedByColonInCodeBlock.stree.txt | 57 +- ...chCharacterFollowedByDoubleColon.stree.txt | 42 +- ...chCharacterFollowedByTripleColon.stree.txt | 42 +- ...arkupWithoutPreceedingWhitespace.stree.txt | 120 +- ...neMarkupContainingStatementBlock.stree.txt | 66 +- ...seSwitchIfOuterBlockIsTerminated.stree.txt | 25 +- ...KindsOfImplicitMarkupInCodeBlock.stree.txt | 252 ++-- ...InCaseAndDefaultBranchesOfSwitch.stree.txt | 282 ++-- ...faultBranchesOfSwitchInCodeBlock.stree.txt | 297 +++-- ...sTrailingNewlineInDesignTimeMode.stree.txt | 38 +- ...licitExprDoesNotAcceptDotAfterAt.stree.txt | 36 +- ...ceptTrailingNewlineInRunTimeMode.stree.txt | 38 +- ...SingleSpaceOrNewlineAtDesignTime.stree.txt | 38 +- ...ingleAtOutputsZeroLengthCodeSpan.stree.txt | 36 +- .../VerbatimBlock.stree.txt | 31 +- ...neIfTheyAreSignificantToAncestor.stree.txt | 44 +- ...DisabledForDataAttributesInBlock.stree.txt | 58 +- ...abledForDataAttributesInDocument.stree.txt | 59 +- ...taAttributesWithExperimentalFlag.stree.txt | 61 +- ...DisabledForDataAttributesInBlock.stree.txt | 63 +- ...abledForDataAttributesInDocument.stree.txt | 54 +- .../DoubleQuotedLiteralAttribute.stree.txt | 58 +- ...eWithWhitespaceSurroundingEquals.stree.txt | 62 +- .../MultiPartLiteralAttribute.stree.txt | 58 +- .../MultiValueExpressionAttribute.stree.txt | 81 +- .../NewLineBetweenAttributes.stree.txt | 66 +- .../NewLinePrecedingAttribute.stree.txt | 42 +- .../SimpleExpressionAttribute.stree.txt | 53 +- .../SimpleLiteralAttribute.stree.txt | 42 +- ...eWithWhitespaceSurroundingEquals.stree.txt | 51 +- .../SymbolBoundAttributes1.stree.txt | 46 +- .../SymbolBoundAttributes2.stree.txt | 44 +- .../SymbolBoundAttributes3.stree.txt | 42 +- .../SymbolBoundAttributes4.stree.txt | 42 +- .../SymbolBoundAttributes5.stree.txt | 42 +- .../SymbolBoundAttributes6.stree.txt | 42 +- ...ttributes_BeforeEqualWhitespace1.stree.txt | 79 +- ...ttributes_BeforeEqualWhitespace2.stree.txt | 75 +- ...ttributes_BeforeEqualWhitespace3.stree.txt | 71 +- ...ttributes_BeforeEqualWhitespace4.stree.txt | 71 +- ...ttributes_BeforeEqualWhitespace5.stree.txt | 71 +- ...ttributes_BeforeEqualWhitespace6.stree.txt | 71 +- ...ymbolBoundAttributes_Whitespace1.stree.txt | 80 +- ...ymbolBoundAttributes_Whitespace2.stree.txt | 76 +- ...ymbolBoundAttributes_Whitespace3.stree.txt | 72 +- ...ymbolBoundAttributes_Whitespace4.stree.txt | 72 +- ...ymbolBoundAttributes_Whitespace5.stree.txt | 72 +- ...ymbolBoundAttributes_Whitespace6.stree.txt | 72 +- ...tributeWithCodeWithSpacesInBlock.stree.txt | 46 +- ...buteWithCodeWithSpacesInDocument.stree.txt | 47 +- .../UnquotedLiteralAttribute.stree.txt | 53 +- ...tesWorkWithConditionalAttributes.stree.txt | 69 +- ...paceAndNewLinePrecedingAttribute.stree.txt | 44 +- .../AcceptsEmptyTextTag.stree.txt | 14 +- ...extTagAsOuterTagButDoesNotRender.stree.txt | 50 +- ...etInAttributeValueIfDoubleQuoted.stree.txt | 64 +- ...etInAttributeValueIfSingleQuoted.stree.txt | 64 +- ...shInAttributeValueIfDoubleQuoted.stree.txt | 72 +- ...shInAttributeValueIfSingleQuoted.stree.txt | 72 +- ...owsStartAndEndTagsToDifferInCase.stree.txt | 50 +- ...AsItCanRecoverToAnExpectedEndTag.stree.txt | 44 +- ...HandleSelfClosingTagsWithinBlock.stree.txt | 38 +- ...ineOfMarkupWithEmbeddedStatement.stree.txt | 58 +- ...nsiderPsuedoTagWithinMarkupBlock.stree.txt | 56 +- ...gleUnlessPreceededByQuestionMark.stree.txt | 50 +- .../HandlesOpenAngleAtEof.stree.txt | 34 +- ...penAngleWithProperTagFollowingIt.stree.txt | 54 +- ...UnbalancedTripleDashHTMLComments.stree.txt | 108 +- ...tmlCommentSupportsMultipleDashes.stree.txt | 267 ++-- ...IgnoresTagsInContentsOfScriptTag.stree.txt | 59 +- ...rminatesCommentOnFullEndSequence.stree.txt | 36 +- .../ParsesSGMLDeclarationAsEmptyTag.stree.txt | 46 +- ...NonWhitespaceCharacterIsStartTag.stree.txt | 68 +- ...LProcessingInstructionAsEmptyTag.stree.txt | 48 +- ...lyBalancesCommentStartAndEndTags.stree.txt | 34 +- ...tCharacterAfterTransitionIsColon.stree.txt | 30 +- .../RendersLiteralTextTagIfDoubled.stree.txt | 72 +- ...topsAtMatchingCloseTagToStartTag.stree.txt | 46 +- ...psParsingMidEmptyTagIfEOFReached.stree.txt | 12 +- ...ngleLineBlockAtEOFIfNoEOLReached.stree.txt | 18 +- .../SupportsCommentAsBlock.stree.txt | 26 +- ...portsCommentWithExtraDashAsBlock.stree.txt | 28 +- .../SupportsCommentWithinBlock.stree.txt | 56 +- ...criptTagsWithLessThanSignsInThem.stree.txt | 48 +- ...agsWithSpacedLessThanSignsInThem.stree.txt | 52 +- .../SupportsTagsWithAttributes.stree.txt | 103 +- ...tCloseAngleDoesNotTerminateBlock.stree.txt | 14 +- .../HtmlBlockTest/TerminatesAtEOF.stree.txt | 12 +- ...erminatesAtEOFWhenParsingComment.stree.txt | 16 +- ...ntAtFirstOccurrenceOfEndSequence.stree.txt | 60 +- ...SGMLDeclarationAtFirstCloseAngle.stree.txt | 50 +- ...tionAtQuestionMarkCloseAnglePair.stree.txt | 54 +- .../TreatsMalformedTagsAsContent.stree.txt | 34 +- .../WithSelfClosingTagJustEmitsTag.stree.txt | 16 +- ...eptsEndTagWithNoMatchingStartTag.stree.txt | 27 +- ...FileAndOutputsZeroLengthCodeSpan.stree.txt | 24 +- ...lyHandlesOddlySpacedHTMLElements.stree.txt | 91 +- ...ineOfMarkupWithEmbeddedStatement.stree.txt | 60 +- ...noreNewLineAtTheEndOfMarkupBlock.stree.txt | 46 +- ...fVerbatimBlockIfNoNewlinePresent.stree.txt | 46 +- ...raNewLineAtTheEndOfVerbatimBlock.stree.txt | 42 +- ...ndNewLineAtTheEndOfVerbatimBlock.stree.txt | 44 +- ...nVerbatimBlockIfFollowedByCSharp.stree.txt | 68 +- ...esNotReturnErrorOnMismatchedTags.stree.txt | 59 +- ...hToCodeOnEmailAddressInAttribute.stree.txt | 60 +- ...EmitsAtSignAsMarkupIfAtEndOfFile.stree.txt | 26 +- ...kIfFirstCharacterIsSwapCharacter.stree.txt | 24 +- ...NewLineBeforeMarkupInNestedBlock.stree.txt | 88 +- ...lesNewLineAndMarkupInNestedBlock.stree.txt | 78 +- .../HandlesNewLineInNestedBlock.stree.txt | 70 +- ...nAtSignEncounteredAndEmitsOutput.stree.txt | 28 +- ...IgnoresTagsInContentsOfScriptTag.stree.txt | 60 +- ...deBlockWithMarkupSetsDotAsMarkup.stree.txt | 114 +- ...pportsDollarOpenBraceCombination.stree.txt | 29 +- ...MarkupSpanIfContentIsEmptyString.stree.txt | 7 +- ...tentAsSingleWhitespaceMarkupSpan.stree.txt | 7 +- ...SwitchToCodeOnEmailAddressInText.stree.txt | 7 +- ...IgnoresTagsInContentsOfScriptTag.stree.txt | 111 +- ...SpanIfNoSwapCharacterEncountered.stree.txt | 11 +- ...gInVerbatimBlockIfFollowedByHtml.stree.txt | 88 +- ...lockIfFollowedByMarkupTransition.stree.txt | 88 +- .../RendersTextPseudoTagAsMarkup.stree.txt | 35 +- ...SegmentIfNoCodeBlocksEncountered.stree.txt | 51 +- ...ingOfAttributeValue_DoesNotThrow.stree.txt | 61 +- ...EndOfAttributeValue_DoesNotThrow.stree.txt | 61 +- ...tweenAttributeValue_DoesNotThrow.stree.txt | 71 +- ...ionInAttributeValue_DoesNotThrow.stree.txt | 56 +- ...leTransitionInEmail_DoesNotThrow.stree.txt | 86 +- ...leTransitionInRegex_DoesNotThrow.stree.txt | 150 ++- ...WithExpressionBlock_DoesNotThrow.stree.txt | 322 +++-- ...ansitionsInAttributeValue_Throws.stree.txt | 74 +- ...onDoesNotCreateDocumentLevelSpan.stree.txt | 78 +- ...sAsLongAsParserCanIdentifyEndTag.stree.txt | 28 +- ...OutputsMarkupSegmentAndEndsBlock.stree.txt | 18 +- ...fEndTextTagContainsTextAfterName.stree.txt | 32 +- ...tartTextTagContainsTextAfterName.stree.txt | 32 +- ...eptionIfBlockDoesNotStartWithTag.stree.txt | 2 +- ...tEOFThrowsMissingEndTagException.stree.txt | 32 +- ...lTagThrowsOnOutermostUnclosedTag.stree.txt | 34 +- ...tEOFThrowsIncompleteTagException.stree.txt | 27 +- .../HtmlTagsTest/CDataTag.stree.txt | 26 +- .../HtmlTagsTest/CommentTag.stree.txt | 26 +- .../HtmlTagsTest/DocTypeTag.stree.txt | 20 +- .../HtmlTagsTest/ElementTags.stree.txt | 32 +- .../HtmlTagsTest/EmptyTag.stree.txt | 24 +- .../EmptyTagNestsLikeNormalTag.stree.txt | 26 +- .../IncompleteVoidElementEndTag.stree.txt | 564 ++++---- .../ProcessingInstructionTag.stree.txt | 32 +- .../HtmlTagsTest/ScriptTag.stree.txt | 57 +- .../ScriptTag_WithNestedBeginTag.stree.txt | 33 +- .../ScriptTag_WithNestedEndTag.stree.txt | 35 +- ...ScriptTag_WithNestedMalformedTag.stree.txt | 59 +- .../ScriptTag_WithNestedTag.stree.txt | 41 +- .../HtmlTagsTest/TextTags.stree.txt | 28 +- .../VoidElementFollowedByCloseTag.stree.txt | 1175 +++++++++-------- .../VoidElementFollowedByContent.stree.txt | 919 +++++++------ .../VoidElementFollowedByOtherTag.stree.txt | 788 ++++++----- ...OrTrailingWhitespaceInDesignMode.stree.txt | 131 +- ...hToCodeOnEmailAddressInAttribute.stree.txt | 58 +- ...oCodeIfThereIsNoMarkupOnThatLine.stree.txt | 137 +- ...SwitchToCodeOnEmailAddressInText.stree.txt | 28 +- ...oCodeIfThereIsNoMarkupOnThatLine.stree.txt | 138 +- ...tsPairsOfAtSignsAsEscapeSequence.stree.txt | 54 +- ...TreatsTwoAtSignsAsEscapeSequence.stree.txt | 36 +- ...ParsesCodeWithinSingleLineMarkup.stree.txt | 43 +- ...tsPairsOfAtSignsAsEscapeSequence.stree.txt | 105 +- ...TreatsTwoAtSignsAsEscapeSequence.stree.txt | 87 +- ...oCodeIfThereIsNoMarkupOnThatLine.stree.txt | 187 +-- ...pportsCodeWithinCDataDeclaration.stree.txt | 67 +- .../SupportsCodeWithinComment.stree.txt | 61 +- ...upportsCodeWithinSGMLDeclaration.stree.txt | 59 +- ...deWithinXMLProcessingInstruction.stree.txt | 61 +- ...acterEncounteredInAttributeValue.stree.txt | 53 +- ...CharacterEncounteredInTagContent.stree.txt | 80 +- ...enSwapCharacterEncounteredMidTag.stree.txt | 33 +- ...acterBeforeSwapIsNonAlphanumeric.stree.txt | 41 +- ...tsPairsOfAtSignsAsEscapeSequence.stree.txt | 53 +- ...TreatsTwoAtSignsAsEscapeSequence.stree.txt | 34 +- ...tes_DoesNotSpecialCase_VoidTags.cspans.txt | 5 + ...ites_DoesNotSpecialCase_VoidTags.stree.txt | 20 + ...tes_EndTagsWithMissingStartTags.cspans.txt | 3 + ...ites_EndTagsWithMissingStartTags.stree.txt | 14 + .../Rewrites_IncompleteTags.cspans.txt | 8 + .../Rewrites_IncompleteTags.stree.txt | 36 + ...formedTags_RecoversSuccessfully.cspans.txt | 7 + ...lformedTags_RecoversSuccessfully.stree.txt | 29 + ...cedEndTags_RecoversSuccessfully.cspans.txt | 8 + ...acedEndTags_RecoversSuccessfully.stree.txt | 35 + .../Rewrites_SelfClosingTags.cspans.txt | 5 + .../Rewrites_SelfClosingTags.stree.txt | 23 + ...tes_StartTagsWithMissingEndTags.cspans.txt | 7 + ...ites_StartTagsWithMissingEndTags.stree.txt | 37 + .../Rewrites_ValidNestedTags.cspans.txt | 8 + .../Rewrites_ValidNestedTags.stree.txt | 41 + ...es_ValidNestedTagsMixedWithCode.cspans.txt | 16 + ...tes_ValidNestedTagsMixedWithCode.stree.txt | 71 + .../Rewrites_ValidTags.cspans.txt | 9 + .../Rewrites_ValidTags.stree.txt | 36 + ...RequiresDoubleQuotesAroundValue.cspans.txt | 0 ...eRequiresDoubleQuotesAroundValue.stree.txt | 19 + ...ive_InvalidLookupText_AddsError.cspans.txt | 0 ...tive_InvalidLookupText_AddsError.stree.txt | 18 + ...HelperDirective_NoValue_Invalid.cspans.txt | 0 ...gHelperDirective_NoValue_Invalid.stree.txt | 18 + ...agHelperDirective_RequiresValue.cspans.txt | 0 ...TagHelperDirective_RequiresValue.stree.txt | 18 + ...irective_SingleQuotes_AddsError.cspans.txt | 0 ...Directive_SingleQuotes_AddsError.stree.txt | 18 + ...RequiresDoubleQuotesAroundValue.cspans.txt | 0 ...eRequiresDoubleQuotesAroundValue.stree.txt | 18 + ...gHelperDirective_SupportsSpaces.cspans.txt | 0 ...agHelperDirective_SupportsSpaces.stree.txt | 22 + ...tes_InvalidLookupText_AddsError.cspans.txt | 0 ...otes_InvalidLookupText_AddsError.stree.txt | 18 + ...tStartOfLineBecauseOfWhitespace.cspans.txt | 10 +- ...AtStartOfLineBecauseOfWhitespace.stree.txt | 20 + ...rectiveErrorsIfNotAtStartOfLine.cspans.txt | 0 ...irectiveErrorsIfNotAtStartOfLine.stree.txt | 20 + ...eDescriptor_AllowsNullableTypes.cspans.txt | 0 ...veDescriptor_AllowsNullableTypes.stree.txt | 80 ++ ...tiveDescriptor_AllowsTupleTypes.cspans.txt | 0 ...ctiveDescriptor_AllowsTupleTypes.stree.txt | 164 +++ ...Types_IgnoresTrailingWhitespace.cspans.txt | 0 ...eTypes_IgnoresTrailingWhitespace.stree.txt | 26 + ...or_AllowsWhiteSpaceAroundTokens.cspans.txt | 0 ...tor_AllowsWhiteSpaceAroundTokens.stree.txt | 30 + ...dleEOFIncompleteNamespaceTokens.cspans.txt | 0 ...ndleEOFIncompleteNamespaceTokens.stree.txt | 16 + ...HandleEOFInvalidNamespaceTokens.cspans.txt | 0 ...nHandleEOFInvalidNamespaceTokens.stree.txt | 19 + ...HandleIncompleteNamespaceTokens.cspans.txt | 0 ...nHandleIncompleteNamespaceTokens.stree.txt | 17 + ...CanHandleInvalidNamespaceTokens.cspans.txt | 0 ..._CanHandleInvalidNamespaceTokens.stree.txt | 20 + ...rrorsExtraContentAfterDirective.cspans.txt | 0 ...ErrorsExtraContentAfterDirective.stree.txt | 22 + ...or_ErrorsForInvalidMemberTokens.cspans.txt | 0 ...tor_ErrorsForInvalidMemberTokens.stree.txt | 16 + ...henEOFBeforeDirectiveBlockStart.cspans.txt | 0 ...WhenEOFBeforeDirectiveBlockStart.stree.txt | 18 + ...henExtraContentBeforeBlockStart.cspans.txt | 0 ...WhenExtraContentBeforeBlockStart.stree.txt | 28 + ...iptor_ErrorsWhenMissingEndBrace.cspans.txt | 0 ...riptor_ErrorsWhenMissingEndBrace.stree.txt | 25 + ...ipleOccurring_CanHaveDuplicates.cspans.txt | 0 ...tipleOccurring_CanHaveDuplicates.stree.txt | 46 + ...nglyOccurring_ErrorsIfDuplicate.cspans.txt | 0 ...inglyOccurring_ErrorsIfDuplicate.stree.txt | 46 + ...ped_CanBeBeneathOtherDirectives.cspans.txt | 0 ...oped_CanBeBeneathOtherDirectives.stree.txt | 40 + ...WhiteSpaceCommentsAndDirectives.cspans.txt | 0 ...rWhiteSpaceCommentsAndDirectives.stree.txt | 67 + ...NoErrorsSemicolonAfterDirective.cspans.txt | 0 ..._NoErrorsSemicolonAfterDirective.stree.txt | 24 + ...en_ParserErrorForNonStringValue.cspans.txt | 0 ...ken_ParserErrorForNonStringValue.stree.txt | 18 + ...arserErrorForPartialQuotedValue.cspans.txt | 0 ...ParserErrorForPartialQuotedValue.stree.txt | 17 + ...ParserErrorForSingleQuotedValue.cspans.txt | 0 ..._ParserErrorForSingleQuotedValue.stree.txt | 18 + ...ken_ParserErrorForUnquotedValue.cspans.txt | 0 ...oken_ParserErrorForUnquotedValue.stree.txt | 16 + ...or_TokensMustBeSeparatedBySpace.cspans.txt | 0 ...tor_TokensMustBeSeparatedBySpace.stree.txt | 20 + ...escriptor_UnderstandsCodeBlocks.cspans.txt | 0 ...Descriptor_UnderstandsCodeBlocks.stree.txt | 37 + ...criptor_UnderstandsMemberTokens.cspans.txt | 0 ...scriptor_UnderstandsMemberTokens.stree.txt | 18 + ...iptor_UnderstandsMultipleTokens.cspans.txt | 0 ...riptor_UnderstandsMultipleTokens.stree.txt | 32 + ...scriptor_UnderstandsRazorBlocks.cspans.txt | 0 ...escriptor_UnderstandsRazorBlocks.stree.txt | 46 + ...criptor_UnderstandsStringTokens.cspans.txt | 0 ...scriptor_UnderstandsStringTokens.stree.txt | 18 + ...escriptor_UnderstandsTypeTokens.cspans.txt | 0 ...Descriptor_UnderstandsTypeTokens.stree.txt | 24 + ...ctives_CanUseReservedWord_Class.cspans.txt | 0 ...ectives_CanUseReservedWord_Class.stree.txt | 14 + ...es_CanUseReservedWord_Namespace.cspans.txt | 0 ...ves_CanUseReservedWord_Namespace.stree.txt | 14 + .../EmptyFunctionsDirective.cspans.txt | 0 .../EmptyFunctionsDirective.stree.txt | 23 + ...tStartOfLineBecauseOfWhitespace.cspans.txt | 10 +- ...AtStartOfLineBecauseOfWhitespace.stree.txt | 26 + ...rectiveErrorsIfNotAtStartOfLine.cspans.txt | 0 ...irectiveErrorsIfNotAtStartOfLine.stree.txt | 27 + ...InheritsDirectiveSupportsArrays.cspans.txt | 0 .../InheritsDirectiveSupportsArrays.stree.txt | 24 + ...DirectiveSupportsNestedGenerics.cspans.txt | 0 ...sDirectiveSupportsNestedGenerics.stree.txt | 34 + ...tsDirectiveSupportsTypeKeywords.cspans.txt | 0 ...itsDirectiveSupportsTypeKeywords.stree.txt | 18 + ...ionalDirectiveTokens_AreSkipped.cspans.txt | 0 ...tionalDirectiveTokens_AreSkipped.stree.txt | 16 + ...tiveTokens_WithBraces_AreParsed.cspans.txt | 0 ...ctiveTokens_WithBraces_AreParsed.stree.txt | 18 + ...ultipleOptionalTokens_AreParsed.cspans.txt | 0 ...MultipleOptionalTokens_AreParsed.stree.txt | 24 + ...kens_WithSimpleTokens_AreParsed.cspans.txt | 0 ...okens_WithSimpleTokens_AreParsed.stree.txt | 18 + ...ns_WithMemberSpecified_IsParsed.cspans.txt | 0 ...ens_WithMemberSpecified_IsParsed.stree.txt | 18 + ...kens_WithMissingMember_IsParsed.cspans.txt | 0 ...okens_WithMissingMember_IsParsed.stree.txt | 18 + .../Parse_FunctionsDirective.cspans.txt | 0 .../Parse_FunctionsDirective.stree.txt | 33 + .../Parse_SectionDirective.cspans.txt | 0 .../Parse_SectionDirective.stree.txt | 46 + ...ctiveToken_WithMultipleSegments.cspans.txt | 0 ...ectiveToken_WithMultipleSegments.stree.txt | 22 + ...irectiveToken_WithSingleSegment.cspans.txt | 0 ...DirectiveToken_WithSingleSegment.stree.txt | 18 + ...RequiresDoubleQuotesAroundValue.cspans.txt | 0 ...eRequiresDoubleQuotesAroundValue.stree.txt | 19 + ...ive_InvalidLookupText_AddsError.cspans.txt | 0 ...tive_InvalidLookupText_AddsError.stree.txt | 18 + ...HelperDirective_NoValue_Invalid.cspans.txt | 0 ...gHelperDirective_NoValue_Invalid.stree.txt | 18 + ...agHelperDirective_RequiresValue.cspans.txt | 0 ...TagHelperDirective_RequiresValue.stree.txt | 18 + ...irective_SingleQuotes_AddsError.cspans.txt | 0 ...Directive_SingleQuotes_AddsError.stree.txt | 18 + ...RequiresDoubleQuotesAroundValue.cspans.txt | 0 ...eRequiresDoubleQuotesAroundValue.stree.txt | 18 + ...gHelperDirective_SupportsSpaces.cspans.txt | 0 ...agHelperDirective_SupportsSpaces.stree.txt | 22 + ...tes_InvalidLookupText_AddsError.cspans.txt | 0 ...otes_InvalidLookupText_AddsError.stree.txt | 18 + ...RequiresDoubleQuotesAroundValue.cspans.txt | 0 ...eRequiresDoubleQuotesAroundValue.stree.txt | 20 + ...PrefixDirective_NoValueSucceeds.cspans.txt | 0 ...rPrefixDirective_NoValueSucceeds.stree.txt | 18 + ...erPrefixDirective_RequiresValue.cspans.txt | 0 ...perPrefixDirective_RequiresValue.stree.txt | 18 + ...RequiresDoubleQuotesAroundValue.cspans.txt | 0 ...eRequiresDoubleQuotesAroundValue.stree.txt | 18 + ...gHelperPrefixDirective_Succeeds.cspans.txt | 0 ...agHelperPrefixDirective_Succeeds.stree.txt | 18 + ...ixDirective_WithQuotes_Succeeds.cspans.txt | 0 ...fixDirective_WithQuotes_Succeeds.stree.txt | 18 + .../AllowsCompatibleTagStructures1.stree.txt | 17 +- .../AllowsCompatibleTagStructures2.stree.txt | 13 +- .../AllowsCompatibleTagStructures3.stree.txt | 29 +- .../AllowsCompatibleTagStructures4.stree.txt | 19 +- .../AllowsCompatibleTagStructures5.stree.txt | 35 +- .../AllowsCompatibleTagStructures6.stree.txt | 13 +- .../AllowsCompatibleTagStructures7.stree.txt | 13 +- .../CanHandleSymbolBoundAttributes1.diag.txt | 5 + .../CanHandleSymbolBoundAttributes1.stree.txt | 42 +- .../CanHandleSymbolBoundAttributes2.diag.txt | 5 + .../CanHandleSymbolBoundAttributes2.stree.txt | 42 +- .../CanHandleSymbolBoundAttributes3.diag.txt | 5 + .../CanHandleSymbolBoundAttributes3.stree.txt | 49 +- .../CanHandleSymbolBoundAttributes4.diag.txt | 5 + .../CanHandleSymbolBoundAttributes4.stree.txt | 49 +- .../CanHandleSymbolBoundAttributes5.diag.txt | 5 + .../CanHandleSymbolBoundAttributes5.stree.txt | 40 +- .../CanHandleSymbolBoundAttributes6.diag.txt | 5 + .../CanHandleSymbolBoundAttributes6.stree.txt | 30 +- .../CanHandleSymbolBoundAttributes7.diag.txt | 5 + .../CanHandleSymbolBoundAttributes7.stree.txt | 40 +- ...HandleWithoutEndTagTagStructure1.stree.txt | 11 +- ...HandleWithoutEndTagTagStructure2.stree.txt | 29 +- ...HandleWithoutEndTagTagStructure3.stree.txt | 19 +- ...HandleWithoutEndTagTagStructure4.stree.txt | 37 +- ...HandleWithoutEndTagTagStructure5.stree.txt | 41 +- ...rEmptyTagHelperBoundAttributes1.cspans.txt | 1 + ...orEmptyTagHelperBoundAttributes1.stree.txt | 28 +- ...EmptyTagHelperBoundAttributes10.cspans.txt | 1 + ...rEmptyTagHelperBoundAttributes10.stree.txt | 28 +- ...EmptyTagHelperBoundAttributes11.cspans.txt | 2 + ...rEmptyTagHelperBoundAttributes11.stree.txt | 42 +- ...rEmptyTagHelperBoundAttributes12.stree.txt | 44 +- ...rEmptyTagHelperBoundAttributes13.stree.txt | 52 +- ...rEmptyTagHelperBoundAttributes14.stree.txt | 60 +- ...orEmptyTagHelperBoundAttributes2.stree.txt | 32 +- ...orEmptyTagHelperBoundAttributes3.stree.txt | 30 +- ...rEmptyTagHelperBoundAttributes4.cspans.txt | 2 + ...orEmptyTagHelperBoundAttributes4.stree.txt | 42 +- ...orEmptyTagHelperBoundAttributes5.stree.txt | 46 +- ...orEmptyTagHelperBoundAttributes6.stree.txt | 40 +- ...rEmptyTagHelperBoundAttributes7.cspans.txt | 1 + ...orEmptyTagHelperBoundAttributes7.stree.txt | 38 +- ...orEmptyTagHelperBoundAttributes8.stree.txt | 40 +- ...orEmptyTagHelperBoundAttributes9.stree.txt | 66 +- ...eatesErrorForMalformedTagHelper1.stree.txt | 10 +- ...eatesErrorForMalformedTagHelper2.stree.txt | 16 +- ...eatesErrorForMalformedTagHelper3.stree.txt | 18 +- ...eatesErrorForMalformedTagHelper4.stree.txt | 19 +- ...eatesErrorForMalformedTagHelper5.stree.txt | 16 +- ...eatesErrorForMalformedTagHelper6.stree.txt | 45 +- ...eatesErrorForMalformedTagHelper7.stree.txt | 48 +- ...eatesErrorForMalformedTagHelper8.stree.txt | 37 +- ...lformedTagHelpersWithAttributes1.stree.txt | 22 +- ...formedTagHelpersWithAttributes10.stree.txt | 34 +- ...formedTagHelpersWithAttributes11.stree.txt | 51 +- ...formedTagHelpersWithAttributes12.stree.txt | 51 +- ...formedTagHelpersWithAttributes13.stree.txt | 35 +- ...formedTagHelpersWithAttributes14.stree.txt | 33 +- ...formedTagHelpersWithAttributes15.stree.txt | 46 +- ...formedTagHelpersWithAttributes16.stree.txt | 38 +- ...formedTagHelpersWithAttributes17.stree.txt | 40 +- ...formedTagHelpersWithAttributes18.stree.txt | 32 +- ...formedTagHelpersWithAttributes19.stree.txt | 47 +- ...lformedTagHelpersWithAttributes2.stree.txt | 33 +- ...lformedTagHelpersWithAttributes3.stree.txt | 38 +- ...lformedTagHelpersWithAttributes4.stree.txt | 38 +- ...lformedTagHelpersWithAttributes5.stree.txt | 25 +- ...lformedTagHelpersWithAttributes6.stree.txt | 27 +- ...lformedTagHelpersWithAttributes7.stree.txt | 44 +- ...lformedTagHelpersWithAttributes8.stree.txt | 30 +- ...lformedTagHelpersWithAttributes9.stree.txt | 30 +- ...ForNonStringTagHelperAttributes1.stree.txt | 30 +- ...orNonStringTagHelperAttributes10.stree.txt | 73 +- ...orNonStringTagHelperAttributes11.stree.txt | 126 +- ...ForNonStringTagHelperAttributes2.stree.txt | 30 +- ...ForNonStringTagHelperAttributes3.stree.txt | 50 +- ...ForNonStringTagHelperAttributes4.stree.txt | 56 +- ...ForNonStringTagHelperAttributes5.stree.txt | 30 +- ...ForNonStringTagHelperAttributes6.stree.txt | 54 +- ...ForNonStringTagHelperAttributes7.stree.txt | 162 ++- ...ForNonStringTagHelperAttributes8.stree.txt | 86 +- ...ForNonStringTagHelperAttributes9.stree.txt | 98 +- ...rMinimizedBooleanBoundAttributes.stree.txt | 26 +- ...UnboundDataDashAttributes_Block1.stree.txt | 75 +- ...UnboundDataDashAttributes_Block2.stree.txt | 61 +- ...UnboundDataDashAttributes_Block3.stree.txt | 81 +- ...UnboundDataDashAttributes_Block4.stree.txt | 81 +- ...UnboundDataDashAttributes_Block5.stree.txt | 87 +- ...UnboundDataDashAttributes_Block6.stree.txt | 99 +- ...UnboundDataDashAttributes_Block7.stree.txt | 100 +- ...oundDataDashAttributes_Document1.stree.txt | 44 +- ...oundDataDashAttributes_Document2.stree.txt | 30 +- ...oundDataDashAttributes_Document3.stree.txt | 50 +- ...oundDataDashAttributes_Document4.stree.txt | 50 +- ...oundDataDashAttributes_Document5.stree.txt | 56 +- ...oundDataDashAttributes_Document6.stree.txt | 68 +- ...oundDataDashAttributes_Document7.stree.txt | 69 +- ...eTreeRewriter_AllowsInvalidHtml1.stree.txt | 36 +- ...TreeRewriter_AllowsInvalidHtml10.stree.txt | 82 +- ...eTreeRewriter_AllowsInvalidHtml2.stree.txt | 19 +- ...eTreeRewriter_AllowsInvalidHtml3.stree.txt | 26 +- ...eTreeRewriter_AllowsInvalidHtml4.stree.txt | 23 +- ...eTreeRewriter_AllowsInvalidHtml5.stree.txt | 47 +- ...eTreeRewriter_AllowsInvalidHtml6.stree.txt | 42 +- ...eTreeRewriter_AllowsInvalidHtml7.stree.txt | 52 +- ...eTreeRewriter_AllowsInvalidHtml8.stree.txt | 69 +- ...eTreeRewriter_AllowsInvalidHtml9.stree.txt | 91 +- ...atesErrorForIncompleteTagHelper1.stree.txt | 93 +- ...tesErrorForIncompleteTagHelper2.cspans.txt | 2 +- ...atesErrorForIncompleteTagHelper2.stree.txt | 58 +- ...tesErrorForIncompleteTagHelper2.tspans.txt | 2 +- ...tesErrorForIncompleteTagHelper3.cspans.txt | 4 +- ...atesErrorForIncompleteTagHelper3.stree.txt | 52 +- ...tesErrorForIncompleteTagHelper3.tspans.txt | 4 +- ...atesErrorForIncompleteTagHelper4.stree.txt | 72 +- ...plexAttributeTagHelperTagBlocks1.stree.txt | 84 +- ...plexAttributeTagHelperTagBlocks2.stree.txt | 242 ++-- ...plexAttributeTagHelperTagBlocks3.stree.txt | 93 +- ...plexAttributeTagHelperTagBlocks4.stree.txt | 251 ++-- ...plexAttributeTagHelperTagBlocks5.stree.txt | 111 +- ...plexAttributeTagHelperTagBlocks6.stree.txt | 269 ++-- ...plexAttributeTagHelperTagBlocks7.stree.txt | 175 ++- ...writesComplexTagHelperTagBlocks1.stree.txt | 34 +- ...writesComplexTagHelperTagBlocks2.stree.txt | 109 +- ...writesComplexTagHelperTagBlocks3.stree.txt | 44 +- ...writesComplexTagHelperTagBlocks4.stree.txt | 119 +- ...writesComplexTagHelperTagBlocks5.stree.txt | 69 +- ...writesComplexTagHelperTagBlocks6.stree.txt | 219 +-- ...writesComplexTagHelperTagBlocks7.stree.txt | 100 +- ...writesComplexTagHelperTagBlocks8.stree.txt | 250 ++-- ...esOddlySpacedTagHelperTagBlocks1.stree.txt | 89 +- ...esOddlySpacedTagHelperTagBlocks2.stree.txt | 98 +- ...esOddlySpacedTagHelperTagBlocks3.stree.txt | 99 +- ...RewritesPlainTagHelperTagBlocks1.stree.txt | 17 +- ...RewritesPlainTagHelperTagBlocks2.stree.txt | 26 +- ...RewritesPlainTagHelperTagBlocks3.stree.txt | 43 +- ...RewritesPlainTagHelperTagBlocks4.stree.txt | 67 +- ...writer_RewritesScriptTagHelpers1.stree.txt | 33 +- ...writer_RewritesScriptTagHelpers2.stree.txt | 41 +- ...writer_RewritesScriptTagHelpers3.stree.txt | 73 +- ...writer_RewritesScriptTagHelpers4.stree.txt | 73 +- ...writer_RewritesScriptTagHelpers5.stree.txt | 48 +- ...writer_RewritesScriptTagHelpers6.stree.txt | 80 +- ...writer_RewritesScriptTagHelpers7.stree.txt | 91 +- ...r_RewritesSelfClosingTagHelpers1.stree.txt | 48 +- ...r_RewritesSelfClosingTagHelpers2.stree.txt | 76 +- ...r_RewritesSelfClosingTagHelpers3.stree.txt | 71 +- ...esTagHelpersWithPlainAttributes1.stree.txt | 52 +- ...esTagHelpersWithPlainAttributes2.stree.txt | 61 +- ...esTagHelpersWithPlainAttributes3.stree.txt | 79 +- ...esTagHelpersWithPlainAttributes4.stree.txt | 128 +- ...gHelpersWithQuotelessAttributes1.stree.txt | 73 +- ...gHelpersWithQuotelessAttributes2.stree.txt | 82 +- ...gHelpersWithQuotelessAttributes3.stree.txt | 98 +- ...gHelpersWithQuotelessAttributes4.stree.txt | 129 +- ...gHelpersWithQuotelessAttributes5.stree.txt | 149 ++- ...standsEmptyAttributeTagHelpers1.cspans.txt | 1 + ...rstandsEmptyAttributeTagHelpers1.stree.txt | 32 +- ...standsEmptyAttributeTagHelpers2.cspans.txt | 1 + ...rstandsEmptyAttributeTagHelpers2.stree.txt | 32 +- ...rstandsEmptyAttributeTagHelpers3.stree.txt | 28 +- ...standsEmptyAttributeTagHelpers4.cspans.txt | 2 + ...rstandsEmptyAttributeTagHelpers4.stree.txt | 52 +- ...standsEmptyAttributeTagHelpers5.cspans.txt | 2 + ...rstandsEmptyAttributeTagHelpers5.stree.txt | 48 +- ...standsMinimizedAttributes_Block1.stree.txt | 51 +- ...tandsMinimizedAttributes_Block10.stree.txt | 50 +- ...tandsMinimizedAttributes_Block11.stree.txt | 51 +- ...andsMinimizedAttributes_Block12.cspans.txt | 1 + ...tandsMinimizedAttributes_Block12.stree.txt | 59 +- ...andsMinimizedAttributes_Block13.cspans.txt | 1 + ...tandsMinimizedAttributes_Block13.stree.txt | 58 +- ...tandsMinimizedAttributes_Block14.stree.txt | 60 +- ...tandsMinimizedAttributes_Block15.stree.txt | 68 +- ...tandsMinimizedAttributes_Block16.stree.txt | 57 +- ...tandsMinimizedAttributes_Block17.stree.txt | 61 +- ...tandsMinimizedAttributes_Block18.stree.txt | 63 +- ...tandsMinimizedAttributes_Block19.stree.txt | 67 +- ...standsMinimizedAttributes_Block2.stree.txt | 55 +- ...tandsMinimizedAttributes_Block20.stree.txt | 68 +- ...tandsMinimizedAttributes_Block21.stree.txt | 72 +- ...tandsMinimizedAttributes_Block22.stree.txt | 68 +- ...tandsMinimizedAttributes_Block23.stree.txt | 72 +- ...tandsMinimizedAttributes_Block24.stree.txt | 68 +- ...tandsMinimizedAttributes_Block25.stree.txt | 68 +- ...tandsMinimizedAttributes_Block26.stree.txt | 68 +- ...tandsMinimizedAttributes_Block27.stree.txt | 72 +- ...tandsMinimizedAttributes_Block28.stree.txt | 68 +- ...tandsMinimizedAttributes_Block29.stree.txt | 72 +- ...standsMinimizedAttributes_Block3.stree.txt | 51 +- ...tandsMinimizedAttributes_Block30.stree.txt | 100 +- ...tandsMinimizedAttributes_Block31.stree.txt | 104 +- ...tandsMinimizedAttributes_Block32.stree.txt | 161 ++- ...tandsMinimizedAttributes_Block33.stree.txt | 165 ++- ...standsMinimizedAttributes_Block4.stree.txt | 51 +- ...standsMinimizedAttributes_Block5.stree.txt | 55 +- ...standsMinimizedAttributes_Block6.stree.txt | 50 +- ...standsMinimizedAttributes_Block7.stree.txt | 51 +- ...standsMinimizedAttributes_Block8.stree.txt | 51 +- ...standsMinimizedAttributes_Block9.stree.txt | 50 +- ...ndsMinimizedAttributes_Document1.stree.txt | 20 +- ...dsMinimizedAttributes_Document10.stree.txt | 19 +- ...dsMinimizedAttributes_Document11.stree.txt | 20 +- ...sMinimizedAttributes_Document12.cspans.txt | 1 + ...dsMinimizedAttributes_Document12.stree.txt | 28 +- ...sMinimizedAttributes_Document13.cspans.txt | 1 + ...dsMinimizedAttributes_Document13.stree.txt | 27 +- ...dsMinimizedAttributes_Document14.stree.txt | 29 +- ...dsMinimizedAttributes_Document15.stree.txt | 37 +- ...dsMinimizedAttributes_Document16.stree.txt | 26 +- ...dsMinimizedAttributes_Document17.stree.txt | 30 +- ...dsMinimizedAttributes_Document18.stree.txt | 32 +- ...dsMinimizedAttributes_Document19.stree.txt | 36 +- ...ndsMinimizedAttributes_Document2.stree.txt | 24 +- ...dsMinimizedAttributes_Document20.stree.txt | 37 +- ...dsMinimizedAttributes_Document21.stree.txt | 41 +- ...dsMinimizedAttributes_Document22.stree.txt | 37 +- ...dsMinimizedAttributes_Document23.stree.txt | 41 +- ...dsMinimizedAttributes_Document24.stree.txt | 37 +- ...dsMinimizedAttributes_Document25.stree.txt | 37 +- ...dsMinimizedAttributes_Document26.stree.txt | 37 +- ...dsMinimizedAttributes_Document27.stree.txt | 41 +- ...dsMinimizedAttributes_Document28.stree.txt | 37 +- ...dsMinimizedAttributes_Document29.stree.txt | 41 +- ...ndsMinimizedAttributes_Document3.stree.txt | 20 +- ...dsMinimizedAttributes_Document30.stree.txt | 69 +- ...dsMinimizedAttributes_Document31.stree.txt | 73 +- ...dsMinimizedAttributes_Document32.stree.txt | 130 +- ...dsMinimizedAttributes_Document33.stree.txt | 134 +- ...ndsMinimizedAttributes_Document4.stree.txt | 20 +- ...ndsMinimizedAttributes_Document5.stree.txt | 24 +- ...ndsMinimizedAttributes_Document6.stree.txt | 19 +- ...ndsMinimizedAttributes_Document7.stree.txt | 20 +- ...ndsMinimizedAttributes_Document8.stree.txt | 20 +- ...ndsMinimizedAttributes_Document9.stree.txt | 19 +- ...MinimizedAttributes_PartialTags1.stree.txt | 16 +- ...MinimizedAttributes_PartialTags2.stree.txt | 16 +- ...MinimizedAttributes_PartialTags3.stree.txt | 16 +- ...MinimizedAttributes_PartialTags4.stree.txt | 28 +- ...MinimizedAttributes_PartialTags5.stree.txt | 16 +- ...MinimizedAttributes_PartialTags6.stree.txt | 16 +- ...MinimizedAttributes_PartialTags7.stree.txt | 22 +- ...MinimizedAttributes_PartialTags8.stree.txt | 47 +- ...sMinimizedBooleanBoundAttributes.stree.txt | 26 +- .../AllowsPrefixedTagHelpers1.stree.txt | 17 +- .../AllowsPrefixedTagHelpers10.stree.txt | 48 +- .../AllowsPrefixedTagHelpers11.stree.txt | 46 +- .../AllowsPrefixedTagHelpers2.stree.txt | 38 +- .../AllowsPrefixedTagHelpers3.stree.txt | 13 +- .../AllowsPrefixedTagHelpers4.stree.txt | 17 +- .../AllowsPrefixedTagHelpers5.stree.txt | 39 +- .../AllowsPrefixedTagHelpers6.stree.txt | 23 +- .../AllowsPrefixedTagHelpers7.stree.txt | 37 +- .../AllowsPrefixedTagHelpers8.stree.txt | 31 +- .../AllowsPrefixedTagHelpers9.stree.txt | 31 +- .../AllowsRazorCommentsAsChildren.stree.txt | 60 +- .../AllowsRazorMarkupInHtmlComment.stree.txt | 78 +- ...lowsSimpleHtmlCommentsAsChildren.stree.txt | 67 +- ...agInCSharpBlock_WithAttrTextTag1.stree.txt | 70 +- ...agInCSharpBlock_WithAttrTextTag2.stree.txt | 94 +- ...agInCSharpBlock_WithAttrTextTag3.stree.txt | 106 +- ...agInCSharpBlock_WithAttrTextTag4.stree.txt | 119 +- ...agInCSharpBlock_WithAttrTextTag5.stree.txt | 126 +- ...gInCSharpBlock_WithBlockTextTag1.stree.txt | 44 +- ...gInCSharpBlock_WithBlockTextTag2.stree.txt | 52 +- ...gInCSharpBlock_WithBlockTextTag3.stree.txt | 68 +- ...gInCSharpBlock_WithBlockTextTag4.stree.txt | 80 +- ...gInCSharpBlock_WithBlockTextTag5.stree.txt | 62 +- ...gInCSharpBlock_WithBlockTextTag6.stree.txt | 62 +- ...gInCSharpBlock_WithBlockTextTag7.stree.txt | 82 +- ...gInCSharpBlock_WithBlockTextTag8.stree.txt | 72 +- ...gInCSharpBlock_WithBlockTextTag9.stree.txt | 82 +- ...lperElementOptForIncompleteHTML1.stree.txt | 9 +- ...lperElementOptForIncompleteHTML2.stree.txt | 17 +- ...lperElementOptForIncompleteHTML3.stree.txt | 21 +- ...lperElementOptForIncompleteHTML4.stree.txt | 28 +- ...lperElementOptForIncompleteHTML5.stree.txt | 37 +- ...lperElementOptForIncompleteHTML6.stree.txt | 41 +- ...lperElementOptForIncompleteHTML7.stree.txt | 47 +- ...tForIncompleteHTMLInCSharpBlock1.stree.txt | 38 +- ...tForIncompleteHTMLInCSharpBlock2.stree.txt | 38 +- ...tForIncompleteHTMLInCSharpBlock3.stree.txt | 48 +- ...tForIncompleteHTMLInCSharpBlock4.stree.txt | 55 +- ...tForIncompleteHTMLInCSharpBlock5.stree.txt | 58 +- ...tForIncompleteHTMLInCSharpBlock6.stree.txt | 73 +- ...tForIncompleteHTMLInCSharpBlock7.stree.txt | 68 +- ...tForIncompleteHTMLInCSharpBlock8.stree.txt | 74 +- ...rIncompleteTextTagInCSharpBlock1.stree.txt | 38 +- ...rIncompleteTextTagInCSharpBlock2.stree.txt | 48 +- ...rIncompleteTextTagInCSharpBlock3.stree.txt | 55 +- ...rIncompleteTextTagInCSharpBlock4.stree.txt | 58 +- ...rIncompleteTextTagInCSharpBlock5.stree.txt | 68 +- ...rIncompleteTextTagInCSharpBlock6.stree.txt | 74 +- ...tOptOutCSharp_WithAttributeData1.stree.txt | 70 +- ...tOptOutCSharp_WithAttributeData2.stree.txt | 94 +- ...tOptOutCSharp_WithAttributeData3.stree.txt | 106 +- ...tOptOutCSharp_WithAttributeData4.stree.txt | 119 +- ...tOptOutCSharp_WithAttributeData5.stree.txt | 126 +- ...ementOptOutCSharp_WithBlockData1.stree.txt | 44 +- ...mentOptOutCSharp_WithBlockData10.stree.txt | 74 +- ...mentOptOutCSharp_WithBlockData11.stree.txt | 84 +- ...mentOptOutCSharp_WithBlockData12.stree.txt | 118 +- ...ementOptOutCSharp_WithBlockData2.stree.txt | 52 +- ...ementOptOutCSharp_WithBlockData3.stree.txt | 68 +- ...ementOptOutCSharp_WithBlockData4.stree.txt | 80 +- ...ementOptOutCSharp_WithBlockData5.stree.txt | 62 +- ...ementOptOutCSharp_WithBlockData6.stree.txt | 60 +- ...ementOptOutCSharp_WithBlockData7.stree.txt | 82 +- ...ementOptOutCSharp_WithBlockData8.stree.txt | 70 +- ...ementOptOutCSharp_WithBlockData9.stree.txt | 82 +- ...entOptOutHTML_WithAttributeData1.stree.txt | 45 +- ...entOptOutHTML_WithAttributeData2.stree.txt | 63 +- ...entOptOutHTML_WithAttributeData3.stree.txt | 76 +- ...entOptOutHTML_WithAttributeData4.stree.txt | 88 +- ...entOptOutHTML_WithAttributeData5.stree.txt | 95 +- ...ElementOptOutHTML_WithBlockData1.stree.txt | 19 +- ...lementOptOutHTML_WithBlockData10.stree.txt | 35 +- ...lementOptOutHTML_WithBlockData11.stree.txt | 51 +- ...lementOptOutHTML_WithBlockData12.stree.txt | 77 +- ...ElementOptOutHTML_WithBlockData2.stree.txt | 21 +- ...ElementOptOutHTML_WithBlockData3.stree.txt | 37 +- ...ElementOptOutHTML_WithBlockData4.stree.txt | 50 +- ...ElementOptOutHTML_WithBlockData5.stree.txt | 31 +- ...ElementOptOutHTML_WithBlockData6.stree.txt | 29 +- ...ElementOptOutHTML_WithBlockData7.stree.txt | 51 +- ...ElementOptOutHTML_WithBlockData8.stree.txt | 45 +- ...ElementOptOutHTML_WithBlockData9.stree.txt | 49 +- ...dleInvalidChildrenWithWhitespace.stree.txt | 63 +- ...pleTagHelpersWithAllowedChildren.stree.txt | 48 +- ...lpersWithAllowedChildren_OneNull.stree.txt | 48 +- .../CanHandleStartTagOnlyTagTagMode.stree.txt | 11 +- ...rrorForInconsistentTagStructures.stree.txt | 11 +- ...houtEndTagTagStructureForEndTags.stree.txt | 15 +- ...esNotRewriteSpecialTagTagHelpers1.diag.txt | 5 + ...sNotRewriteSpecialTagTagHelpers1.stree.txt | 53 +- ...esNotRewriteSpecialTagTagHelpers2.diag.txt | 5 + ...sNotRewriteSpecialTagTagHelpers2.stree.txt | 62 +- ...esNotRewriteSpecialTagTagHelpers3.diag.txt | 5 + ...sNotRewriteSpecialTagTagHelpers3.stree.txt | 48 +- ...esNotRewriteSpecialTagTagHelpers4.diag.txt | 5 + ...sNotRewriteSpecialTagTagHelpers4.stree.txt | 57 +- ...esNotRewriteSpecialTagTagHelpers5.diag.txt | 5 + ...sNotRewriteSpecialTagTagHelpers5.stree.txt | 55 +- ...esNotRewriteSpecialTagTagHelpers6.diag.txt | 5 + ...sNotRewriteSpecialTagTagHelpers6.stree.txt | 50 +- ...esNotRewriteSpecialTagTagHelpers7.diag.txt | 5 + ...sNotRewriteSpecialTagTagHelpers7.stree.txt | 54 +- ...esNotRewriteSpecialTagTagHelpers8.diag.txt | 5 + ...sNotRewriteSpecialTagTagHelpers8.stree.txt | 63 +- ...riteTextTagTransitionTagHelpers1.stree.txt | 26 +- ...riteTextTagTransitionTagHelpers2.stree.txt | 64 +- ...riteTextTagTransitionTagHelpers3.stree.txt | 78 +- ...riteTextTagTransitionTagHelpers4.stree.txt | 70 +- ...ersInInvalidHtmlTypedScriptTags1.stree.txt | 48 +- ...ersInInvalidHtmlTypedScriptTags2.stree.txt | 67 +- ...ersInInvalidHtmlTypedScriptTags3.stree.txt | 75 +- ...ersInInvalidHtmlTypedScriptTags4.stree.txt | 95 +- ...tsAsChildrenWhenFeatureFlagIsOff.stree.txt | 37 +- ...ForContentWithCommentsAsChildren.stree.txt | 61 +- ...NestedNonTagHelperTags_Correctly.stree.txt | 52 +- ...dAllowedChildrenAndRequireParent.stree.txt | 29 +- ...sCreateTagHelperBlocksCorrectly1.stree.txt | 57 +- ...CreateTagHelperBlocksCorrectly10.stree.txt | 133 +- ...sCreateTagHelperBlocksCorrectly2.stree.txt | 57 +- ...sCreateTagHelperBlocksCorrectly3.stree.txt | 79 +- ...sCreateTagHelperBlocksCorrectly4.stree.txt | 79 +- ...sCreateTagHelperBlocksCorrectly5.stree.txt | 89 +- ...sCreateTagHelperBlocksCorrectly6.stree.txt | 89 +- ...sCreateTagHelperBlocksCorrectly7.stree.txt | 89 +- ...sCreateTagHelperBlocksCorrectly8.stree.txt | 89 +- ...sCreateTagHelperBlocksCorrectly9.stree.txt | 133 +- ...agHelperPrefixAndAllowedChildren.stree.txt | 39 +- ...uteMismatchAndRestrictedChildren.stree.txt | 46 +- ...lformedTagHelperBlocksCorrectly1.stree.txt | 11 +- ...formedTagHelperBlocksCorrectly10.stree.txt | 51 +- ...lformedTagHelperBlocksCorrectly2.stree.txt | 27 +- ...lformedTagHelperBlocksCorrectly3.stree.txt | 44 +- ...lformedTagHelperBlocksCorrectly4.stree.txt | 23 +- ...lformedTagHelperBlocksCorrectly5.stree.txt | 34 +- ...lformedTagHelperBlocksCorrectly6.stree.txt | 51 +- ...lformedTagHelperBlocksCorrectly7.stree.txt | 39 +- ...lformedTagHelperBlocksCorrectly8.stree.txt | 56 +- ...lformedTagHelperBlocksCorrectly9.stree.txt | 34 +- ...sCreateTagHelperBlocksCorrectly1.stree.txt | 17 +- ...CreateTagHelperBlocksCorrectly10.stree.txt | 31 +- ...CreateTagHelperBlocksCorrectly11.stree.txt | 47 +- ...CreateTagHelperBlocksCorrectly12.stree.txt | 48 +- ...CreateTagHelperBlocksCorrectly13.stree.txt | 64 +- ...CreateTagHelperBlocksCorrectly14.stree.txt | 43 +- ...CreateTagHelperBlocksCorrectly15.stree.txt | 51 +- ...CreateTagHelperBlocksCorrectly16.stree.txt | 48 +- ...CreateTagHelperBlocksCorrectly17.stree.txt | 64 +- ...CreateTagHelperBlocksCorrectly18.stree.txt | 65 +- ...reateTagHelperBlocksCorrectly19.cspans.txt | 1 + ...CreateTagHelperBlocksCorrectly19.stree.txt | 45 +- ...sCreateTagHelperBlocksCorrectly2.stree.txt | 25 +- ...CreateTagHelperBlocksCorrectly20.stree.txt | 64 +- ...reateTagHelperBlocksCorrectly21.cspans.txt | 1 + ...CreateTagHelperBlocksCorrectly21.stree.txt | 62 +- ...CreateTagHelperBlocksCorrectly22.stree.txt | 97 +- ...reateTagHelperBlocksCorrectly23.cspans.txt | 1 + ...CreateTagHelperBlocksCorrectly23.stree.txt | 83 +- ...CreateTagHelperBlocksCorrectly24.stree.txt | 48 +- ...CreateTagHelperBlocksCorrectly25.stree.txt | 65 +- ...reateTagHelperBlocksCorrectly26.cspans.txt | 1 + ...CreateTagHelperBlocksCorrectly26.stree.txt | 62 +- ...reateTagHelperBlocksCorrectly27.cspans.txt | 1 + ...CreateTagHelperBlocksCorrectly27.stree.txt | 80 +- ...reateTagHelperBlocksCorrectly28.cspans.txt | 1 + ...CreateTagHelperBlocksCorrectly28.stree.txt | 91 +- ...CreateTagHelperBlocksCorrectly29.stree.txt | 131 +- ...sCreateTagHelperBlocksCorrectly3.stree.txt | 17 +- ...reateTagHelperBlocksCorrectly30.cspans.txt | 1 + ...CreateTagHelperBlocksCorrectly30.stree.txt | 101 +- ...sCreateTagHelperBlocksCorrectly4.stree.txt | 25 +- ...sCreateTagHelperBlocksCorrectly5.stree.txt | 31 +- ...sCreateTagHelperBlocksCorrectly6.stree.txt | 47 +- ...sCreateTagHelperBlocksCorrectly7.stree.txt | 48 +- ...sCreateTagHelperBlocksCorrectly8.stree.txt | 64 +- ...sCreateTagHelperBlocksCorrectly9.stree.txt | 69 +- ...ewritesNestedTagHelperTagBlocks1.stree.txt | 31 +- ...ewritesNestedTagHelperTagBlocks2.stree.txt | 42 +- ...ewritesNestedTagHelperTagBlocks3.stree.txt | 75 +- ...ewritesNestedTagHelperTagBlocks4.stree.txt | 91 +- .../UnderstandsAllowedChildren1.stree.txt | 27 +- .../UnderstandsAllowedChildren10.stree.txt | 92 +- .../UnderstandsAllowedChildren11.stree.txt | 100 +- .../UnderstandsAllowedChildren12.stree.txt | 25 +- .../UnderstandsAllowedChildren13.stree.txt | 23 +- .../UnderstandsAllowedChildren14.stree.txt | 97 +- .../UnderstandsAllowedChildren2.stree.txt | 35 +- .../UnderstandsAllowedChildren3.stree.txt | 25 +- .../UnderstandsAllowedChildren4.stree.txt | 21 +- .../UnderstandsAllowedChildren5.stree.txt | 31 +- .../UnderstandsAllowedChildren6.stree.txt | 29 +- .../UnderstandsAllowedChildren7.stree.txt | 49 +- .../UnderstandsAllowedChildren8.stree.txt | 49 +- .../UnderstandsAllowedChildren9.stree.txt | 60 +- ...UnderstandsNestedRequiredParent1.stree.txt | 25 +- ...UnderstandsNestedRequiredParent2.stree.txt | 31 +- ...UnderstandsNestedRequiredParent3.stree.txt | 39 +- ...UnderstandsNestedRequiredParent4.stree.txt | 47 +- ...UnderstandsNestedRequiredParent5.stree.txt | 53 +- ...edVoidSelfClosingRequiredParent1.stree.txt | 33 +- ...edVoidSelfClosingRequiredParent2.stree.txt | 39 +- ...edVoidSelfClosingRequiredParent3.stree.txt | 41 +- ...edVoidSelfClosingRequiredParent4.stree.txt | 55 +- ...edVoidSelfClosingRequiredParent5.stree.txt | 33 +- ...edVoidSelfClosingRequiredParent6.stree.txt | 37 +- ...edVoidSelfClosingRequiredParent7.stree.txt | 41 +- ...edVoidSelfClosingRequiredParent8.stree.txt | 55 +- ...meWithAllowedChildrenForCatchAll.stree.txt | 25 +- ...wedChildrenForCatchAllWithPrefix.stree.txt | 25 +- ...standsPartialRequiredParentTags1.stree.txt | 19 +- ...standsPartialRequiredParentTags2.stree.txt | 25 +- ...standsPartialRequiredParentTags3.stree.txt | 33 +- ...standsPartialRequiredParentTags4.stree.txt | 62 +- ...standsPartialRequiredParentTags5.stree.txt | 63 +- ...standsPartialRequiredParentTags6.stree.txt | 69 +- ...agHelperPrefixAndAllowedChildren.stree.txt | 31 +- ...dAllowedChildrenAndRequireParent.stree.txt | 31 +- ...TagHelpersInHtmlTypedScriptTags1.stree.txt | 65 +- ...TagHelpersInHtmlTypedScriptTags2.stree.txt | 113 +- ...TagHelpersInHtmlTypedScriptTags3.stree.txt | 131 +- ...TagHelpersInHtmlTypedScriptTags4.stree.txt | 139 +- ...ExpressionBlock_To_Parent_Block.cspans.txt | 12 +- ..._ExpressionBlock_To_Parent_Block.stree.txt | 41 +- .../IntegrationTests/IntegrationTestBase.cs | 45 +- .../Language/Legacy/BlockFactory.cs | 99 -- .../Language/Legacy/BlockTypes.cs | 230 ---- .../ClassifiedSpanSerializer.cs | 7 +- .../ClassifiedSpan/ClassifiedSpanVerifier.cs | 9 +- .../ClassifiedSpan/ClassifiedSpanWriter.cs | 66 +- .../Language/Legacy/ErrorCollector.cs | 57 - .../Language/Legacy/ParserTestBase.cs | 465 ++----- ...eSerializer.cs => SyntaxNodeSerializer.cs} | 31 +- ...eNodeVerifier.cs => SyntaxNodeVerifier.cs} | 63 +- .../Language/Legacy/SyntaxNodeWalker.cs | 37 + .../Language/Legacy/SyntaxNodeWriter.cs | 219 +++ .../Language/Legacy/SyntaxTreeNodeWalker.cs | 40 - .../Language/Legacy/SyntaxTreeNodeWriter.cs | 329 ----- .../TagHelperSpan/TagHelperSpanSerializer.cs | 7 +- .../TagHelperSpan/TagHelperSpanVerifier.cs | 9 +- .../TagHelperSpan/TagHelperSpanWriter.cs | 29 +- .../Language/Legacy/TestSpanBuilder.cs | 441 ------- .../Language/SyntaxTreeVerifier.cs | 40 +- .../Language/TestRazorCodeDocument.cs | 4 +- ...rosoft.AspNetCore.Razor.Test.Common.csproj | 2 +- .../Properties/AssemblyInfo.cs | 1 + .../DefaultRazorCompletionFactsServiceTest.cs | 2 +- .../PartialParserTestBase.cs | 16 + .../Xunit/ForegroundDispatcherTestBase.cs | 3 +- .../BraceSmartIndenterTest.cs | 7 +- ...DefaultRazorIndentationFactsServiceTest.cs | 34 +- .../DefaultRazorSyntaxFactsServiceTest.cs | 28 +- ...tVisualStudioRazorParserIntegrationTest.cs | 220 +-- ...soft.VisualStudio.Editor.Razor.Test.csproj | 1 + .../RazorSyntaxTreePartialParserTest.cs | 318 +---- ...dInsertionAcceptedProvisionally.cspans.txt | 4 + ...odInsertionAcceptedProvisionally.stree.txt | 19 + ...pExprAcceptsDCIInStatementBlock.cspans.txt | 9 + ...mpExprAcceptsDCIInStatementBlock.stree.txt | 30 + ...xprAcceptsDCIInStatementBlock_1.cspans.txt | 9 + ...ExprAcceptsDCIInStatementBlock_1.stree.txt | 30 + ...ptsDCIInStmtBlkAfterIdentifiers.cspans.txt | 9 + ...eptsDCIInStmtBlkAfterIdentifiers.stree.txt | 30 + ...sDCIInStmtBlkAfterIdentifiers_1.cspans.txt | 9 + ...tsDCIInStmtBlkAfterIdentifiers_1.stree.txt | 31 + ...sDCIInStmtBlkAfterIdentifiers_2.cspans.txt | 9 + ...tsDCIInStmtBlkAfterIdentifiers_2.stree.txt | 32 + ...AfterDotIfLastChangeProvisional.cspans.txt | 4 + ...dAfterDotIfLastChangeProvisional.stree.txt | 18 + ...nsitiveDCI_NewRoslynIntegration.cspans.txt | 4 + ...ensitiveDCI_NewRoslynIntegration.stree.txt | 17 + ...itiveDCI_NewRoslynIntegration_1.cspans.txt | 4 + ...sitiveDCI_NewRoslynIntegration_1.stree.txt | 16 + ...itiveDCI_NewRoslynIntegration_2.cspans.txt | 4 + ...sitiveDCI_NewRoslynIntegration_2.stree.txt | 16 + ...itiveDCI_NewRoslynIntegration_3.cspans.txt | 4 + ...sitiveDCI_NewRoslynIntegration_3.stree.txt | 17 + ...itiveDCI_NewRoslynIntegration_4.cspans.txt | 4 + ...sitiveDCI_NewRoslynIntegration_4.stree.txt | 17 + .../ImpExprProvisionallyAcceptsDCI.cspans.txt | 4 + .../ImpExprProvisionallyAcceptsDCI.stree.txt | 17 + ...nallyAcceptsDCIAfterIdentifiers.cspans.txt | 4 + ...onallyAcceptsDCIAfterIdentifiers.stree.txt | 17 + ...llyAcceptsDCIAfterIdentifiers_1.cspans.txt | 4 + ...allyAcceptsDCIAfterIdentifiers_1.stree.txt | 18 + ...llyAcceptsDCIAfterIdentifiers_2.cspans.txt | 4 + ...allyAcceptsDCIAfterIdentifiers_2.stree.txt | 19 + ...llyAcceptsDCIAfterIdentifiers_3.cspans.txt | 4 + ...allyAcceptsDCIAfterIdentifiers_3.stree.txt | 19 + ...mpExprProvisionallyAcceptsDCI_1.cspans.txt | 4 + ...ImpExprProvisionallyAcceptsDCI_1.stree.txt | 17 + ...mpExprProvisionallyAcceptsDCI_2.cspans.txt | 4 + ...ImpExprProvisionallyAcceptsDCI_2.stree.txt | 17 + ...eIfPrevWasProvisionallyAccepted.cspans.txt | 7 + ...geIfPrevWasProvisionallyAccepted.stree.txt | 26 + ...eptsParenthesisAtEnd_SingleEdit.cspans.txt | 4 + ...ceptsParenthesisAtEnd_SingleEdit.stree.txt | 18 + ...cceptsParenthesisAtEnd_TwoEdits.cspans.txt | 4 + ...AcceptsParenthesisAtEnd_TwoEdits.stree.txt | 18 + ...aractersIfEndOfSpanIsIdentifier.cspans.txt | 4 + ...haractersIfEndOfSpanIsIdentifier.stree.txt | 16 + ...StartCharactersIfEndOfSpanIsDot.cspans.txt | 9 + ...rStartCharactersIfEndOfSpanIsDot.stree.txt | 30 + ...rPartsIfSomeOfIdentifierRemains.cspans.txt | 4 + ...erPartsIfSomeOfIdentifierRemains.stree.txt | 16 + ...tAtEndOfNonWhitespaceCharacters.cspans.txt | 9 + ...otAtEndOfNonWhitespaceCharacters.stree.txt | 30 + ...eptsDotIfTrailingDotsAreAllowed.cspans.txt | 9 + ...ceptsDotIfTrailingDotsAreAllowed.stree.txt | 29 + ...tAtEndOfNonWhitespaceCharacters.cspans.txt | 9 + ...otAtEndOfNonWhitespaceCharacters.stree.txt | 31 + ...nAtEndOfNonWhitespaceCharacters.cspans.txt | 9 + ...onAtEndOfNonWhitespaceCharacters.stree.txt | 29 + .../ImpExprAcceptsInnerInsertions.cspans.txt | 4 + .../ImpExprAcceptsInnerInsertions.stree.txt | 19 + ...InnerInsertionsInStatementBlock.cspans.txt | 9 + ...sInnerInsertionsInStatementBlock.stree.txt | 32 + ...ItOnlyCausesIdentifierExpansion.cspans.txt | 4 + ...fItOnlyCausesIdentifierExpansion.stree.txt | 16 + ...ierReplacements_MultipleSymbols.cspans.txt | 4 + ...fierReplacements_MultipleSymbols.stree.txt | 18 + ...tifierReplacements_SingleSymbol.cspans.txt | 4 + ...ntifierReplacements_SingleSymbol.stree.txt | 16 + ...ierReplacements_MultipleSymbols.cspans.txt | 4 + ...fierReplacements_MultipleSymbols.stree.txt | 18 + ...tifierReplacements_SingleSymbol.cspans.txt | 4 + ...ntifierReplacements_SingleSymbol.stree.txt | 16 + ...urroundedIdentifierReplacements.cspans.txt | 4 + ...SurroundedIdentifierReplacements.stree.txt | 22 + ...ceptsWholeIdentifierReplacement.cspans.txt | 4 + ...cceptsWholeIdentifierReplacement.stree.txt | 16 + ...entifierExpansionAndTrailingDot.cspans.txt | 4 + ...dentifierExpansionAndTrailingDot.stree.txt | 17 + ...teOfIdentifierPartsIfDotRemains.cspans.txt | 4 + ...eteOfIdentifierPartsIfDotRemains.stree.txt | 17 + ...ceptsDotAfterIdentifierInMarkup.cspans.txt | 4 + ...cceptsDotAfterIdentifierInMarkup.stree.txt | 17 + 1361 files changed, 38116 insertions(+), 28491 deletions(-) delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/MarkupElementRewriterTest.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TagHelperBlockTest.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TagHelperParseTreeRewriterTests.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsExtraContentAfterDirective.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorMultilineCommentInBlock.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorMultilineCommentInBlock.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_DoesNotSpecialCase_VoidTags.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_DoesNotSpecialCase_VoidTags.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_EndTagsWithMissingStartTags.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_EndTagsWithMissingStartTags.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_IncompleteTags.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_IncompleteTags.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_MalformedTags_RecoversSuccessfully.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_MalformedTags_RecoversSuccessfully.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_MisplacedEndTags_RecoversSuccessfully.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_MisplacedEndTags_RecoversSuccessfully.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_SelfClosingTags.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_SelfClosingTags.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_StartTagsWithMissingEndTags.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_StartTagsWithMissingEndTags.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_ValidNestedTags.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_ValidNestedTags.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_ValidNestedTagsMixedWithCode.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_ValidNestedTagsMixedWithCode.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_ValidTags.cspans.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/MarkupElementRewriterTest/Rewrites_ValidTags.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/AddTagHelperDirective_InvalidLookupText_AddsError.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/AddTagHelperDirective_NoValue_Invalid.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/AddTagHelperDirective_RequiresValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/AddTagHelperDirective_SingleQuotes_AddsError.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/AddTagHelperDirective_SupportsSpaces.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt (71%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/BuiltInDirectiveErrorsIfNotAtStartOfLine.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_AllowsNullableTypes.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_AllowsTupleTypes.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_ErrorsExtraContentAfterDirective.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_ErrorsExtraContentAfterDirective.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_ErrorsForInvalidMemberTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_ErrorsWhenMissingEndBrace.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_TokensMustBeSeparatedBySpace.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_UnderstandsCodeBlocks.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_UnderstandsMemberTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_UnderstandsMultipleTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_UnderstandsRazorBlocks.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_UnderstandsStringTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/DirectiveDescriptor_UnderstandsTypeTokens.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/Directives_CanUseReservedWord_Class.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/Directives_CanUseReservedWord_Namespace.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/EmptyFunctionsDirective.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/EmptyFunctionsDirective.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt (71%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/ExtensibleDirectiveErrorsIfNotAtStartOfLine.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/InheritsDirectiveSupportsArrays.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/InheritsDirectiveSupportsNestedGenerics.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/InheritsDirectiveSupportsTypeKeywords.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/OptionalDirectiveTokens_AreSkipped.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/OptionalDirectiveTokens_WithBraces_AreParsed.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/OptionalMemberTokens_WithMemberSpecified_IsParsed.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/OptionalMemberTokens_WithMissingMember_IsParsed.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/Parse_FunctionsDirective.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/Parse_FunctionsDirective.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/Parse_SectionDirective.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/Parse_SectionDirective.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/RemoveTagHelperDirective_InvalidLookupText_AddsError.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/RemoveTagHelperDirective_NoValue_Invalid.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/RemoveTagHelperDirective_RequiresValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/RemoveTagHelperDirective_SingleQuotes_AddsError.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/RemoveTagHelperDirective_SupportsSpaces.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/TagHelperPrefixDirective_NoValueSucceeds.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/TagHelperPrefixDirective_RequiresValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/TagHelperPrefixDirective_Succeeds.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt rename test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/{CSharpDirectivesTest => RazorDirectivesTest}/TagHelperPrefixDirective_WithQuotes_Succeeds.cspans.txt (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/RazorDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes1.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes2.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes3.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes4.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes5.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes6.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CanHandleSymbolBoundAttributes7.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers1.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers2.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers3.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers4.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers5.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers6.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers7.diag.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/TagHelperParseTreeRewriterTest/DoesNotRewriteSpecialTagTagHelpers8.diag.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/BlockFactory.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/BlockTypes.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ErrorCollector.cs rename test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/{SyntaxTreeNodeSerializer.cs => SyntaxNodeSerializer.cs} (52%) rename test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/{SyntaxTreeNodeVerifier.cs => SyntaxNodeVerifier.cs} (76%) create mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxNodeWalker.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxNodeWriter.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeWalker.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeWriter.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/TestSpanBuilder.cs create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test.Common/PartialParserTestBase.cs create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/AwaitPeriodInsertionAcceptedProvisionally.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/AwaitPeriodInsertionAcceptedProvisionally.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStatementBlock.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStatementBlock.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStatementBlock_1.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStatementBlock_1.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStmtBlkAfterIdentifiers.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStmtBlkAfterIdentifiers.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStmtBlkAfterIdentifiers_1.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStmtBlkAfterIdentifiers_1.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStmtBlkAfterIdentifiers_2.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsDCIInStmtBlkAfterIdentifiers_2.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsIdentifierTypedAfterDotIfLastChangeProvisional.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprAcceptsIdentifierTypedAfterDotIfLastChangeProvisional.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration_1.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration_1.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration_2.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration_2.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration_3.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration_3.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration_4.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAccCaseInsensitiveDCI_NewRoslynIntegration_4.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCI.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCI.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCIAfterIdentifiers.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCIAfterIdentifiers.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCIAfterIdentifiers_1.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCIAfterIdentifiers_1.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCIAfterIdentifiers_2.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCIAfterIdentifiers_2.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCIAfterIdentifiers_3.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCIAfterIdentifiers_3.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCI_1.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCI_1.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCI_2.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprProvisionallyAcceptsDCI_2.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprRejectsAcceptableChangeIfPrevWasProvisionallyAccepted.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExprRejectsAcceptableChangeIfPrevWasProvisionallyAccepted.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExpr_AcceptsParenthesisAtEnd_SingleEdit.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExpr_AcceptsParenthesisAtEnd_SingleEdit.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExpr_AcceptsParenthesisAtEnd_TwoEdits.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/DefaultVisualStudioRazorParserIntegrationTest/ImpExpr_AcceptsParenthesisAtEnd_TwoEdits.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsAdditionalIdentifierCharactersIfEndOfSpanIsIdentifier.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsAdditionalIdentifierCharactersIfEndOfSpanIsIdentifier.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsAdditionalIdentifierStartCharactersIfEndOfSpanIsDot.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsAdditionalIdentifierStartCharactersIfEndOfSpanIsDot.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsDeleteOfIdentifierPartsIfSomeOfIdentifierRemains.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsDeleteOfIdentifierPartsIfSomeOfIdentifierRemains.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsDotAtEndOfNonWhitespaceCharacters.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsDotAtEndOfNonWhitespaceCharacters.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsDotIfTrailingDotsAreAllowed.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsDotIfTrailingDotsAreAllowed.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsIdentifierAfterDotAtEndOfNonWhitespaceCharacters.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsIdentifierAfterDotAtEndOfNonWhitespaceCharacters.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsIdentifierExpansionAtEndOfNonWhitespaceCharacters.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsIdentifierExpansionAtEndOfNonWhitespaceCharacters.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsInnerInsertions.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsInnerInsertions.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsInnerInsertionsInStatementBlock.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsInnerInsertionsInStatementBlock.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsMultipleInsertionIfItOnlyCausesIdentifierExpansion.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsMultipleInsertionIfItOnlyCausesIdentifierExpansion.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsPrefixIdentifierReplacements_MultipleSymbols.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsPrefixIdentifierReplacements_MultipleSymbols.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsPrefixIdentifierReplacements_SingleSymbol.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsPrefixIdentifierReplacements_SingleSymbol.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsSuffixIdentifierReplacements_MultipleSymbols.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsSuffixIdentifierReplacements_MultipleSymbols.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsSuffixIdentifierReplacements_SingleSymbol.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsSuffixIdentifierReplacements_SingleSymbol.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsSurroundedIdentifierReplacements.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsSurroundedIdentifierReplacements.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsWholeIdentifierReplacement.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprAcceptsWholeIdentifierReplacement.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprProvisionalForMultipleInsertionIfItCausesIdentifierExpansionAndTrailingDot.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprProvisionalForMultipleInsertionIfItCausesIdentifierExpansionAndTrailingDot.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprProvisionallyAcceptsDeleteOfIdentifierPartsIfDotRemains.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprProvisionallyAcceptsDeleteOfIdentifierPartsIfDotRemains.stree.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprProvisionallyAcceptsDotAfterIdentifierInMarkup.cspans.txt create mode 100644 test/Microsoft.VisualStudio.Editor.Razor.Test/TestFiles/ParserTests/RazorSyntaxTreePartialParserTest/ImpExprProvisionallyAcceptsDotAfterIdentifierInMarkup.stree.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs index 8c5b2e0f7..633c54e46 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs @@ -8,7 +8,7 @@ namespace Razor [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"78993008d95836bec2b9175d4294bf7bd5f5f109", @"/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml")] public class Template { - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("text"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("foo"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt index c4ba72abd..4a512b079 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt @@ -3,7 +3,7 @@ Document - NamespaceDeclaration - - Razor RazorSourceChecksumAttribute - ClassDeclaration - - public - Template - - - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.DoubleQuotes + PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.NoQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - unbound - foo - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs index 8c5b2e0f7..633c54e46 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs @@ -8,7 +8,7 @@ namespace Razor [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"78993008d95836bec2b9175d4294bf7bd5f5f109", @"/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml")] public class Template { - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("text"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("foo"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt index c4ba72abd..4a512b079 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt @@ -3,7 +3,7 @@ Document - NamespaceDeclaration - - Razor RazorSourceChecksumAttribute - ClassDeclaration - - public - Template - - - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.DoubleQuotes + PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.NoQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - unbound - foo - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - 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/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..b22d3a852 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs @@ -208,11 +208,6 @@ internal TestTokenizerBackedParser(LanguageCharacteristics langua { } - public override void ParseBlock() - { - throw new NotImplementedException(); - } - protected override bool TokenKindEquals(SyntaxKind x, SyntaxKind y) { throw new NotImplementedException(); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/WhiteSpaceRewriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/WhiteSpaceRewriterTest.cs index 856172a10..a11549f30 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/WhiteSpaceRewriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/WhiteSpaceRewriterTest.cs @@ -12,18 +12,23 @@ public class WhiteSpaceRewriterTest : CsHtmlMarkupParserTestBase public void Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block() { // Arrange + var content = @" +
+ @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/ComplexTagHelpers_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt index 39903d2ef..8ebbf2b42 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt @@ -91,7 +91,7 @@ Document - DefaultTagHelperProperty - (494:16,45 [9] ComplexTagHelpers.cshtml) - type - string TestNamespace.InputTagHelper2.Type - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (495:16,46 [8] ComplexTagHelpers.cshtml) IntermediateToken - (495:16,46 [8] ComplexTagHelpers.cshtml) - CSharp - checkbox - DefaultTagHelperProperty - (512:16,63 [4] ComplexTagHelpers.cshtml) - checked - bool TestNamespace.InputTagHelper2.Checked - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperProperty - (512:16,63 [4] ComplexTagHelpers.cshtml) - checked - bool TestNamespace.InputTagHelper2.Checked - HtmlAttributeValueStyle.NoQuotes IntermediateToken - (512:16,63 [4] ComplexTagHelpers.cshtml) - CSharp - true DefaultTagHelperExecute - DefaultTagHelperCreate - - TestNamespace.PTagHelper diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs index 8602f83cc..adc9f50cb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs @@ -149,7 +149,7 @@ public async System.Threading.Tasks.Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt index 92bc67f8c..a30c30118 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt @@ -94,7 +94,7 @@ Document - DefaultTagHelperProperty - (494:16,45 [9] ComplexTagHelpers.cshtml) - type - string TestNamespace.InputTagHelper2.Type - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (495:16,46 [8] ComplexTagHelpers.cshtml) IntermediateToken - (495:16,46 [8] ComplexTagHelpers.cshtml) - CSharp - checkbox - DefaultTagHelperProperty - (512:16,63 [4] ComplexTagHelpers.cshtml) - checked - bool TestNamespace.InputTagHelper2.Checked - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperProperty - (512:16,63 [4] ComplexTagHelpers.cshtml) - checked - bool TestNamespace.InputTagHelper2.Checked - HtmlAttributeValueStyle.NoQuotes IntermediateToken - (512:16,63 [4] ComplexTagHelpers.cshtml) - CSharp - true DefaultTagHelperExecute - DefaultTagHelperCreate - - TestNamespace.PTagHelper diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs index 4eca82aaa..8b32b49f8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes_Runtime { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/hello"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/hello"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/?hello=world"), 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("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/?hello=world@false"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "text", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt index ef34c24d7..9ee6d3d89 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt @@ -4,7 +4,7 @@ Document - RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes_Runtime - - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - href - ~/ - HtmlAttributeValueStyle.DoubleQuotes - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - href - ~/hello - HtmlAttributeValueStyle.DoubleQuotes + PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - href - ~/hello - HtmlAttributeValueStyle.NoQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - href - ~/?hello=world - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_3 - href - ~/?hello=world@false - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_4 - type - text - HtmlAttributeValueStyle.DoubleQuotes diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt index 63264fc10..4cec1235f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt @@ -69,7 +69,7 @@ Document - IntermediateToken - (205:5,17 [6] DuplicateAttributeTagHelpers.cshtml) - Html - button DefaultTagHelperProperty - (222:5,34 [4] DuplicateAttributeTagHelpers.cshtml) - checked - bool TestNamespace.InputTagHelper2.Checked - HtmlAttributeValueStyle.DoubleQuotes IntermediateToken - (222:5,34 [4] DuplicateAttributeTagHelpers.cshtml) - CSharp - true - DefaultTagHelperHtmlAttribute - - type - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperHtmlAttribute - - type - HtmlAttributeValueStyle.NoQuotes HtmlContent - (233:5,45 [8] DuplicateAttributeTagHelpers.cshtml) IntermediateToken - (233:5,45 [8] DuplicateAttributeTagHelpers.cshtml) - Html - checkbox DefaultTagHelperHtmlAttribute - - checked - HtmlAttributeValueStyle.SingleQuotes @@ -78,7 +78,7 @@ Document - DefaultTagHelperHtmlAttribute - - type - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (263:5,75 [8] DuplicateAttributeTagHelpers.cshtml) IntermediateToken - (263:5,75 [8] DuplicateAttributeTagHelpers.cshtml) - Html - checkbox - DefaultTagHelperHtmlAttribute - - checked - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperHtmlAttribute - - checked - HtmlAttributeValueStyle.NoQuotes HtmlContent - (281:5,93 [4] DuplicateAttributeTagHelpers.cshtml) IntermediateToken - (281:5,93 [4] DuplicateAttributeTagHelpers.cshtml) - Html - true DefaultTagHelperExecute - diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs index fd4e90095..f1967cc97 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs @@ -13,10 +13,11 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateA private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox"), 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("checked", new global::Microsoft.AspNetCore.Html.HtmlString("false"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "button", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("checked", new global::Microsoft.AspNetCore.Html.HtmlString("true"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_6 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("checked", new global::Microsoft.AspNetCore.Html.HtmlString("true"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_7 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("AGE", new global::Microsoft.AspNetCore.Html.HtmlString("40"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_8 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("Age", new global::Microsoft.AspNetCore.Html.HtmlString("500"), 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("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_6 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("checked", new global::Microsoft.AspNetCore.Html.HtmlString("true"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_7 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("checked", new global::Microsoft.AspNetCore.Html.HtmlString("true"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_8 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("AGE", new global::Microsoft.AspNetCore.Html.HtmlString("40"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_9 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("Age", new global::Microsoft.AspNetCore.Html.HtmlString("500"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden #pragma warning disable 0169 private string __tagHelperStringValueBuffer; @@ -108,10 +109,10 @@ public async System.Threading.Tasks.Task ExecuteAsync() #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); - __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_5); - __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); + __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); + __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { @@ -130,8 +131,8 @@ public async System.Threading.Tasks.Task ExecuteAsync() #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); - __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_8); + __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_9); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt index f2e84ead9..320ae0f00 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt @@ -8,10 +8,11 @@ Document - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_3 - checked - false - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_4 - type - button - HtmlAttributeValueStyle.SingleQuotes - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_5 - checked - true - HtmlAttributeValueStyle.SingleQuotes - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_6 - checked - true - HtmlAttributeValueStyle.DoubleQuotes - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_7 - AGE - 40 - HtmlAttributeValueStyle.DoubleQuotes - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_8 - Age - 500 - HtmlAttributeValueStyle.DoubleQuotes + PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_5 - type - checkbox - HtmlAttributeValueStyle.NoQuotes + PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_6 - checked - true - HtmlAttributeValueStyle.SingleQuotes + PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_7 - checked - true - HtmlAttributeValueStyle.NoQuotes + PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_8 - AGE - 40 - HtmlAttributeValueStyle.DoubleQuotes + PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_9 - Age - 500 - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper @@ -54,16 +55,16 @@ Document - PreallocatedTagHelperProperty - (205:5,17 [6] DuplicateAttributeTagHelpers.cshtml) - __tagHelperAttribute_4 - type - Type DefaultTagHelperProperty - (222:5,34 [4] DuplicateAttributeTagHelpers.cshtml) - checked - bool TestNamespace.InputTagHelper2.Checked - HtmlAttributeValueStyle.DoubleQuotes IntermediateToken - (222:5,34 [4] DuplicateAttributeTagHelpers.cshtml) - CSharp - true - PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_5 - PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_6 + PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 + PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_7 DefaultTagHelperExecute - HtmlContent - (288:5,100 [2] DuplicateAttributeTagHelpers.cshtml) IntermediateToken - (288:5,100 [2] DuplicateAttributeTagHelpers.cshtml) - Html - \n DefaultTagHelperCreate - - TestNamespace.PTagHelper DefaultTagHelperProperty - (43:2,8 [1] DuplicateAttributeTagHelpers.cshtml) - age - int TestNamespace.PTagHelper.Age - HtmlAttributeValueStyle.DoubleQuotes IntermediateToken - (43:2,8 [1] DuplicateAttributeTagHelpers.cshtml) - CSharp - 3 - PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_7 PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_8 + PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_9 DefaultTagHelperExecute - 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/NestedTagHelpers_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.ir.txt index 4a4b5e257..8e4bf85e0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.ir.txt @@ -32,7 +32,7 @@ Document - TagHelper - (84:3,4 [33] NestedTagHelpers.cshtml) - input - TagMode.SelfClosing DefaultTagHelperBody - DefaultTagHelperCreate - - InputTagHelper - DefaultTagHelperProperty - (97:3,17 [5] NestedTagHelpers.cshtml) - value - string InputTagHelper.FooProp - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperProperty - (97:3,17 [5] NestedTagHelpers.cshtml) - value - string InputTagHelper.FooProp - HtmlAttributeValueStyle.NoQuotes HtmlContent - (97:3,17 [5] NestedTagHelpers.cshtml) IntermediateToken - (97:3,17 [5] NestedTagHelpers.cshtml) - Html - Hello DefaultTagHelperHtmlAttribute - - type - HtmlAttributeValueStyle.SingleQuotes diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs index d7752b8ac..bd1475bb0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs @@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"5e63d5fe37100e65dfcf39dd1c542eb697b624db", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml")] public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers_Runtime { - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("text"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("foo"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.ir.txt index f4c6001b8..795142923 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.ir.txt @@ -3,7 +3,7 @@ Document - NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers_Runtime - - - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.DoubleQuotes + PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.NoQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - unbound - foo - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - 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..5c1d24e70 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 @@ -24,7 +24,7 @@ Document - DefaultTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (54:5,1 [11] TagHelpersWithWeirdlySpacedAttributes.cshtml) IntermediateToken - (54:5,1 [11] TagHelpersWithWeirdlySpacedAttributes.cshtml) - Html - Hello World - DefaultTagHelperProperty - (74:5,21 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) - age - int TestNamespace.PTagHelper.Age - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperProperty - (74:5,21 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) - age - int TestNamespace.PTagHelper.Age - HtmlAttributeValueStyle.NoQuotes IntermediateToken - (74:5,21 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) - CSharp - 1337 DefaultTagHelperHtmlAttribute - - data-content - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (99:6,19 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) @@ -63,10 +63,10 @@ Document - DefaultTagHelperBody - DefaultTagHelperCreate - - TestNamespace.InputTagHelper DefaultTagHelperCreate - - TestNamespace.InputTagHelper2 - DefaultTagHelperProperty - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) - type - string TestNamespace.InputTagHelper.Type - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperProperty - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) - type - string TestNamespace.InputTagHelper.Type - HtmlAttributeValueStyle.NoQuotes HtmlContent - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) IntermediateToken - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) - Html - password - DefaultTagHelperProperty - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) - type - string TestNamespace.InputTagHelper2.Type - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperProperty - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) - type - string TestNamespace.InputTagHelper2.Type - HtmlAttributeValueStyle.NoQuotes HtmlContent - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) IntermediateToken - (247:14,8 [8] TagHelpersWithWeirdlySpacedAttributes.cshtml) - Html - password DefaultTagHelperHtmlAttribute - - data-content - HtmlAttributeValueStyle.NoQuotes 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..7469e0742 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 @@ -12,7 +12,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpers private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "text", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); 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_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "password", 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.NoQuotes); #line hidden #pragma warning disable 0169 @@ -51,7 +51,7 @@ public async System.Threading.Tasks.Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.NoQuotes); BeginWriteTagHelperAttribute(); #line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml" Write(true); 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..4408c7176 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 @@ -7,7 +7,7 @@ Document - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - data-content - hello - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_3 - data-content - hello2 - HtmlAttributeValueStyle.SingleQuotes - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_4 - type - password - HtmlAttributeValueStyle.DoubleQuotes + PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_4 - type - password - HtmlAttributeValueStyle.NoQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_5 - data-content - blah - HtmlAttributeValueStyle.NoQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper @@ -22,7 +22,7 @@ Document - IntermediateToken - (105:6,25 [11] TagHelpersWithWeirdlySpacedAttributes.cshtml) - Html - Body of Tag DefaultTagHelperCreate - - TestNamespace.PTagHelper PreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_0 - DefaultTagHelperProperty - (74:5,21 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) - age - int TestNamespace.PTagHelper.Age - HtmlAttributeValueStyle.DoubleQuotes + DefaultTagHelperProperty - (74:5,21 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) - age - int TestNamespace.PTagHelper.Age - HtmlAttributeValueStyle.NoQuotes IntermediateToken - (74:5,21 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) - CSharp - 1337 DefaultTagHelperHtmlAttribute - - data-content - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (99:6,19 [4] TagHelpersWithWeirdlySpacedAttributes.cshtml) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/NestedTagHelpers.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/NestedTagHelpers.ir.txt index ab0e72e99..2cc010252 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/NestedTagHelpers.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/NestedTagHelpers.ir.txt @@ -3,7 +3,7 @@ Document - NamespaceDeclaration - - Razor RazorSourceChecksumAttribute - ClassDeclaration - - public - Template - - - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.DoubleQuotes + PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.NoQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - unbound - foo - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - 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