From 4e87760bc9ae3c388ee0d98fd36ea8025db81ba3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 16 Mar 2018 14:01:43 -0700 Subject: [PATCH 001/110] Update tests. --- src/Workspaces/CSharpTest/Json/CSharpJsonTests.cs | 10 +++++++--- .../RegularExpressions/CSharpRegexParserTests.cs | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Workspaces/CSharpTest/Json/CSharpJsonTests.cs b/src/Workspaces/CSharpTest/Json/CSharpJsonTests.cs index f0c7909068870..899e12cf60672 100644 --- a/src/Workspaces/CSharpTest/Json/CSharpJsonTests.cs +++ b/src/Workspaces/CSharpTest/Json/CSharpJsonTests.cs @@ -9,14 +9,18 @@ using System.Text; using System.Web.Script.Serialization; using System.Xml.Linq; -using Microsoft.CodeAnalysis.CSharp.VirtualChars; +using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.Json; -using Microsoft.CodeAnalysis.VirtualChars; using Newtonsoft.Json.Linq; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Json { + using JsonToken = EmbeddedSyntaxToken; + using JsonTrivia = EmbeddedSyntaxTrivia; + public partial class CSharpJsonParserTests { private readonly IVirtualCharService _service = CSharpVirtualCharService.Instance; @@ -190,7 +194,7 @@ private string TreeToText(JsonTree tree) NodeToElement(tree.Root)).ToString(); } - private string DiagnosticsToText(ImmutableArray diagnostics) + private string DiagnosticsToText(ImmutableArray diagnostics) { if (diagnostics.IsEmpty) { diff --git a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests.cs b/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests.cs index ddf3ffde00b08..40f29d5cdc899 100644 --- a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests.cs +++ b/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests.cs @@ -6,13 +6,17 @@ using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using System.Xml.Linq; -using Microsoft.CodeAnalysis.CSharp.VirtualChars; -using Microsoft.CodeAnalysis.RegularExpressions; -using Microsoft.CodeAnalysis.VirtualChars; +using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; +using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions { + using RegexToken = EmbeddedSyntaxToken; + using RegexTrivia = EmbeddedSyntaxTrivia; + public partial class CSharpRegexParserTests { private readonly IVirtualCharService _service = CSharpVirtualCharService.Instance; From 0bbdfafe27280cb00080e40e3547981648a047b1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 16 Mar 2018 14:23:36 -0700 Subject: [PATCH 002/110] Move tests. --- .../Json/CSharpJsonParserTests_BasicTests.cs | 5 +- .../CSharpJsonParserTests_TestGeneration.cs | 0 .../Json/CSharpJsonTests.cs | 4 +- .../CSharpRegexParserTests.cs | 2 +- .../CSharpRegexParserTests_BasicTests.cs | 2 +- ...arpRegexParserTests_DotnetNegativeTests.cs | 2 +- .../CSharpRegexParserTests_ReferenceTests.cs | 2 +- .../CSharpRegexParserTests.cs | 291 - .../CSharpRegexParserTests_BasicTests.cs | 15024 ---------------- ...arpRegexParserTests_DotnetNegativeTests.cs | 5335 ------ .../CSharpRegexParserTests_ReferenceTests.cs | 6794 ------- .../CSharpRegexParserTests_TestGeneration.cs | 131 - 12 files changed, 8 insertions(+), 27584 deletions(-) rename src/Workspaces/CSharpTest/{ => EmbeddedLanguages}/Json/CSharpJsonParserTests_BasicTests.cs (99%) rename src/Workspaces/CSharpTest/{ => EmbeddedLanguages}/Json/CSharpJsonParserTests_TestGeneration.cs (100%) rename src/Workspaces/CSharpTest/{ => EmbeddedLanguages}/Json/CSharpJsonTests.cs (99%) delete mode 100644 src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests.cs delete mode 100644 src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_BasicTests.cs delete mode 100644 src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs delete mode 100644 src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs delete mode 100644 src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_TestGeneration.cs diff --git a/src/Workspaces/CSharpTest/Json/CSharpJsonParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs similarity index 99% rename from src/Workspaces/CSharpTest/Json/CSharpJsonParserTests_BasicTests.cs rename to src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index c1bfab78b8fa4..b7688007aa46f 100644 --- a/src/Workspaces/CSharpTest/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -1,10 +1,9 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Text.RegularExpressions; using Xunit; -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Json -{ +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json +{ public partial class CSharpJsonParserTests { [Fact] diff --git a/src/Workspaces/CSharpTest/Json/CSharpJsonParserTests_TestGeneration.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs similarity index 100% rename from src/Workspaces/CSharpTest/Json/CSharpJsonParserTests_TestGeneration.cs rename to src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs diff --git a/src/Workspaces/CSharpTest/Json/CSharpJsonTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs similarity index 99% rename from src/Workspaces/CSharpTest/Json/CSharpJsonTests.cs rename to src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 899e12cf60672..46b8cb7bef356 100644 --- a/src/Workspaces/CSharpTest/Json/CSharpJsonTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -11,12 +11,12 @@ using System.Xml.Linq; using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Json; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; -using Microsoft.CodeAnalysis.Json; using Newtonsoft.Json.Linq; using Xunit; -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Json +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { using JsonToken = EmbeddedSyntaxToken; using JsonTrivia = EmbeddedSyntaxTrivia; diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs index c061d1663ab3f..40f29d5cdc899 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs @@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Xunit; -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.RegularExpressions +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions { using RegexToken = EmbeddedSyntaxToken; using RegexTrivia = EmbeddedSyntaxTrivia; diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs index 4e00cd6c369ae..6eca1e9b5ce94 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs @@ -3,7 +3,7 @@ using System.Text.RegularExpressions; using Xunit; -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.RegularExpressions +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions { public partial class CSharpRegexParserTests { diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs index 3c8e07e6a6329..f8dbde1e0c46c 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs @@ -3,7 +3,7 @@ using System.Text.RegularExpressions; using Xunit; -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.RegularExpressions +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions { public partial class CSharpRegexParserTests { diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs index 6dd390d9e4f31..fa19092f819c4 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs @@ -3,7 +3,7 @@ using System.Text.RegularExpressions; using Xunit; -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.RegularExpressions +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions { public partial class CSharpRegexParserTests { diff --git a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests.cs b/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests.cs deleted file mode 100644 index 40f29d5cdc899..0000000000000 --- a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests.cs +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright (c) Microsoft. 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.Immutable; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text.RegularExpressions; -using System.Xml.Linq; -using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; -using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; -using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; -using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - using RegexToken = EmbeddedSyntaxToken; - using RegexTrivia = EmbeddedSyntaxTrivia; - - public partial class CSharpRegexParserTests - { - private readonly IVirtualCharService _service = CSharpVirtualCharService.Instance; - private const string _statmentPrefix = "var v = "; - - private SyntaxToken GetStringToken(string text) - { - var statement = _statmentPrefix + text; - var parsedStatement = SyntaxFactory.ParseStatement(statement); - var token = parsedStatement.DescendantTokens().ToArray()[3]; - Assert.True(token.Kind() == SyntaxKind.StringLiteralToken); - - return token; - } - - private void Test(string stringText, string expected, RegexOptions options, - bool runSubTreeTests = true, [CallerMemberName]string name = "") - { - var tree = TryParseTree(stringText, options, conversionFailureOk: false); - - // Tests are allowed to not run the subtree tests. This is because some - // subtrees can cause the native regex parser to exhibit very bad behavior - // (like not ever actually finishing compiling). - if (runSubTreeTests) - { - TryParseSubTrees(stringText, options); - } - - var actual = TreeToText(tree).Replace("\"", "\"\""); - Assert.Equal(expected.Replace("\"", "\"\""), actual); - } - - private void TryParseSubTrees(string stringText, RegexOptions options) - { - // Trim the input from the right and make sure tree invariants hold - var current = stringText; - while (current != "@\"\"" && current != "\"\"") - { - current = current.Substring(0, current.Length - 2) + "\""; - TryParseTree(current, options, conversionFailureOk: true); - } - - // Trim the input from the left and make sure tree invariants hold - current = stringText; - while (current != "@\"\"" && current != "\"\"") - { - if (current[0] == '@') - { - current = "@\"" + current.Substring(3); - } - else - { - current = "\"" + current.Substring(2); - } - - TryParseTree(current, options, conversionFailureOk: true); - } - - for (int start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++) - { - TryParseTree( - stringText.Substring(0, start) + - stringText.Substring(start + 1, stringText.Length - (start + 1)), - options, conversionFailureOk: true); - } - } - - private (SyntaxToken, RegexTree, ImmutableArray) JustParseTree( - string stringText, RegexOptions options, bool conversionFailureOk) - { - var token = GetStringToken(stringText); - var allChars = _service.TryConvertToVirtualChars(token); - if (allChars.IsDefault) - { - Assert.True(conversionFailureOk, "Failed to convert text to token."); - return (token, null, allChars); - } - - var tree = RegexParser.TryParse(allChars, options); - return (token, tree, allChars); - } - - private RegexTree TryParseTree(string stringText, RegexOptions options, bool conversionFailureOk) - { - var (token, tree, allChars) = JustParseTree(stringText, options, conversionFailureOk); - if (tree == null) - { - Assert.True(allChars.IsDefault); - return null; - } - - CheckInvariants(tree, allChars); - - try - { - var regex = new Regex(token.ValueText, options); - Assert.Empty(tree.Diagnostics); - - Assert.True(regex.GetGroupNumbers().OrderBy(v => v).SequenceEqual( - tree.CaptureNumbersToSpan.Keys.OrderBy(v => v))); - - Assert.True(regex.GetGroupNames().Where(v => !int.TryParse(v, out _)).OrderBy(v => v).SequenceEqual( - tree.CaptureNamesToSpan.Keys.OrderBy(v => v))); - } - catch (IndexOutOfRangeException) - { - // bug with .net regex parser. Can happen with patterns like: (?<-0 - Assert.NotEmpty(tree.Diagnostics); - } - catch (NullReferenceException) - { - // bug with .net regex parser. can happen with patterns like: (?(?S)) - } - catch (OutOfMemoryException) - { - // bug with .net regex parser. can happen with patterns like: a{2147483647,} - } - catch (Exception e) - { - Assert.NotEmpty(tree.Diagnostics); - Assert.True(tree.Diagnostics.Any(d => e.Message.Contains(d.Message))); - } - - return tree; - } - - private string TreeToText(RegexTree tree) - { - var element = new XElement("Tree", - NodeToElement(tree.Root)); - - if (tree.Diagnostics.Length > 0) { - element.Add(new XElement("Diagnostics", - tree.Diagnostics.Select(d => - new XElement("Diagnostic", - new XAttribute("Message", d.Message), - new XAttribute("Start", d.Span.Start), - new XAttribute("Length", d.Span.Length))))); - } - - element.Add(new XElement("Captures", - tree.CaptureNumbersToSpan.OrderBy(kvp => kvp.Key).Select(kvp => - new XElement("Capture", new XAttribute("Name", kvp.Key), new XAttribute("Span", kvp.Value))), - tree.CaptureNamesToSpan.OrderBy(kvp => kvp.Key).Select(kvp => - new XElement("Capture", new XAttribute("Name", kvp.Key), new XAttribute("Span", kvp.Value))))); - - return element.ToString(); - } - - private XElement NodeToElement(RegexNode node) - { - var element = new XElement(node.Kind.ToString()); - foreach (var child in node) - { - element.Add(child.IsNode ? NodeToElement(child.Node) : TokenToElement(child.Token)); - } - - return element; - } - - private XElement TokenToElement(RegexToken token) - { - var element = new XElement(token.Kind.ToString()); - - if (token.Value != null) - { - element.Add(new XAttribute("value", token.Value)); - } - - if (token.LeadingTrivia.Length > 0) - { - element.Add(new XElement("Trivia", token.LeadingTrivia.Select(t => TriviaToElement(t)))); - } - - if (token.VirtualChars.Length > 0) - { - element.Add(token.VirtualChars.CreateString()); - } - - return element; - } - - private XElement TriviaToElement(RegexTrivia trivia) - => new XElement( - trivia.Kind.ToString(), - trivia.VirtualChars.CreateString()); - - private void CheckInvariants(RegexTree tree, ImmutableArray allChars) - { - var root = tree.Root; - var position = 0; - CheckInvariants(root, ref position, allChars); - Assert.Equal(allChars.Length, position); - } - - private void CheckInvariants(RegexNode node, ref int position, ImmutableArray allChars) - { - foreach (var child in node) - { - if (child.IsNode) - { - CheckInvariants(child.Node, ref position, allChars); - } - else - { - CheckInvariants(child.Token, ref position, allChars); - } - } - } - - private void CheckInvariants(RegexToken token, ref int position, ImmutableArray allChars) - { - CheckInvariants(token.LeadingTrivia, ref position, allChars); - CheckCharacters(token.VirtualChars, ref position, allChars); - } - - private void CheckInvariants(ImmutableArray leadingTrivia, ref int position, ImmutableArray allChars) - { - foreach (var trivia in leadingTrivia) - { - CheckInvariants(trivia, ref position, allChars); - } - } - - private void CheckInvariants(RegexTrivia trivia, ref int position, ImmutableArray allChars) - { - switch (trivia.Kind) - { - case RegexKind.CommentTrivia: - case RegexKind.WhitespaceTrivia: - break; - default: - Assert.False(true, "Incorrect trivia kind"); - return; - } - - CheckCharacters(trivia.VirtualChars, ref position, allChars); - } - - private static void CheckCharacters(ImmutableArray virtualChars, ref int position, ImmutableArray allChars) - { - for (var i = 0; i < virtualChars.Length; i++) - { - Assert.Equal(allChars[position + i], virtualChars[i]); - } - - position += virtualChars.Length; - } - - [Fact] - public void TestDeepRecursion() - { - var (token, tree, chars) = - JustParseTree( -@"@""(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((""", RegexOptions.None, conversionFailureOk: false); - Assert.False(token.IsMissing); - Assert.False(chars.IsDefaultOrEmpty); - Assert.Null(tree); - } - } -} diff --git a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_BasicTests.cs deleted file mode 100644 index 6eca1e9b5ce94..0000000000000 --- a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_BasicTests.cs +++ /dev/null @@ -1,15024 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Text.RegularExpressions; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - public partial class CSharpRegexParserTests - { - [Fact] - public void TestEmpty() - { - Test(@"""""", @" - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOneWhitespace_IgnorePatternWhitespace() - { - Test(@""" """, @" - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestTwoWhitespace_IgnorePatternWhitespace() - { - Test(@""" """, @" - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestEmptyParenComment() - { - Test(@"""(?#)""", @" - - - - - (?#) - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleParenComment() - { - Test(@"""(?# )""", @" - - - - - (?# ) - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnterminatedParenComment1() - { - Test(@"""(?#""", @" - - - - - (?# - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnterminatedParenComment2() - { - Test(@"""(?# """, @" - - - - - (?# - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestMultipleComments1() - { - Test(@"""(?#)(?#)""", @" - - - - - (?#) - (?#) - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestMultipleComments2() - { - Test(@"""(?#)(?#)""", @" - - - - - (?#) - (?#) - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestMultipleComments3() - { - Test(@"""(?#) (?#)""", @" - - - - - - (?#) - - - - - - (?#) - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestMultipleComments4() - { - Test(@"""(?#) (?#)""", @" - - - - - (?#) - - (?#) - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass1() - { - Test(@"@""[a\p{Lu}(?#)b]""", @" - - - - [ - - - a - - - \ - p - { - Lu - } - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass2() - { - Test(@"@""[a\0(?#)b]""", @" - - - - [ - - - a - - - \ - 0 - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass3() - { - Test(@"@""[a\a(?#)b]""", @" - - - - [ - - - a - - - \ - a - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass4() - { - Test(@"@""[a\x00(?#)b]""", @" - - - - [ - - - a - - - \ - x - 00 - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass5() - { - Test(@"@""[a\u0000(?#)b]""", @" - - - - [ - - - a - - - \ - u - 0000 - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass6() - { - Test(@"@""[a\](?#)b]""", @" - - - - [ - - - a - - - \ - ] - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOpenQuestion1() - { - Test(@"""(?""", @" - - - - ( - - - ? - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOpenQuestion2() - { - Test(@"""(?""", @" - - - - ( - - - ? - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestOpenQuestion3() - { - Test(@"""(? """, @" - - - - ( - - - ? - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOpenQuestion4() - { - Test(@"""(? """, @" - - - - ( - - - ? - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestSimpleOptionsNode1() - { - Test(@"""(?i)""", @" - - - - ( - ? - i - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleOptionsNode2() - { - Test(@"""(?im)""", @" - - - - ( - ? - im - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleOptionsNode3() - { - Test(@"""(?im-x)""", @" - - - - ( - ? - im-x - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleOptionsNode4() - { - Test(@"""(?im-x+n)""", @" - - - - ( - ? - im-x+n - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOptionThatDoesNotChangeWhitespaceScanning() - { - Test(@"""(?i) """, @" - - - - ( - ? - i - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOptionThatDoesChangeWhitespaceScanning() - { - Test(@"""(?x) """, @" - - - - ( - ? - x - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOptionThatDoesChangeWhitespaceScanning2() - { - Test(@""" (?x) """, @" - - - - - - - ( - ? - x - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOptionThatDoesChangeWhitespaceScanning3() - { - Test(@""" (?-x) """, @" - - - - - - - ( - ? - -x - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestOptionRestoredWhenGroupPops() - { - Test(@""" ( (?-x) ) """, @" - - - - - - - ( - - - - - - ( - ? - -x - ) - - - - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNestedOptionGroup1() - { - Test(@""" (?-x:) """, @" - - - - - - - ( - ? - -x - : - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNestedOptionGroup2() - { - Test(@""" (?-x: ) """, @" - - - - - - - ( - ? - -x - : - - - - - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNestedOptionGroup3() - { - Test(@""" (?-x: (?+x: ) ) """, @" - - - - - - - ( - ? - -x - : - - - - - - ( - ? - +x - : - - - - - ) - - - - - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncompleteOptionsGroup1() - { - Test(@"""(?-x""", @" - - - - ( - ? - -x - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncompleteOptionsGroup2() - { - Test(@"""(?-x """, @" - - - - ( - ? - -x - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncorrectOptionsGroup3() - { - Test(@"""(?-x :""", @" - - - - ( - ? - -x - - - - : - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncorrectOptionsGroup4() - { - Test(@"""(?-x )""", @" - - - - ( - ? - -x - - - - - - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncorrectOptionsGroup5() - { - Test(@"""(?-x :)""", @" - - - - ( - ? - -x - - - - : - - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCloseParen() - { - Test(@""")""", @" - - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSingleChar() - { - Test(@"""a""", @" - - - - a - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTwoCharsChar() - { - Test(@"""ab""", @" - - - - ab - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuantifier() - { - Test(@"""a*""", @" - - - - - a - - * - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuestionQuantifier() - { - Test(@"""a*?""", @" - - - - - - a - - * - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuantifier() - { - Test(@"""a+""", @" - - - - - a - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuestionQuantifier() - { - Test(@"""a+?""", @" - - - - - - a - - + - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuantifier() - { - Test(@"""a?""", @" - - - - - a - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuestionQuantifier() - { - Test(@"""a??""", @" - - - - - - a - - ? - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestEmptySimpleGroup() - { - Test(@"""()""", @" - - - - ( - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestGroupWithSingleElement() - { - Test(@"""(a)""", @" - - - - ( - - - a - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestGroupWithMissingCloseParen() - { - Test(@"""(""", @" - - - - ( - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestGroupWithElementWithMissingCloseParen() - { - Test(@"""(a""", @" - - - - ( - - - a - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void JustBar() - { - Test(@"""|""", @" - - - - | - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void SpaceBar() - { - Test(@""" |""", @" - - - - - - - - | - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void BarSpace() - { - Test(@"""| """, @" - - - - | - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void SpaceBarSpace() - { - Test(@""" | """, @" - - - - - - - - | - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void JustBar_IgnoreWhitespace() - { - Test(@"""|""", @" - - - - | - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void SpaceBar_IgnoreWhitespace() - { - Test(@""" |""", @" - - - - - - - | - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void BarSpace_IgnoreWhitespace() - { - Test(@"""| """, @" - - - - | - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void SpaceBarSpace_IgnoreWhitespace() - { - Test(@""" | """, @" - - - - - - - | - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void DoubleBar() - { - Test(@"""||""", @" - - - - - | - - - | - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void BarInGroup() - { - Test(@"""(|)""", @" - - - - ( - - - | - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestExactNumericQuantifier() - { - Test(@"""a{0}""", @" - - - - - a - - { - 0 - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOpenRangeNumericQuantifier() - { - Test(@"""a{0,}""", @" - - - - - a - - { - 0 - , - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestClosedRangeNumericQuantifier() - { - Test(@"""a{0,1}""", @" - - - - - a - - { - 0 - , - 1 - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestLargeExactRangeNumericQuantifier1() - { - Test(@"""a{2147483647}""", @" - - - - - a - - { - 2147483647 - } - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeExactRangeNumericQuantifier2() - { - Test(@"""a{2147483648}""", @" - - - - - a - - { - 2147483648 - } - - - - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeOpenRangeNumericQuantifier1() - { - Test(@"""a{2147483647,}""", @" - - - - - a - - { - 2147483647 - , - } - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeOpenRangeNumericQuantifier2() - { - Test(@"""a{2147483648,}""", @" - - - - - a - - { - 2147483648 - , - } - - - - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeClosedRangeNumericQuantifier1() - { - Test(@"""a{0,2147483647}""", @" - - - - - a - - { - 0 - , - 2147483647 - } - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeClosedRangeNumericQuantifier2() - { - Test(@"""a{0,2147483648}""", @" - - - - - a - - { - 0 - , - 2147483648 - } - - - - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestBadMinMaxClosedRangeNumericQuantifier() - { - Test(@"""a{1,0}""", @" - - - - - a - - { - 1 - , - 0 - } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestLazyExactNumericQuantifier() - { - Test(@"""a{0}?""", @" - - - - - - a - - { - 0 - } - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestLazyOpenNumericQuantifier() - { - Test(@"""a{0,}?""", @" - - - - - - a - - { - 0 - , - } - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestLazyClosedNumericQuantifier() - { - Test(@"""a{0,1}?""", @" - - - - - - a - - { - 0 - , - 1 - } - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestIncompleteNumericQuantifier1() - { - Test(@"""a{""", @" - - - - a{ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestIncompleteNumericQuantifier2() - { - Test(@"""a{0""", @" - - - - a{0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestIncompleteNumericQuantifier3() - { - Test(@"""a{0,""", @" - - - - a{0, - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestIncompleteNumericQuantifier4() - { - Test(@"""a{0,1""", @" - - - - a{0,1 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNotNumericQuantifier1() - { - Test(@"""a{0 }""", @" - - - - a{0 - - - - - - } - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier2() - { - Test(@"""a{0, }""", @" - - - - a{0, - - - - - - } - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier3() - { - Test(@"""a{0 ,}""", @" - - - - a{0 - - - - - - ,} - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier4() - { - Test(@"""a{0 ,1}""", @" - - - - a{0 - - - - - - ,1} - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier5() - { - Test(@"""a{0, 1}""", @" - - - - a{0, - - - - - - 1} - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier6() - { - Test(@"""a{0,1 }""", @" - - - - a{0,1 - - - - - - } - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestLazyQuantifierDueToIgnoredWhitespace() - { - Test(@"""a* ?""", @" - - - - - - a - - * - - - - - ? - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNonLazyQuantifierDueToNonIgnoredWhitespace() - { - Test(@"""a* ?""", @" - - - - - a - - * - - - - - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuantifierAtStart() - { - Test(@"""*""", @" - - - - * - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuantifierAtStartOfGroup() - { - Test(@"""(*)""", @" - - - - ( - - - * - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuantifierAfterQuantifier() - { - Test(@"""a**""", @" - - - - - a - - * - - - * - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuantifierAtStart() - { - Test(@"""+""", @" - - - - + - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuantifierAtStartOfGroup() - { - Test(@"""(+)""", @" - - - - ( - - - + - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuantifierAfterQuantifier() - { - Test(@"""a*+""", @" - - - - - a - - * - - - + - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuantifierAtStart() - { - Test(@"""?""", @" - - - - ? - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuantifierAtStartOfGroup() - { - Test(@"""(?)""", @" - - - - ( - - - ? - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuantifierAfterQuantifier() - { - Test(@"""a*??""", @" - - - - - - a - - * - - ? - - - ? - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericQuantifierAtStart() - { - Test(@"""{0}""", @" - - - - { - - - 0} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericQuantifierAtStartOfGroup() - { - Test(@"""({0})""", @" - - - - ( - - - { - - - 0} - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericQuantifierAfterQuantifier() - { - Test(@"""a*{0}""", @" - - - - - a - - * - - - { - - - 0} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonNumericQuantifierAtStart() - { - Test(@"""{0""", @" - - - - {0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonNumericQuantifierAtStartOfGroup() - { - Test(@"""({0)""", @" - - - - ( - - - {0 - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonNumericQuantifierAfterQuantifier() - { - Test(@"""a*{0""", @" - - - - - a - - * - - - {0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestEscapeAtEnd1() - { - Test(@"@""\""", @" - - - - \ - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestEscapeAtEnd2() - { - Test(@"""\\""", @" - - - - \ - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleEscape() - { - Test(@"@""\w""", @" - - - - \ - w - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPrimaryEscapes1() - { - Test(@"@""\b\B\A\G\Z\z\w\W\s\W\s\S\d\D""", @" - - - - \ - b - - - \ - B - - - \ - A - - - \ - G - - - \ - Z - - - \ - z - - - \ - w - - - \ - W - - - \ - s - - - \ - W - - - \ - s - - - \ - S - - - \ - d - - - \ - D - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape1() - { - Test(@"@""\c""", @" - - - - \ - c - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape2() - { - Test(@"@""\c<""", @" - - - - \ - c - - - - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape3() - { - Test(@"@""\ca""", @" - - - - \ - c - a - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape4() - { - Test(@"@""\cA""", @" - - - - \ - c - A - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape5() - { - Test(@"@""\c A""", @" - - - - \ - c - - - - A - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape6() - { - Test(@"@""\c(a)""", @" - - - - \ - c - - - - ( - - - a - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape7() - { - Test(@"@""\c>""", @" - - - - \ - c - - - - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape8() - { - Test(@"@""\c?""", @" - - - - - \ - c - - - ? - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape9() - { - Test(@"@""\c@""", @" - - - - \ - c - @ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape10() - { - Test(@"@""\c^""", @" - - - - \ - c - ^ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape11() - { - Test(@"@""\c_""", @" - - - - \ - c - _ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape12() - { - Test(@"@""\c`""", @" - - - - \ - c - - - - ` - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape13() - { - Test(@"@""\c{""", @" - - - - \ - c - - - - { - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape14() - { - Test(@"@""\ca""", @" - - - - \ - c - a - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape15() - { - Test(@"@""\cA""", @" - - - - \ - c - A - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape16() - { - Test(@"@""\cz""", @" - - - - \ - c - z - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape17() - { - Test(@"@""\cZ""", @" - - - - \ - c - Z - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnknownEscape1() - { - Test(@"@""\m""", @" - - - - \ - m - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape1() - { - Test(@"@""\x""", @" - - - - \ - x - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape2() - { - Test(@"@""\x """, @" - - - - \ - x - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape3() - { - Test(@"@""\x0""", @" - - - - \ - x - 0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape4() - { - Test(@"@""\x0 """, @" - - - - \ - x - 0 - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape5() - { - Test(@"@""\x00""", @" - - - - \ - x - 00 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape6() - { - Test(@"@""\x00 """, @" - - - - \ - x - 00 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape7() - { - Test(@"@""\x000""", @" - - - - \ - x - 00 - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape8() - { - Test(@"@""\xff""", @" - - - - \ - x - ff - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape9() - { - Test(@"@""\xFF""", @" - - - - \ - x - FF - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape10() - { - Test(@"@""\xfF""", @" - - - - \ - x - fF - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape11() - { - Test(@"@""\xfff""", @" - - - - \ - x - ff - - - f - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape12() - { - Test(@"@""\xgg""", @" - - - - \ - x - - - - gg - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnknownEscape2() - { - Test(@"@""\m """, @" - - - - \ - m - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape1() - { - Test(@"@""\u""", @" - - - - \ - u - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape2() - { - Test(@"@""\u0""", @" - - - - \ - u - 0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape3() - { - Test(@"@""\u00""", @" - - - - \ - u - 00 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape4() - { - Test(@"@""\u000""", @" - - - - \ - u - 000 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape5() - { - Test(@"@""\u0000""", @" - - - - \ - u - 0000 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape6() - { - Test(@"@""\u0000 """, @" - - - - \ - u - 0000 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape7() - { - Test(@"@""\u """, @" - - - - \ - u - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape8() - { - Test(@"@""\u0 """, @" - - - - \ - u - 0 - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape9() - { - Test(@"@""\ugggg""", @" - - - - \ - u - - - - gggg - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape1() - { - Test(@"@""\0""", @" - - - - \ - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape2() - { - Test(@"@""\0 """, @" - - - - \ - 0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape3() - { - Test(@"@""\00""", @" - - - - \ - 00 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape4() - { - Test(@"@""\00 """, @" - - - - \ - 00 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape5() - { - Test(@"@""\000""", @" - - - - \ - 000 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape6() - { - Test(@"@""\000 """, @" - - - - \ - 000 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape7() - { - Test(@"@""\0000""", @" - - - - \ - 000 - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape8() - { - Test(@"@""\0000 """, @" - - - - \ - 000 - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape9() - { - Test(@"@""\7""", @" - - - - \ - 7 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape10() - { - Test(@"@""\78""", @" - - - - \ - 7 - - - 8 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape11() - { - Test(@"@""\8""", @" - - - - \ - 8 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscapeEcmascript1() - { - Test(@"@""\40""", @" - - - - \ - 40 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestOctalEscapeEcmascript2() - { - Test(@"@""\401""", @" - - - - \ - 40 - - - 1 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestOctalEscapeEcmascript3() - { - Test(@"@""\37""", @" - - - - \ - 37 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestOctalEscapeEcmascript4() - { - Test(@"@""\371""", @" - - - - \ - 371 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestOctalEscapeEcmascript5() - { - Test(@"@""\0000""", @" - - - - \ - 000 - - - 0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEscape1() - { - Test(@"@""\k""", @" - - - - \ - k - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape2() - { - Test(@"@""\k """, @" - - - - \ - k - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape3() - { - Test(@"@""\k<""", @" - - - - \ - k - - - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape4() - { - Test(@"@""\k< """, @" - - - - \ - k - - - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape5() - { - Test(@"@""\k<0""", @" - - - - \ - k - - - <0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape6() - { - Test(@"@""\k<0 """, @" - - - - \ - k - - - <0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape7() - { - Test(@"@""\k<0>""", @" - - - - \ - k - < - 0 - > - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape8() - { - Test(@"@""\k<0> """, @" - - - - \ - k - < - 0 - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape9() - { - Test(@"@""\k<00> """, @" - - - - \ - k - < - 00 - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape10() - { - Test(@"@""\k """, @" - - - - \ - k - < - a - > - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape11() - { - Test(@"@""(?)\k """, @" - - - - ( - ? - < - a - > - - ) - - - \ - k - < - a - > - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEcmaEscape1() - { - Test(@"@""\k""", @" - - - - \ - k - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape2() - { - Test(@"@""\k """, @" - - - - \ - k - - - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape3() - { - Test(@"@""\k<""", @" - - - - \ - k - - - < - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape4() - { - Test(@"@""\k< """, @" - - - - \ - k - - - < - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape5() - { - Test(@"@""\k<0""", @" - - - - \ - k - - - <0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape6() - { - Test(@"@""\k<0 """, @" - - - - \ - k - - - <0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape7() - { - Test(@"@""\k<0>""", @" - - - - \ - k - < - 0 - > - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape8() - { - Test(@"@""\k<0> """, @" - - - - \ - k - < - 0 - > - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureQuoteEscape3() - { - Test(@"@""\k'""", @" - - - - \ - k - - - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape4() - { - Test(@"@""\k' """, @" - - - - \ - k - - - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape5() - { - Test(@"@""\k'0""", @" - - - - \ - k - - - '0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape6() - { - Test(@"@""\k'0 """, @" - - - - \ - k - - - '0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape7() - { - Test(@"@""\k'0'""", @" - - - - \ - k - ' - 0 - ' - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape8() - { - Test(@"@""\k'0' """, @" - - - - \ - k - ' - 0 - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape9() - { - Test(@"@""\k'00' """, @" - - - - \ - k - ' - 00 - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape10() - { - Test(@"@""\k'a' """, @" - - - - \ - k - ' - a - ' - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape11() - { - Test(@"@""(?)\k'a' """, @" - - - - ( - ? - < - a - > - - ) - - - \ - k - ' - a - ' - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureWrongQuote1() - { - Test(@"@""\k<0' """, @" - - - - \ - k - - - <0' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureWrongQuote2() - { - Test(@"@""\k'0> """, @" - - - - \ - k - - - '0> - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape1() - { - Test(@"@""\""", @" - - - - \ - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape2() - { - Test(@"@""\ """, @" - - - - \ - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape3() - { - Test(@"@""\<""", @" - - - - \ - < - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape4() - { - Test(@"@""\< """, @" - - - - \ - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape5() - { - Test(@"@""\<0""", @" - - - - \ - < - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape6() - { - Test(@"@""\<0 """, @" - - - - \ - < - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape7() - { - Test(@"@""\<0>""", @" - - - - \ - < - 0 - > - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape8() - { - Test(@"@""\<0> """, @" - - - - \ - < - 0 - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape9() - { - Test(@"@""\<00> """, @" - - - - \ - < - 00 - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape10() - { - Test(@"@""\ """, @" - - - - \ - < - a - > - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape11() - { - Test(@"@""(?)\ """, @" - - - - ( - ? - < - a - > - - ) - - - \ - < - a - > - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEcmaEscape1() - { - Test(@"@""\""", @" - - - - \ - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape2() - { - Test(@"@""\ """, @" - - - - \ - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape3() - { - Test(@"@""\<""", @" - - - - \ - < - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape4() - { - Test(@"@""\< """, @" - - - - \ - < - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape5() - { - Test(@"@""\<0""", @" - - - - \ - < - - - 0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape6() - { - Test(@"@""\<0 """, @" - - - - \ - < - - - 0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape7() - { - Test(@"@""\<0>""", @" - - - - \ - < - 0 - > - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape8() - { - Test(@"@""\<0> """, @" - - - - \ - < - 0 - > - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureQuoteEscape3() - { - Test(@"@""\'""", @" - - - - \ - ' - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape4() - { - Test(@"@""\' """, @" - - - - \ - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape5() - { - Test(@"@""\'0""", @" - - - - \ - ' - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape6() - { - Test(@"@""\'0 """, @" - - - - \ - ' - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape7() - { - Test(@"@""\'0'""", @" - - - - \ - ' - 0 - ' - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape8() - { - Test(@"@""\'0' """, @" - - - - \ - ' - 0 - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape9() - { - Test(@"@""\'00' """, @" - - - - \ - ' - 00 - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape10() - { - Test(@"@""\'a' """, @" - - - - \ - ' - a - ' - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape11() - { - Test(@"@""(?)\'a' """, @" - - - - ( - ? - < - a - > - - ) - - - \ - ' - a - ' - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureWrongQuote1() - { - Test(@"@""\<0' """, @" - - - - \ - < - - - 0' - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureWrongQuote2() - { - Test(@"@""\'0> """, @" - - - - \ - ' - - - 0> - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestDefinedCategoryEscape() - { - Test(@"""\\p{Cc}""", @" - - - - \ - p - { - Cc - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestDefinedCategoryEscapeWithSpaces1() - { - Test(@"""\\p{ Cc }""", @" - - - - \ - p - - - { Cc } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestDefinedCategoryEscapeWithSpaces2() - { - Test(@"""\\p{ Cc }""", @" - - - - \ - p - - - { - - - - - - Cc - - - - - - } - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestDefinedCategoryEscapeWithSpaces3() - { - Test(@"""\\p {Cc}""", @" - - - - \ - p - - - - - - {Cc} - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestUndefinedCategoryEscape() - { - Test(@"""\\p{xxx}""", @" - - - - \ - p - { - xxx - } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape1() - { - Test(@"""\\p""", @" - - - - \ - p - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape2() - { - Test(@"""\\p{""", @" - - - - \ - p - - - { - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape3() - { - Test(@"""\\p{}""", @" - - - - \ - p - - - {} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape4() - { - Test(@"""\\p{} """, @" - - - - \ - p - - - {} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape5() - { - Test(@"""\\p {} """, @" - - - - \ - p - - - {} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape6() - { - Test(@"""\\p{Cc """, @" - - - - \ - p - - - {Cc - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCategoryNameWithDash() - { - Test(@"""\\p{IsArabicPresentationForms-A}""", @" - - - - \ - p - { - IsArabicPresentationForms-A - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonCapturingGrouping1() - { - Test(@"""(?:)""", @" - - - - ( - ? - : - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonCapturingGrouping2() - { - Test(@"""(?:a)""", @" - - - - ( - ? - : - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonCapturingGrouping3() - { - Test(@"""(?:""", @" - - - - ( - ? - : - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonCapturingGrouping4() - { - Test(@"""(?: """, @" - - - - ( - ? - : - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestPositiveLookaheadGrouping1() - { - Test(@"""(?=)""", @" - - - - ( - ? - = - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookaheadGrouping2() - { - Test(@"""(?=a)""", @" - - - - ( - ? - = - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookaheadGrouping3() - { - Test(@"""(?=""", @" - - - - ( - ? - = - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookaheadGrouping4() - { - Test(@"""(?= """, @" - - - - ( - ? - = - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNegativeLookaheadGrouping1() - { - Test(@"""(?!)""", @" - - - - ( - ? - ! - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookaheadGrouping2() - { - Test(@"""(?!a)""", @" - - - - ( - ? - ! - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookaheadGrouping3() - { - Test(@"""(?!""", @" - - - - ( - ? - ! - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookaheadGrouping4() - { - Test(@"""(?! """, @" - - - - ( - ? - ! - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNonBacktrackingGrouping1() - { - Test(@"""(?>)""", @" - - - - ( - ? - > - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonBacktrackingGrouping2() - { - Test(@"""(?>a)""", @" - - - - ( - ? - > - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonBacktrackingGrouping3() - { - Test(@"""(?>""", @" - - - - ( - ? - > - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonBacktrackingGrouping4() - { - Test(@"""(?> """, @" - - - - ( - ? - > - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestPositiveLookbehindGrouping1() - { - Test(@"""(?<=)""", @" - - - - ( - ? - < - = - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookbehindGrouping2() - { - Test(@"""(?<=a)""", @" - - - - ( - ? - < - = - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookbehindGrouping3() - { - Test(@"""(?<=""", @" - - - - ( - ? - < - = - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookbehindGrouping4() - { - Test(@"""(?<= """, @" - - - - ( - ? - < - = - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNegativeLookbehindGrouping1() - { - Test(@"""(? - - - - ( - ? - < - ! - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookbehindGrouping2() - { - Test(@"""(? - - - - ( - ? - < - ! - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookbehindGrouping3() - { - Test(@"""(? - - - - ( - ? - < - ! - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookbehindGrouping4() - { - Test(@"""(? - - - - ( - ? - < - ! - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture1() - { - Test(@"""(?<""", @" - - - - ( - ? - < - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture2() - { - Test(@"""(?<>""", @" - - - - ( - ? - < - - > - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture3() - { - Test(@"""(? - - - - ( - ? - < - a - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture4() - { - Test(@"""(?""", @" - - - - ( - ? - < - a - > - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture5() - { - Test(@"""(?a""", @" - - - - ( - ? - < - a - > - - - a - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture6() - { - Test(@"""(?a)""", @" - - - - ( - ? - < - a - > - - - a - - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture7() - { - Test(@"""(?a)""", @" - - - - ( - ? - < - a - - - - >a - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNamedCapture8() - { - Test(@"""(?a)""", @" - - - - ( - ? - < - a - - - - - - - >a - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture9() - { - Test(@"""(?< a>a)""", @" - - - - ( - ? - < - - - - - a>a - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNamedCapture10() - { - Test(@"""(?< a>a)""", @" - - - - ( - ? - < - - - - - - - - a>a - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture11() - { - Test(@"""(?< a >a)""", @" - - - - ( - ? - < - - - - - a >a - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNamedCapture12() - { - Test(@"""(?< a >a)""", @" - - - - ( - ? - < - - - - - - - - a - - - - - - >a - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture13() - { - Test(@"""(?a)""", @" - - - - ( - ? - < - ab - > - - - a - - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestZeroNumberCapture() - { - Test(@"""(?<0>a)""", @" - - - - ( - ? - < - 0 - > - - - a - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNumericNumberCapture1() - { - Test(@"""(?<1>a)""", @" - - - - ( - ? - < - 1 - > - - - a - - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNumericNumberCapture2() - { - Test(@"""(?<10>a)""", @" - - - - ( - ? - < - 10 - > - - - a - - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNumericNumberCapture3() - { - Test(@"""(?<1>)""", @" - - - - ( - ? - < - 1 - > - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericNumberCapture4() - { - Test(@"""(?<1> )""", @" - - - - ( - ? - < - 1 - > - - - - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericNumberCapture6() - { - Test(@"""(?<1> )""", @" - - - - ( - ? - < - 1 - > - - - - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping1() - { - Test(@"""(?<-""", @" - - - - ( - ? - < - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping2() - { - Test(@"""(?<-0""", @" - - - - ( - ? - < - - - - 0 - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping3() - { - Test(@"""(?<-0)""", @" - - - - ( - ? - < - - - - 0 - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping4() - { - Test(@"""(?<-0>""", @" - - - - ( - ? - < - - - - 0 - > - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping5() - { - Test(@"""(?<-0>)""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping6() - { - Test(@"""(?<-0 >)""", @" - - - - ( - ? - < - - - - 0 - - - - - - - > - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping7() - { - Test(@"""(?<- 0 >)""", @" - - - - ( - ? - < - - - - - - - - - - - 0 - - - - - - > - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping8() - { - Test(@"""(?<- 0>)""", @" - - - - ( - ? - < - - - - - - - - - - - 0> - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping9() - { - Test(@"""(?<-00>)""", @" - - - - ( - ? - < - - - - 00 - > - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping10() - { - Test(@"""(? - - - - ( - ? - < - a - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping11() - { - Test(@"""(? - - - - ( - ? - < - a - - - 0 - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping12() - { - Test(@"""(? - - - - ( - ? - < - a - - - 0 - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping13() - { - Test(@"""(?""", @" - - - - ( - ? - < - a - - - 0 - > - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping14() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - 0 - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping15() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - 0 - - - - - - - > - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping16() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - - - - - - - - 0 - - - - - - > - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping17() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - - - - - - - - 0> - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping18() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - 00 - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingUndefinedReference1() - { - Test(@"""(?<-1>)""", @" - - - - ( - ? - < - - - - 1 - > - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingDefinedReferenceBehind() - { - Test(@"""()(?<-1>)""", @" - - - - ( - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingDefinedReferenceAhead() - { - Test(@"""(?<-1>)()""", @" - - - - ( - ? - < - - - - 1 - > - - ) - - - ( - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingNamedReferenceBehind() - { - Test(@"""(?)(?<-a>)""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - < - - - - a - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingNamedReferenceAhead() - { - Test(@"""(?<-a>)(?)""", @" - - - - ( - ? - < - - - - a - > - - ) - - - ( - ? - < - a - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingNumberedReferenceBehind() - { - Test(@"""(?<4>)(?<-4>)""", @" - - - - ( - ? - < - 4 - > - - ) - - - ( - ? - < - - - - 4 - > - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingNumberedReferenceAhead() - { - Test(@"""(?<-4>)(?<4>)""", @" - - - - ( - ? - < - - - - 4 - > - - ) - - - ( - ? - < - 4 - > - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumberedExists() - { - Test(@"""(?)(?)(?<-1>)(?<-2>)""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - < - b - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers() - { - Test(@"""()()(?<-0>)(?<-1>)(?<-2>)(?<-3>)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers1() - { - Test(@"""()(?)(?<-0>)(?<-1>)(?<-2>)(?<-3>)""", @" - - - - ( - - ) - - - ( - ? - < - a - > - - ) - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers2() - { - Test(@"""(?)()(?<-0>)(?<-1>)(?<-2>)(?<-3>)""", @" - - - - ( - ? - < - a - > - - ) - - - ( - - ) - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers3() - { - Test(@"""(?)(?)(?<-0>)(?<-1>)(?<-2>)(?<-3>)""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - < - b - > - - ) - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers4() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)()()""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - - ) - - - ( - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers5_1() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)()(?""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - - ) - - - ( - - - ? - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers5() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)()(?)""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - - ) - - - ( - ? - < - a - > - - ) - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers6() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)(?)()""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - ? - < - a - > - - ) - - - ( - - ) - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers7_1() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)(?)(?""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - ? - < - a - > - - ) - - - ( - - - ? - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers7() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)(?)(?)""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - ? - < - a - > - - ) - - - ( - ? - < - b - > - - ) - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestReferenceToBalancingGroupCaptureName1() - { - Test(@"""(?)(?)""", @" - - - - ( - ? - < - a - - - 0 - > - - ) - - - ( - ? - < - b - - - a - > - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestReferenceToBalancingGroupCaptureName2() - { - Test(@"""(?)(?<-a>)""", @" - - - - ( - ? - < - a - - - 0 - > - - ) - - - ( - ? - < - - - - a - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestReferenceToSameBalancingGroup() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - a - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestQuoteNamedCapture() - { - Test(@"""(?'a')""", @" - - - - ( - ? - ' - a - ' - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestQuoteBalancingCapture1() - { - Test(@"""(?'-0')""", @" - - - - ( - ? - ' - - - - 0 - ' - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestQuoteBalancingCapture2() - { - Test(@"""(?'a-0')""", @" - - - - ( - ? - ' - a - - - 0 - ' - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestMismatchedOpenCloseCapture1() - { - Test(@"""(? - - - - ( - ? - < - a - - - 0 - - - - ' - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestMismatchedOpenCloseCapture2() - { - Test(@"""(?'a-0>)""", @" - - - - ( - ? - ' - a - - - 0 - - - - > - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture1() - { - Test(@"""(?(""", @" - - - - ( - ? - - ( - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture2() - { - Test(@"""(?(0""", @" - - - - ( - ? - ( - 0 - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture3() - { - Test(@"""(?(0)""", @" - - - - ( - ? - ( - 0 - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture4() - { - Test(@"""(?(0))""", @" - - - - ( - ? - ( - 0 - ) - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture5() - { - Test(@"""(?(0)a)""", @" - - - - ( - ? - ( - 0 - ) - - - a - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture6() - { - Test(@"""(?(0)a|)""", @" - - - - ( - ? - ( - 0 - ) - - - - a - - - | - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture7() - { - Test(@"""(?(0)a|b)""", @" - - - - ( - ? - ( - 0 - ) - - - - a - - - | - - - b - - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture8() - { - Test(@"""(?(0)a|b|)""", @" - - - - ( - ? - ( - 0 - ) - - - - - a - - - | - - - b - - - - | - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture9() - { - Test(@"""(?(0)a|b|c)""", @" - - - - ( - ? - ( - 0 - ) - - - - - a - - - | - - - b - - - - | - - - c - - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture10() - { - Test(@"""(?(0 )""", @" - - - - ( - ? - ( - 0 - - - - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture11() - { - Test(@"""(?(1))""", @" - - - - ( - ? - ( - 1 - ) - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture12() - { - Test(@"""(?(00))""", @" - - - - ( - ? - ( - 00 - ) - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedConditionalCapture1() - { - Test(@"""(?(a))""", @" - - - - ( - ? - - ( - - - a - - - ) - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedConditionalCapture2() - { - Test(@"""(?)(?(a))""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - ( - a - ) - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedConditionalCapture3() - { - Test(@"""(?)(?(a ))""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - - ( - - - a - - - - - - ) - - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedConditionalCapture4() - { - Test(@"""(?)(?( a))""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - - ( - - - - - - a - - - ) - - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNestedGroupsInConditionalGrouping1() - { - Test(@"""(?(()a()))""", @" - - - - ( - ? - - ( - - - ( - - ) - - - a - - - ( - - ) - - - ) - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNestedGroupsInConditionalGrouping2() - { - Test(@"""(?((?)a(?)))""", @" - - - - ( - ? - - ( - - - ( - ? - < - x - > - - ) - - - a - - - ( - ? - < - y - > - - ) - - - ) - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureInConditionalGrouping1() - { - Test(@"""(?(?'""", @" - - - - ( - ? - - ( - ? - ' - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCaptureInConditionalGrouping2() - { - Test(@"""(?(?'x'))""", @" - - - - ( - ? - - ( - ? - ' - x - ' - - ) - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCommentInConditionalGrouping1() - { - Test(@"""(?(?#""", @" - - - - ( - ? - - ( - - - ? - - - - - - - - - - - # - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCommentInConditionalGrouping2() - { - Test(@"""(?(?#)""", @" - - - - ( - ? - - ( - - - ? - - - - - - - - - - - #) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCommentInConditionalGrouping3() - { - Test(@"""(?(?#))""", @" - - - - ( - ? - - ( - - - ? - - - - - - - - - - - #)) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping1() - { - Test(@"""(?(?<""", @" - - - - ( - ? - - ( - ? - < - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping2() - { - Test(@"""(?(? - - - - ( - ? - - ( - ? - < - a - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping3() - { - Test(@"""(?(?""", @" - - - - ( - ? - - ( - ? - < - a - > - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping4() - { - Test(@"""(?(?)""", @" - - - - ( - ? - - ( - ? - < - a - > - - ) - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping5() - { - Test(@"""(?(?))""", @" - - - - ( - ? - - ( - ? - < - a - > - - ) - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestLookbehindAssertionInConditionalGrouping1() - { - Test(@"""(?(?<=))""", @" - - - - ( - ? - - ( - ? - < - = - - ) - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestLookbehindAssertionInConditionalGrouping2() - { - Test(@"""(?(? - - - - ( - ? - - ( - ? - < - ! - - ) - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBackreference1() - { - Test(@"@""\1""", @" - - - - \ - 1 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestBackreference2() - { - Test(@"@""\1 """, @" - - - - \ - 1 - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestBackreference3() - { - Test(@"@""()\1""", @" - - - - ( - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestBackreference4() - { - Test(@"@""()\1 """, @" - - - - ( - - ) - - - \ - 1 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestBackreference5() - { - Test(@"@""()\10 """, @" - - - - ( - - ) - - - \ - 10 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestEcmascriptBackreference1() - { - Test(@"@""\1""", @" - - - - \ - 1 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmascriptBackreference2() - { - Test(@"@""\1 """, @" - - - - \ - 1 - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmascriptBackreference3() - { - Test(@"@""()\1""", @" - - - - ( - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmaBackreference4() - { - Test(@"@""()\1 """, @" - - - - ( - - ) - - - \ - 1 - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmascriptBackreference5() - { - Test(@"@""()\10 """, @" - - - - ( - - ) - - - \ - 1 - - - 0 - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmascriptBackreference6() - { - Test(@"@""()()()()()()()()()()\10 """, @" - - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - \ - 10 - - - - - - - - - - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCharacterClass1() - { - Test(@"@""[""", @" - - - - [ - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass2() - { - Test(@"@""[ """, @" - - - - [ - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass3() - { - Test(@"@""[]""", @" - - - - [ - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass4() - { - Test(@"@""[] """, @" - - - - [ - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass5() - { - Test(@"@""[a]""", @" - - - - [ - - - a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass6() - { - Test(@"@""[a] """, @" - - - - [ - - - a - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass7() - { - Test(@"@""[a-""", @" - - - - [ - - - - a - - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass8() - { - Test(@"@""[a- """, @" - - - - [ - - - - a - - - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass9() - { - Test(@"@""[a-]""", @" - - - - [ - - - a- - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass10() - { - Test(@"@""[a-] """, @" - - - - [ - - - a- - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass11() - { - Test(@"@""[a-b]""", @" - - - - [ - - - - a - - - - - b - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass12() - { - Test(@"@""[a-b] """, @" - - - - [ - - - - a - - - - - b - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass13() - { - Test(@"@""[a-[b]] """, @" - - - - [ - - - a - - - - - - [ - - - b - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass14() - { - Test(@"@""[a-b-[c]] """, @" - - - - [ - - - - a - - - - - b - - - - - - - [ - - - c - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass15() - { - Test(@"@""[a-[b]-c] """, @" - - - - [ - - - a - - - - - - [ - - - b - - - ] - - - - -c - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass16() - { - Test(@"@""[[a]-b] """, @" - - - - [ - - - [a - - - ] - - - -b] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass17() - { - Test(@"@""[[a]-[b]] """, @" - - - - [ - - - [a - - - ] - - - - - - - [ - - - b - - - ] - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass18() - { - Test(@"@""[\w-a] """, @" - - - - [ - - - \ - w - - - -a - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass19() - { - Test(@"@""[a-\w] """, @" - - - - [ - - - - a - - - - - \ - w - - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass20() - { - Test(@"@""[\p{llll}-a] """, @" - - - - [ - - - \ - p - { - llll - } - - - -a - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass21() - { - Test(@"@""[\p{Lu}-a] """, @" - - - - [ - - - \ - p - { - Lu - } - - - -a - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass22() - { - Test(@"@""[a-\p{Lu}] """, @" - - - - [ - - - - a - - - - - \ - p - { - Lu - } - - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass23() - { - Test(@"@""[a-[:Ll:]] """, @" - - - - [ - - - a - - - - - - [ - - - :Ll: - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass24() - { - Test(@"@""[a-[:Ll]] """, @" - - - - [ - - - a - - - - - - [ - - - :Ll - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass25() - { - Test(@"@""[a-[:""", @" - - - - [ - - - a - - - - - - [ - - - : - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass26() - { - Test(@"@""[a-[:L""", @" - - - - [ - - - a - - - - - - [ - - - :L - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass27() - { - Test(@"@""[a-[:L:""", @" - - - - [ - - - a - - - - - - [ - - - :L: - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass28() - { - Test(@"@""[a-[:L:]""", @" - - - - [ - - - a - - - - - - [ - - - :L: - - - ] - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass29() - { - Test(@"@""[\-]""", @" - - - - [ - - - \ - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass30() - { - Test(@"@""[a-b-c] """, @" - - - - [ - - - - a - - - - - b - - - - -c - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass31() - { - Test(@"@""[-b-c] """, @" - - - - [ - - - - - - - - b - - - - - c - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass32() - { - Test(@"@""[-[b] """, @" - - - - [ - - - -[b - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass33() - { - Test(@"@""[-[b]] """, @" - - - - [ - - - -[b - - - ] - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass34() - { - Test(@"@""[--b """, @" - - - - [ - - - - - - - - - - b - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass35() - { - Test(@"@""[--b] """, @" - - - - [ - - - - - - - - - - b - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass36() - { - Test(@"@""[--[b """, @" - - - - [ - - - - - - - - - - [ - - - b - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass37() - { - Test(@"@""[--[b] """, @" - - - - [ - - - - - - - - - - [ - - - b - - - ] - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass38() - { - Test(@"@""[--[b]] """, @" - - - - [ - - - - - - - - - - [ - - - b - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass39() - { - Test(@"@""[a--[b """, @" - - - - [ - - - - a - - - - - - - - - - [b - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass40() - { - Test(@"@""[,--[a] """, @" - - - - [ - - - - , - - - - - - - - - - [a - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass41() - { - Test(@"@""[,--[a]] """, @" - - - - [ - - - - , - - - - - - - - - - [a - - - ] - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass42() - { - Test(@"@""[\s-a]""", @" - - - - [ - - - \ - s - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass43() - { - Test(@"@""[\p{Lu}-a]""", @" - - - - [ - - - \ - p - { - Lu - } - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass44() - { - Test(@"@""[\p{Lu}-a]""", @" - - - - [ - - - \ - p - { - Lu - } - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegatedCharacterClass1() - { - Test(@"@""[a]""", @" - - - - [ - - - a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange1() - { - Test(@"@""[\c<-\c>]""", @" - - - - [ - - - \ - c - - - - - < - - - - - \ - c - - - - - > - - - ] - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange2() - { - Test(@"@""[\c>-\c<]""", @" - - - - [ - - - \ - c - - - - - > - - - - - \ - c - - - - - < - - - ] - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange3() - { - Test(@"@""[\c>-a]""", @" - - - - [ - - - \ - c - - - - - > - - - - - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange4() - { - Test(@"@""[a-\c>]""", @" - - - - [ - - - - a - - - - - \ - c - - - - - > - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange5() - { - Test(@"@""[a--]""", @" - - - - [ - - - - a - - - - - - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange6() - { - Test(@"@""[--a]""", @" - - - - [ - - - - - - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange7() - { - Test(@"@""[a-\-]""", @" - - - - [ - - - - a - - - - - - \ - - - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange8() - { - Test(@"@""[\--a]""", @" - - - - [ - - - \ - - - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange9() - { - Test(@"@""[\0-\1]""", @" - - - - [ - - - - \ - 0 - - - - - \ - 1 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange10() - { - Test(@"@""[\1-\0]""", @" - - - - [ - - - - \ - 1 - - - - - \ - 0 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange11() - { - Test(@"@""[\0-\01]""", @" - - - - [ - - - - \ - 0 - - - - - \ - 01 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange12() - { - Test(@"@""[\01-\0]""", @" - - - - [ - - - - \ - 01 - - - - - \ - 0 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange13() - { - Test(@"@""[[:x:]-a]""", @" - - - - [ - - - - [:x:] - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange14() - { - Test(@"@""[a-[:x:]]""", @" - - - - [ - - - a - - - - - - [ - - - :x: - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange15() - { - Test(@"@""[\0-\ca]""", @" - - - - [ - - - - \ - 0 - - - - - \ - c - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange16() - { - Test(@"@""[\ca-\0]""", @" - - - - [ - - - - \ - c - a - - - - - \ - 0 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange17() - { - Test(@"@""[\ca-\cA]""", @" - - - - [ - - - - \ - c - a - - - - - \ - c - A - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange18() - { - Test(@"@""[\cA-\ca]""", @" - - - - [ - - - - \ - c - A - - - - - \ - c - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange19() - { - Test(@"@""[\u0-\u1]""", @" - - - - [ - - - - \ - u - 0 - - - - - \ - u - 1 - - - - ] - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange20() - { - Test(@"@""[\u1-\u0]""", @" - - - - [ - - - - \ - u - 1 - - - - - \ - u - 0 - - - - ] - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange21() - { - Test(@"@""[\u0000-\u0000]""", @" - - - - [ - - - - \ - u - 0000 - - - - - \ - u - 0000 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange22() - { - Test(@"@""[\u0000-\u0001]""", @" - - - - [ - - - - \ - u - 0000 - - - - - \ - u - 0001 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange23() - { - Test(@"@""[\u0001-\u0000]""", @" - - - - [ - - - - \ - u - 0001 - - - - - \ - u - 0000 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange24() - { - Test(@"@""[\u0001-a]""", @" - - - - [ - - - - \ - u - 0001 - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange25() - { - Test(@"@""[a-\u0001]""", @" - - - - [ - - - - a - - - - - \ - u - 0001 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange26() - { - Test(@"@""[a-a]""", @" - - - - [ - - - - a - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange27() - { - Test(@"@""[a-A]""", @" - - - - [ - - - - a - - - - - A - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange28() - { - Test(@"@""[A-a]""", @" - - - - [ - - - - A - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange29() - { - Test(@"@""[a-a]""", @" - - - - [ - - - - a - - - - - a - - - - ] - - - - - - - -", RegexOptions.IgnoreCase); - } - - [Fact] - public void TestCharacterClassRange30() - { - Test(@"@""[a-A]""", @" - - - - [ - - - - a - - - - - A - - - - ] - - - - - - - - - - -", RegexOptions.IgnoreCase); - } - - [Fact] - public void TestCharacterClassRange31() - { - Test(@"@""[A-a]""", @" - - - - [ - - - - A - - - - - a - - - - ] - - - - - - - -", RegexOptions.IgnoreCase); - } - - [Fact] - public void TestCharacterClassRange32() - { - Test(@"@""[a-\x61]""", @" - - - - [ - - - - a - - - - - \ - x - 61 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange33() - { - Test(@"@""[\x61-a]""", @" - - - - [ - - - - \ - x - 61 - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange34() - { - Test(@"@""[a-\x60]""", @" - - - - [ - - - - a - - - - - \ - x - 60 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange35() - { - Test(@"@""[\x62-a]""", @" - - - - [ - - - - \ - x - 62 - - - - - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange36() - { - Test(@"@""[a-\x62]""", @" - - - - [ - - - - a - - - - - \ - x - 62 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange37() - { - Test(@"@""[\x62-a]""", @" - - - - [ - - - - \ - x - 62 - - - - - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange38() - { - Test(@"@""[\3-\cc]""", @" - - - - [ - - - - \ - 3 - - - - - \ - c - c - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange39() - { - Test(@"@""[\cc-\3]""", @" - - - - [ - - - - \ - c - c - - - - - \ - 3 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange40() - { - Test(@"@""[\2-\cc]""", @" - - - - [ - - - - \ - 2 - - - - - \ - c - c - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange41() - { - Test(@"@""[\cc-\2]""", @" - - - - [ - - - - \ - c - c - - - - - \ - 2 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange42() - { - Test(@"@""[\4-\cc]""", @" - - - - [ - - - - \ - 4 - - - - - \ - c - c - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange43() - { - Test(@"@""[\cc-\4]""", @" - - - - [ - - - - \ - c - c - - - - - \ - 4 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange44() - { - Test(@"@""[\ca-\cb]""", @" - - - - [ - - - - \ - c - a - - - - - \ - c - b - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange45() - { - Test(@"@""[\ca-\cB]""", @" - - - - [ - - - - \ - c - a - - - - - \ - c - B - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange46() - { - Test(@"@""[\cA-\cb]""", @" - - - - [ - - - - \ - c - A - - - - - \ - c - b - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange47() - { - Test(@"@""[\cA-\cB]""", @" - - - - [ - - - - \ - c - A - - - - - \ - c - B - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange48() - { - Test(@"@""[\cb-\ca]""", @" - - - - [ - - - - \ - c - b - - - - - \ - c - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange49() - { - Test(@"@""[\cb-\cA]""", @" - - - - [ - - - - \ - c - b - - - - - \ - c - A - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange50() - { - Test(@"@""[\cB-\ca]""", @" - - - - [ - - - - \ - c - B - - - - - \ - c - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange51() - { - Test(@"@""[\cB-\cA]""", @" - - - - [ - - - - \ - c - B - - - - - \ - c - A - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange52() - { - Test(@"@""[\--a]""", @" - - - - [ - - - \ - - - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange53() - { - Test(@"@""[\--#]""", @" - - - - [ - - - \ - - - - - -# - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange54() - { - Test(@"@""[a-\-]""", @" - - - - [ - - - - a - - - - - - \ - - - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange55() - { - Test(@"@""[a-\-b]""", @" - - - - [ - - - - a - - - - - - \ - - - - - b - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange56() - { - Test(@"@""[a-\-\-b]""", @" - - - - [ - - - - a - - - - - - \ - - - - - \ - - - - - b - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange57() - { - Test(@"@""[b-\-a]""", @" - - - - [ - - - - b - - - - - - \ - - - - - a - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange58() - { - Test(@"@""[b-\-\-a]""", @" - - - - [ - - - - b - - - - - - \ - - - - - \ - - - - - a - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange59() - { - Test(@"@""[a-\-\D]""", @" - - - - [ - - - - a - - - - - - \ - - - - - \ - D - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange60() - { - Test(@"@""[a-\-\-\D]""", @" - - - - [ - - - - a - - - - - - \ - - - - - \ - - - - - \ - D - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange61() - { - Test(@"@""[a -\-\b]""", @" - - - - [ - - - a - - - - - - - - - - \ - - - - - \ - b - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures1() - { - Test(@"@""()\1""", @" - - - - ( - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures2() - { - Test(@"@""()\2""", @" - - - - ( - - ) - - - \ - 2 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures3() - { - Test(@"@""()()\2""", @" - - - - ( - - ) - - - ( - - ) - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures4() - { - Test(@"@""()\1""", @" - - - - ( - - ) - - - \ - 1 - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures5() - { - Test(@"@""()\2""", @" - - - - ( - - ) - - - \ - 2 - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures6() - { - Test(@"@""()()\2""", @" - - - - ( - - ) - - - ( - - ) - - - \ - 2 - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures7() - { - Test(@"@""()()(?n)\1\2""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - n - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures8() - { - Test(@"@""()(?n)()\1\2""", @" - - - - ( - - ) - - - ( - ? - n - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures9() - { - Test(@"@""(?n)()()\1\2""", @" - - - - ( - ? - n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures10() - { - Test(@"@""()()(?n)\1\2""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - n - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures11() - { - Test(@"@""()(?n)()\1\2""", @" - - - - ( - - ) - - - ( - ? - n - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures12() - { - Test(@"@""(?n)()()\1\2""", @" - - - - ( - ? - n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures13() - { - Test(@"@""()()(?-n)\1\2""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - -n - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures14() - { - Test(@"@""()(?-n)()\1\2""", @" - - - - ( - - ) - - - ( - ? - -n - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures15() - { - Test(@"@""(?-n)()()\1\2""", @" - - - - ( - ? - -n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures16() - { - Test(@"@""()()(?-n)\1\2""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - -n - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures17() - { - Test(@"@""()(?-n)()\1\2""", @" - - - - ( - - ) - - - ( - ? - -n - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures18() - { - Test(@"@""(?-n)()()\1\2""", @" - - - - ( - ? - -n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures19() - { - Test(@"@""()()(?n:\1\2)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - n - : - - - \ - 1 - - - \ - 2 - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures20() - { - Test(@"@""()()(?n:\1\2)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - n - : - - - \ - 1 - - - \ - 2 - - - ) - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures21() - { - Test(@"@""()()(?-n:\1\2)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - -n - : - - - \ - 1 - - - \ - 2 - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures22() - { - Test(@"@""()()(?-n:\1\2)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - -n - : - - - \ - 1 - - - \ - 2 - - - ) - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures23() - { - Test(@"@""(?n:)()()\1\2""", @" - - - - ( - ? - n - : - - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures24() - { - Test(@"@""(?n:)()()\1\2""", @" - - - - ( - ? - n - : - - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures25() - { - Test(@"@""(?-n:)()()\1\2""", @" - - - - ( - ? - -n - : - - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures26() - { - Test(@"@""(?-n:)()()\1\2""", @" - - - - ( - ? - -n - : - - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures27() - { - Test(@"@""(?n)(?-n)()()\1\2""", @" - - - - ( - ? - n - ) - - - ( - ? - -n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures28() - { - Test(@"@""(?n)(?-n)()()\1\2""", @" - - - - ( - ? - n - ) - - - ( - ? - -n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures29() - { - Test(@"@""(?-n)(?n)()()\1\2""", @" - - - - ( - ? - -n - ) - - - ( - ? - n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures30() - { - Test(@"@""(?-n)(?n)()()\1\2""", @" - - - - ( - ? - -n - ) - - - ( - ? - n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - } -} diff --git a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs b/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs deleted file mode 100644 index f8dbde1e0c46c..0000000000000 --- a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs +++ /dev/null @@ -1,5335 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Text.RegularExpressions; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - public partial class CSharpRegexParserTests - { - [Fact] - public void NegativeTest0() - { - Test(@"@""cat([a-\d]*)dog""", @" - - - - cat - - - ( - - - - [ - - - - a - - - - - \ - d - - - - ] - - * - - - ) - - - dog - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest1() - { - Test(@"@""\k<1""", @" - - - - \ - k - - - <1 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest2() - { - Test(@"@""\k<""", @" - - - - \ - k - - - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest3() - { - Test(@"@""\k""", @" - - - - \ - k - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest4() - { - Test(@"@""\1""", @" - - - - \ - 1 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest5() - { - Test(@"@""(?')""", @" - - - - ( - ? - ' - - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest6() - { - Test(@"@""(?<)""", @" - - - - ( - ? - < - - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest7() - { - Test(@"@""(?)""", @" - - - - ( - - - ? - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest8() - { - Test(@"@""(?>""", @" - - - - ( - ? - > - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest9() - { - Test(@"@""(? - - - - ( - ? - < - ! - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest10() - { - Test(@"@""(?<=""", @" - - - - ( - ? - < - = - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest11() - { - Test(@"@""(?!""", @" - - - - ( - ? - ! - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest12() - { - Test(@"@""(?=""", @" - - - - ( - ? - = - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest13() - { - Test(@"@""(?imn )""", @" - - - - ( - ? - imn - - - - - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest14() - { - Test(@"@""(?imn""", @" - - - - ( - ? - imn - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest15() - { - Test(@"@""(?:""", @" - - - - ( - ? - : - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest16() - { - Test(@"@""(?'cat'""", @" - - - - ( - ? - ' - cat - ' - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest17() - { - Test(@"@""(?'""", @" - - - - ( - ? - ' - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest18() - { - Test(@"@""[^""", @" - - - - [ - ^ - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest19() - { - Test(@"@""[cat""", @" - - - - [ - - - cat - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest20() - { - Test(@"@""[^cat""", @" - - - - [ - ^ - - - cat - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest21() - { - Test(@"@""[a-""", @" - - - - [ - - - - a - - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest22() - { - Test(@"@""\p{""", @" - - - - \ - p - - - { - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest23() - { - Test(@"@""\p{cat""", @" - - - - \ - p - - - {cat - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest24() - { - Test(@"@""\k - - - - \ - k - - - <cat - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest25() - { - Test(@"@""\p{cat}""", @" - - - - \ - p - { - cat - } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest26() - { - Test(@"@""\P{cat""", @" - - - - \ - P - - - {cat - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest27() - { - Test(@"@""\P{cat}""", @" - - - - \ - P - { - cat - } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest28() - { - Test(@"@""(""", @" - - - - ( - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest29() - { - Test(@"@""(?""", @" - - - - ( - - - ? - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest30() - { - Test(@"@""(?<""", @" - - - - ( - ? - < - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest31() - { - Test(@"@""(?""", @" - - - - ( - ? - < - cat - > - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest32() - { - Test(@"@""\P{""", @" - - - - \ - P - - - { - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest33() - { - Test(@"@""\k<>""", @" - - - - \ - k - - - <> - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest34() - { - Test(@"@""(?(""", @" - - - - ( - ? - - ( - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest35() - { - Test(@"@""(?()|""", @" - - - - ( - ? - - ( - - ) - - - - | - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest36() - { - Test(@"@""?(a|b)""", @" - - - - ? - - - ( - - - - a - - - | - - - b - - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest37() - { - Test(@"@""?((a)""", @" - - - - ? - - - ( - - - ( - - - a - - - ) - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest38() - { - Test(@"@""?((a)a""", @" - - - - ? - - - ( - - - ( - - - a - - - ) - - - a - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest39() - { - Test(@"@""?((a)a|""", @" - - - - ? - - - ( - - - - ( - - - a - - - ) - - - a - - - | - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest40() - { - Test(@"@""?((a)a|b""", @" - - - - ? - - - ( - - - - ( - - - a - - - ) - - - a - - - | - - - b - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest41() - { - Test(@"@""(?(?i))""", @" - - - - ( - ? - - ( - ? - i - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest42() - { - Test(@"@""?(a)""", @" - - - - ? - - - ( - - - a - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest43() - { - Test(@"@""(?(?I))""", @" - - - - ( - ? - - ( - ? - I - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest44() - { - Test(@"@""(?(?M))""", @" - - - - ( - ? - - ( - ? - M - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest45() - { - Test(@"@""(?(?s))""", @" - - - - ( - ? - - ( - ? - s - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest46() - { - Test(@"@""(?(?S))""", @" - - - - ( - ? - - ( - ? - S - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest47() - { - Test(@"@""(?(?x))""", @" - - - - ( - ? - - ( - ? - x - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest48() - { - Test(@"@""(?(?X))""", @" - - - - ( - ? - - ( - ? - X - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest49() - { - Test(@"@""(?(?n))""", @" - - - - ( - ? - - ( - ? - n - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest50() - { - Test(@"@""(?(?m))""", @" - - - - ( - ? - - ( - ? - m - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest51() - { - Test(@"@""[a""", @" - - - - [ - - - a - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest52() - { - Test(@"@""?(a:b)""", @" - - - - ? - - - ( - - - a:b - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest53() - { - Test(@"@""(?(?""", @" - - - - ( - ? - - ( - - - ? - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest54() - { - Test(@"@""(?(cat""", @" - - - - ( - ? - - ( - - - cat - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest55() - { - Test(@"@""(?(cat)|""", @" - - - - ( - ? - - ( - - - cat - - - ) - - - - | - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest56() - { - Test(@"@""foo(?<0>bar)""", @" - - - - foo - - - ( - ? - < - 0 - > - - - bar - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest57() - { - Test(@"@""foo(?'0'bar)""", @" - - - - foo - - - ( - ? - ' - 0 - ' - - - bar - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest58() - { - Test(@"@""foo(?<1bar)""", @" - - - - foo - - - ( - ? - < - 1 - - - - bar - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest59() - { - Test(@"@""foo(?'1bar)""", @" - - - - foo - - - ( - ? - ' - 1 - - - - bar - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest60() - { - Test(@"@""(?(""", @" - - - - ( - ? - - ( - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest61() - { - Test(@"@""\p{klsak""", @" - - - - \ - p - - - {klsak - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest62() - { - Test(@"@""(?c:cat)""", @" - - - - ( - - - ? - - - c:cat - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest63() - { - Test(@"@""(??e:cat)""", @" - - - - ( - - - - ? - - ? - - - e:cat - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest64() - { - Test(@"@""[a-f-[]]+""", @" - - - - [ - - - - a - - - - - f - - - - - - - [ - - - ] - - - ] - - - - + - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest65() - { - Test(@"@""[A-[]+""", @" - - - - [ - - - A - - - - - - [ - - - ]+ - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest66() - { - Test(@"@""(?(?e))""", @" - - - - ( - ? - - ( - - - ? - - - e - - - ) - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest67() - { - Test(@"@""(?(?a)""", @" - - - - ( - ? - - ( - - - ? - - - a - - - ) - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest68() - { - Test(@"@""(?r:cat)""", @" - - - - ( - - - ? - - - r:cat - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest69() - { - Test(@"@""(?(?N))""", @" - - - - ( - ? - - ( - ? - N - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest70() - { - Test(@"@""[]""", @" - - - - [ - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest71() - { - Test(@"@""\x2""", @" - - - - \ - x - 2 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest72() - { - Test(@"@""(cat) (?#cat) \s+ (?#followed by 1 or more whitespace""", @" - - - - ( - - - cat - - - ) - - - - - - - (?#cat) - - \ - s - - + - - - - - - (?#followed by 1 or more whitespace - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void NegativeTest73() - { - Test(@"@""cat(?(?afdcat)dog)""", @" - - - - cat - - - ( - ? - - ( - - - ? - - - afdcat - - - ) - - - - dog - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest74() - { - Test(@"@""cat(?(?cat)dog)""", @" - - - - cat - - - ( - ? - - ( - ? - < - cat - > - - - cat - - - ) - - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest75() - { - Test(@"@""cat(?(?'cat'cat)dog)""", @" - - - - cat - - - ( - ? - - ( - ? - ' - cat - ' - - - cat - - - ) - - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest76() - { - Test(@"@""cat(?(?#COMMENT)cat)""", @" - - - - cat - - - ( - ? - - ( - - - ? - - - #COMMENT - - - ) - - - - cat - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest77() - { - Test(@"@""(?cat)\w+(?dog)""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - w - - + - - - ( - ? - < - dog - - - - - - - - ( - - ) - - * - - - !@>dog - - - ) - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest78() - { - Test(@"@""(?cat)\w+(?dog)""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - w - - + - - - ( - ? - < - dog - - - catdog - > - - - dog - - - ) - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest79() - { - Test(@"@""(?cat)\w+(?dog)""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - w - - + - - - ( - ? - < - dog - - - 1 - - - - uosn>dog - - - ) - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest80() - { - Test(@"@""(?cat)\w+(?dog)""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - w - - + - - - ( - ? - < - dog - - - 16 - > - - - dog - - - ) - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest81() - { - Test(@"@""cat(?<->dog)""", @" - - - - cat - - - ( - ? - < - - - - - > - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest82() - { - Test(@"@""cat(?<>dog)""", @" - - - - cat - - - ( - ? - < - - > - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest83() - { - Test(@"@""cat(?)_*>dog)""", @" - - - - cat - - - ( - ? - < - dog - - - - <> - - - ) - - - - _ - - * - - - >dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest84() - { - Test(@"@""cat(?)_*>dog)""", @" - - - - cat - - - ( - ? - < - dog - - - - > - - - ) - - - - _ - - * - - - >dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest85() - { - Test(@"@""cat(?)_*>dog)""", @" - - - - cat - - - ( - ? - < - dog - - - - !> - - - ) - - - - _ - - * - - - >dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest86() - { - Test(@"@""cat(?dog)""", @" - - - - cat - - - ( - ? - < - dog - - - ) - - - - _ - - * - - - >dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest87() - { - Test(@"@""cat(?<1dog>dog)""", @" - - - - cat - - - ( - ? - < - 1 - - - - dog>dog - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest88() - { - Test(@"@""cat(?<0>dog)""", @" - - - - cat - - - ( - ? - < - 0 - > - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest89() - { - Test(@"@""([5-\D]*)dog""", @" - - - - ( - - - - [ - - - - 5 - - - - - \ - D - - - - ] - - * - - - ) - - - dog - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest90() - { - Test(@"@""cat([6-\s]*)dog""", @" - - - - cat - - - ( - - - - [ - - - - 6 - - - - - \ - s - - - - ] - - * - - - ) - - - dog - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest91() - { - Test(@"@""cat([c-\S]*)""", @" - - - - cat - - - ( - - - - [ - - - - c - - - - - \ - S - - - - ] - - * - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest92() - { - Test(@"@""cat([7-\w]*)""", @" - - - - cat - - - ( - - - - [ - - - - 7 - - - - - \ - w - - - - ] - - * - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest93() - { - Test(@"@""cat([a-\W]*)dog""", @" - - - - cat - - - ( - - - - [ - - - - a - - - - - \ - W - - - - ] - - * - - - ) - - - dog - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest94() - { - Test(@"@""([f-\p{Lu}]\w*)\s([\p{Lu}]\w*)""", @" - - - - ( - - - [ - - - - f - - - - - \ - p - { - Lu - } - - - - ] - - - - \ - w - - * - - - ) - - - \ - s - - - ( - - - [ - - - \ - p - { - Lu - } - - - ] - - - - \ - w - - * - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest95() - { - Test(@"@""(cat) (?#cat) \s+ (?#followed by 1 or more whitespace""", @" - - - - ( - - - cat - - - ) - - - - - - - - (?#cat) - - - - - \ - s - - + - - - - - - - - (?#followed by 1 or more whitespace - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest96() - { - Test(@"@""([1-\P{Ll}][\p{Ll}]*)\s([\P{Ll}][\p{Ll}]*)""", @" - - - - ( - - - [ - - - - 1 - - - - - \ - P - { - Ll - } - - - - ] - - - - [ - - - \ - p - { - Ll - } - - - ] - - * - - - ) - - - \ - s - - - ( - - - [ - - - \ - P - { - Ll - } - - - ] - - - - [ - - - \ - p - { - Ll - } - - - ] - - * - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest97() - { - Test(@"@""[\P]""", @" - - - - [ - - - \ - P - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest98() - { - Test(@"@""([\pcat])""", @" - - - - ( - - - [ - - - \ - p - - - cat - - - ] - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest99() - { - Test(@"@""([\Pcat])""", @" - - - - ( - - - [ - - - \ - P - - - cat - - - ] - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest100() - { - Test(@"@""(\p{""", @" - - - - ( - - - \ - p - - - { - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest101() - { - Test(@"@""(\p{Ll""", @" - - - - ( - - - \ - p - - - {Ll - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest102() - { - Test(@"@""(cat)([\o]*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - - [ - - - \ - o - - - ] - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest103() - { - Test(@"@""[\p]""", @" - - - - [ - - - \ - p - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest104() - { - Test(@"@""(?cat)\s+(?dog)\kcat""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - - - cat - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest105() - { - Test(@"@""(?cat)\s+(?dog)\k""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - < - cat2 - > - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest106() - { - Test(@"@""(?cat)\s+(?dog)\k<8>cat""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - < - 8 - > - - - cat - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest107() - { - Test(@"@""^[abcd]{1}?*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - { - 1 - } - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest108() - { - Test(@"@""^[abcd]*+$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - * - - - + - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest109() - { - Test(@"@""^[abcd]+*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - + - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest110() - { - Test(@"@""^[abcd]?*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest111() - { - Test(@"@""^[abcd]*?+$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - * - - ? - - - + - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest112() - { - Test(@"@""^[abcd]+?*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - + - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest113() - { - Test(@"@""^[abcd]{1,}?*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - { - 1 - , - } - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest114() - { - Test(@"@""^[abcd]??*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - ? - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest115() - { - Test(@"@""^[abcd]+{0,5}$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - + - - - { - - - 0,5} - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest116() - { - Test(@"@""^[abcd]?{0,5}$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - ? - - - { - - - 0,5} - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest117() - { - Test(@"@""\u""", @" - - - - \ - u - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest118() - { - Test(@"@""\ua""", @" - - - - \ - u - a - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest119() - { - Test(@"@""\u0""", @" - - - - \ - u - 0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest120() - { - Test(@"@""\x""", @" - - - - \ - x - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest121() - { - Test(@"@""^[abcd]*{0,5}$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - * - - - { - - - 0,5} - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest122() - { - Test(@"@""[""", @" - - - - [ - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest123() - { - Test(@"@""^[abcd]{0,16}?*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - { - 0 - , - 16 - } - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest124() - { - Test(@"@""^[abcd]{1,}*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - { - 1 - , - } - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest125() - { - Test(@"@""(?cat)\s+(?dog)\k<8>cat""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - < - 8 - > - - - cat - - - - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void NegativeTest126() - { - Test(@"@""(?cat)\s+(?dog)\k8""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - - - 8 - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest127() - { - Test(@"@""(?cat)\s+(?dog)\k8""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - - - 8 - - - - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void NegativeTest128() - { - Test(@"@""(cat)(\7)""", @" - - - - ( - - - cat - - - ) - - - ( - - - \ - 7 - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest129() - { - Test(@"@""(cat)\s+(?<2147483648>dog)""", @" - - - - ( - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - 2147483648 - > - - - dog - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest130() - { - Test(@"@""(cat)\s+(?<21474836481097>dog)""", @" - - - - ( - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - 21474836481097 - > - - - dog - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest131() - { - Test(@"@""^[abcd]{1}*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - { - 1 - } - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest132() - { - Test(@"@""(cat)(\c*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - - \ - c - - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest133() - { - Test(@"@""(cat)(\c *)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - \ - c - - - - - - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest134() - { - Test(@"@""(cat)(\c?*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - - \ - c - - - ? - - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest135() - { - Test(@"@""(cat)(\c`*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - \ - c - - - - - ` - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest136() - { - Test(@"@""(cat)(\c\|*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - - \ - c - \ - - - | - - - * - - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest137() - { - Test(@"@""(cat)(\c\[*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - \ - c - \ - - - [ - - - *)(dog) - - - - - - - - - - - - - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void NegativeTest138() - { - Test(@"@""^[abcd]{0,16}*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - { - 0 - , - 16 - } - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest139() - { - Test(@"@""(cat)\c""", @" - - - - ( - - - cat - - - ) - - - \ - c - - - - - - - - - - - - -", RegexOptions.None); - } - - // [Fact] - // public void NegativeTest140() - // { - // Test(@"@"" (?(?n))""", @" - // - // - // - // - // - // - // ( - // ? - // - // ( - // ? - // n - // ) - // - // - // ) - // - // - // - // - //", RegexOptions.None); - // } - } -} diff --git a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs b/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs deleted file mode 100644 index fa19092f819c4..0000000000000 --- a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs +++ /dev/null @@ -1,6794 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Text.RegularExpressions; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - public partial class CSharpRegexParserTests - { - [Fact] - public void ReferenceTest0() - { - Test(@"@""[aeiou]""", @" - - - - [ - - - aeiou - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest1() - { - Test(@"@""(?\w+)\s\k\W(?\w+)""", @" - - - - ( - ? - < - duplicateWord - > - - - - \ - w - - + - - - ) - - - \ - s - - - \ - k - < - duplicateWord - > - - - \ - W - - - ( - ? - < - nextWord - > - - - - \ - w - - + - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest2() - { - Test(@"@""((?abc)\d+)?(?xyz)(.*)""", @" - - - - - ( - - - ( - ? - < - One - > - - - abc - - - ) - - - - \ - d - - + - - - ) - - ? - - - ( - ? - < - Two - > - - - xyz - - - ) - - - ( - - - - . - - * - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest3() - { - Test(@"@""(\w+)\s(\1)""", @" - - - - ( - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - \ - 1 - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest4() - { - Test(@"@""\Bqu\w+""", @" - - - - \ - B - - - qu - - - - \ - w - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest5() - { - Test(@"@""\bare\w*\b""", @" - - - - \ - b - - - are - - - - \ - w - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest6() - { - Test(@"@""\G(\w+\s?\w*),?""", @" - - - - \ - G - - - ( - - - - \ - w - - + - - - - \ - s - - ? - - - - \ - w - - * - - - ) - - - - , - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest7() - { - Test(@"@""\D+(?\d+)\D+(?\d+)?""", @" - - - - - \ - D - - + - - - ( - ? - < - digit - > - - - - \ - d - - + - - - ) - - - - \ - D - - + - - - - ( - ? - < - digit - > - - - - \ - d - - + - - - ) - - ? - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest8() - { - Test(@"@""(\s\d{4}(-(\d{4}|present))?,?)+""", @" - - - - - ( - - - \ - s - - - - \ - d - - { - 4 - } - - - - ( - - - - - - - ( - - - - \ - d - - { - 4 - } - - - &#124;present - - - ) - - - ) - - ? - - - - , - - ? - - - ) - - + - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest9() - { - Test(@"@""^((\w+(\s?)){2,}),\s(\w+\s\w+),(\s\d{4}(-(\d{4}|present))?,?)+""", @" - - - - ^ - - - ( - - - - ( - - - - \ - w - - + - - - ( - - - - \ - s - - ? - - - ) - - - ) - - { - 2 - , - } - - - ) - - - , - - - \ - s - - - ( - - - - \ - w - - + - - - \ - s - - - - \ - w - - + - - - ) - - - , - - - - ( - - - \ - s - - - - \ - d - - { - 4 - } - - - - ( - - - - - - - ( - - - - - \ - d - - { - 4 - } - - - | - - - present - - - - ) - - - ) - - ? - - - - , - - ? - - - ) - - + - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest10() - { - Test(@"@""^[0-9-[2468]]+$""", @" - - - - ^ - - - - [ - - - - 0 - - - - - 9 - - - - - - - [ - - - 2468 - - - ] - - - - ] - - + - - - $ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest11() - { - Test(@"@""[a-z-[0-9]]""", @" - - - - [ - - - - a - - - - - z - - - - - - - [ - - - - 0 - - - - - 9 - - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest12() - { - Test(@"@""[\p{IsBasicLatin}-[\x00-\x7F]]""", @" - - - - [ - - - \ - p - { - IsBasicLatin - } - - - - - - [ - - - - \ - x - 00 - - - - - \ - x - 7F - - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest13() - { - Test(@"@""[\u0000-\uFFFF-[\s\p{P}\p{IsGreek}\x85]]""", @" - - - - [ - - - - \ - u - 0000 - - - - - \ - u - FFFF - - - - - - - [ - - - \ - s - - - \ - p - { - P - } - - - \ - p - { - IsGreek - } - - - \ - x - 85 - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest14() - { - Test(@"@""[a-z-[d-w-[m-o]]]""", @" - - - - [ - - - - a - - - - - z - - - - - - - [ - - - - d - - - - - w - - - - - - - [ - - - - m - - - - - o - - - - ] - - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest15() - { - Test(@"@""((\w+(\s?)){2,}""", @" - - - - ( - - - - ( - - - - \ - w - - + - - - ( - - - - \ - s - - ? - - - ) - - - ) - - { - 2 - , - } - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest16() - { - Test(@"@""[a-z-[djp]]""", @" - - - - [ - - - - a - - - - - z - - - - - - - [ - - - djp - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest17() - { - Test(@"@""^[^<>]*(((?'Open'<)[^<>]*)+((?'Close-Open'>)[^<>]*)+)*(?(Open)(?!))$""", @" - - - - ^ - - - - [ - ^ - - - <> - - - ] - - * - - - - ( - - - - ( - - - ( - ? - ' - Open - ' - - - < - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - - ( - - - ( - ? - ' - Close - - - Open - ' - - - > - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - ) - - * - - - ( - ? - ( - Open - ) - - - ( - ? - ! - - ) - - - ) - - - $ - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest18() - { - Test(@"@""((?'Close-Open'>)[^<>]*)+""", @" - - - - - ( - - - ( - ? - ' - Close - - - Open - ' - - - > - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest19() - { - Test(@"@""(\w)\1+.\b""", @" - - - - ( - - - \ - w - - - ) - - - - \ - 1 - - + - - - . - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest20() - { - Test(@"@""\d{4}\b""", @" - - - - - \ - d - - { - 4 - } - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest21() - { - Test(@"@""\d{1,2},""", @" - - - - - \ - d - - { - 1 - , - 2 - } - - - , - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest22() - { - Test(@"@""(? - - - - ( - ? - < - ! - - - ( - - - - Saturday - - - | - - - Sunday - - - - ) - - - - - - ) - - - \ - b - - - - \ - w - - + - - - - - - - \ - d - - { - 1 - , - 2 - } - - - , - - - - \ - d - - { - 4 - } - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest23() - { - Test(@"@""(?<=\b20)\d{2}\b""", @" - - - - ( - ? - < - = - - - \ - b - - - 20 - - - ) - - - - \ - d - - { - 2 - } - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest24() - { - Test(@"@""\b\w+\b(?!\p{P})""", @" - - - - \ - b - - - - \ - w - - + - - - \ - b - - - ( - ? - ! - - - \ - p - { - P - } - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest25() - { - Test(@"@""(((?'Open'<)[^<>]*)+((?'Close-Open'>)[^<>]*)+)*""", @" - - - - - ( - - - - ( - - - ( - ? - ' - Open - ' - - - < - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - - ( - - - ( - ? - ' - Close - - - Open - ' - - - > - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - ) - - * - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest26() - { - Test(@"@""\b(?!un)\w+\b""", @" - - - - \ - b - - - ( - ? - ! - - - un - - - ) - - - - \ - w - - + - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest27() - { - Test(@"@""\b(?ix: d \w+)\s""", @" - - - - \ - b - - - ( - ? - ix - : - - - - - - d - - - - - - - \ - w - - + - - - ) - - - \ - s - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest28() - { - Test(@"@""(?:\w+)""", @" - - - - ( - ? - : - - - - \ - w - - + - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest29() - { - Test(@"@""(?:\b(?:\w+)\W*)+""", @" - - - - - ( - ? - : - - - \ - b - - - ( - ? - : - - - - \ - w - - + - - - ) - - - - \ - W - - * - - - ) - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest30() - { - Test(@"@""(?:\b(?:\w+)\W*)+\.""", @" - - - - - ( - ? - : - - - \ - b - - - ( - ? - : - - - - \ - w - - + - - - ) - - - - \ - W - - * - - - ) - - + - - - \ - . - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest31() - { - Test(@"@""(?'Close-Open'>)""", @" - - - - ( - ? - ' - Close - - - Open - ' - - - > - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest32() - { - Test(@"@""[^<>]*""", @" - - - - - [ - ^ - - - <> - - - ] - - * - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest33() - { - Test(@"@""\b\w+(?=\sis\b)""", @" - - - - \ - b - - - - \ - w - - + - - - ( - ? - = - - - \ - s - - - is - - - \ - b - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest34() - { - Test(@"@""[a-z-[m]]""", @" - - - - [ - - - - a - - - - - z - - - - - - - [ - - - m - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest35() - { - Test(@"@""^\D\d{1,5}\D*$""", @" - - - - ^ - - - \ - D - - - - \ - d - - { - 1 - , - 5 - } - - - - \ - D - - * - - - $ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest36() - { - Test(@"@""[^0-9]""", @" - - - - [ - ^ - - - - 0 - - - - - 9 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest37() - { - Test(@"@""(\p{IsGreek}+(\s)?)+""", @" - - - - - ( - - - - \ - p - { - IsGreek - } - - + - - - - ( - - - \ - s - - - ) - - ? - - - ) - - + - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest38() - { - Test(@"@""\b(\p{IsGreek}+(\s)?)+\p{Pd}\s(\p{IsBasicLatin}+(\s)?)+""", @" - - - - \ - b - - - - ( - - - - \ - p - { - IsGreek - } - - + - - - - ( - - - \ - s - - - ) - - ? - - - ) - - + - - - \ - p - { - Pd - } - - - \ - s - - - - ( - - - - \ - p - { - IsBasicLatin - } - - + - - - - ( - - - \ - s - - - ) - - ? - - - ) - - + - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest39() - { - Test(@"@""\b.*[.?!;:](\s|\z)""", @" - - - - \ - b - - - - . - - * - - - [ - - - .?!;: - - - ] - - - ( - - - - \ - s - - - | - - - \ - z - - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest40() - { - Test(@"@""^.+""", @" - - - - ^ - - - - . - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest41() - { - Test(@"@""[^o]""", @" - - - - [ - ^ - - - o - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest42() - { - Test(@"@""\bth[^o]\w+\b""", @" - - - - \ - b - - - th - - - [ - ^ - - - o - - - ] - - - - \ - w - - + - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest43() - { - Test(@"@""(\P{Sc})+""", @" - - - - - ( - - - \ - P - { - Sc - } - - - ) - - + - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest44() - { - Test(@"@""[^\p{P}\d]""", @" - - - - [ - ^ - - - \ - p - { - P - } - - - \ - d - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest45() - { - Test(@"@""\b[A-Z]\w*\b""", @" - - - - \ - b - - - [ - - - - A - - - - - Z - - - - ] - - - - \ - w - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest46() - { - Test(@"@""\S+?""", @" - - - - - - \ - S - - + - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest47() - { - Test(@"@""y\s""", @" - - - - y - - - \ - s - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest48() - { - Test(@"@""gr[ae]y\s\S+?[\s\p{P}]""", @" - - - - gr - - - [ - - - ae - - - ] - - - y - - - \ - s - - - - - \ - S - - + - - ? - - - [ - - - \ - s - - - \ - p - { - P - } - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest49() - { - Test(@"@""[\s\p{P}]""", @" - - - - [ - - - \ - s - - - \ - p - { - P - } - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest50() - { - Test(@"@""[\p{P}\d]""", @" - - - - [ - - - \ - p - { - P - } - - - \ - d - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest51() - { - Test(@"@""[^aeiou]""", @" - - - - [ - ^ - - - aeiou - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest52() - { - Test(@"@""(\w)\1""", @" - - - - ( - - - \ - w - - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest53() - { - Test(@"@""[^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}\p{Lm}] """, @" - - - - [ - ^ - - - \ - p - { - Ll - } - - - \ - p - { - Lu - } - - - \ - p - { - Lt - } - - - \ - p - { - Lo - } - - - \ - p - { - Nd - } - - - \ - p - { - Pc - } - - - \ - p - { - Lm - } - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest54() - { - Test(@"@""[^a-zA-Z_0-9]""", @" - - - - [ - ^ - - - - a - - - - - z - - - - - A - - - - - Z - - - - _ - - - - 0 - - - - - 9 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest55() - { - Test(@"@""\P{Nd}""", @" - - - - \ - P - { - Nd - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest56() - { - Test(@"@""(\(?\d{3}\)?[\s-])?""", @" - - - - - ( - - - - \ - ( - - ? - - - - \ - d - - { - 3 - } - - - - \ - ) - - ? - - - [ - - - \ - s - - - - - - - ] - - - ) - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest57() - { - Test(@"@""^(\(?\d{3}\)?[\s-])?\d{3}-\d{4}$""", @" - - - - ^ - - - - ( - - - - \ - ( - - ? - - - - \ - d - - { - 3 - } - - - - \ - ) - - ? - - - [ - - - \ - s - - - - - - - ] - - - ) - - ? - - - - \ - d - - { - 3 - } - - - - - - - - \ - d - - { - 4 - } - - - $ - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest58() - { - Test(@"@""[0-9]""", @" - - - - [ - - - - 0 - - - - - 9 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest59() - { - Test(@"@""\p{Nd}""", @" - - - - \ - p - { - Nd - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest60() - { - Test(@"@""\b(\S+)\s?""", @" - - - - \ - b - - - ( - - - - \ - S - - + - - - ) - - - - \ - s - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest61() - { - Test(@"@""[^ \f\n\r\t\v]""", @" - - - - [ - ^ - - - - - - \ - f - - - \ - n - - - \ - r - - - \ - t - - - \ - v - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest62() - { - Test(@"@""[^\f\n\r\t\v\x85\p{Z}]""", @" - - - - [ - ^ - - - \ - f - - - \ - n - - - \ - r - - - \ - t - - - \ - v - - - \ - x - 85 - - - \ - p - { - Z - } - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest63() - { - Test(@"@""(\s|$)""", @" - - - - ( - - - - \ - s - - - | - - - $ - - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest64() - { - Test(@"@""\b\w+(e)?s(\s|$)""", @" - - - - \ - b - - - - \ - w - - + - - - - ( - - - e - - - ) - - ? - - - s - - - ( - - - - \ - s - - - | - - - $ - - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest65() - { - Test(@"@""[ \f\n\r\t\v]""", @" - - - - [ - - - - - - \ - f - - - \ - n - - - \ - r - - - \ - t - - - \ - v - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest66() - { - Test(@"@""(\W){1,2}""", @" - - - - - ( - - - \ - W - - - ) - - { - 1 - , - 2 - } - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest67() - { - Test(@"@""(\w+)""", @" - - - - ( - - - - \ - w - - + - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest68() - { - Test(@"@""\b""", @" - - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest69() - { - Test(@"@""\b(\w+)(\W){1,2}""", @" - - - - \ - b - - - ( - - - - \ - w - - + - - - ) - - - - ( - - - \ - W - - - ) - - { - 1 - , - 2 - } - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest70() - { - Test(@"@""(?>(\w)\1+).\b""", @" - - - - ( - ? - > - - - ( - - - \ - w - - - ) - - - - \ - 1 - - + - - - ) - - - . - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest71() - { - Test(@"@""(\b(\w+)\W+)+""", @" - - - - - ( - - - \ - b - - - ( - - - - \ - w - - + - - - ) - - - - \ - W - - + - - - ) - - + - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest72() - { - Test(@"@""(\w)\1+.\b""", @" - - - - ( - - - \ - w - - - ) - - - - \ - 1 - - + - - - . - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest73() - { - Test(@"@""\p{Sc}*(\s?\d+[.,]?\d*)\p{Sc}*""", @" - - - - - \ - p - { - Sc - } - - * - - - ( - - - - \ - s - - ? - - - - \ - d - - + - - - - [ - - - ., - - - ] - - ? - - - - \ - d - - * - - - ) - - - - \ - p - { - Sc - } - - * - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest74() - { - Test(@"@""p{Sc}*(?\s?\d+[.,]?\d*)\p{Sc}*""", @" - - - - p{Sc - - - - } - - * - - - ( - ? - < - amount - > - - - - \ - s - - ? - - - - \ - d - - + - - - - [ - - - ., - - - ] - - ? - - - - \ - d - - * - - - ) - - - - \ - p - { - Sc - } - - * - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest75() - { - Test(@"@""^(\w+\s?)+$""", @" - - - - ^ - - - - ( - - - - \ - w - - + - - - - \ - s - - ? - - - ) - - + - - - $ - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest76() - { - Test(@"@""(?ix) d \w+ \s""", @" - - - - ( - ? - ix - ) - - - - - - d - - - - - - - \ - w - - + - - - - - - \ - s - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest77() - { - Test(@"@""\b(?ix: d \w+)\s""", @" - - - - \ - b - - - ( - ? - ix - : - - - - - - d - - - - - - - \ - w - - + - - - ) - - - \ - s - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest78() - { - Test(@"@""\bthe\w*\b""", @" - - - - \ - b - - - the - - - - \ - w - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest79() - { - Test(@"@""\b(?i:t)he\w*\b""", @" - - - - \ - b - - - ( - ? - i - : - - - t - - - ) - - - he - - - - \ - w - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest80() - { - Test(@"@""^(\w+)\s(\d+)$""", @" - - - - ^ - - - ( - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - - \ - d - - + - - - ) - - - $ - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest81() - { - Test(@"@""^(\w+)\s(\d+)\r*$""", @" - - - - ^ - - - ( - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - - \ - d - - + - - - ) - - - - \ - r - - * - - - $ - - - - - - - - - -", RegexOptions.Multiline); - } - - [Fact] - public void ReferenceTest82() - { - Test(@"@""(?m)^(\w+)\s(\d+)\r*$""", @" - - - - ( - ? - m - ) - - - ^ - - - ( - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - - \ - d - - + - - - ) - - - - \ - r - - * - - - $ - - - - - - - - - -", RegexOptions.Multiline); - } - - [Fact] - public void ReferenceTest83() - { - Test(@"@""(?s)^.+""", @" - - - - ( - ? - s - ) - - - ^ - - - - . - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest84() - { - Test(@"@""\b(\d{2}-)*(?(1)\d{7}|\d{3}-\d{2}-\d{4})\b""", @" - - - - \ - b - - - - ( - - - - \ - d - - { - 2 - } - - - - - - - ) - - * - - - ( - ? - ( - 1 - ) - - - - - \ - d - - { - 7 - } - - - | - - - - \ - d - - { - 3 - } - - - - - - - - \ - d - - { - 2 - } - - - - - - - - \ - d - - { - 4 - } - - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest85() - { - Test(@"@""\b\(?((\w+),?\s?)+[\.!?]\)?""", @" - - - - \ - b - - - - \ - ( - - ? - - - - ( - - - ( - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest86() - { - Test(@"@""(?n)\b\(?((?>\w+),?\s?)+[\.!?]\)?""", @" - - - - ( - ? - n - ) - - - \ - b - - - - \ - ( - - ? - - - - ( - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest87() - { - Test(@"@""\b\(?(?n:(?>\w+),?\s?)+[\.!?]\)?""", @" - - - - \ - b - - - - \ - ( - - ? - - - - ( - ? - n - : - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest88() - { - Test(@"@""\b\(?((?>\w+),?\s?)+[\.!?]\)?""", @" - - - - \ - b - - - - \ - ( - - ? - - - - ( - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void ReferenceTest89() - { - Test(@"@""(?x)\b \(? ( (?>\w+) ,?\s? )+ [\.!?] \)? # Matches an entire sentence.""", @" - - - - ( - ? - x - ) - - - \ - b - - - - - - - \ - ( - - ? - - - - - - - ( - - - - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - - - - , - - ? - - - - \ - s - - ? - - - - - - ) - - + - - - - - - [ - - - \ - . - - - !? - - - ] - - - - - - - \ - ) - - ? - - - - - - # Matches an entire sentence. - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest90() - { - Test(@"@""\bb\w+\s""", @" - - - - \ - b - - - b - - - - \ - w - - + - - - \ - s - - - - - - - -", RegexOptions.RightToLeft); - } - - [Fact] - public void ReferenceTest91() - { - Test(@"@""(?<=\d{1,2}\s)\w+,?\s\d{4}""", @" - - - - ( - ? - < - = - - - - \ - d - - { - 1 - , - 2 - } - - - \ - s - - - ) - - - - \ - w - - + - - - - , - - ? - - - \ - s - - - - \ - d - - { - 4 - } - - - - - - - -", RegexOptions.RightToLeft); - } - - [Fact] - public void ReferenceTest92() - { - Test(@"@""\b(\w+\s*)+""", @" - - - - \ - b - - - - ( - - - - \ - w - - + - - - - \ - s - - * - - - ) - - + - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void ReferenceTest93() - { - Test(@"@""((a+)(\1) ?)+""", @" - - - - - ( - - - ( - - - - a - - + - - - ) - - - ( - - - \ - 1 - - - ) - - - - - - ? - - - ) - - + - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void ReferenceTest94() - { - Test(@"@""\b(D\w+)\s(d\w+)\b""", @" - - - - \ - b - - - ( - - - D - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - d - - - - \ - w - - + - - - ) - - - \ - b - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest95() - { - Test(@"@""\b(D\w+)(?ixn) \s (d\w+) \b""", @" - - - - \ - b - - - ( - - - D - - - - \ - w - - + - - - ) - - - ( - ? - ixn - ) - - - - - - \ - s - - - - - - ( - - - d - - - - \ - w - - + - - - ) - - - - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest96() - { - Test(@"@""\b((?# case-sensitive comparison)D\w+)\s((?#case-insensitive comparison)d\w+)\b""", @" - - - - \ - b - - - ( - - - - - (?# case-sensitive comparison) - D - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - - - (?#case-insensitive comparison) - d - - - - \ - w - - + - - - ) - - - \ - b - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest97() - { - Test(@"@""\b\(?((?>\w+),?\s?)+[\.!?]\)?""", @" - - - - \ - b - - - - \ - ( - - ? - - - - ( - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest98() - { - Test(@"@""\b(?\d{2}-)*(?(n2)\d{7}|\d{3}-\d{2}-\d{4})\b""", @" - - - - \ - b - - - - ( - ? - < - n2 - > - - - - \ - d - - { - 2 - } - - - - - - - ) - - * - - - ( - ? - ( - n2 - ) - - - - - \ - d - - { - 7 - } - - - | - - - - \ - d - - { - 3 - } - - - - - - - - \ - d - - { - 2 - } - - - - - - - - \ - d - - { - 4 - } - - - - ) - - - \ - b - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest99() - { - Test(@"@""\b(\d{2}-\d{7}|\d{3}-\d{2}-\d{4})\b""", @" - - - - \ - b - - - ( - - - - - \ - d - - { - 2 - } - - - - - - - - \ - d - - { - 7 - } - - - | - - - - \ - d - - { - 3 - } - - - - - - - - \ - d - - { - 2 - } - - - - - - - - \ - d - - { - 4 - } - - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest100() - { - Test(@"@""\bgr(a|e)y\b""", @" - - - - \ - b - - - gr - - - ( - - - - a - - - | - - - e - - - - ) - - - y - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest101() - { - Test(@"@""(?>(\w)\1+).\b""", @" - - - - ( - ? - > - - - ( - - - \ - w - - - ) - - - - \ - 1 - - + - - - ) - - - . - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest102() - { - Test(@"@""(\b(\w+)\W+)+""", @" - - - - - ( - - - \ - b - - - ( - - - - \ - w - - + - - - ) - - - - \ - W - - + - - - ) - - + - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest103() - { - Test(@"@""\b91*9*\b""", @" - - - - \ - b - - - 9 - - - - 1 - - * - - - - 9 - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest104() - { - Test(@"@""\ban+\w*?\b""", @" - - - - \ - b - - - a - - - - n - - + - - - - - \ - w - - * - - ? - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest105() - { - Test(@"@""\ban?\b""", @" - - - - \ - b - - - a - - - - n - - ? - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest106() - { - Test(@"@""\b\d+\,\d{3}\b""", @" - - - - \ - b - - - - \ - d - - + - - - \ - , - - - - \ - d - - { - 3 - } - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest107() - { - Test(@"@""\b\d{2,}\b\D+""", @" - - - - \ - b - - - - \ - d - - { - 2 - , - } - - - \ - b - - - - \ - D - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest108() - { - Test(@"@""(00\s){2,4}""", @" - - - - - ( - - - 00 - - - \ - s - - - ) - - { - 2 - , - 4 - } - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest109() - { - Test(@"@""\b\w*?oo\w*?\b""", @" - - - - \ - b - - - - - \ - w - - * - - ? - - - oo - - - - - \ - w - - * - - ? - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest110() - { - Test(@"@""\b\w+?\b""", @" - - - - \ - b - - - - - \ - w - - + - - ? - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest111() - { - Test(@"@""^\s*(System.)??Console.Write(Line)??\(??""", @" - - - - ^ - - - - \ - s - - * - - - - - ( - - - System - - - . - - - ) - - ? - - ? - - - Console - - - . - - - Write - - - - - ( - - - Line - - - ) - - ? - - ? - - - - - \ - ( - - ? - - ? - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest112() - { - Test(@"@""(System.)??""", @" - - - - - - ( - - - System - - - . - - - ) - - ? - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest113() - { - Test(@"@""\b(\w{3,}?\.){2}?\w{3,}?\b""", @" - - - - \ - b - - - - - ( - - - - - \ - w - - { - 3 - , - } - - ? - - - \ - . - - - ) - - { - 2 - } - - ? - - - - - \ - w - - { - 3 - , - } - - ? - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest114() - { - Test(@"@""\b[A-Z](\w*?\s*?){1,10}[.!?]""", @" - - - - \ - b - - - [ - - - - A - - - - - Z - - - - ] - - - - ( - - - - - \ - w - - * - - ? - - - - - \ - s - - * - - ? - - - ) - - { - 1 - , - 10 - } - - - [ - - - .!? - - - ] - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest115() - { - Test(@"@""b.*([0-9]{4})\b""", @" - - - - b - - - - . - - * - - - ( - - - - [ - - - - 0 - - - - - 9 - - - - ] - - { - 4 - } - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest116() - { - Test(@"@""\b.*?([0-9]{4})\b""", @" - - - - \ - b - - - - - . - - * - - ? - - - ( - - - - [ - - - - 0 - - - - - 9 - - - - ] - - { - 4 - } - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest117() - { - Test(@"@""(a?)*""", @" - - - - - ( - - - - a - - ? - - - ) - - * - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest118() - { - Test(@"@""(a\1|(?(1)\1)){0,2}""", @" - - - - - ( - - - - a - - - \ - 1 - - - | - - - ( - ? - ( - 1 - ) - - - \ - 1 - - - ) - - - - ) - - { - 0 - , - 2 - } - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest119() - { - Test(@"@""(a\1|(?(1)\1)){2}""", @" - - - - - ( - - - - a - - - \ - 1 - - - | - - - ( - ? - ( - 1 - ) - - - \ - 1 - - - ) - - - - ) - - { - 2 - } - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest120() - { - Test(@"@""(\w)\1""", @" - - - - ( - - - \ - w - - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest121() - { - Test(@"@""(?\w)\k""", @" - - - - ( - ? - < - char - > - - - \ - w - - - ) - - - \ - k - < - char - > - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest122() - { - Test(@"@""(?<2>\w)\k<2>""", @" - - - - ( - ? - < - 2 - > - - - \ - w - - - ) - - - \ - k - < - 2 - > - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest123() - { - Test(@"@""(?<1>a)(?<1>\1b)*""", @" - - - - ( - ? - < - 1 - > - - - a - - - ) - - - - ( - ? - < - 1 - > - - - \ - 1 - - - b - - - ) - - * - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest124() - { - Test(@"@""\b(\p{Lu}{2})(\d{2})?(\p{Lu}{2})\b""", @" - - - - \ - b - - - ( - - - - \ - p - { - Lu - } - - { - 2 - } - - - ) - - - - ( - - - - \ - d - - { - 2 - } - - - ) - - ? - - - ( - - - - \ - p - { - Lu - } - - { - 2 - } - - - ) - - - \ - b - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest125() - { - Test(@"@""\bgr[ae]y\b""", @" - - - - \ - b - - - gr - - - [ - - - ae - - - ] - - - y - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest126() - { - Test(@"@""\b((?# case sensitive comparison)D\w+)\s(?ixn)((?#case insensitive comparison)d\w+)\b""", @" - - - - \ - b - - - ( - - - - - (?# case sensitive comparison) - D - - - - \ - w - - + - - - ) - - - \ - s - - - ( - ? - ixn - ) - - - ( - - - - - (?#case insensitive comparison) - d - - - - \ - w - - + - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest127() - { - Test(@"@""\{\d+(,-*\d+)*(\:\w{1,4}?)*\}(?x) # Looks for a composite format item.""", @" - - - - \ - { - - - - \ - d - - + - - - - ( - - - , - - - - - - - * - - - - \ - d - - + - - - ) - - * - - - - ( - - - \ - : - - - - - \ - w - - { - 1 - , - 4 - } - - ? - - - ) - - * - - - \ - } - - - ( - ? - x - ) - - - - - - # Looks for a composite format item. - - - - - - - - -", RegexOptions.None); - } - } -} diff --git a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_TestGeneration.cs b/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_TestGeneration.cs deleted file mode 100644 index 3d0a67e4af7a9..0000000000000 --- a/src/Workspaces/CSharpTest/RegularExpressions/CSharpRegexParserTests_TestGeneration.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if false - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; -using System.Text.RegularExpressions; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.RegularExpressions; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - internal class LogicalStringComparer : IComparer - { - [DllImport("shlwapi.dll", CharSet = CharSet.Unicode)] - private static extern int StrCmpLogicalW(string psz1, string psz2); - - public static readonly IComparer Instance = new LogicalStringComparer(); - - private LogicalStringComparer() - { - } - - public int Compare(string x, string y) - { - return StrCmpLogicalW(x, y); - } - } - - public class Fixture : IDisposable - { - public void Dispose() - { - var other = new Dictionary(); - - var tree = SyntaxFactory.ParseSyntaxTree( - File.ReadAllText(@"C:\GitHub\roslyn-internal\Open\src\Workspaces\CSharpTest\RegularExpressions\CSharpRegexParserTests_BasicTests.cs")); - - var methodNames = tree.GetRoot().DescendantNodes().OfType().Select(m => m.Identifier.ValueText); - var nameToIndex = new Dictionary(); - - var index = 0; - foreach (var name in methodNames) - { - nameToIndex[name] = index; - index++; - } - -#if true - var tests = - CSharpRegexParserTests.nameToTest.Where(kvp => !kvp.Key.StartsWith("NegativeTest") && !kvp.Key.StartsWith("Reference")) - .OrderBy(kvp => nameToIndex[kvp.Key]) - .Select(kvp => kvp.Value); -#elif false - var tests = - CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("NegativeTest")) - .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) - .Select(kvp => kvp.Value); -#else - var tests = - CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("Reference")) - .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) - .Select(kvp => kvp.Value); -#endif - - - var val = string.Join("\r\n", tests); - } - } - - [CollectionDefinition(nameof(MyCollection))] - public class MyCollection : ICollectionFixture - { - } - - [Collection(nameof(MyCollection))] - public partial class CSharpRegexParserTests - { - private readonly Fixture _fixture; - - public CSharpRegexParserTests(Fixture fixture) - { - _fixture = fixture; - } - - - public static Dictionary nameToTest = new Dictionary(); - - private void Test1(string stringText, string expected, RegexOptions options, bool runSubTreeTests = true, [CallerMemberName]string name = "") - { - var test = GenerateTests(stringText, options, runSubTreeTests, name); - nameToTest.Add(name, test); - } - - public string GenerateTests(string val, RegexOptions options, bool runSubTreeTests, string testName) - { - var builder = new StringBuilder(); - builder.AppendLine("[Fact]"); - builder.AppendLine("public void " + testName + "()"); - builder.AppendLine("{"); - builder.Append(@" Test("); - - var escaped = val.Replace("\"", "\"\""); - var quoted = "" + '@' + '"' + escaped + '"'; - builder.Append(quoted); - - var token = GetStringToken(val); - var allChars = _service.TryConvertToVirtualChars(token); - var tree = RegexParser.TryParse(allChars, options); - - var actual = TreeToText(tree).Replace("\"", "\"\""); - builder.Append(", " + '@' + '"'); - builder.Append(actual); - - builder.AppendLine("" + '"' + (runSubTreeTests - ? (", RegexOptions." + options.ToString()) - : (", runSubTreeTests: false, options: RegexOptions." + options.ToString())) + ");"); - builder.AppendLine("}"); - - return builder.ToString(); - } - } -} - -#endif From b746137fd48eb01da09963582ea57737e4baae58 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 3 Apr 2018 00:08:39 -0700 Subject: [PATCH 003/110] Remove tests. --- .../CSharpRegexParserTests.cs | 291 - .../CSharpRegexParserTests_BasicTests.cs | 15024 ---------------- ...arpRegexParserTests_DotnetNegativeTests.cs | 5335 ------ .../CSharpRegexParserTests_ReferenceTests.cs | 6794 ------- .../CSharpRegexParserTests_TestGeneration.cs | 131 - 5 files changed, 27575 deletions(-) delete mode 100644 src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs delete mode 100644 src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs delete mode 100644 src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs delete mode 100644 src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs delete mode 100644 src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_TestGeneration.cs diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs deleted file mode 100644 index 40f29d5cdc899..0000000000000 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright (c) Microsoft. 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.Immutable; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text.RegularExpressions; -using System.Xml.Linq; -using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; -using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; -using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; -using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - using RegexToken = EmbeddedSyntaxToken; - using RegexTrivia = EmbeddedSyntaxTrivia; - - public partial class CSharpRegexParserTests - { - private readonly IVirtualCharService _service = CSharpVirtualCharService.Instance; - private const string _statmentPrefix = "var v = "; - - private SyntaxToken GetStringToken(string text) - { - var statement = _statmentPrefix + text; - var parsedStatement = SyntaxFactory.ParseStatement(statement); - var token = parsedStatement.DescendantTokens().ToArray()[3]; - Assert.True(token.Kind() == SyntaxKind.StringLiteralToken); - - return token; - } - - private void Test(string stringText, string expected, RegexOptions options, - bool runSubTreeTests = true, [CallerMemberName]string name = "") - { - var tree = TryParseTree(stringText, options, conversionFailureOk: false); - - // Tests are allowed to not run the subtree tests. This is because some - // subtrees can cause the native regex parser to exhibit very bad behavior - // (like not ever actually finishing compiling). - if (runSubTreeTests) - { - TryParseSubTrees(stringText, options); - } - - var actual = TreeToText(tree).Replace("\"", "\"\""); - Assert.Equal(expected.Replace("\"", "\"\""), actual); - } - - private void TryParseSubTrees(string stringText, RegexOptions options) - { - // Trim the input from the right and make sure tree invariants hold - var current = stringText; - while (current != "@\"\"" && current != "\"\"") - { - current = current.Substring(0, current.Length - 2) + "\""; - TryParseTree(current, options, conversionFailureOk: true); - } - - // Trim the input from the left and make sure tree invariants hold - current = stringText; - while (current != "@\"\"" && current != "\"\"") - { - if (current[0] == '@') - { - current = "@\"" + current.Substring(3); - } - else - { - current = "\"" + current.Substring(2); - } - - TryParseTree(current, options, conversionFailureOk: true); - } - - for (int start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++) - { - TryParseTree( - stringText.Substring(0, start) + - stringText.Substring(start + 1, stringText.Length - (start + 1)), - options, conversionFailureOk: true); - } - } - - private (SyntaxToken, RegexTree, ImmutableArray) JustParseTree( - string stringText, RegexOptions options, bool conversionFailureOk) - { - var token = GetStringToken(stringText); - var allChars = _service.TryConvertToVirtualChars(token); - if (allChars.IsDefault) - { - Assert.True(conversionFailureOk, "Failed to convert text to token."); - return (token, null, allChars); - } - - var tree = RegexParser.TryParse(allChars, options); - return (token, tree, allChars); - } - - private RegexTree TryParseTree(string stringText, RegexOptions options, bool conversionFailureOk) - { - var (token, tree, allChars) = JustParseTree(stringText, options, conversionFailureOk); - if (tree == null) - { - Assert.True(allChars.IsDefault); - return null; - } - - CheckInvariants(tree, allChars); - - try - { - var regex = new Regex(token.ValueText, options); - Assert.Empty(tree.Diagnostics); - - Assert.True(regex.GetGroupNumbers().OrderBy(v => v).SequenceEqual( - tree.CaptureNumbersToSpan.Keys.OrderBy(v => v))); - - Assert.True(regex.GetGroupNames().Where(v => !int.TryParse(v, out _)).OrderBy(v => v).SequenceEqual( - tree.CaptureNamesToSpan.Keys.OrderBy(v => v))); - } - catch (IndexOutOfRangeException) - { - // bug with .net regex parser. Can happen with patterns like: (?<-0 - Assert.NotEmpty(tree.Diagnostics); - } - catch (NullReferenceException) - { - // bug with .net regex parser. can happen with patterns like: (?(?S)) - } - catch (OutOfMemoryException) - { - // bug with .net regex parser. can happen with patterns like: a{2147483647,} - } - catch (Exception e) - { - Assert.NotEmpty(tree.Diagnostics); - Assert.True(tree.Diagnostics.Any(d => e.Message.Contains(d.Message))); - } - - return tree; - } - - private string TreeToText(RegexTree tree) - { - var element = new XElement("Tree", - NodeToElement(tree.Root)); - - if (tree.Diagnostics.Length > 0) { - element.Add(new XElement("Diagnostics", - tree.Diagnostics.Select(d => - new XElement("Diagnostic", - new XAttribute("Message", d.Message), - new XAttribute("Start", d.Span.Start), - new XAttribute("Length", d.Span.Length))))); - } - - element.Add(new XElement("Captures", - tree.CaptureNumbersToSpan.OrderBy(kvp => kvp.Key).Select(kvp => - new XElement("Capture", new XAttribute("Name", kvp.Key), new XAttribute("Span", kvp.Value))), - tree.CaptureNamesToSpan.OrderBy(kvp => kvp.Key).Select(kvp => - new XElement("Capture", new XAttribute("Name", kvp.Key), new XAttribute("Span", kvp.Value))))); - - return element.ToString(); - } - - private XElement NodeToElement(RegexNode node) - { - var element = new XElement(node.Kind.ToString()); - foreach (var child in node) - { - element.Add(child.IsNode ? NodeToElement(child.Node) : TokenToElement(child.Token)); - } - - return element; - } - - private XElement TokenToElement(RegexToken token) - { - var element = new XElement(token.Kind.ToString()); - - if (token.Value != null) - { - element.Add(new XAttribute("value", token.Value)); - } - - if (token.LeadingTrivia.Length > 0) - { - element.Add(new XElement("Trivia", token.LeadingTrivia.Select(t => TriviaToElement(t)))); - } - - if (token.VirtualChars.Length > 0) - { - element.Add(token.VirtualChars.CreateString()); - } - - return element; - } - - private XElement TriviaToElement(RegexTrivia trivia) - => new XElement( - trivia.Kind.ToString(), - trivia.VirtualChars.CreateString()); - - private void CheckInvariants(RegexTree tree, ImmutableArray allChars) - { - var root = tree.Root; - var position = 0; - CheckInvariants(root, ref position, allChars); - Assert.Equal(allChars.Length, position); - } - - private void CheckInvariants(RegexNode node, ref int position, ImmutableArray allChars) - { - foreach (var child in node) - { - if (child.IsNode) - { - CheckInvariants(child.Node, ref position, allChars); - } - else - { - CheckInvariants(child.Token, ref position, allChars); - } - } - } - - private void CheckInvariants(RegexToken token, ref int position, ImmutableArray allChars) - { - CheckInvariants(token.LeadingTrivia, ref position, allChars); - CheckCharacters(token.VirtualChars, ref position, allChars); - } - - private void CheckInvariants(ImmutableArray leadingTrivia, ref int position, ImmutableArray allChars) - { - foreach (var trivia in leadingTrivia) - { - CheckInvariants(trivia, ref position, allChars); - } - } - - private void CheckInvariants(RegexTrivia trivia, ref int position, ImmutableArray allChars) - { - switch (trivia.Kind) - { - case RegexKind.CommentTrivia: - case RegexKind.WhitespaceTrivia: - break; - default: - Assert.False(true, "Incorrect trivia kind"); - return; - } - - CheckCharacters(trivia.VirtualChars, ref position, allChars); - } - - private static void CheckCharacters(ImmutableArray virtualChars, ref int position, ImmutableArray allChars) - { - for (var i = 0; i < virtualChars.Length; i++) - { - Assert.Equal(allChars[position + i], virtualChars[i]); - } - - position += virtualChars.Length; - } - - [Fact] - public void TestDeepRecursion() - { - var (token, tree, chars) = - JustParseTree( -@"@""(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( -(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((""", RegexOptions.None, conversionFailureOk: false); - Assert.False(token.IsMissing); - Assert.False(chars.IsDefaultOrEmpty); - Assert.Null(tree); - } - } -} diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs deleted file mode 100644 index 6eca1e9b5ce94..0000000000000 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs +++ /dev/null @@ -1,15024 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Text.RegularExpressions; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - public partial class CSharpRegexParserTests - { - [Fact] - public void TestEmpty() - { - Test(@"""""", @" - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOneWhitespace_IgnorePatternWhitespace() - { - Test(@""" """, @" - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestTwoWhitespace_IgnorePatternWhitespace() - { - Test(@""" """, @" - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestEmptyParenComment() - { - Test(@"""(?#)""", @" - - - - - (?#) - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleParenComment() - { - Test(@"""(?# )""", @" - - - - - (?# ) - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnterminatedParenComment1() - { - Test(@"""(?#""", @" - - - - - (?# - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnterminatedParenComment2() - { - Test(@"""(?# """, @" - - - - - (?# - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestMultipleComments1() - { - Test(@"""(?#)(?#)""", @" - - - - - (?#) - (?#) - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestMultipleComments2() - { - Test(@"""(?#)(?#)""", @" - - - - - (?#) - (?#) - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestMultipleComments3() - { - Test(@"""(?#) (?#)""", @" - - - - - - (?#) - - - - - - (?#) - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestMultipleComments4() - { - Test(@"""(?#) (?#)""", @" - - - - - (?#) - - (?#) - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass1() - { - Test(@"@""[a\p{Lu}(?#)b]""", @" - - - - [ - - - a - - - \ - p - { - Lu - } - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass2() - { - Test(@"@""[a\0(?#)b]""", @" - - - - [ - - - a - - - \ - 0 - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass3() - { - Test(@"@""[a\a(?#)b]""", @" - - - - [ - - - a - - - \ - a - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass4() - { - Test(@"@""[a\x00(?#)b]""", @" - - - - [ - - - a - - - \ - x - 00 - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass5() - { - Test(@"@""[a\u0000(?#)b]""", @" - - - - [ - - - a - - - \ - u - 0000 - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCommentAfterEscapeInCharacterClass6() - { - Test(@"@""[a\](?#)b]""", @" - - - - [ - - - a - - - \ - ] - - - (?#)b - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOpenQuestion1() - { - Test(@"""(?""", @" - - - - ( - - - ? - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOpenQuestion2() - { - Test(@"""(?""", @" - - - - ( - - - ? - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestOpenQuestion3() - { - Test(@"""(? """, @" - - - - ( - - - ? - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOpenQuestion4() - { - Test(@"""(? """, @" - - - - ( - - - ? - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestSimpleOptionsNode1() - { - Test(@"""(?i)""", @" - - - - ( - ? - i - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleOptionsNode2() - { - Test(@"""(?im)""", @" - - - - ( - ? - im - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleOptionsNode3() - { - Test(@"""(?im-x)""", @" - - - - ( - ? - im-x - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleOptionsNode4() - { - Test(@"""(?im-x+n)""", @" - - - - ( - ? - im-x+n - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOptionThatDoesNotChangeWhitespaceScanning() - { - Test(@"""(?i) """, @" - - - - ( - ? - i - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOptionThatDoesChangeWhitespaceScanning() - { - Test(@"""(?x) """, @" - - - - ( - ? - x - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOptionThatDoesChangeWhitespaceScanning2() - { - Test(@""" (?x) """, @" - - - - - - - ( - ? - x - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOptionThatDoesChangeWhitespaceScanning3() - { - Test(@""" (?-x) """, @" - - - - - - - ( - ? - -x - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestOptionRestoredWhenGroupPops() - { - Test(@""" ( (?-x) ) """, @" - - - - - - - ( - - - - - - ( - ? - -x - ) - - - - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNestedOptionGroup1() - { - Test(@""" (?-x:) """, @" - - - - - - - ( - ? - -x - : - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNestedOptionGroup2() - { - Test(@""" (?-x: ) """, @" - - - - - - - ( - ? - -x - : - - - - - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNestedOptionGroup3() - { - Test(@""" (?-x: (?+x: ) ) """, @" - - - - - - - ( - ? - -x - : - - - - - - ( - ? - +x - : - - - - - ) - - - - - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncompleteOptionsGroup1() - { - Test(@"""(?-x""", @" - - - - ( - ? - -x - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncompleteOptionsGroup2() - { - Test(@"""(?-x """, @" - - - - ( - ? - -x - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncorrectOptionsGroup3() - { - Test(@"""(?-x :""", @" - - - - ( - ? - -x - - - - : - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncorrectOptionsGroup4() - { - Test(@"""(?-x )""", @" - - - - ( - ? - -x - - - - - - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestIncorrectOptionsGroup5() - { - Test(@"""(?-x :)""", @" - - - - ( - ? - -x - - - - : - - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCloseParen() - { - Test(@""")""", @" - - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSingleChar() - { - Test(@"""a""", @" - - - - a - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTwoCharsChar() - { - Test(@"""ab""", @" - - - - ab - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuantifier() - { - Test(@"""a*""", @" - - - - - a - - * - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuestionQuantifier() - { - Test(@"""a*?""", @" - - - - - - a - - * - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuantifier() - { - Test(@"""a+""", @" - - - - - a - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuestionQuantifier() - { - Test(@"""a+?""", @" - - - - - - a - - + - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuantifier() - { - Test(@"""a?""", @" - - - - - a - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuestionQuantifier() - { - Test(@"""a??""", @" - - - - - - a - - ? - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestEmptySimpleGroup() - { - Test(@"""()""", @" - - - - ( - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestGroupWithSingleElement() - { - Test(@"""(a)""", @" - - - - ( - - - a - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestGroupWithMissingCloseParen() - { - Test(@"""(""", @" - - - - ( - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestGroupWithElementWithMissingCloseParen() - { - Test(@"""(a""", @" - - - - ( - - - a - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void JustBar() - { - Test(@"""|""", @" - - - - | - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void SpaceBar() - { - Test(@""" |""", @" - - - - - - - - | - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void BarSpace() - { - Test(@"""| """, @" - - - - | - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void SpaceBarSpace() - { - Test(@""" | """, @" - - - - - - - - | - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void JustBar_IgnoreWhitespace() - { - Test(@"""|""", @" - - - - | - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void SpaceBar_IgnoreWhitespace() - { - Test(@""" |""", @" - - - - - - - | - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void BarSpace_IgnoreWhitespace() - { - Test(@"""| """, @" - - - - | - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void SpaceBarSpace_IgnoreWhitespace() - { - Test(@""" | """, @" - - - - - - - | - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void DoubleBar() - { - Test(@"""||""", @" - - - - - | - - - | - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void BarInGroup() - { - Test(@"""(|)""", @" - - - - ( - - - | - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestExactNumericQuantifier() - { - Test(@"""a{0}""", @" - - - - - a - - { - 0 - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOpenRangeNumericQuantifier() - { - Test(@"""a{0,}""", @" - - - - - a - - { - 0 - , - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestClosedRangeNumericQuantifier() - { - Test(@"""a{0,1}""", @" - - - - - a - - { - 0 - , - 1 - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestLargeExactRangeNumericQuantifier1() - { - Test(@"""a{2147483647}""", @" - - - - - a - - { - 2147483647 - } - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeExactRangeNumericQuantifier2() - { - Test(@"""a{2147483648}""", @" - - - - - a - - { - 2147483648 - } - - - - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeOpenRangeNumericQuantifier1() - { - Test(@"""a{2147483647,}""", @" - - - - - a - - { - 2147483647 - , - } - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeOpenRangeNumericQuantifier2() - { - Test(@"""a{2147483648,}""", @" - - - - - a - - { - 2147483648 - , - } - - - - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeClosedRangeNumericQuantifier1() - { - Test(@"""a{0,2147483647}""", @" - - - - - a - - { - 0 - , - 2147483647 - } - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestLargeClosedRangeNumericQuantifier2() - { - Test(@"""a{0,2147483648}""", @" - - - - - a - - { - 0 - , - 2147483648 - } - - - - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void TestBadMinMaxClosedRangeNumericQuantifier() - { - Test(@"""a{1,0}""", @" - - - - - a - - { - 1 - , - 0 - } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestLazyExactNumericQuantifier() - { - Test(@"""a{0}?""", @" - - - - - - a - - { - 0 - } - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestLazyOpenNumericQuantifier() - { - Test(@"""a{0,}?""", @" - - - - - - a - - { - 0 - , - } - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestLazyClosedNumericQuantifier() - { - Test(@"""a{0,1}?""", @" - - - - - - a - - { - 0 - , - 1 - } - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestIncompleteNumericQuantifier1() - { - Test(@"""a{""", @" - - - - a{ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestIncompleteNumericQuantifier2() - { - Test(@"""a{0""", @" - - - - a{0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestIncompleteNumericQuantifier3() - { - Test(@"""a{0,""", @" - - - - a{0, - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestIncompleteNumericQuantifier4() - { - Test(@"""a{0,1""", @" - - - - a{0,1 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNotNumericQuantifier1() - { - Test(@"""a{0 }""", @" - - - - a{0 - - - - - - } - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier2() - { - Test(@"""a{0, }""", @" - - - - a{0, - - - - - - } - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier3() - { - Test(@"""a{0 ,}""", @" - - - - a{0 - - - - - - ,} - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier4() - { - Test(@"""a{0 ,1}""", @" - - - - a{0 - - - - - - ,1} - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier5() - { - Test(@"""a{0, 1}""", @" - - - - a{0, - - - - - - 1} - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNotNumericQuantifier6() - { - Test(@"""a{0,1 }""", @" - - - - a{0,1 - - - - - - } - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestLazyQuantifierDueToIgnoredWhitespace() - { - Test(@"""a* ?""", @" - - - - - - a - - * - - - - - ? - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNonLazyQuantifierDueToNonIgnoredWhitespace() - { - Test(@"""a* ?""", @" - - - - - a - - * - - - - - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuantifierAtStart() - { - Test(@"""*""", @" - - - - * - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuantifierAtStartOfGroup() - { - Test(@"""(*)""", @" - - - - ( - - - * - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestAsteriskQuantifierAfterQuantifier() - { - Test(@"""a**""", @" - - - - - a - - * - - - * - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuantifierAtStart() - { - Test(@"""+""", @" - - - - + - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuantifierAtStartOfGroup() - { - Test(@"""(+)""", @" - - - - ( - - - + - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPlusQuantifierAfterQuantifier() - { - Test(@"""a*+""", @" - - - - - a - - * - - - + - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuantifierAtStart() - { - Test(@"""?""", @" - - - - ? - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuantifierAtStartOfGroup() - { - Test(@"""(?)""", @" - - - - ( - - - ? - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestQuestionQuantifierAfterQuantifier() - { - Test(@"""a*??""", @" - - - - - - a - - * - - ? - - - ? - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericQuantifierAtStart() - { - Test(@"""{0}""", @" - - - - { - - - 0} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericQuantifierAtStartOfGroup() - { - Test(@"""({0})""", @" - - - - ( - - - { - - - 0} - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericQuantifierAfterQuantifier() - { - Test(@"""a*{0}""", @" - - - - - a - - * - - - { - - - 0} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonNumericQuantifierAtStart() - { - Test(@"""{0""", @" - - - - {0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonNumericQuantifierAtStartOfGroup() - { - Test(@"""({0)""", @" - - - - ( - - - {0 - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonNumericQuantifierAfterQuantifier() - { - Test(@"""a*{0""", @" - - - - - a - - * - - - {0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestEscapeAtEnd1() - { - Test(@"@""\""", @" - - - - \ - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestEscapeAtEnd2() - { - Test(@"""\\""", @" - - - - \ - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestSimpleEscape() - { - Test(@"@""\w""", @" - - - - \ - w - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPrimaryEscapes1() - { - Test(@"@""\b\B\A\G\Z\z\w\W\s\W\s\S\d\D""", @" - - - - \ - b - - - \ - B - - - \ - A - - - \ - G - - - \ - Z - - - \ - z - - - \ - w - - - \ - W - - - \ - s - - - \ - W - - - \ - s - - - \ - S - - - \ - d - - - \ - D - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape1() - { - Test(@"@""\c""", @" - - - - \ - c - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape2() - { - Test(@"@""\c<""", @" - - - - \ - c - - - - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape3() - { - Test(@"@""\ca""", @" - - - - \ - c - a - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape4() - { - Test(@"@""\cA""", @" - - - - \ - c - A - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape5() - { - Test(@"@""\c A""", @" - - - - \ - c - - - - A - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape6() - { - Test(@"@""\c(a)""", @" - - - - \ - c - - - - ( - - - a - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape7() - { - Test(@"@""\c>""", @" - - - - \ - c - - - - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape8() - { - Test(@"@""\c?""", @" - - - - - \ - c - - - ? - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape9() - { - Test(@"@""\c@""", @" - - - - \ - c - @ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape10() - { - Test(@"@""\c^""", @" - - - - \ - c - ^ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape11() - { - Test(@"@""\c_""", @" - - - - \ - c - _ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape12() - { - Test(@"@""\c`""", @" - - - - \ - c - - - - ` - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape13() - { - Test(@"@""\c{""", @" - - - - \ - c - - - - { - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape14() - { - Test(@"@""\ca""", @" - - - - \ - c - a - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape15() - { - Test(@"@""\cA""", @" - - - - \ - c - A - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape16() - { - Test(@"@""\cz""", @" - - - - \ - c - z - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestControlEscape17() - { - Test(@"@""\cZ""", @" - - - - \ - c - Z - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnknownEscape1() - { - Test(@"@""\m""", @" - - - - \ - m - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape1() - { - Test(@"@""\x""", @" - - - - \ - x - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape2() - { - Test(@"@""\x """, @" - - - - \ - x - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape3() - { - Test(@"@""\x0""", @" - - - - \ - x - 0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape4() - { - Test(@"@""\x0 """, @" - - - - \ - x - 0 - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape5() - { - Test(@"@""\x00""", @" - - - - \ - x - 00 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape6() - { - Test(@"@""\x00 """, @" - - - - \ - x - 00 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape7() - { - Test(@"@""\x000""", @" - - - - \ - x - 00 - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape8() - { - Test(@"@""\xff""", @" - - - - \ - x - ff - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape9() - { - Test(@"@""\xFF""", @" - - - - \ - x - FF - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape10() - { - Test(@"@""\xfF""", @" - - - - \ - x - fF - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape11() - { - Test(@"@""\xfff""", @" - - - - \ - x - ff - - - f - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestHexEscape12() - { - Test(@"@""\xgg""", @" - - - - \ - x - - - - gg - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnknownEscape2() - { - Test(@"@""\m """, @" - - - - \ - m - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape1() - { - Test(@"@""\u""", @" - - - - \ - u - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape2() - { - Test(@"@""\u0""", @" - - - - \ - u - 0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape3() - { - Test(@"@""\u00""", @" - - - - \ - u - 00 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape4() - { - Test(@"@""\u000""", @" - - - - \ - u - 000 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape5() - { - Test(@"@""\u0000""", @" - - - - \ - u - 0000 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape6() - { - Test(@"@""\u0000 """, @" - - - - \ - u - 0000 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape7() - { - Test(@"@""\u """, @" - - - - \ - u - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape8() - { - Test(@"@""\u0 """, @" - - - - \ - u - 0 - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestUnicodeEscape9() - { - Test(@"@""\ugggg""", @" - - - - \ - u - - - - gggg - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape1() - { - Test(@"@""\0""", @" - - - - \ - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape2() - { - Test(@"@""\0 """, @" - - - - \ - 0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape3() - { - Test(@"@""\00""", @" - - - - \ - 00 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape4() - { - Test(@"@""\00 """, @" - - - - \ - 00 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape5() - { - Test(@"@""\000""", @" - - - - \ - 000 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape6() - { - Test(@"@""\000 """, @" - - - - \ - 000 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape7() - { - Test(@"@""\0000""", @" - - - - \ - 000 - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape8() - { - Test(@"@""\0000 """, @" - - - - \ - 000 - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape9() - { - Test(@"@""\7""", @" - - - - \ - 7 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape10() - { - Test(@"@""\78""", @" - - - - \ - 7 - - - 8 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscape11() - { - Test(@"@""\8""", @" - - - - \ - 8 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestOctalEscapeEcmascript1() - { - Test(@"@""\40""", @" - - - - \ - 40 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestOctalEscapeEcmascript2() - { - Test(@"@""\401""", @" - - - - \ - 40 - - - 1 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestOctalEscapeEcmascript3() - { - Test(@"@""\37""", @" - - - - \ - 37 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestOctalEscapeEcmascript4() - { - Test(@"@""\371""", @" - - - - \ - 371 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestOctalEscapeEcmascript5() - { - Test(@"@""\0000""", @" - - - - \ - 000 - - - 0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEscape1() - { - Test(@"@""\k""", @" - - - - \ - k - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape2() - { - Test(@"@""\k """, @" - - - - \ - k - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape3() - { - Test(@"@""\k<""", @" - - - - \ - k - - - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape4() - { - Test(@"@""\k< """, @" - - - - \ - k - - - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape5() - { - Test(@"@""\k<0""", @" - - - - \ - k - - - <0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape6() - { - Test(@"@""\k<0 """, @" - - - - \ - k - - - <0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape7() - { - Test(@"@""\k<0>""", @" - - - - \ - k - < - 0 - > - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape8() - { - Test(@"@""\k<0> """, @" - - - - \ - k - < - 0 - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape9() - { - Test(@"@""\k<00> """, @" - - - - \ - k - < - 00 - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape10() - { - Test(@"@""\k """, @" - - - - \ - k - < - a - > - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEscape11() - { - Test(@"@""(?)\k """, @" - - - - ( - ? - < - a - > - - ) - - - \ - k - < - a - > - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureEcmaEscape1() - { - Test(@"@""\k""", @" - - - - \ - k - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape2() - { - Test(@"@""\k """, @" - - - - \ - k - - - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape3() - { - Test(@"@""\k<""", @" - - - - \ - k - - - < - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape4() - { - Test(@"@""\k< """, @" - - - - \ - k - - - < - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape5() - { - Test(@"@""\k<0""", @" - - - - \ - k - - - <0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape6() - { - Test(@"@""\k<0 """, @" - - - - \ - k - - - <0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape7() - { - Test(@"@""\k<0>""", @" - - - - \ - k - < - 0 - > - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureEcmaEscape8() - { - Test(@"@""\k<0> """, @" - - - - \ - k - < - 0 - > - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestKCaptureQuoteEscape3() - { - Test(@"@""\k'""", @" - - - - \ - k - - - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape4() - { - Test(@"@""\k' """, @" - - - - \ - k - - - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape5() - { - Test(@"@""\k'0""", @" - - - - \ - k - - - '0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape6() - { - Test(@"@""\k'0 """, @" - - - - \ - k - - - '0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape7() - { - Test(@"@""\k'0'""", @" - - - - \ - k - ' - 0 - ' - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape8() - { - Test(@"@""\k'0' """, @" - - - - \ - k - ' - 0 - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape9() - { - Test(@"@""\k'00' """, @" - - - - \ - k - ' - 00 - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape10() - { - Test(@"@""\k'a' """, @" - - - - \ - k - ' - a - ' - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureQuoteEscape11() - { - Test(@"@""(?)\k'a' """, @" - - - - ( - ? - < - a - > - - ) - - - \ - k - ' - a - ' - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureWrongQuote1() - { - Test(@"@""\k<0' """, @" - - - - \ - k - - - <0' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestKCaptureWrongQuote2() - { - Test(@"@""\k'0> """, @" - - - - \ - k - - - '0> - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape1() - { - Test(@"@""\""", @" - - - - \ - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape2() - { - Test(@"@""\ """, @" - - - - \ - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape3() - { - Test(@"@""\<""", @" - - - - \ - < - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape4() - { - Test(@"@""\< """, @" - - - - \ - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape5() - { - Test(@"@""\<0""", @" - - - - \ - < - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape6() - { - Test(@"@""\<0 """, @" - - - - \ - < - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape7() - { - Test(@"@""\<0>""", @" - - - - \ - < - 0 - > - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape8() - { - Test(@"@""\<0> """, @" - - - - \ - < - 0 - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape9() - { - Test(@"@""\<00> """, @" - - - - \ - < - 00 - > - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape10() - { - Test(@"@""\ """, @" - - - - \ - < - a - > - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEscape11() - { - Test(@"@""(?)\ """, @" - - - - ( - ? - < - a - > - - ) - - - \ - < - a - > - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureEcmaEscape1() - { - Test(@"@""\""", @" - - - - \ - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape2() - { - Test(@"@""\ """, @" - - - - \ - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape3() - { - Test(@"@""\<""", @" - - - - \ - < - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape4() - { - Test(@"@""\< """, @" - - - - \ - < - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape5() - { - Test(@"@""\<0""", @" - - - - \ - < - - - 0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape6() - { - Test(@"@""\<0 """, @" - - - - \ - < - - - 0 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape7() - { - Test(@"@""\<0>""", @" - - - - \ - < - 0 - > - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureEcmaEscape8() - { - Test(@"@""\<0> """, @" - - - - \ - < - 0 - > - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCaptureQuoteEscape3() - { - Test(@"@""\'""", @" - - - - \ - ' - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape4() - { - Test(@"@""\' """, @" - - - - \ - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape5() - { - Test(@"@""\'0""", @" - - - - \ - ' - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape6() - { - Test(@"@""\'0 """, @" - - - - \ - ' - - - 0 - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape7() - { - Test(@"@""\'0'""", @" - - - - \ - ' - 0 - ' - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape8() - { - Test(@"@""\'0' """, @" - - - - \ - ' - 0 - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape9() - { - Test(@"@""\'00' """, @" - - - - \ - ' - 00 - ' - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape10() - { - Test(@"@""\'a' """, @" - - - - \ - ' - a - ' - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureQuoteEscape11() - { - Test(@"@""(?)\'a' """, @" - - - - ( - ? - < - a - > - - ) - - - \ - ' - a - ' - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureWrongQuote1() - { - Test(@"@""\<0' """, @" - - - - \ - < - - - 0' - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureWrongQuote2() - { - Test(@"@""\'0> """, @" - - - - \ - ' - - - 0> - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestDefinedCategoryEscape() - { - Test(@"""\\p{Cc}""", @" - - - - \ - p - { - Cc - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestDefinedCategoryEscapeWithSpaces1() - { - Test(@"""\\p{ Cc }""", @" - - - - \ - p - - - { Cc } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestDefinedCategoryEscapeWithSpaces2() - { - Test(@"""\\p{ Cc }""", @" - - - - \ - p - - - { - - - - - - Cc - - - - - - } - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestDefinedCategoryEscapeWithSpaces3() - { - Test(@"""\\p {Cc}""", @" - - - - \ - p - - - - - - {Cc} - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestUndefinedCategoryEscape() - { - Test(@"""\\p{xxx}""", @" - - - - \ - p - { - xxx - } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape1() - { - Test(@"""\\p""", @" - - - - \ - p - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape2() - { - Test(@"""\\p{""", @" - - - - \ - p - - - { - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape3() - { - Test(@"""\\p{}""", @" - - - - \ - p - - - {} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape4() - { - Test(@"""\\p{} """, @" - - - - \ - p - - - {} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape5() - { - Test(@"""\\p {} """, @" - - - - \ - p - - - {} - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestTooShortCategoryEscape6() - { - Test(@"""\\p{Cc """, @" - - - - \ - p - - - {Cc - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCategoryNameWithDash() - { - Test(@"""\\p{IsArabicPresentationForms-A}""", @" - - - - \ - p - { - IsArabicPresentationForms-A - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonCapturingGrouping1() - { - Test(@"""(?:)""", @" - - - - ( - ? - : - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonCapturingGrouping2() - { - Test(@"""(?:a)""", @" - - - - ( - ? - : - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonCapturingGrouping3() - { - Test(@"""(?:""", @" - - - - ( - ? - : - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonCapturingGrouping4() - { - Test(@"""(?: """, @" - - - - ( - ? - : - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestPositiveLookaheadGrouping1() - { - Test(@"""(?=)""", @" - - - - ( - ? - = - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookaheadGrouping2() - { - Test(@"""(?=a)""", @" - - - - ( - ? - = - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookaheadGrouping3() - { - Test(@"""(?=""", @" - - - - ( - ? - = - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookaheadGrouping4() - { - Test(@"""(?= """, @" - - - - ( - ? - = - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNegativeLookaheadGrouping1() - { - Test(@"""(?!)""", @" - - - - ( - ? - ! - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookaheadGrouping2() - { - Test(@"""(?!a)""", @" - - - - ( - ? - ! - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookaheadGrouping3() - { - Test(@"""(?!""", @" - - - - ( - ? - ! - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookaheadGrouping4() - { - Test(@"""(?! """, @" - - - - ( - ? - ! - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNonBacktrackingGrouping1() - { - Test(@"""(?>)""", @" - - - - ( - ? - > - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonBacktrackingGrouping2() - { - Test(@"""(?>a)""", @" - - - - ( - ? - > - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonBacktrackingGrouping3() - { - Test(@"""(?>""", @" - - - - ( - ? - > - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNonBacktrackingGrouping4() - { - Test(@"""(?> """, @" - - - - ( - ? - > - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestPositiveLookbehindGrouping1() - { - Test(@"""(?<=)""", @" - - - - ( - ? - < - = - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookbehindGrouping2() - { - Test(@"""(?<=a)""", @" - - - - ( - ? - < - = - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookbehindGrouping3() - { - Test(@"""(?<=""", @" - - - - ( - ? - < - = - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestPositiveLookbehindGrouping4() - { - Test(@"""(?<= """, @" - - - - ( - ? - < - = - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNegativeLookbehindGrouping1() - { - Test(@"""(? - - - - ( - ? - < - ! - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookbehindGrouping2() - { - Test(@"""(? - - - - ( - ? - < - ! - - - a - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookbehindGrouping3() - { - Test(@"""(? - - - - ( - ? - < - ! - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegativeLookbehindGrouping4() - { - Test(@"""(? - - - - ( - ? - < - ! - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture1() - { - Test(@"""(?<""", @" - - - - ( - ? - < - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture2() - { - Test(@"""(?<>""", @" - - - - ( - ? - < - - > - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture3() - { - Test(@"""(? - - - - ( - ? - < - a - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture4() - { - Test(@"""(?""", @" - - - - ( - ? - < - a - > - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture5() - { - Test(@"""(?a""", @" - - - - ( - ? - < - a - > - - - a - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture6() - { - Test(@"""(?a)""", @" - - - - ( - ? - < - a - > - - - a - - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture7() - { - Test(@"""(?a)""", @" - - - - ( - ? - < - a - - - - >a - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNamedCapture8() - { - Test(@"""(?a)""", @" - - - - ( - ? - < - a - - - - - - - >a - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture9() - { - Test(@"""(?< a>a)""", @" - - - - ( - ? - < - - - - - a>a - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNamedCapture10() - { - Test(@"""(?< a>a)""", @" - - - - ( - ? - < - - - - - - - - a>a - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture11() - { - Test(@"""(?< a >a)""", @" - - - - ( - ? - < - - - - - a >a - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNamedCapture12() - { - Test(@"""(?< a >a)""", @" - - - - ( - ? - < - - - - - - - - a - - - - - - >a - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedCapture13() - { - Test(@"""(?a)""", @" - - - - ( - ? - < - ab - > - - - a - - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestZeroNumberCapture() - { - Test(@"""(?<0>a)""", @" - - - - ( - ? - < - 0 - > - - - a - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNumericNumberCapture1() - { - Test(@"""(?<1>a)""", @" - - - - ( - ? - < - 1 - > - - - a - - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNumericNumberCapture2() - { - Test(@"""(?<10>a)""", @" - - - - ( - ? - < - 10 - > - - - a - - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNumericNumberCapture3() - { - Test(@"""(?<1>)""", @" - - - - ( - ? - < - 1 - > - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericNumberCapture4() - { - Test(@"""(?<1> )""", @" - - - - ( - ? - < - 1 - > - - - - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNumericNumberCapture6() - { - Test(@"""(?<1> )""", @" - - - - ( - ? - < - 1 - > - - - - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping1() - { - Test(@"""(?<-""", @" - - - - ( - ? - < - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping2() - { - Test(@"""(?<-0""", @" - - - - ( - ? - < - - - - 0 - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping3() - { - Test(@"""(?<-0)""", @" - - - - ( - ? - < - - - - 0 - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping4() - { - Test(@"""(?<-0>""", @" - - - - ( - ? - < - - - - 0 - > - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping5() - { - Test(@"""(?<-0>)""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping6() - { - Test(@"""(?<-0 >)""", @" - - - - ( - ? - < - - - - 0 - - - - - - - > - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping7() - { - Test(@"""(?<- 0 >)""", @" - - - - ( - ? - < - - - - - - - - - - - 0 - - - - - - > - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping8() - { - Test(@"""(?<- 0>)""", @" - - - - ( - ? - < - - - - - - - - - - - 0> - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping9() - { - Test(@"""(?<-00>)""", @" - - - - ( - ? - < - - - - 00 - > - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping10() - { - Test(@"""(? - - - - ( - ? - < - a - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping11() - { - Test(@"""(? - - - - ( - ? - < - a - - - 0 - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping12() - { - Test(@"""(? - - - - ( - ? - < - a - - - 0 - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping13() - { - Test(@"""(?""", @" - - - - ( - ? - < - a - - - 0 - > - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping14() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - 0 - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping15() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - 0 - - - - - - - > - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping16() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - - - - - - - - 0 - - - - - - > - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping17() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - - - - - - - - 0> - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGrouping18() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - 00 - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingUndefinedReference1() - { - Test(@"""(?<-1>)""", @" - - - - ( - ? - < - - - - 1 - > - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingDefinedReferenceBehind() - { - Test(@"""()(?<-1>)""", @" - - - - ( - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingDefinedReferenceAhead() - { - Test(@"""(?<-1>)()""", @" - - - - ( - ? - < - - - - 1 - > - - ) - - - ( - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingNamedReferenceBehind() - { - Test(@"""(?)(?<-a>)""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - < - - - - a - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingNamedReferenceAhead() - { - Test(@"""(?<-a>)(?)""", @" - - - - ( - ? - < - - - - a - > - - ) - - - ( - ? - < - a - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingNumberedReferenceBehind() - { - Test(@"""(?<4>)(?<-4>)""", @" - - - - ( - ? - < - 4 - > - - ) - - - ( - ? - < - - - - 4 - > - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingNumberedReferenceAhead() - { - Test(@"""(?<-4>)(?<4>)""", @" - - - - ( - ? - < - - - - 4 - > - - ) - - - ( - ? - < - 4 - > - - ) - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumberedExists() - { - Test(@"""(?)(?)(?<-1>)(?<-2>)""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - < - b - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers() - { - Test(@"""()()(?<-0>)(?<-1>)(?<-2>)(?<-3>)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers1() - { - Test(@"""()(?)(?<-0>)(?<-1>)(?<-2>)(?<-3>)""", @" - - - - ( - - ) - - - ( - ? - < - a - > - - ) - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers2() - { - Test(@"""(?)()(?<-0>)(?<-1>)(?<-2>)(?<-3>)""", @" - - - - ( - ? - < - a - > - - ) - - - ( - - ) - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers3() - { - Test(@"""(?)(?)(?<-0>)(?<-1>)(?<-2>)(?<-3>)""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - < - b - > - - ) - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers4() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)()()""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - - ) - - - ( - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers5_1() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)()(?""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - - ) - - - ( - - - ? - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers5() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)()(?)""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - - ) - - - ( - ? - < - a - > - - ) - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers6() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)(?)()""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - ? - < - a - > - - ) - - - ( - - ) - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers7_1() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)(?)(?""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - ? - < - a - > - - ) - - - ( - - - ? - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBalancingGroupingAutoNumbers7() - { - Test(@"""(?<-0>)(?<-1>)(?<-2>)(?<-3>)(?)(?)""", @" - - - - ( - ? - < - - - - 0 - > - - ) - - - ( - ? - < - - - - 1 - > - - ) - - - ( - ? - < - - - - 2 - > - - ) - - - ( - ? - < - - - - 3 - > - - ) - - - ( - ? - < - a - > - - ) - - - ( - ? - < - b - > - - ) - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestReferenceToBalancingGroupCaptureName1() - { - Test(@"""(?)(?)""", @" - - - - ( - ? - < - a - - - 0 - > - - ) - - - ( - ? - < - b - - - a - > - - ) - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestReferenceToBalancingGroupCaptureName2() - { - Test(@"""(?)(?<-a>)""", @" - - - - ( - ? - < - a - - - 0 - > - - ) - - - ( - ? - < - - - - a - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestReferenceToSameBalancingGroup() - { - Test(@"""(?)""", @" - - - - ( - ? - < - a - - - a - > - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestQuoteNamedCapture() - { - Test(@"""(?'a')""", @" - - - - ( - ? - ' - a - ' - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestQuoteBalancingCapture1() - { - Test(@"""(?'-0')""", @" - - - - ( - ? - ' - - - - 0 - ' - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestQuoteBalancingCapture2() - { - Test(@"""(?'a-0')""", @" - - - - ( - ? - ' - a - - - 0 - ' - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestMismatchedOpenCloseCapture1() - { - Test(@"""(? - - - - ( - ? - < - a - - - 0 - - - - ' - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestMismatchedOpenCloseCapture2() - { - Test(@"""(?'a-0>)""", @" - - - - ( - ? - ' - a - - - 0 - - - - > - - - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture1() - { - Test(@"""(?(""", @" - - - - ( - ? - - ( - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture2() - { - Test(@"""(?(0""", @" - - - - ( - ? - ( - 0 - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture3() - { - Test(@"""(?(0)""", @" - - - - ( - ? - ( - 0 - ) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture4() - { - Test(@"""(?(0))""", @" - - - - ( - ? - ( - 0 - ) - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture5() - { - Test(@"""(?(0)a)""", @" - - - - ( - ? - ( - 0 - ) - - - a - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture6() - { - Test(@"""(?(0)a|)""", @" - - - - ( - ? - ( - 0 - ) - - - - a - - - | - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture7() - { - Test(@"""(?(0)a|b)""", @" - - - - ( - ? - ( - 0 - ) - - - - a - - - | - - - b - - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture8() - { - Test(@"""(?(0)a|b|)""", @" - - - - ( - ? - ( - 0 - ) - - - - - a - - - | - - - b - - - - | - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture9() - { - Test(@"""(?(0)a|b|c)""", @" - - - - ( - ? - ( - 0 - ) - - - - - a - - - | - - - b - - - - | - - - c - - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture10() - { - Test(@"""(?(0 )""", @" - - - - ( - ? - ( - 0 - - - - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture11() - { - Test(@"""(?(1))""", @" - - - - ( - ? - ( - 1 - ) - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestConditionalCapture12() - { - Test(@"""(?(00))""", @" - - - - ( - ? - ( - 00 - ) - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedConditionalCapture1() - { - Test(@"""(?(a))""", @" - - - - ( - ? - - ( - - - a - - - ) - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedConditionalCapture2() - { - Test(@"""(?)(?(a))""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - ( - a - ) - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedConditionalCapture3() - { - Test(@"""(?)(?(a ))""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - - ( - - - a - - - - - - ) - - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNamedConditionalCapture4() - { - Test(@"""(?)(?( a))""", @" - - - - ( - ? - < - a - > - - ) - - - ( - ? - - ( - - - - - - a - - - ) - - - ) - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestNestedGroupsInConditionalGrouping1() - { - Test(@"""(?(()a()))""", @" - - - - ( - ? - - ( - - - ( - - ) - - - a - - - ( - - ) - - - ) - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNestedGroupsInConditionalGrouping2() - { - Test(@"""(?((?)a(?)))""", @" - - - - ( - ? - - ( - - - ( - ? - < - x - > - - ) - - - a - - - ( - ? - < - y - > - - ) - - - ) - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptureInConditionalGrouping1() - { - Test(@"""(?(?'""", @" - - - - ( - ? - - ( - ? - ' - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCaptureInConditionalGrouping2() - { - Test(@"""(?(?'x'))""", @" - - - - ( - ? - - ( - ? - ' - x - ' - - ) - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCommentInConditionalGrouping1() - { - Test(@"""(?(?#""", @" - - - - ( - ? - - ( - - - ? - - - - - - - - - - - # - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCommentInConditionalGrouping2() - { - Test(@"""(?(?#)""", @" - - - - ( - ? - - ( - - - ? - - - - - - - - - - - #) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestCommentInConditionalGrouping3() - { - Test(@"""(?(?#))""", @" - - - - ( - ? - - ( - - - ? - - - - - - - - - - - #)) - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping1() - { - Test(@"""(?(?<""", @" - - - - ( - ? - - ( - ? - < - - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping2() - { - Test(@"""(?(? - - - - ( - ? - - ( - ? - < - a - - - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping3() - { - Test(@"""(?(?""", @" - - - - ( - ? - - ( - ? - < - a - > - - - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping4() - { - Test(@"""(?(?)""", @" - - - - ( - ? - - ( - ? - < - a - > - - ) - - - - - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestAngleCaptureInConditionalGrouping5() - { - Test(@"""(?(?))""", @" - - - - ( - ? - - ( - ? - < - a - > - - ) - - - ) - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestLookbehindAssertionInConditionalGrouping1() - { - Test(@"""(?(?<=))""", @" - - - - ( - ? - - ( - ? - < - = - - ) - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestLookbehindAssertionInConditionalGrouping2() - { - Test(@"""(?(? - - - - ( - ? - - ( - ? - < - ! - - ) - - - ) - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void TestBackreference1() - { - Test(@"@""\1""", @" - - - - \ - 1 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestBackreference2() - { - Test(@"@""\1 """, @" - - - - \ - 1 - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestBackreference3() - { - Test(@"@""()\1""", @" - - - - ( - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestBackreference4() - { - Test(@"@""()\1 """, @" - - - - ( - - ) - - - \ - 1 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestBackreference5() - { - Test(@"@""()\10 """, @" - - - - ( - - ) - - - \ - 10 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestEcmascriptBackreference1() - { - Test(@"@""\1""", @" - - - - \ - 1 - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmascriptBackreference2() - { - Test(@"@""\1 """, @" - - - - \ - 1 - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmascriptBackreference3() - { - Test(@"@""()\1""", @" - - - - ( - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmaBackreference4() - { - Test(@"@""()\1 """, @" - - - - ( - - ) - - - \ - 1 - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmascriptBackreference5() - { - Test(@"@""()\10 """, @" - - - - ( - - ) - - - \ - 1 - - - 0 - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestEcmascriptBackreference6() - { - Test(@"@""()()()()()()()()()()\10 """, @" - - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - ( - - ) - - - \ - 10 - - - - - - - - - - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void TestCharacterClass1() - { - Test(@"@""[""", @" - - - - [ - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass2() - { - Test(@"@""[ """, @" - - - - [ - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass3() - { - Test(@"@""[]""", @" - - - - [ - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass4() - { - Test(@"@""[] """, @" - - - - [ - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass5() - { - Test(@"@""[a]""", @" - - - - [ - - - a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass6() - { - Test(@"@""[a] """, @" - - - - [ - - - a - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass7() - { - Test(@"@""[a-""", @" - - - - [ - - - - a - - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass8() - { - Test(@"@""[a- """, @" - - - - [ - - - - a - - - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass9() - { - Test(@"@""[a-]""", @" - - - - [ - - - a- - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass10() - { - Test(@"@""[a-] """, @" - - - - [ - - - a- - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass11() - { - Test(@"@""[a-b]""", @" - - - - [ - - - - a - - - - - b - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass12() - { - Test(@"@""[a-b] """, @" - - - - [ - - - - a - - - - - b - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass13() - { - Test(@"@""[a-[b]] """, @" - - - - [ - - - a - - - - - - [ - - - b - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass14() - { - Test(@"@""[a-b-[c]] """, @" - - - - [ - - - - a - - - - - b - - - - - - - [ - - - c - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass15() - { - Test(@"@""[a-[b]-c] """, @" - - - - [ - - - a - - - - - - [ - - - b - - - ] - - - - -c - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass16() - { - Test(@"@""[[a]-b] """, @" - - - - [ - - - [a - - - ] - - - -b] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass17() - { - Test(@"@""[[a]-[b]] """, @" - - - - [ - - - [a - - - ] - - - - - - - [ - - - b - - - ] - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass18() - { - Test(@"@""[\w-a] """, @" - - - - [ - - - \ - w - - - -a - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass19() - { - Test(@"@""[a-\w] """, @" - - - - [ - - - - a - - - - - \ - w - - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass20() - { - Test(@"@""[\p{llll}-a] """, @" - - - - [ - - - \ - p - { - llll - } - - - -a - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass21() - { - Test(@"@""[\p{Lu}-a] """, @" - - - - [ - - - \ - p - { - Lu - } - - - -a - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass22() - { - Test(@"@""[a-\p{Lu}] """, @" - - - - [ - - - - a - - - - - \ - p - { - Lu - } - - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass23() - { - Test(@"@""[a-[:Ll:]] """, @" - - - - [ - - - a - - - - - - [ - - - :Ll: - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass24() - { - Test(@"@""[a-[:Ll]] """, @" - - - - [ - - - a - - - - - - [ - - - :Ll - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass25() - { - Test(@"@""[a-[:""", @" - - - - [ - - - a - - - - - - [ - - - : - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass26() - { - Test(@"@""[a-[:L""", @" - - - - [ - - - a - - - - - - [ - - - :L - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass27() - { - Test(@"@""[a-[:L:""", @" - - - - [ - - - a - - - - - - [ - - - :L: - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass28() - { - Test(@"@""[a-[:L:]""", @" - - - - [ - - - a - - - - - - [ - - - :L: - - - ] - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass29() - { - Test(@"@""[\-]""", @" - - - - [ - - - \ - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass30() - { - Test(@"@""[a-b-c] """, @" - - - - [ - - - - a - - - - - b - - - - -c - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass31() - { - Test(@"@""[-b-c] """, @" - - - - [ - - - - - - - - b - - - - - c - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass32() - { - Test(@"@""[-[b] """, @" - - - - [ - - - -[b - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass33() - { - Test(@"@""[-[b]] """, @" - - - - [ - - - -[b - - - ] - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass34() - { - Test(@"@""[--b """, @" - - - - [ - - - - - - - - - - b - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass35() - { - Test(@"@""[--b] """, @" - - - - [ - - - - - - - - - - b - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass36() - { - Test(@"@""[--[b """, @" - - - - [ - - - - - - - - - - [ - - - b - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass37() - { - Test(@"@""[--[b] """, @" - - - - [ - - - - - - - - - - [ - - - b - - - ] - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass38() - { - Test(@"@""[--[b]] """, @" - - - - [ - - - - - - - - - - [ - - - b - - - ] - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass39() - { - Test(@"@""[a--[b """, @" - - - - [ - - - - a - - - - - - - - - - [b - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass40() - { - Test(@"@""[,--[a] """, @" - - - - [ - - - - , - - - - - - - - - - [a - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass41() - { - Test(@"@""[,--[a]] """, @" - - - - [ - - - - , - - - - - - - - - - [a - - - ] - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass42() - { - Test(@"@""[\s-a]""", @" - - - - [ - - - \ - s - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass43() - { - Test(@"@""[\p{Lu}-a]""", @" - - - - [ - - - \ - p - { - Lu - } - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClass44() - { - Test(@"@""[\p{Lu}-a]""", @" - - - - [ - - - \ - p - { - Lu - } - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestNegatedCharacterClass1() - { - Test(@"@""[a]""", @" - - - - [ - - - a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange1() - { - Test(@"@""[\c<-\c>]""", @" - - - - [ - - - \ - c - - - - - < - - - - - \ - c - - - - - > - - - ] - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange2() - { - Test(@"@""[\c>-\c<]""", @" - - - - [ - - - \ - c - - - - - > - - - - - \ - c - - - - - < - - - ] - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange3() - { - Test(@"@""[\c>-a]""", @" - - - - [ - - - \ - c - - - - - > - - - - - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange4() - { - Test(@"@""[a-\c>]""", @" - - - - [ - - - - a - - - - - \ - c - - - - - > - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange5() - { - Test(@"@""[a--]""", @" - - - - [ - - - - a - - - - - - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange6() - { - Test(@"@""[--a]""", @" - - - - [ - - - - - - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange7() - { - Test(@"@""[a-\-]""", @" - - - - [ - - - - a - - - - - - \ - - - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange8() - { - Test(@"@""[\--a]""", @" - - - - [ - - - \ - - - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange9() - { - Test(@"@""[\0-\1]""", @" - - - - [ - - - - \ - 0 - - - - - \ - 1 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange10() - { - Test(@"@""[\1-\0]""", @" - - - - [ - - - - \ - 1 - - - - - \ - 0 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange11() - { - Test(@"@""[\0-\01]""", @" - - - - [ - - - - \ - 0 - - - - - \ - 01 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange12() - { - Test(@"@""[\01-\0]""", @" - - - - [ - - - - \ - 01 - - - - - \ - 0 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange13() - { - Test(@"@""[[:x:]-a]""", @" - - - - [ - - - - [:x:] - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange14() - { - Test(@"@""[a-[:x:]]""", @" - - - - [ - - - a - - - - - - [ - - - :x: - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange15() - { - Test(@"@""[\0-\ca]""", @" - - - - [ - - - - \ - 0 - - - - - \ - c - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange16() - { - Test(@"@""[\ca-\0]""", @" - - - - [ - - - - \ - c - a - - - - - \ - 0 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange17() - { - Test(@"@""[\ca-\cA]""", @" - - - - [ - - - - \ - c - a - - - - - \ - c - A - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange18() - { - Test(@"@""[\cA-\ca]""", @" - - - - [ - - - - \ - c - A - - - - - \ - c - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange19() - { - Test(@"@""[\u0-\u1]""", @" - - - - [ - - - - \ - u - 0 - - - - - \ - u - 1 - - - - ] - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange20() - { - Test(@"@""[\u1-\u0]""", @" - - - - [ - - - - \ - u - 1 - - - - - \ - u - 0 - - - - ] - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange21() - { - Test(@"@""[\u0000-\u0000]""", @" - - - - [ - - - - \ - u - 0000 - - - - - \ - u - 0000 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange22() - { - Test(@"@""[\u0000-\u0001]""", @" - - - - [ - - - - \ - u - 0000 - - - - - \ - u - 0001 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange23() - { - Test(@"@""[\u0001-\u0000]""", @" - - - - [ - - - - \ - u - 0001 - - - - - \ - u - 0000 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange24() - { - Test(@"@""[\u0001-a]""", @" - - - - [ - - - - \ - u - 0001 - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange25() - { - Test(@"@""[a-\u0001]""", @" - - - - [ - - - - a - - - - - \ - u - 0001 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange26() - { - Test(@"@""[a-a]""", @" - - - - [ - - - - a - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange27() - { - Test(@"@""[a-A]""", @" - - - - [ - - - - a - - - - - A - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange28() - { - Test(@"@""[A-a]""", @" - - - - [ - - - - A - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange29() - { - Test(@"@""[a-a]""", @" - - - - [ - - - - a - - - - - a - - - - ] - - - - - - - -", RegexOptions.IgnoreCase); - } - - [Fact] - public void TestCharacterClassRange30() - { - Test(@"@""[a-A]""", @" - - - - [ - - - - a - - - - - A - - - - ] - - - - - - - - - - -", RegexOptions.IgnoreCase); - } - - [Fact] - public void TestCharacterClassRange31() - { - Test(@"@""[A-a]""", @" - - - - [ - - - - A - - - - - a - - - - ] - - - - - - - -", RegexOptions.IgnoreCase); - } - - [Fact] - public void TestCharacterClassRange32() - { - Test(@"@""[a-\x61]""", @" - - - - [ - - - - a - - - - - \ - x - 61 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange33() - { - Test(@"@""[\x61-a]""", @" - - - - [ - - - - \ - x - 61 - - - - - a - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange34() - { - Test(@"@""[a-\x60]""", @" - - - - [ - - - - a - - - - - \ - x - 60 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange35() - { - Test(@"@""[\x62-a]""", @" - - - - [ - - - - \ - x - 62 - - - - - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange36() - { - Test(@"@""[a-\x62]""", @" - - - - [ - - - - a - - - - - \ - x - 62 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange37() - { - Test(@"@""[\x62-a]""", @" - - - - [ - - - - \ - x - 62 - - - - - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange38() - { - Test(@"@""[\3-\cc]""", @" - - - - [ - - - - \ - 3 - - - - - \ - c - c - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange39() - { - Test(@"@""[\cc-\3]""", @" - - - - [ - - - - \ - c - c - - - - - \ - 3 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange40() - { - Test(@"@""[\2-\cc]""", @" - - - - [ - - - - \ - 2 - - - - - \ - c - c - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange41() - { - Test(@"@""[\cc-\2]""", @" - - - - [ - - - - \ - c - c - - - - - \ - 2 - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange42() - { - Test(@"@""[\4-\cc]""", @" - - - - [ - - - - \ - 4 - - - - - \ - c - c - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange43() - { - Test(@"@""[\cc-\4]""", @" - - - - [ - - - - \ - c - c - - - - - \ - 4 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange44() - { - Test(@"@""[\ca-\cb]""", @" - - - - [ - - - - \ - c - a - - - - - \ - c - b - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange45() - { - Test(@"@""[\ca-\cB]""", @" - - - - [ - - - - \ - c - a - - - - - \ - c - B - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange46() - { - Test(@"@""[\cA-\cb]""", @" - - - - [ - - - - \ - c - A - - - - - \ - c - b - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange47() - { - Test(@"@""[\cA-\cB]""", @" - - - - [ - - - - \ - c - A - - - - - \ - c - B - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange48() - { - Test(@"@""[\cb-\ca]""", @" - - - - [ - - - - \ - c - b - - - - - \ - c - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange49() - { - Test(@"@""[\cb-\cA]""", @" - - - - [ - - - - \ - c - b - - - - - \ - c - A - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange50() - { - Test(@"@""[\cB-\ca]""", @" - - - - [ - - - - \ - c - B - - - - - \ - c - a - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange51() - { - Test(@"@""[\cB-\cA]""", @" - - - - [ - - - - \ - c - B - - - - - \ - c - A - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange52() - { - Test(@"@""[\--a]""", @" - - - - [ - - - \ - - - - - -a - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange53() - { - Test(@"@""[\--#]""", @" - - - - [ - - - \ - - - - - -# - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange54() - { - Test(@"@""[a-\-]""", @" - - - - [ - - - - a - - - - - - \ - - - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange55() - { - Test(@"@""[a-\-b]""", @" - - - - [ - - - - a - - - - - - \ - - - - - b - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange56() - { - Test(@"@""[a-\-\-b]""", @" - - - - [ - - - - a - - - - - - \ - - - - - \ - - - - - b - - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange57() - { - Test(@"@""[b-\-a]""", @" - - - - [ - - - - b - - - - - - \ - - - - - a - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange58() - { - Test(@"@""[b-\-\-a]""", @" - - - - [ - - - - b - - - - - - \ - - - - - \ - - - - - a - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange59() - { - Test(@"@""[a-\-\D]""", @" - - - - [ - - - - a - - - - - - \ - - - - - \ - D - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange60() - { - Test(@"@""[a-\-\-\D]""", @" - - - - [ - - - - a - - - - - - \ - - - - - \ - - - - - \ - D - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCharacterClassRange61() - { - Test(@"@""[a -\-\b]""", @" - - - - [ - - - a - - - - - - - - - - \ - - - - - \ - b - - - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures1() - { - Test(@"@""()\1""", @" - - - - ( - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures2() - { - Test(@"@""()\2""", @" - - - - ( - - ) - - - \ - 2 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures3() - { - Test(@"@""()()\2""", @" - - - - ( - - ) - - - ( - - ) - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures4() - { - Test(@"@""()\1""", @" - - - - ( - - ) - - - \ - 1 - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures5() - { - Test(@"@""()\2""", @" - - - - ( - - ) - - - \ - 2 - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures6() - { - Test(@"@""()()\2""", @" - - - - ( - - ) - - - ( - - ) - - - \ - 2 - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures7() - { - Test(@"@""()()(?n)\1\2""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - n - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures8() - { - Test(@"@""()(?n)()\1\2""", @" - - - - ( - - ) - - - ( - ? - n - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures9() - { - Test(@"@""(?n)()()\1\2""", @" - - - - ( - ? - n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures10() - { - Test(@"@""()()(?n)\1\2""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - n - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures11() - { - Test(@"@""()(?n)()\1\2""", @" - - - - ( - - ) - - - ( - ? - n - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures12() - { - Test(@"@""(?n)()()\1\2""", @" - - - - ( - ? - n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures13() - { - Test(@"@""()()(?-n)\1\2""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - -n - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures14() - { - Test(@"@""()(?-n)()\1\2""", @" - - - - ( - - ) - - - ( - ? - -n - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures15() - { - Test(@"@""(?-n)()()\1\2""", @" - - - - ( - ? - -n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures16() - { - Test(@"@""()()(?-n)\1\2""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - -n - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures17() - { - Test(@"@""()(?-n)()\1\2""", @" - - - - ( - - ) - - - ( - ? - -n - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures18() - { - Test(@"@""(?-n)()()\1\2""", @" - - - - ( - ? - -n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures19() - { - Test(@"@""()()(?n:\1\2)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - n - : - - - \ - 1 - - - \ - 2 - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures20() - { - Test(@"@""()()(?n:\1\2)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - n - : - - - \ - 1 - - - \ - 2 - - - ) - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures21() - { - Test(@"@""()()(?-n:\1\2)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - -n - : - - - \ - 1 - - - \ - 2 - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures22() - { - Test(@"@""()()(?-n:\1\2)""", @" - - - - ( - - ) - - - ( - - ) - - - ( - ? - -n - : - - - \ - 1 - - - \ - 2 - - - ) - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures23() - { - Test(@"@""(?n:)()()\1\2""", @" - - - - ( - ? - n - : - - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures24() - { - Test(@"@""(?n:)()()\1\2""", @" - - - - ( - ? - n - : - - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures25() - { - Test(@"@""(?-n:)()()\1\2""", @" - - - - ( - ? - -n - : - - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures26() - { - Test(@"@""(?-n:)()()\1\2""", @" - - - - ( - ? - -n - : - - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures27() - { - Test(@"@""(?n)(?-n)()()\1\2""", @" - - - - ( - ? - n - ) - - - ( - ? - -n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures28() - { - Test(@"@""(?n)(?-n)()()\1\2""", @" - - - - ( - ? - n - ) - - - ( - ? - -n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - - [Fact] - public void TestCaptures29() - { - Test(@"@""(?-n)(?n)()()\1\2""", @" - - - - ( - ? - -n - ) - - - ( - ? - n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void TestCaptures30() - { - Test(@"@""(?-n)(?n)()()\1\2""", @" - - - - ( - ? - -n - ) - - - ( - ? - n - ) - - - ( - - ) - - - ( - - ) - - - \ - 1 - - - \ - 2 - - - - - - - - - - - -", RegexOptions.ExplicitCapture); - } - } -} diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs deleted file mode 100644 index f8dbde1e0c46c..0000000000000 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs +++ /dev/null @@ -1,5335 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Text.RegularExpressions; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - public partial class CSharpRegexParserTests - { - [Fact] - public void NegativeTest0() - { - Test(@"@""cat([a-\d]*)dog""", @" - - - - cat - - - ( - - - - [ - - - - a - - - - - \ - d - - - - ] - - * - - - ) - - - dog - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest1() - { - Test(@"@""\k<1""", @" - - - - \ - k - - - <1 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest2() - { - Test(@"@""\k<""", @" - - - - \ - k - - - < - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest3() - { - Test(@"@""\k""", @" - - - - \ - k - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest4() - { - Test(@"@""\1""", @" - - - - \ - 1 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest5() - { - Test(@"@""(?')""", @" - - - - ( - ? - ' - - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest6() - { - Test(@"@""(?<)""", @" - - - - ( - ? - < - - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest7() - { - Test(@"@""(?)""", @" - - - - ( - - - ? - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest8() - { - Test(@"@""(?>""", @" - - - - ( - ? - > - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest9() - { - Test(@"@""(? - - - - ( - ? - < - ! - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest10() - { - Test(@"@""(?<=""", @" - - - - ( - ? - < - = - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest11() - { - Test(@"@""(?!""", @" - - - - ( - ? - ! - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest12() - { - Test(@"@""(?=""", @" - - - - ( - ? - = - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest13() - { - Test(@"@""(?imn )""", @" - - - - ( - ? - imn - - - - - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest14() - { - Test(@"@""(?imn""", @" - - - - ( - ? - imn - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest15() - { - Test(@"@""(?:""", @" - - - - ( - ? - : - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest16() - { - Test(@"@""(?'cat'""", @" - - - - ( - ? - ' - cat - ' - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest17() - { - Test(@"@""(?'""", @" - - - - ( - ? - ' - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest18() - { - Test(@"@""[^""", @" - - - - [ - ^ - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest19() - { - Test(@"@""[cat""", @" - - - - [ - - - cat - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest20() - { - Test(@"@""[^cat""", @" - - - - [ - ^ - - - cat - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest21() - { - Test(@"@""[a-""", @" - - - - [ - - - - a - - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest22() - { - Test(@"@""\p{""", @" - - - - \ - p - - - { - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest23() - { - Test(@"@""\p{cat""", @" - - - - \ - p - - - {cat - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest24() - { - Test(@"@""\k - - - - \ - k - - - <cat - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest25() - { - Test(@"@""\p{cat}""", @" - - - - \ - p - { - cat - } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest26() - { - Test(@"@""\P{cat""", @" - - - - \ - P - - - {cat - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest27() - { - Test(@"@""\P{cat}""", @" - - - - \ - P - { - cat - } - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest28() - { - Test(@"@""(""", @" - - - - ( - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest29() - { - Test(@"@""(?""", @" - - - - ( - - - ? - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest30() - { - Test(@"@""(?<""", @" - - - - ( - ? - < - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest31() - { - Test(@"@""(?""", @" - - - - ( - ? - < - cat - > - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest32() - { - Test(@"@""\P{""", @" - - - - \ - P - - - { - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest33() - { - Test(@"@""\k<>""", @" - - - - \ - k - - - <> - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest34() - { - Test(@"@""(?(""", @" - - - - ( - ? - - ( - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest35() - { - Test(@"@""(?()|""", @" - - - - ( - ? - - ( - - ) - - - - | - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest36() - { - Test(@"@""?(a|b)""", @" - - - - ? - - - ( - - - - a - - - | - - - b - - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest37() - { - Test(@"@""?((a)""", @" - - - - ? - - - ( - - - ( - - - a - - - ) - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest38() - { - Test(@"@""?((a)a""", @" - - - - ? - - - ( - - - ( - - - a - - - ) - - - a - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest39() - { - Test(@"@""?((a)a|""", @" - - - - ? - - - ( - - - - ( - - - a - - - ) - - - a - - - | - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest40() - { - Test(@"@""?((a)a|b""", @" - - - - ? - - - ( - - - - ( - - - a - - - ) - - - a - - - | - - - b - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest41() - { - Test(@"@""(?(?i))""", @" - - - - ( - ? - - ( - ? - i - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest42() - { - Test(@"@""?(a)""", @" - - - - ? - - - ( - - - a - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest43() - { - Test(@"@""(?(?I))""", @" - - - - ( - ? - - ( - ? - I - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest44() - { - Test(@"@""(?(?M))""", @" - - - - ( - ? - - ( - ? - M - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest45() - { - Test(@"@""(?(?s))""", @" - - - - ( - ? - - ( - ? - s - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest46() - { - Test(@"@""(?(?S))""", @" - - - - ( - ? - - ( - ? - S - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest47() - { - Test(@"@""(?(?x))""", @" - - - - ( - ? - - ( - ? - x - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest48() - { - Test(@"@""(?(?X))""", @" - - - - ( - ? - - ( - ? - X - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest49() - { - Test(@"@""(?(?n))""", @" - - - - ( - ? - - ( - ? - n - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest50() - { - Test(@"@""(?(?m))""", @" - - - - ( - ? - - ( - ? - m - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest51() - { - Test(@"@""[a""", @" - - - - [ - - - a - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest52() - { - Test(@"@""?(a:b)""", @" - - - - ? - - - ( - - - a:b - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest53() - { - Test(@"@""(?(?""", @" - - - - ( - ? - - ( - - - ? - - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest54() - { - Test(@"@""(?(cat""", @" - - - - ( - ? - - ( - - - cat - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest55() - { - Test(@"@""(?(cat)|""", @" - - - - ( - ? - - ( - - - cat - - - ) - - - - | - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest56() - { - Test(@"@""foo(?<0>bar)""", @" - - - - foo - - - ( - ? - < - 0 - > - - - bar - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest57() - { - Test(@"@""foo(?'0'bar)""", @" - - - - foo - - - ( - ? - ' - 0 - ' - - - bar - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest58() - { - Test(@"@""foo(?<1bar)""", @" - - - - foo - - - ( - ? - < - 1 - - - - bar - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest59() - { - Test(@"@""foo(?'1bar)""", @" - - - - foo - - - ( - ? - ' - 1 - - - - bar - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest60() - { - Test(@"@""(?(""", @" - - - - ( - ? - - ( - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest61() - { - Test(@"@""\p{klsak""", @" - - - - \ - p - - - {klsak - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest62() - { - Test(@"@""(?c:cat)""", @" - - - - ( - - - ? - - - c:cat - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest63() - { - Test(@"@""(??e:cat)""", @" - - - - ( - - - - ? - - ? - - - e:cat - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest64() - { - Test(@"@""[a-f-[]]+""", @" - - - - [ - - - - a - - - - - f - - - - - - - [ - - - ] - - - ] - - - - + - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest65() - { - Test(@"@""[A-[]+""", @" - - - - [ - - - A - - - - - - [ - - - ]+ - - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest66() - { - Test(@"@""(?(?e))""", @" - - - - ( - ? - - ( - - - ? - - - e - - - ) - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest67() - { - Test(@"@""(?(?a)""", @" - - - - ( - ? - - ( - - - ? - - - a - - - ) - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest68() - { - Test(@"@""(?r:cat)""", @" - - - - ( - - - ? - - - r:cat - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest69() - { - Test(@"@""(?(?N))""", @" - - - - ( - ? - - ( - ? - N - ) - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest70() - { - Test(@"@""[]""", @" - - - - [ - - - ] - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest71() - { - Test(@"@""\x2""", @" - - - - \ - x - 2 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest72() - { - Test(@"@""(cat) (?#cat) \s+ (?#followed by 1 or more whitespace""", @" - - - - ( - - - cat - - - ) - - - - - - - (?#cat) - - \ - s - - + - - - - - - (?#followed by 1 or more whitespace - - - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void NegativeTest73() - { - Test(@"@""cat(?(?afdcat)dog)""", @" - - - - cat - - - ( - ? - - ( - - - ? - - - afdcat - - - ) - - - - dog - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest74() - { - Test(@"@""cat(?(?cat)dog)""", @" - - - - cat - - - ( - ? - - ( - ? - < - cat - > - - - cat - - - ) - - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest75() - { - Test(@"@""cat(?(?'cat'cat)dog)""", @" - - - - cat - - - ( - ? - - ( - ? - ' - cat - ' - - - cat - - - ) - - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest76() - { - Test(@"@""cat(?(?#COMMENT)cat)""", @" - - - - cat - - - ( - ? - - ( - - - ? - - - #COMMENT - - - ) - - - - cat - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest77() - { - Test(@"@""(?cat)\w+(?dog)""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - w - - + - - - ( - ? - < - dog - - - - - - - - ( - - ) - - * - - - !@>dog - - - ) - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest78() - { - Test(@"@""(?cat)\w+(?dog)""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - w - - + - - - ( - ? - < - dog - - - catdog - > - - - dog - - - ) - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest79() - { - Test(@"@""(?cat)\w+(?dog)""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - w - - + - - - ( - ? - < - dog - - - 1 - - - - uosn>dog - - - ) - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest80() - { - Test(@"@""(?cat)\w+(?dog)""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - w - - + - - - ( - ? - < - dog - - - 16 - > - - - dog - - - ) - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest81() - { - Test(@"@""cat(?<->dog)""", @" - - - - cat - - - ( - ? - < - - - - - > - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest82() - { - Test(@"@""cat(?<>dog)""", @" - - - - cat - - - ( - ? - < - - > - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest83() - { - Test(@"@""cat(?)_*>dog)""", @" - - - - cat - - - ( - ? - < - dog - - - - <> - - - ) - - - - _ - - * - - - >dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest84() - { - Test(@"@""cat(?)_*>dog)""", @" - - - - cat - - - ( - ? - < - dog - - - - > - - - ) - - - - _ - - * - - - >dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest85() - { - Test(@"@""cat(?)_*>dog)""", @" - - - - cat - - - ( - ? - < - dog - - - - !> - - - ) - - - - _ - - * - - - >dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest86() - { - Test(@"@""cat(?dog)""", @" - - - - cat - - - ( - ? - < - dog - - - ) - - - - _ - - * - - - >dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest87() - { - Test(@"@""cat(?<1dog>dog)""", @" - - - - cat - - - ( - ? - < - 1 - - - - dog>dog - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest88() - { - Test(@"@""cat(?<0>dog)""", @" - - - - cat - - - ( - ? - < - 0 - > - - - dog - - - ) - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest89() - { - Test(@"@""([5-\D]*)dog""", @" - - - - ( - - - - [ - - - - 5 - - - - - \ - D - - - - ] - - * - - - ) - - - dog - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest90() - { - Test(@"@""cat([6-\s]*)dog""", @" - - - - cat - - - ( - - - - [ - - - - 6 - - - - - \ - s - - - - ] - - * - - - ) - - - dog - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest91() - { - Test(@"@""cat([c-\S]*)""", @" - - - - cat - - - ( - - - - [ - - - - c - - - - - \ - S - - - - ] - - * - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest92() - { - Test(@"@""cat([7-\w]*)""", @" - - - - cat - - - ( - - - - [ - - - - 7 - - - - - \ - w - - - - ] - - * - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest93() - { - Test(@"@""cat([a-\W]*)dog""", @" - - - - cat - - - ( - - - - [ - - - - a - - - - - \ - W - - - - ] - - * - - - ) - - - dog - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest94() - { - Test(@"@""([f-\p{Lu}]\w*)\s([\p{Lu}]\w*)""", @" - - - - ( - - - [ - - - - f - - - - - \ - p - { - Lu - } - - - - ] - - - - \ - w - - * - - - ) - - - \ - s - - - ( - - - [ - - - \ - p - { - Lu - } - - - ] - - - - \ - w - - * - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest95() - { - Test(@"@""(cat) (?#cat) \s+ (?#followed by 1 or more whitespace""", @" - - - - ( - - - cat - - - ) - - - - - - - - (?#cat) - - - - - \ - s - - + - - - - - - - - (?#followed by 1 or more whitespace - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest96() - { - Test(@"@""([1-\P{Ll}][\p{Ll}]*)\s([\P{Ll}][\p{Ll}]*)""", @" - - - - ( - - - [ - - - - 1 - - - - - \ - P - { - Ll - } - - - - ] - - - - [ - - - \ - p - { - Ll - } - - - ] - - * - - - ) - - - \ - s - - - ( - - - [ - - - \ - P - { - Ll - } - - - ] - - - - [ - - - \ - p - { - Ll - } - - - ] - - * - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest97() - { - Test(@"@""[\P]""", @" - - - - [ - - - \ - P - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest98() - { - Test(@"@""([\pcat])""", @" - - - - ( - - - [ - - - \ - p - - - cat - - - ] - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest99() - { - Test(@"@""([\Pcat])""", @" - - - - ( - - - [ - - - \ - P - - - cat - - - ] - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest100() - { - Test(@"@""(\p{""", @" - - - - ( - - - \ - p - - - { - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest101() - { - Test(@"@""(\p{Ll""", @" - - - - ( - - - \ - p - - - {Ll - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest102() - { - Test(@"@""(cat)([\o]*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - - [ - - - \ - o - - - ] - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest103() - { - Test(@"@""[\p]""", @" - - - - [ - - - \ - p - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest104() - { - Test(@"@""(?cat)\s+(?dog)\kcat""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - - - cat - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest105() - { - Test(@"@""(?cat)\s+(?dog)\k""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - < - cat2 - > - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest106() - { - Test(@"@""(?cat)\s+(?dog)\k<8>cat""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - < - 8 - > - - - cat - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest107() - { - Test(@"@""^[abcd]{1}?*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - { - 1 - } - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest108() - { - Test(@"@""^[abcd]*+$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - * - - - + - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest109() - { - Test(@"@""^[abcd]+*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - + - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest110() - { - Test(@"@""^[abcd]?*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest111() - { - Test(@"@""^[abcd]*?+$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - * - - ? - - - + - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest112() - { - Test(@"@""^[abcd]+?*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - + - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest113() - { - Test(@"@""^[abcd]{1,}?*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - { - 1 - , - } - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest114() - { - Test(@"@""^[abcd]??*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - ? - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest115() - { - Test(@"@""^[abcd]+{0,5}$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - + - - - { - - - 0,5} - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest116() - { - Test(@"@""^[abcd]?{0,5}$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - ? - - - { - - - 0,5} - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest117() - { - Test(@"@""\u""", @" - - - - \ - u - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest118() - { - Test(@"@""\ua""", @" - - - - \ - u - a - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest119() - { - Test(@"@""\u0""", @" - - - - \ - u - 0 - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest120() - { - Test(@"@""\x""", @" - - - - \ - x - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest121() - { - Test(@"@""^[abcd]*{0,5}$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - * - - - { - - - 0,5} - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest122() - { - Test(@"@""[""", @" - - - - [ - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest123() - { - Test(@"@""^[abcd]{0,16}?*$""", @" - - - - ^ - - - - - [ - - - abcd - - - ] - - { - 0 - , - 16 - } - - ? - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest124() - { - Test(@"@""^[abcd]{1,}*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - { - 1 - , - } - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest125() - { - Test(@"@""(?cat)\s+(?dog)\k<8>cat""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - < - 8 - > - - - cat - - - - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void NegativeTest126() - { - Test(@"@""(?cat)\s+(?dog)\k8""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - - - 8 - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest127() - { - Test(@"@""(?cat)\s+(?dog)\k8""", @" - - - - ( - ? - < - cat - > - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - dog - > - - - dog - - - ) - - - \ - k - - - 8 - - - - - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void NegativeTest128() - { - Test(@"@""(cat)(\7)""", @" - - - - ( - - - cat - - - ) - - - ( - - - \ - 7 - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest129() - { - Test(@"@""(cat)\s+(?<2147483648>dog)""", @" - - - - ( - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - 2147483648 - > - - - dog - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest130() - { - Test(@"@""(cat)\s+(?<21474836481097>dog)""", @" - - - - ( - - - cat - - - ) - - - - \ - s - - + - - - ( - ? - < - 21474836481097 - > - - - dog - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest131() - { - Test(@"@""^[abcd]{1}*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - { - 1 - } - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest132() - { - Test(@"@""(cat)(\c*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - - \ - c - - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest133() - { - Test(@"@""(cat)(\c *)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - \ - c - - - - - - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest134() - { - Test(@"@""(cat)(\c?*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - - \ - c - - - ? - - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest135() - { - Test(@"@""(cat)(\c`*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - \ - c - - - - - ` - - * - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest136() - { - Test(@"@""(cat)(\c\|*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - - \ - c - \ - - - | - - - * - - - - ) - - - ( - - - dog - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest137() - { - Test(@"@""(cat)(\c\[*)(dog)""", @" - - - - ( - - - cat - - - ) - - - ( - - - \ - c - \ - - - [ - - - *)(dog) - - - - - - - - - - - - - - - - - - - -", runSubTreeTests: false, options: RegexOptions.None); - } - - [Fact] - public void NegativeTest138() - { - Test(@"@""^[abcd]{0,16}*$""", @" - - - - ^ - - - - [ - - - abcd - - - ] - - { - 0 - , - 16 - } - - - * - - - $ - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void NegativeTest139() - { - Test(@"@""(cat)\c""", @" - - - - ( - - - cat - - - ) - - - \ - c - - - - - - - - - - - - -", RegexOptions.None); - } - - // [Fact] - // public void NegativeTest140() - // { - // Test(@"@"" (?(?n))""", @" - // - // - // - // - // - // - // ( - // ? - // - // ( - // ? - // n - // ) - // - // - // ) - // - // - // - // - //", RegexOptions.None); - // } - } -} diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs deleted file mode 100644 index fa19092f819c4..0000000000000 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs +++ /dev/null @@ -1,6794 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Text.RegularExpressions; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - public partial class CSharpRegexParserTests - { - [Fact] - public void ReferenceTest0() - { - Test(@"@""[aeiou]""", @" - - - - [ - - - aeiou - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest1() - { - Test(@"@""(?\w+)\s\k\W(?\w+)""", @" - - - - ( - ? - < - duplicateWord - > - - - - \ - w - - + - - - ) - - - \ - s - - - \ - k - < - duplicateWord - > - - - \ - W - - - ( - ? - < - nextWord - > - - - - \ - w - - + - - - ) - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest2() - { - Test(@"@""((?abc)\d+)?(?xyz)(.*)""", @" - - - - - ( - - - ( - ? - < - One - > - - - abc - - - ) - - - - \ - d - - + - - - ) - - ? - - - ( - ? - < - Two - > - - - xyz - - - ) - - - ( - - - - . - - * - - - ) - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest3() - { - Test(@"@""(\w+)\s(\1)""", @" - - - - ( - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - \ - 1 - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest4() - { - Test(@"@""\Bqu\w+""", @" - - - - \ - B - - - qu - - - - \ - w - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest5() - { - Test(@"@""\bare\w*\b""", @" - - - - \ - b - - - are - - - - \ - w - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest6() - { - Test(@"@""\G(\w+\s?\w*),?""", @" - - - - \ - G - - - ( - - - - \ - w - - + - - - - \ - s - - ? - - - - \ - w - - * - - - ) - - - - , - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest7() - { - Test(@"@""\D+(?\d+)\D+(?\d+)?""", @" - - - - - \ - D - - + - - - ( - ? - < - digit - > - - - - \ - d - - + - - - ) - - - - \ - D - - + - - - - ( - ? - < - digit - > - - - - \ - d - - + - - - ) - - ? - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest8() - { - Test(@"@""(\s\d{4}(-(\d{4}|present))?,?)+""", @" - - - - - ( - - - \ - s - - - - \ - d - - { - 4 - } - - - - ( - - - - - - - ( - - - - \ - d - - { - 4 - } - - - &#124;present - - - ) - - - ) - - ? - - - - , - - ? - - - ) - - + - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest9() - { - Test(@"@""^((\w+(\s?)){2,}),\s(\w+\s\w+),(\s\d{4}(-(\d{4}|present))?,?)+""", @" - - - - ^ - - - ( - - - - ( - - - - \ - w - - + - - - ( - - - - \ - s - - ? - - - ) - - - ) - - { - 2 - , - } - - - ) - - - , - - - \ - s - - - ( - - - - \ - w - - + - - - \ - s - - - - \ - w - - + - - - ) - - - , - - - - ( - - - \ - s - - - - \ - d - - { - 4 - } - - - - ( - - - - - - - ( - - - - - \ - d - - { - 4 - } - - - | - - - present - - - - ) - - - ) - - ? - - - - , - - ? - - - ) - - + - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest10() - { - Test(@"@""^[0-9-[2468]]+$""", @" - - - - ^ - - - - [ - - - - 0 - - - - - 9 - - - - - - - [ - - - 2468 - - - ] - - - - ] - - + - - - $ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest11() - { - Test(@"@""[a-z-[0-9]]""", @" - - - - [ - - - - a - - - - - z - - - - - - - [ - - - - 0 - - - - - 9 - - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest12() - { - Test(@"@""[\p{IsBasicLatin}-[\x00-\x7F]]""", @" - - - - [ - - - \ - p - { - IsBasicLatin - } - - - - - - [ - - - - \ - x - 00 - - - - - \ - x - 7F - - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest13() - { - Test(@"@""[\u0000-\uFFFF-[\s\p{P}\p{IsGreek}\x85]]""", @" - - - - [ - - - - \ - u - 0000 - - - - - \ - u - FFFF - - - - - - - [ - - - \ - s - - - \ - p - { - P - } - - - \ - p - { - IsGreek - } - - - \ - x - 85 - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest14() - { - Test(@"@""[a-z-[d-w-[m-o]]]""", @" - - - - [ - - - - a - - - - - z - - - - - - - [ - - - - d - - - - - w - - - - - - - [ - - - - m - - - - - o - - - - ] - - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest15() - { - Test(@"@""((\w+(\s?)){2,}""", @" - - - - ( - - - - ( - - - - \ - w - - + - - - ( - - - - \ - s - - ? - - - ) - - - ) - - { - 2 - , - } - - - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest16() - { - Test(@"@""[a-z-[djp]]""", @" - - - - [ - - - - a - - - - - z - - - - - - - [ - - - djp - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest17() - { - Test(@"@""^[^<>]*(((?'Open'<)[^<>]*)+((?'Close-Open'>)[^<>]*)+)*(?(Open)(?!))$""", @" - - - - ^ - - - - [ - ^ - - - <> - - - ] - - * - - - - ( - - - - ( - - - ( - ? - ' - Open - ' - - - < - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - - ( - - - ( - ? - ' - Close - - - Open - ' - - - > - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - ) - - * - - - ( - ? - ( - Open - ) - - - ( - ? - ! - - ) - - - ) - - - $ - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest18() - { - Test(@"@""((?'Close-Open'>)[^<>]*)+""", @" - - - - - ( - - - ( - ? - ' - Close - - - Open - ' - - - > - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest19() - { - Test(@"@""(\w)\1+.\b""", @" - - - - ( - - - \ - w - - - ) - - - - \ - 1 - - + - - - . - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest20() - { - Test(@"@""\d{4}\b""", @" - - - - - \ - d - - { - 4 - } - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest21() - { - Test(@"@""\d{1,2},""", @" - - - - - \ - d - - { - 1 - , - 2 - } - - - , - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest22() - { - Test(@"@""(? - - - - ( - ? - < - ! - - - ( - - - - Saturday - - - | - - - Sunday - - - - ) - - - - - - ) - - - \ - b - - - - \ - w - - + - - - - - - - \ - d - - { - 1 - , - 2 - } - - - , - - - - \ - d - - { - 4 - } - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest23() - { - Test(@"@""(?<=\b20)\d{2}\b""", @" - - - - ( - ? - < - = - - - \ - b - - - 20 - - - ) - - - - \ - d - - { - 2 - } - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest24() - { - Test(@"@""\b\w+\b(?!\p{P})""", @" - - - - \ - b - - - - \ - w - - + - - - \ - b - - - ( - ? - ! - - - \ - p - { - P - } - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest25() - { - Test(@"@""(((?'Open'<)[^<>]*)+((?'Close-Open'>)[^<>]*)+)*""", @" - - - - - ( - - - - ( - - - ( - ? - ' - Open - ' - - - < - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - - ( - - - ( - ? - ' - Close - - - Open - ' - - - > - - - ) - - - - [ - ^ - - - <> - - - ] - - * - - - ) - - + - - - ) - - * - - - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest26() - { - Test(@"@""\b(?!un)\w+\b""", @" - - - - \ - b - - - ( - ? - ! - - - un - - - ) - - - - \ - w - - + - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest27() - { - Test(@"@""\b(?ix: d \w+)\s""", @" - - - - \ - b - - - ( - ? - ix - : - - - - - - d - - - - - - - \ - w - - + - - - ) - - - \ - s - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest28() - { - Test(@"@""(?:\w+)""", @" - - - - ( - ? - : - - - - \ - w - - + - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest29() - { - Test(@"@""(?:\b(?:\w+)\W*)+""", @" - - - - - ( - ? - : - - - \ - b - - - ( - ? - : - - - - \ - w - - + - - - ) - - - - \ - W - - * - - - ) - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest30() - { - Test(@"@""(?:\b(?:\w+)\W*)+\.""", @" - - - - - ( - ? - : - - - \ - b - - - ( - ? - : - - - - \ - w - - + - - - ) - - - - \ - W - - * - - - ) - - + - - - \ - . - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest31() - { - Test(@"@""(?'Close-Open'>)""", @" - - - - ( - ? - ' - Close - - - Open - ' - - - > - - - ) - - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest32() - { - Test(@"@""[^<>]*""", @" - - - - - [ - ^ - - - <> - - - ] - - * - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest33() - { - Test(@"@""\b\w+(?=\sis\b)""", @" - - - - \ - b - - - - \ - w - - + - - - ( - ? - = - - - \ - s - - - is - - - \ - b - - - ) - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest34() - { - Test(@"@""[a-z-[m]]""", @" - - - - [ - - - - a - - - - - z - - - - - - - [ - - - m - - - ] - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest35() - { - Test(@"@""^\D\d{1,5}\D*$""", @" - - - - ^ - - - \ - D - - - - \ - d - - { - 1 - , - 5 - } - - - - \ - D - - * - - - $ - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest36() - { - Test(@"@""[^0-9]""", @" - - - - [ - ^ - - - - 0 - - - - - 9 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest37() - { - Test(@"@""(\p{IsGreek}+(\s)?)+""", @" - - - - - ( - - - - \ - p - { - IsGreek - } - - + - - - - ( - - - \ - s - - - ) - - ? - - - ) - - + - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest38() - { - Test(@"@""\b(\p{IsGreek}+(\s)?)+\p{Pd}\s(\p{IsBasicLatin}+(\s)?)+""", @" - - - - \ - b - - - - ( - - - - \ - p - { - IsGreek - } - - + - - - - ( - - - \ - s - - - ) - - ? - - - ) - - + - - - \ - p - { - Pd - } - - - \ - s - - - - ( - - - - \ - p - { - IsBasicLatin - } - - + - - - - ( - - - \ - s - - - ) - - ? - - - ) - - + - - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest39() - { - Test(@"@""\b.*[.?!;:](\s|\z)""", @" - - - - \ - b - - - - . - - * - - - [ - - - .?!;: - - - ] - - - ( - - - - \ - s - - - | - - - \ - z - - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest40() - { - Test(@"@""^.+""", @" - - - - ^ - - - - . - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest41() - { - Test(@"@""[^o]""", @" - - - - [ - ^ - - - o - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest42() - { - Test(@"@""\bth[^o]\w+\b""", @" - - - - \ - b - - - th - - - [ - ^ - - - o - - - ] - - - - \ - w - - + - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest43() - { - Test(@"@""(\P{Sc})+""", @" - - - - - ( - - - \ - P - { - Sc - } - - - ) - - + - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest44() - { - Test(@"@""[^\p{P}\d]""", @" - - - - [ - ^ - - - \ - p - { - P - } - - - \ - d - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest45() - { - Test(@"@""\b[A-Z]\w*\b""", @" - - - - \ - b - - - [ - - - - A - - - - - Z - - - - ] - - - - \ - w - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest46() - { - Test(@"@""\S+?""", @" - - - - - - \ - S - - + - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest47() - { - Test(@"@""y\s""", @" - - - - y - - - \ - s - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest48() - { - Test(@"@""gr[ae]y\s\S+?[\s\p{P}]""", @" - - - - gr - - - [ - - - ae - - - ] - - - y - - - \ - s - - - - - \ - S - - + - - ? - - - [ - - - \ - s - - - \ - p - { - P - } - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest49() - { - Test(@"@""[\s\p{P}]""", @" - - - - [ - - - \ - s - - - \ - p - { - P - } - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest50() - { - Test(@"@""[\p{P}\d]""", @" - - - - [ - - - \ - p - { - P - } - - - \ - d - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest51() - { - Test(@"@""[^aeiou]""", @" - - - - [ - ^ - - - aeiou - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest52() - { - Test(@"@""(\w)\1""", @" - - - - ( - - - \ - w - - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest53() - { - Test(@"@""[^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}\p{Lm}] """, @" - - - - [ - ^ - - - \ - p - { - Ll - } - - - \ - p - { - Lu - } - - - \ - p - { - Lt - } - - - \ - p - { - Lo - } - - - \ - p - { - Nd - } - - - \ - p - { - Pc - } - - - \ - p - { - Lm - } - - - ] - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest54() - { - Test(@"@""[^a-zA-Z_0-9]""", @" - - - - [ - ^ - - - - a - - - - - z - - - - - A - - - - - Z - - - - _ - - - - 0 - - - - - 9 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest55() - { - Test(@"@""\P{Nd}""", @" - - - - \ - P - { - Nd - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest56() - { - Test(@"@""(\(?\d{3}\)?[\s-])?""", @" - - - - - ( - - - - \ - ( - - ? - - - - \ - d - - { - 3 - } - - - - \ - ) - - ? - - - [ - - - \ - s - - - - - - - ] - - - ) - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest57() - { - Test(@"@""^(\(?\d{3}\)?[\s-])?\d{3}-\d{4}$""", @" - - - - ^ - - - - ( - - - - \ - ( - - ? - - - - \ - d - - { - 3 - } - - - - \ - ) - - ? - - - [ - - - \ - s - - - - - - - ] - - - ) - - ? - - - - \ - d - - { - 3 - } - - - - - - - - \ - d - - { - 4 - } - - - $ - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest58() - { - Test(@"@""[0-9]""", @" - - - - [ - - - - 0 - - - - - 9 - - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest59() - { - Test(@"@""\p{Nd}""", @" - - - - \ - p - { - Nd - } - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest60() - { - Test(@"@""\b(\S+)\s?""", @" - - - - \ - b - - - ( - - - - \ - S - - + - - - ) - - - - \ - s - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest61() - { - Test(@"@""[^ \f\n\r\t\v]""", @" - - - - [ - ^ - - - - - - \ - f - - - \ - n - - - \ - r - - - \ - t - - - \ - v - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest62() - { - Test(@"@""[^\f\n\r\t\v\x85\p{Z}]""", @" - - - - [ - ^ - - - \ - f - - - \ - n - - - \ - r - - - \ - t - - - \ - v - - - \ - x - 85 - - - \ - p - { - Z - } - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest63() - { - Test(@"@""(\s|$)""", @" - - - - ( - - - - \ - s - - - | - - - $ - - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest64() - { - Test(@"@""\b\w+(e)?s(\s|$)""", @" - - - - \ - b - - - - \ - w - - + - - - - ( - - - e - - - ) - - ? - - - s - - - ( - - - - \ - s - - - | - - - $ - - - - ) - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest65() - { - Test(@"@""[ \f\n\r\t\v]""", @" - - - - [ - - - - - - \ - f - - - \ - n - - - \ - r - - - \ - t - - - \ - v - - - ] - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest66() - { - Test(@"@""(\W){1,2}""", @" - - - - - ( - - - \ - W - - - ) - - { - 1 - , - 2 - } - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest67() - { - Test(@"@""(\w+)""", @" - - - - ( - - - - \ - w - - + - - - ) - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest68() - { - Test(@"@""\b""", @" - - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest69() - { - Test(@"@""\b(\w+)(\W){1,2}""", @" - - - - \ - b - - - ( - - - - \ - w - - + - - - ) - - - - ( - - - \ - W - - - ) - - { - 1 - , - 2 - } - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest70() - { - Test(@"@""(?>(\w)\1+).\b""", @" - - - - ( - ? - > - - - ( - - - \ - w - - - ) - - - - \ - 1 - - + - - - ) - - - . - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest71() - { - Test(@"@""(\b(\w+)\W+)+""", @" - - - - - ( - - - \ - b - - - ( - - - - \ - w - - + - - - ) - - - - \ - W - - + - - - ) - - + - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest72() - { - Test(@"@""(\w)\1+.\b""", @" - - - - ( - - - \ - w - - - ) - - - - \ - 1 - - + - - - . - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest73() - { - Test(@"@""\p{Sc}*(\s?\d+[.,]?\d*)\p{Sc}*""", @" - - - - - \ - p - { - Sc - } - - * - - - ( - - - - \ - s - - ? - - - - \ - d - - + - - - - [ - - - ., - - - ] - - ? - - - - \ - d - - * - - - ) - - - - \ - p - { - Sc - } - - * - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest74() - { - Test(@"@""p{Sc}*(?\s?\d+[.,]?\d*)\p{Sc}*""", @" - - - - p{Sc - - - - } - - * - - - ( - ? - < - amount - > - - - - \ - s - - ? - - - - \ - d - - + - - - - [ - - - ., - - - ] - - ? - - - - \ - d - - * - - - ) - - - - \ - p - { - Sc - } - - * - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest75() - { - Test(@"@""^(\w+\s?)+$""", @" - - - - ^ - - - - ( - - - - \ - w - - + - - - - \ - s - - ? - - - ) - - + - - - $ - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest76() - { - Test(@"@""(?ix) d \w+ \s""", @" - - - - ( - ? - ix - ) - - - - - - d - - - - - - - \ - w - - + - - - - - - \ - s - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest77() - { - Test(@"@""\b(?ix: d \w+)\s""", @" - - - - \ - b - - - ( - ? - ix - : - - - - - - d - - - - - - - \ - w - - + - - - ) - - - \ - s - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest78() - { - Test(@"@""\bthe\w*\b""", @" - - - - \ - b - - - the - - - - \ - w - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest79() - { - Test(@"@""\b(?i:t)he\w*\b""", @" - - - - \ - b - - - ( - ? - i - : - - - t - - - ) - - - he - - - - \ - w - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest80() - { - Test(@"@""^(\w+)\s(\d+)$""", @" - - - - ^ - - - ( - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - - \ - d - - + - - - ) - - - $ - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest81() - { - Test(@"@""^(\w+)\s(\d+)\r*$""", @" - - - - ^ - - - ( - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - - \ - d - - + - - - ) - - - - \ - r - - * - - - $ - - - - - - - - - -", RegexOptions.Multiline); - } - - [Fact] - public void ReferenceTest82() - { - Test(@"@""(?m)^(\w+)\s(\d+)\r*$""", @" - - - - ( - ? - m - ) - - - ^ - - - ( - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - - \ - d - - + - - - ) - - - - \ - r - - * - - - $ - - - - - - - - - -", RegexOptions.Multiline); - } - - [Fact] - public void ReferenceTest83() - { - Test(@"@""(?s)^.+""", @" - - - - ( - ? - s - ) - - - ^ - - - - . - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest84() - { - Test(@"@""\b(\d{2}-)*(?(1)\d{7}|\d{3}-\d{2}-\d{4})\b""", @" - - - - \ - b - - - - ( - - - - \ - d - - { - 2 - } - - - - - - - ) - - * - - - ( - ? - ( - 1 - ) - - - - - \ - d - - { - 7 - } - - - | - - - - \ - d - - { - 3 - } - - - - - - - - \ - d - - { - 2 - } - - - - - - - - \ - d - - { - 4 - } - - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest85() - { - Test(@"@""\b\(?((\w+),?\s?)+[\.!?]\)?""", @" - - - - \ - b - - - - \ - ( - - ? - - - - ( - - - ( - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest86() - { - Test(@"@""(?n)\b\(?((?>\w+),?\s?)+[\.!?]\)?""", @" - - - - ( - ? - n - ) - - - \ - b - - - - \ - ( - - ? - - - - ( - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest87() - { - Test(@"@""\b\(?(?n:(?>\w+),?\s?)+[\.!?]\)?""", @" - - - - \ - b - - - - \ - ( - - ? - - - - ( - ? - n - : - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest88() - { - Test(@"@""\b\(?((?>\w+),?\s?)+[\.!?]\)?""", @" - - - - \ - b - - - - \ - ( - - ? - - - - ( - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - - -", RegexOptions.IgnorePatternWhitespace); - } - - [Fact] - public void ReferenceTest89() - { - Test(@"@""(?x)\b \(? ( (?>\w+) ,?\s? )+ [\.!?] \)? # Matches an entire sentence.""", @" - - - - ( - ? - x - ) - - - \ - b - - - - - - - \ - ( - - ? - - - - - - - ( - - - - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - - - - , - - ? - - - - \ - s - - ? - - - - - - ) - - + - - - - - - [ - - - \ - . - - - !? - - - ] - - - - - - - \ - ) - - ? - - - - - - # Matches an entire sentence. - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest90() - { - Test(@"@""\bb\w+\s""", @" - - - - \ - b - - - b - - - - \ - w - - + - - - \ - s - - - - - - - -", RegexOptions.RightToLeft); - } - - [Fact] - public void ReferenceTest91() - { - Test(@"@""(?<=\d{1,2}\s)\w+,?\s\d{4}""", @" - - - - ( - ? - < - = - - - - \ - d - - { - 1 - , - 2 - } - - - \ - s - - - ) - - - - \ - w - - + - - - - , - - ? - - - \ - s - - - - \ - d - - { - 4 - } - - - - - - - -", RegexOptions.RightToLeft); - } - - [Fact] - public void ReferenceTest92() - { - Test(@"@""\b(\w+\s*)+""", @" - - - - \ - b - - - - ( - - - - \ - w - - + - - - - \ - s - - * - - - ) - - + - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void ReferenceTest93() - { - Test(@"@""((a+)(\1) ?)+""", @" - - - - - ( - - - ( - - - - a - - + - - - ) - - - ( - - - \ - 1 - - - ) - - - - - - ? - - - ) - - + - - - - - - - - - - -", RegexOptions.ECMAScript); - } - - [Fact] - public void ReferenceTest94() - { - Test(@"@""\b(D\w+)\s(d\w+)\b""", @" - - - - \ - b - - - ( - - - D - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - d - - - - \ - w - - + - - - ) - - - \ - b - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest95() - { - Test(@"@""\b(D\w+)(?ixn) \s (d\w+) \b""", @" - - - - \ - b - - - ( - - - D - - - - \ - w - - + - - - ) - - - ( - ? - ixn - ) - - - - - - \ - s - - - - - - ( - - - d - - - - \ - w - - + - - - ) - - - - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest96() - { - Test(@"@""\b((?# case-sensitive comparison)D\w+)\s((?#case-insensitive comparison)d\w+)\b""", @" - - - - \ - b - - - ( - - - - - (?# case-sensitive comparison) - D - - - - \ - w - - + - - - ) - - - \ - s - - - ( - - - - - (?#case-insensitive comparison) - d - - - - \ - w - - + - - - ) - - - \ - b - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest97() - { - Test(@"@""\b\(?((?>\w+),?\s?)+[\.!?]\)?""", @" - - - - \ - b - - - - \ - ( - - ? - - - - ( - - - ( - ? - > - - - - \ - w - - + - - - ) - - - - , - - ? - - - - \ - s - - ? - - - ) - - + - - - [ - - - \ - . - - - !? - - - ] - - - - \ - ) - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest98() - { - Test(@"@""\b(?\d{2}-)*(?(n2)\d{7}|\d{3}-\d{2}-\d{4})\b""", @" - - - - \ - b - - - - ( - ? - < - n2 - > - - - - \ - d - - { - 2 - } - - - - - - - ) - - * - - - ( - ? - ( - n2 - ) - - - - - \ - d - - { - 7 - } - - - | - - - - \ - d - - { - 3 - } - - - - - - - - \ - d - - { - 2 - } - - - - - - - - \ - d - - { - 4 - } - - - - ) - - - \ - b - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest99() - { - Test(@"@""\b(\d{2}-\d{7}|\d{3}-\d{2}-\d{4})\b""", @" - - - - \ - b - - - ( - - - - - \ - d - - { - 2 - } - - - - - - - - \ - d - - { - 7 - } - - - | - - - - \ - d - - { - 3 - } - - - - - - - - \ - d - - { - 2 - } - - - - - - - - \ - d - - { - 4 - } - - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest100() - { - Test(@"@""\bgr(a|e)y\b""", @" - - - - \ - b - - - gr - - - ( - - - - a - - - | - - - e - - - - ) - - - y - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest101() - { - Test(@"@""(?>(\w)\1+).\b""", @" - - - - ( - ? - > - - - ( - - - \ - w - - - ) - - - - \ - 1 - - + - - - ) - - - . - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest102() - { - Test(@"@""(\b(\w+)\W+)+""", @" - - - - - ( - - - \ - b - - - ( - - - - \ - w - - + - - - ) - - - - \ - W - - + - - - ) - - + - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest103() - { - Test(@"@""\b91*9*\b""", @" - - - - \ - b - - - 9 - - - - 1 - - * - - - - 9 - - * - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest104() - { - Test(@"@""\ban+\w*?\b""", @" - - - - \ - b - - - a - - - - n - - + - - - - - \ - w - - * - - ? - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest105() - { - Test(@"@""\ban?\b""", @" - - - - \ - b - - - a - - - - n - - ? - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest106() - { - Test(@"@""\b\d+\,\d{3}\b""", @" - - - - \ - b - - - - \ - d - - + - - - \ - , - - - - \ - d - - { - 3 - } - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest107() - { - Test(@"@""\b\d{2,}\b\D+""", @" - - - - \ - b - - - - \ - d - - { - 2 - , - } - - - \ - b - - - - \ - D - - + - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest108() - { - Test(@"@""(00\s){2,4}""", @" - - - - - ( - - - 00 - - - \ - s - - - ) - - { - 2 - , - 4 - } - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest109() - { - Test(@"@""\b\w*?oo\w*?\b""", @" - - - - \ - b - - - - - \ - w - - * - - ? - - - oo - - - - - \ - w - - * - - ? - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest110() - { - Test(@"@""\b\w+?\b""", @" - - - - \ - b - - - - - \ - w - - + - - ? - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest111() - { - Test(@"@""^\s*(System.)??Console.Write(Line)??\(??""", @" - - - - ^ - - - - \ - s - - * - - - - - ( - - - System - - - . - - - ) - - ? - - ? - - - Console - - - . - - - Write - - - - - ( - - - Line - - - ) - - ? - - ? - - - - - \ - ( - - ? - - ? - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest112() - { - Test(@"@""(System.)??""", @" - - - - - - ( - - - System - - - . - - - ) - - ? - - ? - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest113() - { - Test(@"@""\b(\w{3,}?\.){2}?\w{3,}?\b""", @" - - - - \ - b - - - - - ( - - - - - \ - w - - { - 3 - , - } - - ? - - - \ - . - - - ) - - { - 2 - } - - ? - - - - - \ - w - - { - 3 - , - } - - ? - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest114() - { - Test(@"@""\b[A-Z](\w*?\s*?){1,10}[.!?]""", @" - - - - \ - b - - - [ - - - - A - - - - - Z - - - - ] - - - - ( - - - - - \ - w - - * - - ? - - - - - \ - s - - * - - ? - - - ) - - { - 1 - , - 10 - } - - - [ - - - .!? - - - ] - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest115() - { - Test(@"@""b.*([0-9]{4})\b""", @" - - - - b - - - - . - - * - - - ( - - - - [ - - - - 0 - - - - - 9 - - - - ] - - { - 4 - } - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest116() - { - Test(@"@""\b.*?([0-9]{4})\b""", @" - - - - \ - b - - - - - . - - * - - ? - - - ( - - - - [ - - - - 0 - - - - - 9 - - - - ] - - { - 4 - } - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest117() - { - Test(@"@""(a?)*""", @" - - - - - ( - - - - a - - ? - - - ) - - * - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest118() - { - Test(@"@""(a\1|(?(1)\1)){0,2}""", @" - - - - - ( - - - - a - - - \ - 1 - - - | - - - ( - ? - ( - 1 - ) - - - \ - 1 - - - ) - - - - ) - - { - 0 - , - 2 - } - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest119() - { - Test(@"@""(a\1|(?(1)\1)){2}""", @" - - - - - ( - - - - a - - - \ - 1 - - - | - - - ( - ? - ( - 1 - ) - - - \ - 1 - - - ) - - - - ) - - { - 2 - } - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest120() - { - Test(@"@""(\w)\1""", @" - - - - ( - - - \ - w - - - ) - - - \ - 1 - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest121() - { - Test(@"@""(?\w)\k""", @" - - - - ( - ? - < - char - > - - - \ - w - - - ) - - - \ - k - < - char - > - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest122() - { - Test(@"@""(?<2>\w)\k<2>""", @" - - - - ( - ? - < - 2 - > - - - \ - w - - - ) - - - \ - k - < - 2 - > - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest123() - { - Test(@"@""(?<1>a)(?<1>\1b)*""", @" - - - - ( - ? - < - 1 - > - - - a - - - ) - - - - ( - ? - < - 1 - > - - - \ - 1 - - - b - - - ) - - * - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest124() - { - Test(@"@""\b(\p{Lu}{2})(\d{2})?(\p{Lu}{2})\b""", @" - - - - \ - b - - - ( - - - - \ - p - { - Lu - } - - { - 2 - } - - - ) - - - - ( - - - - \ - d - - { - 2 - } - - - ) - - ? - - - ( - - - - \ - p - { - Lu - } - - { - 2 - } - - - ) - - - \ - b - - - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest125() - { - Test(@"@""\bgr[ae]y\b""", @" - - - - \ - b - - - gr - - - [ - - - ae - - - ] - - - y - - - \ - b - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest126() - { - Test(@"@""\b((?# case sensitive comparison)D\w+)\s(?ixn)((?#case insensitive comparison)d\w+)\b""", @" - - - - \ - b - - - ( - - - - - (?# case sensitive comparison) - D - - - - \ - w - - + - - - ) - - - \ - s - - - ( - ? - ixn - ) - - - ( - - - - - (?#case insensitive comparison) - d - - - - \ - w - - + - - - ) - - - \ - b - - - - - - - - -", RegexOptions.None); - } - - [Fact] - public void ReferenceTest127() - { - Test(@"@""\{\d+(,-*\d+)*(\:\w{1,4}?)*\}(?x) # Looks for a composite format item.""", @" - - - - \ - { - - - - \ - d - - + - - - - ( - - - , - - - - - - - * - - - - \ - d - - + - - - ) - - * - - - - ( - - - \ - : - - - - - \ - w - - { - 1 - , - 4 - } - - ? - - - ) - - * - - - \ - } - - - ( - ? - x - ) - - - - - - # Looks for a composite format item. - - - - - - - - -", RegexOptions.None); - } - } -} diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_TestGeneration.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_TestGeneration.cs deleted file mode 100644 index 3d0a67e4af7a9..0000000000000 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_TestGeneration.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if false - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; -using System.Text.RegularExpressions; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.RegularExpressions; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.RegularExpressions -{ - internal class LogicalStringComparer : IComparer - { - [DllImport("shlwapi.dll", CharSet = CharSet.Unicode)] - private static extern int StrCmpLogicalW(string psz1, string psz2); - - public static readonly IComparer Instance = new LogicalStringComparer(); - - private LogicalStringComparer() - { - } - - public int Compare(string x, string y) - { - return StrCmpLogicalW(x, y); - } - } - - public class Fixture : IDisposable - { - public void Dispose() - { - var other = new Dictionary(); - - var tree = SyntaxFactory.ParseSyntaxTree( - File.ReadAllText(@"C:\GitHub\roslyn-internal\Open\src\Workspaces\CSharpTest\RegularExpressions\CSharpRegexParserTests_BasicTests.cs")); - - var methodNames = tree.GetRoot().DescendantNodes().OfType().Select(m => m.Identifier.ValueText); - var nameToIndex = new Dictionary(); - - var index = 0; - foreach (var name in methodNames) - { - nameToIndex[name] = index; - index++; - } - -#if true - var tests = - CSharpRegexParserTests.nameToTest.Where(kvp => !kvp.Key.StartsWith("NegativeTest") && !kvp.Key.StartsWith("Reference")) - .OrderBy(kvp => nameToIndex[kvp.Key]) - .Select(kvp => kvp.Value); -#elif false - var tests = - CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("NegativeTest")) - .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) - .Select(kvp => kvp.Value); -#else - var tests = - CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("Reference")) - .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) - .Select(kvp => kvp.Value); -#endif - - - var val = string.Join("\r\n", tests); - } - } - - [CollectionDefinition(nameof(MyCollection))] - public class MyCollection : ICollectionFixture - { - } - - [Collection(nameof(MyCollection))] - public partial class CSharpRegexParserTests - { - private readonly Fixture _fixture; - - public CSharpRegexParserTests(Fixture fixture) - { - _fixture = fixture; - } - - - public static Dictionary nameToTest = new Dictionary(); - - private void Test1(string stringText, string expected, RegexOptions options, bool runSubTreeTests = true, [CallerMemberName]string name = "") - { - var test = GenerateTests(stringText, options, runSubTreeTests, name); - nameToTest.Add(name, test); - } - - public string GenerateTests(string val, RegexOptions options, bool runSubTreeTests, string testName) - { - var builder = new StringBuilder(); - builder.AppendLine("[Fact]"); - builder.AppendLine("public void " + testName + "()"); - builder.AppendLine("{"); - builder.Append(@" Test("); - - var escaped = val.Replace("\"", "\"\""); - var quoted = "" + '@' + '"' + escaped + '"'; - builder.Append(quoted); - - var token = GetStringToken(val); - var allChars = _service.TryConvertToVirtualChars(token); - var tree = RegexParser.TryParse(allChars, options); - - var actual = TreeToText(tree).Replace("\"", "\"\""); - builder.Append(", " + '@' + '"'); - builder.Append(actual); - - builder.AppendLine("" + '"' + (runSubTreeTests - ? (", RegexOptions." + options.ToString()) - : (", runSubTreeTests: false, options: RegexOptions." + options.ToString())) + ");"); - builder.AppendLine("}"); - - return builder.ToString(); - } - } -} - -#endif From b1e955902cb371602858ac5229b34c0ed48c7747 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 4 Apr 2018 00:17:21 -0700 Subject: [PATCH 004/110] Add comments. --- .../Core/Portable/EmbeddedLanguages/Json/JsonParser.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 4f58980ef8008..e0b21384b6115 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -116,6 +116,7 @@ private JsonTree ParseTree(bool strict) var arraySequence = compilationUnit.Sequence; if (arraySequence.ChildCount == 0) { + // json is not allowed to be just whitespace. if (text.Length > 0 && compilationUnit.EndOfFileToken.LeadingTrivia.All( t => t.Kind == JsonKind.WhitespaceTrivia || t.Kind == JsonKind.EndOfLineTrivia)) From 42af503269bfc9d6feb35805c82192c5b0319eef Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 4 Apr 2018 00:18:03 -0700 Subject: [PATCH 005/110] Add comment. --- .../Core/Portable/EmbeddedLanguages/Json/JsonParser.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index e0b21384b6115..8f657a26b57b0 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -94,6 +94,8 @@ private JsonTree ParseTree(bool strict) var diagnostic = GetFirstDiagnostic(root) ?? CheckTopLevel(_lexer.Text, root); if (diagnostic == null) { + // We didn't have any diagnostics in the tree so far. Do the json.net/strict checks + // depending on how we were invoked. diagnostic = strict ? StrictSyntaxChecker.CheckSyntax(root) : JsonNetSyntaxChecker.CheckSyntax(root); From 4cfa1eb6e62a066b193009b61e452e41ba7e19ea Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 10 Apr 2018 16:17:59 -0700 Subject: [PATCH 006/110] Add files back. --- .../Json/IJsonNodeVisitor.cs | 18 + .../EmbeddedLanguages/Json/JsonHelpers.cs | 33 ++ .../EmbeddedLanguages/Json/JsonKind.cs | 48 ++ .../EmbeddedLanguages/Json/JsonLexer.cs | 420 +++++++++++++++ .../EmbeddedLanguages/Json/JsonNode.cs | 15 + .../EmbeddedLanguages/Json/JsonNodes.cs | 343 ++++++++++++ .../EmbeddedLanguages/Json/JsonOptions.cs | 50 ++ .../Json/JsonParser.JsonNetSyntaxChecks.cs | 240 +++++++++ .../Json/JsonParser.StrictSyntaxChecker.cs | 336 ++++++++++++ .../EmbeddedLanguages/Json/JsonParser.cs | 487 ++++++++++++++++++ .../EmbeddedLanguages/Json/JsonTree.cs | 18 + 11 files changed, 2008 insertions(+) create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs create mode 100644 src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs new file mode 100644 index 0000000000000..3529592a04a93 --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + internal interface IJsonNodeVisitor + { + void Visit(JsonCompilationUnit node); + void Visit(JsonSequenceNode node); + void Visit(JsonArrayNode node); + void Visit(JsonObjectNode node); + void Visit(JsonPropertyNode node); + void Visit(JsonConstructorNode node); + void Visit(JsonLiteralNode node); + void Visit(JsonNegativeLiteralNode node); + void Visit(JsonTextNode node); + void Visit(JsonEmptyValueNode node); + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs new file mode 100644 index 0000000000000..0980ae8983fd0 --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + using JsonToken = EmbeddedSyntaxToken; + using JsonTrivia = EmbeddedSyntaxTrivia; + + internal static class JsonHelpers + { + public static JsonToken CreateToken( + JsonKind kind, ImmutableArray leadingTrivia, + ImmutableArray virtualChars, ImmutableArray trailingTrivia) + => CreateToken(kind, leadingTrivia, virtualChars, trailingTrivia, ImmutableArray.Empty); + + public static JsonToken CreateToken(JsonKind kind, + ImmutableArray leadingTrivia, ImmutableArray virtualChars, + ImmutableArray trailingTrivia, ImmutableArray diagnostics) + => new JsonToken(kind, leadingTrivia, virtualChars, trailingTrivia, diagnostics, value: null); + + public static JsonToken CreateMissingToken(JsonKind kind) + => CreateToken(kind, ImmutableArray.Empty, ImmutableArray.Empty, ImmutableArray.Empty); + + public static JsonTrivia CreateTrivia(JsonKind kind, ImmutableArray virtualChars) + => CreateTrivia(kind, virtualChars, ImmutableArray.Empty); + + public static JsonTrivia CreateTrivia(JsonKind kind, ImmutableArray virtualChars, ImmutableArray diagnostics) + => new JsonTrivia(kind, virtualChars, diagnostics); + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs new file mode 100644 index 0000000000000..b37d295ff340b --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + internal enum JsonKind + { + None = 0, + Sequence, + CompilationUnit, + Text, + Object, + Array, + Literal, + NegativeLiteral, + Property, + Constructor, + EmptyValue, + + // Tokens + EndOfFile, + OpenBraceToken, + CloseBraceToken, + OpenBracketToken, + CloseBracketToken, + OpenParenToken, + CloseParenToken, + StringToken, + NumberToken, + TextToken, + ColonToken, + CommaToken, + TrueLiteralToken, + FalseLiteralToken, + NullLiteralToken, + UndefinedLiteralToken, + NaNLiteralToken, + InfinityLiteralToken, + NegativeInfinityLiteralToken, + MinusToken, + NewKeyword, + + // Trivia + SingleLineCommentTrivia, + MultiLineCommentTrivia, + WhitespaceTrivia, + EndOfLineTrivia, + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs new file mode 100644 index 0000000000000..b27828b552826 --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Diagnostics; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; +using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + using static EmbeddedSyntaxHelpers; + using static JsonHelpers; + + using JsonToken = EmbeddedSyntaxToken; + using JsonTrivia = EmbeddedSyntaxTrivia; + + internal struct JsonLexer + { + public readonly ImmutableArray Text; + public int Position; + + public JsonLexer(ImmutableArray text) : this() + { + Text = text; + } + + public VirtualChar CurrentChar => Position < Text.Length + ? Text[Position] + : new VirtualChar((char)0, span: default); + + public ImmutableArray GetCharsToCurrentPosition(int start) + { + var end = Position; + var result = ArrayBuilder.GetInstance(end - start); + for (var i = start; i < end; i++) + { + result.Add(Text[i]); + } + + return result.ToImmutableAndFree(); + } + + public JsonToken ScanNextToken() + { + var leadingTrivia = ScanTrivia(leading: true); + if (Position == Text.Length) + { + return CreateToken( + JsonKind.EndOfFile, leadingTrivia, + ImmutableArray.Empty, ImmutableArray.Empty); + } + + var (chars, kind, diagnostic) = ScanNextTokenWorker(); + Debug.Assert(chars.Length > 0); + + var trailingTrivia = ScanTrivia(leading: false); + var token = CreateToken(kind, leadingTrivia, chars, trailingTrivia); + + if (diagnostic != null) + { + token = token.AddDiagnosticIfNone(diagnostic.Value); + } + + return token; + } + + private bool IsSpecial(char ch) + { + // Standard tokens. + switch (ch) + { + case '{': case '}': + case '[': case ']': + case '(': case ')': + case ',': case ':': + case '\'': case '"': + return true; + + case ' ': case '\t': case '/': case '\r': case '\n': + // trivia cases + return true; + } + + // more trivia + if (char.IsWhiteSpace(ch)) + { + return true; + } + + return false; + } + + private (ImmutableArray, JsonKind, EmbeddedDiagnostic? diagnostic) ScanNextTokenWorker() + { + Debug.Assert(Position < Text.Length); + switch (this.CurrentChar) + { + case '{': return ScanSingleCharToken(JsonKind.OpenBraceToken); + case '}': return ScanSingleCharToken(JsonKind.CloseBraceToken); + case '[': return ScanSingleCharToken(JsonKind.OpenBracketToken); + case ']': return ScanSingleCharToken(JsonKind.CloseBracketToken); + case '(': return ScanSingleCharToken(JsonKind.OpenParenToken); + case ')': return ScanSingleCharToken(JsonKind.CloseParenToken); + case ',': return ScanSingleCharToken(JsonKind.CommaToken); + case ':': return ScanSingleCharToken(JsonKind.ColonToken); + + case '\'': case '"': + return ScanString(); + + // It would be tempting to try to scan out numbers here. However, numbers are + // actually quite tricky to get right (especially looking one character at a time). + // So, instead, we take a page from json.net and just consume out a text sequence. + // Later on, we'll analyze that text sequence as a whole to see if it looks like a + // number and to also report any issues in line with how json.net and ecmascript + // handle json numbers. + + //case '-': case '.': + //case '0': case '1': case '2': case '3': case '4': + //case '5': case '6': case '7': case '8': case '9': + // return ScanNumber(); + + default: + return ScanText(); + } + } + + private (ImmutableArray, JsonKind, EmbeddedDiagnostic?) ScanString() + { + var start = Position; + var openChar = this.CurrentChar.Char; + Position++; + + EmbeddedDiagnostic? diagnostic = null; + while (Position < Text.Length) + { + var currentCh = this.CurrentChar.Char; + + Position++; + switch (currentCh) + { + case '"': + case '\'': + if (currentCh == openChar) + { + return (GetCharsToCurrentPosition(start), JsonKind.StringToken, diagnostic); + } + continue; + + case '\\': + var escapeDiag = ScanEscape(start, Position - 1); + diagnostic = diagnostic ?? escapeDiag; + continue; + } + } + + var chars = GetCharsToCurrentPosition(start); + diagnostic = diagnostic ?? new EmbeddedDiagnostic( + WorkspacesResources.Unterminated_string, GetSpan(chars)); + return (chars, JsonKind.StringToken, diagnostic); + } + + /// + /// does not actually lex out an escape token. Instead, it just + /// moves the position forward and returns a diagnostic if this was not a valid escape. + /// + private EmbeddedDiagnostic? ScanEscape(int stringStart, int escapeStart) + { + if (this.Position == Text.Length) + { + var chars = GetCharsToCurrentPosition(stringStart); + return new EmbeddedDiagnostic(WorkspacesResources.Unterminated_string, GetSpan(chars)); + } + + var currentCh = this.CurrentChar; + switch (currentCh) + { + case 'b': + case 't': + case 'n': + case 'f': + case 'r': + case '\\': + case '"': + case '\'': + case '/': + Position++; + return null; + + case 'u': + Position++; + return ScanUnicodeChars(escapeStart, Position); + + default: + Position++; + var chars = GetCharsToCurrentPosition(escapeStart); + return new EmbeddedDiagnostic(WorkspacesResources.Invalid_escape_sequence, GetSpan(chars)); + } + } + + private EmbeddedDiagnostic? ScanUnicodeChars(int escapeStart, int unicodeCharStart) + { + var invalid = false; + for (int i = 0; this.Position < Text.Length && i < 4; i++) + { + var ch = this.CurrentChar; + Position++; + + invalid |= !IsHexDigit(ch); + } + + if (invalid || (Position - unicodeCharStart != 4)) + { + var chars = GetCharsToCurrentPosition(escapeStart); + return new EmbeddedDiagnostic(WorkspacesResources.Invalid_escape_sequence, GetSpan(chars)); + } + + return null; + } + + private static bool IsHexDigit(char c) + { + return (c >= '0' && c <= '9') || + (c >= 'A' && c <= 'F') || + (c >= 'a' && c <= 'f'); + } + + private (ImmutableArray, JsonKind, EmbeddedDiagnostic?) ScanText() + { + var start = Position; + + var firstChar = this.CurrentChar; + while (Position < Text.Length && !IsSpecial(this.CurrentChar)) + { + Position++; + } + + return (GetCharsToCurrentPosition(start), JsonKind.TextToken, null); + } + + private (ImmutableArray, JsonKind, EmbeddedDiagnostic?) ScanSingleCharToken(JsonKind kind) + { + var chars = ImmutableArray.Create(this.CurrentChar); + Position++; + return (chars, kind, null); + } + + private ImmutableArray ScanTrivia(bool leading) + { + var result = ArrayBuilder.GetInstance(); + + var start = Position; + + while (Position < Text.Length) + { + var comment = ScanComment(); + if (comment != null) + { + result.Add(comment.Value); + continue; + } + + var endOfLine = ScanEndOfLine(); + if (endOfLine != null) + { + result.Add(endOfLine.Value); + + if (leading) + { + continue; + } + else + { + break; + } + } + + var whitespace = ScanWhitespace(); + if (whitespace != null) + { + result.Add(whitespace.Value); + continue; + } + + break; + } + + return result.ToImmutableAndFree(); + } + + private JsonTrivia? ScanEndOfLine() + { + var start = Position; + if (IsAt("\r\n")) + { + Position += 2; + return CreateTrivia(JsonKind.EndOfLineTrivia, GetCharsToCurrentPosition(start)); + } + else if (IsAt("\r") || IsAt("\n")) + { + Position++; + return CreateTrivia(JsonKind.EndOfLineTrivia, GetCharsToCurrentPosition(start)); + } + + return null; + } + + public JsonTrivia? ScanComment() + { + if (IsAt("//")) + { + return ScanSingleLineComment(); + } + else if (IsAt("/*")) + { + return ScanMultiLineComment(); + } + else if (IsAt("/")) + { + var start = Position; + Position++; + + var chars = GetCharsToCurrentPosition(start); + return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars, + ImmutableArray.Create(new EmbeddedDiagnostic( + WorkspacesResources.Error_parsing_comment, + GetSpan(chars)))); + } + + return null; + } + + private JsonTrivia ScanSingleLineComment() + { + var start = Position; + Position += 2; + + while (Position < Text.Length && + this.CurrentChar is var ch && + ch != '\r' && ch != '\n') + { + Position++; + } + + var chars = GetCharsToCurrentPosition(start); + if (Position == start + 2) + { + // Note: json.net reports an error if the file ends with "//", so we just + // preserve that behavior. + var diagnostics = ImmutableArray.Create(new EmbeddedDiagnostic( + WorkspacesResources.Unterminated_comment, + GetSpan(chars))); + return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars, diagnostics); + } + + return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars); + } + + private JsonTrivia ScanMultiLineComment() + { + var start = Position; + Position += 2; + + while (Position < Text.Length && + !IsAt("*/")) + { + Position++; + } + + if (IsAt("*/")) + { + Position += 2; + return CreateTrivia(JsonKind.MultiLineCommentTrivia, GetCharsToCurrentPosition(start)); + } + + Debug.Assert(Position == Text.Length); + return CreateTrivia(JsonKind.MultiLineCommentTrivia, GetCharsToCurrentPosition(start), + ImmutableArray.Create(new EmbeddedDiagnostic( + WorkspacesResources.Unterminated_comment, + GetTextSpan(start, Position)))); + } + + private TextSpan GetTextSpan(int startInclusive, int endExclusive) + => TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End); + + private bool IsAt(string val) + => TextAt(this.Position, val); + + private bool TextAt(int position, string val) + { + for (var i = 0; i < val.Length; i++) + { + if (position + i >= Text.Length || + Text[position + i] != val[i]) + { + return false; + } + } + + return true; + } + + private JsonTrivia? ScanWhitespace() + { + var start = Position; + while (Position < Text.Length && + char.IsWhiteSpace(this.CurrentChar)) + { + Position++; + } + + if (Position > start) + { + return CreateTrivia(JsonKind.WhitespaceTrivia, GetCharsToCurrentPosition(start)); + } + + return null; + } + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs new file mode 100644 index 0000000000000..a172b258ccf7c --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + internal abstract class JsonNode : EmbeddedSyntaxNode + { + protected JsonNode(JsonKind kind) : base(kind) + { + } + + public abstract void Accept(IJsonNodeVisitor visitor); + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs new file mode 100644 index 0000000000000..ce7d9829b0cbe --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft. 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.Immutable; +using System.Diagnostics; +using System.Linq; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + using JsonNodeOrToken = EmbeddedSyntaxNodeOrToken; + using JsonToken = EmbeddedSyntaxToken; + + internal sealed class JsonCompilationUnit : JsonNode + { + public JsonCompilationUnit(JsonSequenceNode sequence, JsonToken endOfFileToken) + : base(JsonKind.CompilationUnit) + { + Debug.Assert(sequence != null); + Debug.Assert(endOfFileToken.Kind == JsonKind.EndOfFile); + Sequence = sequence; + EndOfFileToken = endOfFileToken; + } + + public JsonSequenceNode Sequence { get; } + public JsonToken EndOfFileToken { get; } + + internal override int ChildCount => 2; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return Sequence; + case 1: return EndOfFileToken; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + /// + /// Root of all value nodes. + /// + internal abstract class JsonValueNode : JsonNode + { + protected JsonValueNode(JsonKind kind) + : base(kind) + { + } + } + + /// + /// Represents a possibly-empty sequence of json expressions. + /// + internal sealed class JsonSequenceNode : JsonNode + { + public ImmutableArray Children { get; } + + internal override int ChildCount => Children.Length; + + public JsonSequenceNode(ImmutableArray children) + : base(JsonKind.Sequence) + { + Debug.Assert(children.All(v => v != null)); + this.Children = children; + } + + internal override JsonNodeOrToken ChildAt(int index) + => Children[index]; + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + /// + /// Represents a chunk of text that we did not understand as anything special. i.e. it wasn't a + /// keyword, number, or literal. + /// + internal sealed class JsonTextNode : JsonValueNode + { + public JsonTextNode(JsonToken textToken) + : base(JsonKind.Text) + { + Debug.Assert(textToken.Kind == JsonKind.TextToken); + TextToken = textToken; + } + + public JsonToken TextToken { get; } + + internal override int ChildCount => 1; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return TextToken; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + internal sealed class JsonObjectNode : JsonValueNode + { + public JsonObjectNode( + JsonToken openBraceToken, + JsonSequenceNode sequence, + JsonToken closeBraceToken) + : base(JsonKind.Object) + { + Debug.Assert(openBraceToken.Kind == JsonKind.OpenBraceToken); + Debug.Assert(sequence != null); + Debug.Assert(closeBraceToken.Kind == JsonKind.CloseBraceToken); + + OpenBraceToken = openBraceToken; + Sequence = sequence; + CloseBraceToken = closeBraceToken; + } + + public JsonToken OpenBraceToken { get; } + public JsonSequenceNode Sequence { get; } + public JsonToken CloseBraceToken { get; } + + internal override int ChildCount => 3; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return OpenBraceToken; + case 1: return Sequence; + case 2: return CloseBraceToken; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + internal sealed class JsonArrayNode : JsonValueNode + { + public JsonArrayNode( + JsonToken openBracketToken, + JsonSequenceNode sequence, + JsonToken closeBracketToken) + : base(JsonKind.Array) + { + Debug.Assert(openBracketToken.Kind == JsonKind.OpenBracketToken); + Debug.Assert(sequence != null); + Debug.Assert(closeBracketToken.Kind == JsonKind.CloseBracketToken); + + OpenBracketToken = openBracketToken; + Sequence = sequence; + CloseBracketToken = closeBracketToken; + } + + public JsonToken OpenBracketToken { get; } + public JsonSequenceNode Sequence { get; } + public JsonToken CloseBracketToken { get; } + + internal override int ChildCount => 3; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return OpenBracketToken; + case 1: return Sequence; + case 2: return CloseBracketToken; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + internal sealed class JsonNegativeLiteralNode : JsonValueNode + { + public JsonNegativeLiteralNode(JsonToken minusToken, JsonToken literalToken) + : base(JsonKind.NegativeLiteral) + { + MinusToken = minusToken; + LiteralToken = literalToken; + } + + public JsonToken MinusToken { get; } + public JsonToken LiteralToken { get; } + + internal override int ChildCount => 2; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return MinusToken; + case 1: return LiteralToken; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + internal sealed class JsonLiteralNode : JsonValueNode + { + public JsonLiteralNode(JsonToken literalToken) + : base(JsonKind.Literal) + { + LiteralToken = literalToken; + } + + public JsonToken LiteralToken { get; } + + internal override int ChildCount => 1; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return LiteralToken; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + internal sealed class JsonEmptyValueNode : JsonValueNode + { + public JsonEmptyValueNode(JsonToken commaToken) + : base(JsonKind.EmptyValue) + { + Debug.Assert(commaToken.Kind == JsonKind.CommaToken); + CommaToken = commaToken; + } + + public JsonToken CommaToken { get; } + + internal override int ChildCount => 1; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return CommaToken; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + internal sealed class JsonPropertyNode : JsonValueNode + { + public JsonPropertyNode(JsonToken nameToken, JsonToken colonToken, JsonValueNode value) + : base(JsonKind.Property) + { + Debug.Assert(nameToken.Kind == JsonKind.StringToken || nameToken.Kind == JsonKind.TextToken); + Debug.Assert(colonToken.Kind == JsonKind.ColonToken); + Debug.Assert(value != null); + NameToken = nameToken; + ColonToken = colonToken; + Value = value; + } + + public JsonToken NameToken { get; } + public JsonToken ColonToken { get; } + public JsonValueNode Value { get; } + + internal override int ChildCount => 3; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return NameToken; + case 1: return ColonToken; + case 2: return Value; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } + + internal sealed class JsonConstructorNode : JsonValueNode + { + public JsonConstructorNode( + JsonToken newKeyword, JsonToken nameToken, JsonToken openParenToken, JsonSequenceNode sequence, JsonToken closeParenToken) + : base(JsonKind.Constructor) + { + NewKeyword = newKeyword; + NameToken = nameToken; + OpenParenToken = openParenToken; + Sequence = sequence; + CloseParenToken = closeParenToken; + } + + public JsonToken NewKeyword { get; } + public JsonToken NameToken { get; } + public JsonToken OpenParenToken { get; } + public JsonSequenceNode Sequence { get; } + public JsonToken CloseParenToken { get; } + + internal override int ChildCount => 5; + + internal override JsonNodeOrToken ChildAt(int index) + { + switch (index) + { + case 0: return NewKeyword; + case 1: return NameToken; + case 2: return OpenParenToken; + case 3: return Sequence; + case 4: return CloseParenToken; + } + + throw new InvalidOperationException(); + } + + public override void Accept(IJsonNodeVisitor visitor) + => visitor.Visit(this); + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs new file mode 100644 index 0000000000000..fe4dbb63f1f7c --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Composition; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Options.Providers; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + internal class JsonOptions + { + public static PerLanguageOption ColorizeJsonPatterns = + new PerLanguageOption( + nameof(JsonOptions), + nameof(ColorizeJsonPatterns), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ColorizeJsonPatterns")); + + public static PerLanguageOption ReportInvalidJsonPatterns = + new PerLanguageOption( + nameof(JsonOptions), + nameof(ReportInvalidJsonPatterns), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")); + + public static PerLanguageOption HighlightRelatedJsonComponentsUnderCursor = + new PerLanguageOption( + nameof(JsonOptions), + nameof(HighlightRelatedJsonComponentsUnderCursor), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")); + + public static PerLanguageOption DetectAndOfferEditorFeaturesForProbableJsonStrings = + new PerLanguageOption( + nameof(JsonOptions), + nameof(DetectAndOfferEditorFeaturesForProbableJsonStrings), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DetectAndOfferEditorFeaturesForProbableJsonStrings")); + } + + [ExportOptionProvider, Shared] + internal class JsonOptionsProvider : IOptionProvider + { + public ImmutableArray Options { get; } = ImmutableArray.Create( + JsonOptions.ColorizeJsonPatterns, + JsonOptions.ReportInvalidJsonPatterns, + JsonOptions.HighlightRelatedJsonComponentsUnderCursor, + JsonOptions.DetectAndOfferEditorFeaturesForProbableJsonStrings); + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs new file mode 100644 index 0000000000000..b254465d1b574 --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Globalization; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + using static EmbeddedSyntaxHelpers; + + using JsonToken = EmbeddedSyntaxToken; + + internal partial struct JsonParser + { + private static class JsonNetSyntaxChecker + { + private static EmbeddedDiagnostic? CheckChildren(JsonNode node) + { + foreach (var child in node) + { + if (child.IsNode) + { + var diagnostic = CheckSyntax(child.Node); + if (diagnostic != null) + { + return diagnostic; + } + } + } + + return null; + } + + public static EmbeddedDiagnostic? CheckSyntax(JsonNode node) + { + switch (node.Kind) + { + case JsonKind.Array: return CheckArray((JsonArrayNode)node); + case JsonKind.Object: return CheckObject((JsonObjectNode)node); + case JsonKind.Constructor: return CheckConstructor((JsonConstructorNode)node); + case JsonKind.Property: return CheckProperty((JsonPropertyNode)node); + case JsonKind.Literal: return CheckLiteral((JsonLiteralNode)node); + case JsonKind.NegativeLiteral: return CheckNegativeLiteral((JsonNegativeLiteralNode)node); + } + + return CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckLiteral(JsonLiteralNode node) + { + if (node.LiteralToken.Kind == JsonKind.NumberToken) + { + return CheckNumber(node.LiteralToken); + } + + return CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckNegativeLiteral(JsonNegativeLiteralNode node) + { + if (node.LiteralToken.Kind == JsonKind.NumberToken) + { + return CheckNumber(node.LiteralToken); + } + + return CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckNumber(JsonToken numberToken) + { + // This code was effectively copied from: + // https://github.com/JamesNK/Newtonsoft.Json/blob/993215529562866719689206e27e413013d4439c/Src/Newtonsoft.Json/JsonTextReader.cs#L1926 + // So as to match Newtonsoft.Json's behavior around number parsing. + var chars = numberToken.VirtualChars; + var firstChar = chars[0].Char; + + var singleDigit = char.IsDigit(firstChar) && chars.Length == 1; + if (singleDigit) + { + return null; + } + + var nonBase10 = + firstChar == '0' && chars.Length > 1 && + chars[1] != '.' && chars[1] != 'e' && chars[1] != 'E'; + + var literalText = numberToken.VirtualChars.CreateString(); + if (nonBase10) + { + Debug.Assert(chars.Length > 1); + var b = chars[1] == 'x' || chars[1] == 'X' ? 16 : 8; + + try + { + Convert.ToInt64(literalText, b); + } + catch (Exception) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Invalid_number, + GetSpan(chars)); + } + } + else if (!double.TryParse( + literalText, NumberStyles.Float, + CultureInfo.InvariantCulture, out _)) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Invalid_number, + GetSpan(chars)); + } + + return null; + } + + private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) + { + foreach (var child in node.Sequence) + { + var childNode = child.Node; + if (childNode.Kind == JsonKind.Property) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Properties_not_allowed_in_an_array, + ((JsonPropertyNode)childNode).ColonToken.GetSpan()); + } + } + + var diagnostic = CheckCommasBetweenSequenceElements(node.Sequence); + return diagnostic ?? CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckConstructor(JsonConstructorNode node) + { + if (!IsValidConstructorName(node.NameToken)) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Invalid_constructor_name, + node.NameToken.GetSpan()); + } + + return CheckCommasBetweenSequenceElements(node.Sequence) ?? CheckChildren(node); + } + + private static bool IsValidConstructorName(JsonToken nameToken) + { + foreach (var vc in nameToken.VirtualChars) + { + if (!char.IsLetterOrDigit(vc.Char)) + { + return false; + } + } + + return true; + } + + private static EmbeddedDiagnostic? CheckCommasBetweenSequenceElements(JsonSequenceNode node) + { + for (int i = 0, n = node.ChildCount - 1; i < n; i++) + { + var child = node.ChildAt(i).Node; + if (child.Kind != JsonKind.EmptyValue) + { + var next = node.ChildAt(i + 1).Node; + + if (next.Kind != JsonKind.EmptyValue) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_expected, ','), + GetFirstToken(next).GetSpan()); + } + } + } + + return null; + } + + private static EmbeddedDiagnostic? CheckObject(JsonObjectNode node) + { + for (int i = 0, n = node.Sequence.ChildCount; i < n; i++) + { + var child = node.Sequence.ChildAt(i).Node; + + if (i % 2 == 0) + { + if (child.Kind != JsonKind.Property) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Only_properties_allowed_in_an_object, + GetFirstToken(child).GetSpan()); + } + } + else + { + if (child.Kind != JsonKind.EmptyValue) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_expected, ','), + GetFirstToken(child).GetSpan()); + } + } + } + + return CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckProperty(JsonPropertyNode node) + { + if (node.NameToken.Kind != JsonKind.StringToken && + !IsLegalPropertyNameText(node.NameToken)) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Invalid_property_name, + node.NameToken.GetSpan()); + } + + return CheckChildren(node); + } + + private static bool IsLegalPropertyNameText(JsonToken textToken) + { + foreach (var ch in textToken.VirtualChars) + { + if (!IsLegalPropertyNameChar(ch)) + { + return false; + } + } + + return true; + } + + private static bool IsLegalPropertyNameChar(char ch) + => char.IsLetterOrDigit(ch) || ch == '_' || ch == '$'; + } + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs new file mode 100644 index 0000000000000..36a7be4fcd832 --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + + +using System.Collections.Immutable; +using System.Text.RegularExpressions; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + using static EmbeddedSyntaxHelpers; + + using JsonToken = EmbeddedSyntaxToken; + using JsonTrivia = EmbeddedSyntaxTrivia; + + internal partial struct JsonParser + { + private static class StrictSyntaxChecker + { + private static EmbeddedDiagnostic? CheckChildren(JsonNode node) + { + foreach (var child in node) + { + var diagnostic = child.IsNode ? CheckSyntax(child.Node) : CheckToken(child.Token); + if (diagnostic != null) + { + return diagnostic; + } + } + + return null; + } + + private static EmbeddedDiagnostic? CheckToken(JsonToken token) + => CheckTrivia(token.LeadingTrivia) ?? CheckTrivia(token.TrailingTrivia); + + private static EmbeddedDiagnostic? CheckTrivia(ImmutableArray triviaList) + { + foreach (var trivia in triviaList) + { + var diagnostic = CheckTrivia(trivia); + if (diagnostic != null) + { + return diagnostic; + } + } + + return null; + } + + private static EmbeddedDiagnostic? CheckTrivia(JsonTrivia trivia) + { + switch (trivia.Kind) + { + case JsonKind.MultiLineCommentTrivia: + case JsonKind.SingleLineCommentTrivia: + return new EmbeddedDiagnostic( + WorkspacesResources.Comments_not_allowed, + GetSpan(trivia.VirtualChars)); + case JsonKind.WhitespaceTrivia: + return CheckWhitespace(trivia); + } + + return null; + } + + private static EmbeddedDiagnostic? CheckWhitespace(JsonTrivia trivia) + { + foreach (var ch in trivia.VirtualChars) + { + switch (ch) + { + case ' ': case '\t': + break; + + default: + return new EmbeddedDiagnostic( + WorkspacesResources.Illegal_whitespace_character, + ch.Span); + } + } + + return null; + } + + public static EmbeddedDiagnostic? CheckSyntax(JsonNode node) + { + switch (node.Kind) + { + case JsonKind.Constructor: return CheckConstructor((JsonConstructorNode)node); + case JsonKind.Literal: return CheckLiteral((JsonLiteralNode)node); + case JsonKind.NegativeLiteral: return CheckNegativeLiteral((JsonNegativeLiteralNode)node); + case JsonKind.Property: return CheckProperty((JsonPropertyNode)node); + case JsonKind.Array: return CheckArray((JsonArrayNode)node); + case JsonKind.Object: return CheckObject((JsonObjectNode)node); + } + + return CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckObject(JsonObjectNode node) + { + var sequence = node.Sequence; + foreach (var child in sequence) + { + var childNode = child.Node; + if (childNode.Kind != JsonKind.Property && childNode.Kind != JsonKind.EmptyValue) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Only_properties_allowed_in_an_object, + GetFirstToken(childNode).GetSpan()); + } + } + + return CheckProperSeparation(sequence) ?? CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) + { + foreach (var child in node.Sequence) + { + var childNode = child.Node; + if (childNode.Kind == JsonKind.Property) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Properties_not_allowed_in_an_array, + ((JsonPropertyNode)childNode).ColonToken.GetSpan()); + } + } + + return CheckProperSeparation(node.Sequence) ?? CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckProperSeparation(JsonSequenceNode sequence) + { + for (int i = 0, n = sequence.ChildCount; i < n; i++) + { + var child = sequence.ChildAt(i).Node; + if (i % 2 == 0) + { + if (child.Kind == JsonKind.EmptyValue) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_unexpected, ","), + child.GetSpan()); + } + } + else + { + if (child.Kind != JsonKind.EmptyValue) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_expected, ","), + GetFirstToken(child).GetSpan()); + } + } + } + + if (sequence.ChildCount != 0 && sequence.ChildCount % 2 == 0) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Trailing_comma_not_allowed, + sequence.ChildAt(sequence.ChildCount - 1).Node.GetSpan()); + } + + return null; + } + + private static EmbeddedDiagnostic? CheckProperty(JsonPropertyNode node) + { + if (node.NameToken.Kind != JsonKind.StringToken) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Property_name_must_be_a_string, + node.NameToken.GetSpan()); + } + + if (node.Value.Kind == JsonKind.EmptyValue) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Value_required, + new TextSpan(node.ColonToken.VirtualChars[0].Span.End, 0)); + } + + return CheckString(node.NameToken) ?? CheckChildren(node); + } + + private static EmbeddedDiagnostic? CheckLiteral(JsonLiteralNode node) + { + switch (node.LiteralToken.Kind) + { + case JsonKind.NaNLiteralToken: + case JsonKind.InfinityLiteralToken: + case JsonKind.UndefinedLiteralToken: + return InvalidLiteral(node.LiteralToken); + case JsonKind.NumberToken: + return CheckNumber(node.LiteralToken); + case JsonKind.StringToken: + return CheckString(node.LiteralToken); + } + + return CheckChildren(node); + } + + /* + From: https://tools.ietf.org/html/rfc8259 + + The representation of numbers is similar to that used in most + programming languages. A number is represented in base 10 using + decimal digits. It contains an integer component that may be + prefixed with an optional minus sign, which may be followed by a + fraction part and/or an exponent part. Leading zeros are not + allowed. + + A fraction part is a decimal point followed by one or more digits. + + An exponent part begins with the letter E in uppercase or lowercase, + which may be followed by a plus or minus sign. The E and optional + sign are followed by one or more digits. + + Numeric values that cannot be represented in the grammar below (such + as Infinity and NaN) are not permitted. + + number = [ minus ] int [ frac ] [ exp ] + decimal-point = %x2E ; . + digit1-9 = %x31-39 ; 1-9 + e = %x65 / %x45 ; e E + + exp = e [ minus / plus ] 1*DIGIT + frac = decimal-point 1*DIGIT + int = zero / ( digit1-9 *DIGIT ) + minus = %x2D ; - + plus = %x2B ; + + zero = %x30 ; 0 + */ + + private static readonly Regex s_validNumberRegex = + new Regex( +@"^ +-? # [ minus ] +(0|([1-9][0-9]*)) # int +(\.[0-9]+)? # [ frac ] +([eE][-+]?[0-9]+)? # [ exp ] +$", + RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace); + + private static EmbeddedDiagnostic? CheckNumber(JsonToken literalToken) + { + var literalText = literalToken.VirtualChars.CreateString(); + if (!s_validNumberRegex.IsMatch(literalText)) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Invalid_number, + literalToken.GetSpan()); + } + + if (!double.TryParse(literalText, out var val) || + double.IsNaN(val) || + double.IsInfinity(val)) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Invalid_number, + literalToken.GetSpan()); + } + + return CheckToken(literalToken); + } + + private static EmbeddedDiagnostic? CheckString(JsonToken literalToken) + { + var chars = literalToken.VirtualChars; + if (chars[0].Char == '\'') + { + return new EmbeddedDiagnostic( + WorkspacesResources.Strings_must_start_with_double_quote_not_single_quote, + chars[0].Span); + } + + for (int i = 1, n = chars.Length - 1; i < n; i++) + { + if (chars[i].Char < ' ') + { + return new EmbeddedDiagnostic( + WorkspacesResources.Illegal_string_character, + chars[i].Span); + } + } + + // Lexer allows \' as that's ok in json.net. Check and block that here. + for (int i = 1, n = chars.Length - 1; i < n;) + { + if (chars[i] == '\\') + { + if (chars[i + 1] == '\'') + { + return new EmbeddedDiagnostic( + WorkspacesResources.Invalid_escape_sequence, + TextSpan.FromBounds(chars[i].Span.Start, chars[i + 1].Span.End)); + } + + // Legal escape. just jump forward past it. Note, this works for simple + // escape and unicode \uXXXX escapes. + i += 2; + continue; + } + + i++; + } + + return CheckToken(literalToken); + } + + private static EmbeddedDiagnostic? InvalidLiteral(JsonToken literalToken) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_literal_not_allowed, literalToken.VirtualChars.CreateString()), + literalToken.GetSpan()); + } + + private static EmbeddedDiagnostic? CheckNegativeLiteral(JsonNegativeLiteralNode node) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_literal_not_allowed, "-Infinity"), + node.GetSpan()); + } + + private static EmbeddedDiagnostic? CheckConstructor(JsonConstructorNode node) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Constructors_not_allowed, + node.NewKeyword.GetSpan()); + } + } + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs new file mode 100644 index 0000000000000..8f657a26b57b0 --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft. 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.Immutable; +using System.Diagnostics; +using System.Linq; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; +using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + using static EmbeddedSyntaxHelpers; + using static JsonHelpers; + + using JsonNodeOrToken = EmbeddedSyntaxNodeOrToken; + using JsonToken = EmbeddedSyntaxToken; + using JsonTrivia = EmbeddedSyntaxTrivia; + + internal partial struct JsonParser + { + private static readonly string _closeBracketExpected = string.Format(WorkspacesResources._0_expected, ']'); + private static readonly string _closeBraceExpected = string.Format(WorkspacesResources._0_expected, '}'); + private static readonly string _openParenExpected = string.Format(WorkspacesResources._0_expected, '('); + private static readonly string _closeParenExpected = string.Format(WorkspacesResources._0_expected, ')'); + + private JsonLexer _lexer; + private JsonToken _currentToken; + private int _recursionDepth; + + // Fields used to keep track of what types of json values we're in. They're used for error + // recovery, specifically with respect to to encountering unexpected tokens while parsing + // out a sequence of values. For example, if we have: ```{ a: [1, 2, }```, we will mark + // that we're both in an object and in an array. When we then encounter the errant ```}```, + // we'll see that we were in an object, and thus should stop parsing out the sequence for + // the array so that the ```}``` can be consume by the object we were in. However, if we + // just had ```[1, 2, }```, we would not be in an object, and we would just consume the + // ```}``` as a bogus value inside the array. + // + // This approach of keeping track of the parse contexts we're in, and using them to + // determine if we should consume or pop-out when encountering an error token, mirrors the + // same approach that we use in the C# and TS/JS parsers. + private bool _inObject; + private bool _inArray; + private bool _inConstructor; + + private JsonParser( + ImmutableArray text) : this() + { + _lexer = new JsonLexer(text); + + // Get the first token. + ConsumeCurrentToken(); + } + + /// + /// Returns the latest token the lexer has produced, and then asks the lexer to + /// produce the next token after that. + /// + private JsonToken ConsumeCurrentToken() + { + var previous = _currentToken; + _currentToken = _lexer.ScanNextToken(); + return previous; + } + + /// + /// Given an input text, parses out a fully representative syntax tree and list of + /// diagnostics. Parsing should always succeed, except in the case of the stack + /// overflowing. + /// + public static JsonTree TryParse(ImmutableArray text, bool strict) + { + try + { + return new JsonParser(text).ParseTree(strict); + } + catch (Exception e) when (StackGuard.IsInsufficientExecutionStackException(e)) + { + return null; + } + } + + private JsonTree ParseTree(bool strict) + { + var arraySequence = this.ParseSequence(); + Debug.Assert(_lexer.Position == _lexer.Text.Length); + Debug.Assert(_currentToken.Kind == JsonKind.EndOfFile); + + var root = new JsonCompilationUnit(arraySequence, _currentToken); + + var diagnostic = GetFirstDiagnostic(root) ?? CheckTopLevel(_lexer.Text, root); + if (diagnostic == null) + { + // We didn't have any diagnostics in the tree so far. Do the json.net/strict checks + // depending on how we were invoked. + diagnostic = strict + ? StrictSyntaxChecker.CheckSyntax(root) + : JsonNetSyntaxChecker.CheckSyntax(root); + } + + var diagnostics = diagnostic == null + ? ImmutableArray.Empty + : ImmutableArray.Create(diagnostic.Value); + + return new JsonTree( + _lexer.Text, root, diagnostics); + } + + /// + /// Checks for errors in json for both json.net and strict mode. + /// + private static EmbeddedDiagnostic? CheckTopLevel( + ImmutableArray text, JsonCompilationUnit compilationUnit) + { + var arraySequence = compilationUnit.Sequence; + if (arraySequence.ChildCount == 0) + { + // json is not allowed to be just whitespace. + if (text.Length > 0 && + compilationUnit.EndOfFileToken.LeadingTrivia.All( + t => t.Kind == JsonKind.WhitespaceTrivia || t.Kind == JsonKind.EndOfLineTrivia)) + { + return new EmbeddedDiagnostic(WorkspacesResources.Syntax_error, GetSpan(text)); + } + } + else if (arraySequence.ChildCount >= 2) + { + // the top level can't have more than one actual value. + var firstToken = GetFirstToken(arraySequence.ChildAt(1).Node); + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_unexpected, firstToken.VirtualChars[0].Char), + firstToken.GetSpan()); + } + + foreach (var child in compilationUnit.Sequence) + { + if (child.IsNode && child.Node.Kind == JsonKind.EmptyValue) + { + var emptyValue = (JsonEmptyValueNode)child.Node; + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_unexpected, ','), + emptyValue.CommaToken.GetSpan()); + } + } + + return null; + } + + private static JsonToken GetFirstToken(JsonNode node) + { + var child = node.ChildAt(0); + return child.IsNode + ? GetFirstToken(child.Node) + : child.Token; + } + + private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonNode node) + { + foreach (var child in node) + { + var diagnostic = GetFirstDiagnostic(child); + if (diagnostic != null) + { + return diagnostic; + } + } + + return null; + } + + private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonNodeOrToken child) + { + return child.IsNode + ? GetFirstDiagnostic(child.Node) + : GetFirstDiagnostic(child.Token); + } + + private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonToken token) + => GetFirstDiagnostic(token.LeadingTrivia) ?? token.Diagnostics.FirstOrNullable() ?? GetFirstDiagnostic(token.TrailingTrivia); + + private static EmbeddedDiagnostic? GetFirstDiagnostic(ImmutableArray list) + { + foreach (var trivia in list) + { + var diagnostic = trivia.Diagnostics.FirstOrNullable(); + if (diagnostic != null) + { + return diagnostic; + } + } + + return null; + } + + private JsonSequenceNode ParseSequence() + { + try + { + _recursionDepth++; + StackGuard.EnsureSufficientExecutionStack(_recursionDepth); + return ParseSequenceWorker(); + } + finally + { + _recursionDepth--; + } + } + + private JsonSequenceNode ParseSequenceWorker() + { + var list = ArrayBuilder.GetInstance(); + + while (ShouldConsumeSequenceElement()) + { + list.Add(ParseValue()); + } + + return new JsonSequenceNode(list.ToImmutableAndFree()); + } + + private bool ShouldConsumeSequenceElement() + { + if (_currentToken.Kind == JsonKind.EndOfFile) + { + return false; + } + + if (_currentToken.Kind == JsonKind.CloseBraceToken) + { + return !_inObject; + } + + if (_currentToken.Kind == JsonKind.CloseBracketToken) + { + return !_inArray; + } + + if (_currentToken.Kind == JsonKind.CloseParenToken) + { + return !_inConstructor; + } + + return true; + } + + private JsonValueNode ParseValue() + { + switch (_currentToken.Kind) + { + case JsonKind.OpenBraceToken: + return ParseObject(); + case JsonKind.OpenBracketToken: + return ParseArray(); + case JsonKind.CommaToken: + return ParseEmptyValue(); + default: + return ParseLiteralOrPropertyOrConstructor(); + } + } + + private static void SplitLiteral(JsonToken literalToken, out JsonToken minusToken, out JsonToken newLiteralToken) + { + minusToken = CreateToken( + JsonKind.MinusToken, literalToken.LeadingTrivia, + ImmutableArray.Create(literalToken.VirtualChars[0]), + ImmutableArray.Empty); + newLiteralToken = CreateToken( + literalToken.Kind, + ImmutableArray.Empty, + literalToken.VirtualChars.Skip(1).ToImmutableArray(), + literalToken.TrailingTrivia, + literalToken.Diagnostics); + } + + private JsonPropertyNode ParseProperty(JsonToken stringLiteralOrText) + { + Debug.Assert(_currentToken.Kind == JsonKind.ColonToken); + if (stringLiteralOrText.Kind != JsonKind.StringToken) + { + stringLiteralOrText = stringLiteralOrText.With(kind: JsonKind.TextToken); + } + + var colonToken = ConsumeCurrentToken(); + // Newtonsoft allows "{ a: , }" as a legal property. + if (_currentToken.Kind == JsonKind.CommaToken) + { + return new JsonPropertyNode( + stringLiteralOrText, colonToken, + new JsonEmptyValueNode(CreateMissingToken(JsonKind.CommaToken))); + } + else if (_currentToken.Kind == JsonKind.EndOfFile) + { + return new JsonPropertyNode( + stringLiteralOrText, colonToken, + new JsonEmptyValueNode(CreateMissingToken(JsonKind.CommaToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( + WorkspacesResources.Missing_property_value, + GetTokenStartPositionSpan(_currentToken))))); + } + + var value = ParseValue(); + if (value.Kind == JsonKind.Property) + { + var nestedProperty = (JsonPropertyNode)value; + value = new JsonPropertyNode( + nestedProperty.NameToken, + nestedProperty.ColonToken.AddDiagnosticIfNone(new EmbeddedDiagnostic( + WorkspacesResources.Nested_properties_not_allowed, + nestedProperty.ColonToken.GetSpan())), + nestedProperty.Value); + } + + return new JsonPropertyNode( + stringLiteralOrText, colonToken, value); + } + + private JsonValueNode ParseLiteralOrPropertyOrConstructor() + { + var textToken = ConsumeCurrentToken(); + if (_currentToken.Kind != JsonKind.ColonToken) + { + return ParseLiteralOrTextOrConstructor(textToken); + } + + return ParseProperty(textToken); + } + + private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) + { + if (token.Kind == JsonKind.StringToken) + { + return new JsonLiteralNode(token); + } + + if (Matches(token, "new")) + { + return ParseConstructor(token); + } + + Debug.Assert(token.VirtualChars.Length > 0); + if (TryMatch(token, "NaN", JsonKind.NaNLiteralToken, out var newKind) || + TryMatch(token, "true", JsonKind.TrueLiteralToken, out newKind) || + TryMatch(token, "null", JsonKind.NullLiteralToken, out newKind) || + TryMatch(token, "false", JsonKind.FalseLiteralToken, out newKind) || + TryMatch(token, "Infinity", JsonKind.InfinityLiteralToken, out newKind) || + TryMatch(token, "undefined", JsonKind.UndefinedLiteralToken, out newKind)) + { + return new JsonLiteralNode(token.With(kind: newKind)); + } + + if (Matches(token, "-Infinity")) + { + SplitLiteral(token, out var minusToken, out var newLiteralToken); + + return new JsonNegativeLiteralNode( + minusToken, newLiteralToken.With(kind: JsonKind.InfinityLiteralToken)); + } + + var firstChar = token.VirtualChars[0]; + if (firstChar == '-' || firstChar == '.' || IsDigit(firstChar)) + { + return ParseNumber(token); + } + + return new JsonTextNode( + token.With(kind: JsonKind.TextToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_unexpected, firstChar.Char), + firstChar.Span))); + } + + private JsonConstructorNode ParseConstructor(JsonToken token) + { + var newKeyword = token.With(kind: JsonKind.NewKeyword); + var nameToken = ConsumeToken(JsonKind.TextToken, WorkspacesResources.Name_expected); + var openParen = ConsumeToken(JsonKind.OpenParenToken, _openParenExpected); + + var savedInConstructor = _inConstructor; + _inConstructor = true; + + var result = new JsonConstructorNode( + newKeyword, + nameToken, + openParen, + ParseSequence(), + ConsumeToken(JsonKind.CloseParenToken, _closeParenExpected)); + + _inConstructor = savedInConstructor; + return result; + } + + private bool TryMatch(JsonToken token, string val, JsonKind kind, out JsonKind newKind) + { + if (Matches(token, val)) + { + newKind = kind; + return true; + } + + newKind = default; + return false; + } + + private bool Matches(JsonToken token, string val) + { + var chars = token.VirtualChars; + if (chars.Length != val.Length) + { + return false; + } + + for (int i = 0; i < val.Length; i++) + { + if (chars[i].Char != val[i]) + { + return false; + } + } + + return true; + } + + private static bool IsDigit(char ch) + => ch >= '0' && ch <= '9'; + + private static JsonLiteralNode ParseLiteral(JsonToken textToken, JsonKind kind) + => new JsonLiteralNode(textToken.With(kind: kind)); + + private static JsonValueNode ParseNumber(JsonToken textToken) + { + var numberToken = textToken.With(kind: JsonKind.NumberToken); + return new JsonLiteralNode(numberToken); + } + + private JsonEmptyValueNode ParseEmptyValue() + => new JsonEmptyValueNode(ConsumeCurrentToken()); + + private JsonArrayNode ParseArray() + { + var savedInArray = _inArray; + _inArray = true; + + var result = new JsonArrayNode( + ConsumeCurrentToken(), + ParseSequence(), + ConsumeToken(JsonKind.CloseBracketToken, _closeBracketExpected)); + + _inArray = savedInArray; + return result; + } + + private JsonObjectNode ParseObject() + { + var savedInObject = _inObject; + _inObject = true; + + var result = new JsonObjectNode( + ConsumeCurrentToken(), + ParseSequence(), + ConsumeToken(JsonKind.CloseBraceToken, _closeBraceExpected)); + + _inObject = savedInObject; + return result; + } + + private JsonToken ConsumeToken(JsonKind kind, string error) + { + if (_currentToken.Kind == kind) + { + return ConsumeCurrentToken(); + } + else + { + return CreateMissingToken(kind).AddDiagnosticIfNone( + new EmbeddedDiagnostic(error, GetTokenStartPositionSpan(_currentToken))); + } + } + + private TextSpan GetTokenStartPositionSpan(JsonToken token) + { + return token.Kind == JsonKind.EndOfFile + ? new TextSpan(_lexer.Text.Last().Span.End, 0) + : new TextSpan(token.VirtualChars[0].Span.Start, 0); + } + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs new file mode 100644 index 0000000000000..5b54bab97d19a --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json +{ + internal sealed class JsonTree : EmbeddedSyntaxTree + { + public JsonTree( + ImmutableArray text, + JsonCompilationUnit root, + ImmutableArray diagnostics) : base(text, root, diagnostics) + { + } + } +} From 8f4661fbd44235002b51dc764c38f4b84c3fb568 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 10 Apr 2018 16:19:49 -0700 Subject: [PATCH 007/110] Add files back. --- .../Portable/WorkspacesResources.Designer.cs | 243 ++++++++++++++++++ .../Core/Portable/WorkspacesResources.resx | 81 ++++++ .../Portable/xlf/WorkspacesResources.cs.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.de.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.es.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.fr.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.it.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.ja.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.ko.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.pl.xlf | 135 ++++++++++ .../xlf/WorkspacesResources.pt-BR.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.ru.xlf | 135 ++++++++++ .../Portable/xlf/WorkspacesResources.tr.xlf | 135 ++++++++++ .../xlf/WorkspacesResources.zh-Hans.xlf | 135 ++++++++++ .../xlf/WorkspacesResources.zh-Hant.xlf | 135 ++++++++++ 15 files changed, 2079 insertions(+) diff --git a/src/Workspaces/Core/Portable/WorkspacesResources.Designer.cs b/src/Workspaces/Core/Portable/WorkspacesResources.Designer.cs index 15a84c3dd8bb3..f89d784bc9924 100644 --- a/src/Workspaces/Core/Portable/WorkspacesResources.Designer.cs +++ b/src/Workspaces/Core/Portable/WorkspacesResources.Designer.cs @@ -70,6 +70,15 @@ internal static string _0_encountered_an_error_and_has_been_disabled { } } + /// + /// Looks up a localized string similar to '{0}' expected. + /// + internal static string _0_expected { + get { + return ResourceManager.GetString("_0_expected", resourceCulture); + } + } + /// /// Looks up a localized string similar to '{0}' is already part of the workspace.. /// @@ -142,6 +151,15 @@ internal static string _0_is_still_open { } } + /// + /// Looks up a localized string similar to '{0}' literal not allowed. + /// + internal static string _0_literal_not_allowed { + get { + return ResourceManager.GetString("_0_literal_not_allowed", resourceCulture); + } + } + /// /// Looks up a localized string similar to "{0}" must be a non-null and non-empty string.. /// @@ -169,6 +187,15 @@ internal static string _0_still_contains_open_documents { } } + /// + /// Looks up a localized string similar to '{0}' unexpected. + /// + internal static string _0_unexpected { + get { + return ResourceManager.GetString("_0_unexpected", resourceCulture); + } + } + /// /// Looks up a localized string similar to A language name cannot be specified for this option.. /// @@ -494,6 +521,24 @@ internal static string Class { } } + /// + /// Looks up a localized string similar to Comments not allowed. + /// + internal static string Comments_not_allowed { + get { + return ResourceManager.GetString("Comments_not_allowed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Constructors not allowed. + /// + internal static string Constructors_not_allowed { + get { + return ResourceManager.GetString("Constructors_not_allowed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Could not find location to generation symbol into.. /// @@ -620,6 +665,15 @@ internal static string Enable_and_ignore_future_errors { } } + /// + /// Looks up a localized string similar to Enable JSON editor features. + /// + internal static string Enable_JSON_editor_features { + get { + return ResourceManager.GetString("Enable_JSON_editor_features", resourceCulture); + } + } + /// /// Looks up a localized string similar to Enum. /// @@ -638,6 +692,15 @@ internal static string Error { } } + /// + /// Looks up a localized string similar to Error parsing comment. + /// + internal static string Error_parsing_comment { + get { + return ResourceManager.GetString("Error_parsing_comment", resourceCulture); + } + } + /// /// Looks up a localized string similar to Event. /// @@ -746,6 +809,24 @@ internal static string Fix_all_0_in_Solution { } } + /// + /// Looks up a localized string similar to Illegal string character. + /// + internal static string Illegal_string_character { + get { + return ResourceManager.GetString("Illegal_string_character", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Illegal whitespace character. + /// + internal static string Illegal_whitespace_character { + get { + return ResourceManager.GetString("Illegal_whitespace_character", resourceCulture); + } + } + /// /// Looks up a localized string similar to Interface. /// @@ -764,6 +845,33 @@ internal static string Invalid_CodePage_value_colon_0 { } } + /// + /// Looks up a localized string similar to Invalid constructor name. + /// + internal static string Invalid_constructor_name { + get { + return ResourceManager.GetString("Invalid_constructor_name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid escape sequence. + /// + internal static string Invalid_escape_sequence { + get { + return ResourceManager.GetString("Invalid_escape_sequence", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid number. + /// + internal static string Invalid_number { + get { + return ResourceManager.GetString("Invalid_number", resourceCulture); + } + } + /// /// Looks up a localized string similar to Invalid number of parameters for binary operator.. /// @@ -818,6 +926,15 @@ internal static string Invalid_project_file_path_colon_0 { } } + /// + /// Looks up a localized string similar to Invalid property name. + /// + internal static string Invalid_property_name { + get { + return ResourceManager.GetString("Invalid_property_name", resourceCulture); + } + } + /// /// Looks up a localized string similar to Invalid solution file path: '{0}'. /// @@ -827,6 +944,15 @@ internal static string Invalid_solution_file_path_colon_0 { } } + /// + /// Looks up a localized string similar to JSON issue: {0}. + /// + internal static string JSON_issue_0 { + get { + return ResourceManager.GetString("JSON_issue_0", resourceCulture); + } + } + /// /// Looks up a localized string similar to Label for node '{0}' is invalid, it must be within [0, {1}).. /// @@ -899,6 +1025,15 @@ internal static string Missing_prefix_colon_0 { } } + /// + /// Looks up a localized string similar to Missing property value. + /// + internal static string Missing_property_value { + get { + return ResourceManager.GetString("Missing_property_value", resourceCulture); + } + } + /// /// Looks up a localized string similar to Missing suffix: '{0}'. /// @@ -917,6 +1052,24 @@ internal static string Name_can_be_simplified { } } + /// + /// Looks up a localized string similar to Name expected. + /// + internal static string Name_expected { + get { + return ResourceManager.GetString("Name_expected", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Nested properties not allowed. + /// + internal static string Nested_properties_not_allowed { + get { + return ResourceManager.GetString("Nested_properties_not_allowed", resourceCulture); + } + } + /// /// Looks up a localized string similar to No location provided to add statements to.. /// @@ -971,6 +1124,15 @@ internal static string None { } } + /// + /// Looks up a localized string similar to Only properties allowed in an object. + /// + internal static string Only_properties_allowed_in_an_object { + get { + return ResourceManager.GetString("Only_properties_allowed_in_an_object", resourceCulture); + } + } + /// /// Looks up a localized string similar to Options did not come from Workspace. /// @@ -1025,6 +1187,15 @@ internal static string Private_or_Internal_Static_Field { } } + /// + /// Looks up a localized string similar to Probable JSON string detected. + /// + internal static string Probable_JSON_string_detected { + get { + return ResourceManager.GetString("Probable_JSON_string_detected", resourceCulture); + } + } + /// /// Looks up a localized string similar to Project file not found: '{0}'. /// @@ -1034,6 +1205,15 @@ internal static string Project_file_not_found_colon_0 { } } + /// + /// Looks up a localized string similar to Properties not allowed in an array. + /// + internal static string Properties_not_allowed_in_an_array { + get { + return ResourceManager.GetString("Properties_not_allowed_in_an_array", resourceCulture); + } + } + /// /// Looks up a localized string similar to Property. /// @@ -1043,6 +1223,15 @@ internal static string Property { } } + /// + /// Looks up a localized string similar to Property name must be a string. + /// + internal static string Property_name_must_be_a_string { + get { + return ResourceManager.GetString("Property_name_must_be_a_string", resourceCulture); + } + } + /// /// Looks up a localized string similar to Public or Protected Field. /// @@ -1179,6 +1368,15 @@ internal static string Stream_is_too_long { } } + /// + /// Looks up a localized string similar to Strings must start with " not '. + /// + internal static string Strings_must_start_with_double_quote_not_single_quote { + get { + return ResourceManager.GetString("Strings_must_start_with_double_quote_not_single_quote", resourceCulture); + } + } + /// /// Looks up a localized string similar to Struct. /// @@ -1215,6 +1413,15 @@ internal static string Symbol_0_is_not_from_source { } } + /// + /// Looks up a localized string similar to Syntax error. + /// + internal static string Syntax_error { + get { + return ResourceManager.GetString("Syntax_error", resourceCulture); + } + } + /// /// Looks up a localized string similar to Temporary storage cannot be written more than once.. /// @@ -1422,6 +1629,15 @@ internal static string This_workspace_does_not_support_opening_and_closing_docum } } + /// + /// Looks up a localized string similar to Trailing comma not allowed. + /// + internal static string Trailing_comma_not_allowed { + get { + return ResourceManager.GetString("Trailing_comma_not_allowed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Types. /// @@ -1458,6 +1674,24 @@ internal static string Unrecognized_language_name { } } + /// + /// Looks up a localized string similar to Unterminated comment. + /// + internal static string Unterminated_comment { + get { + return ResourceManager.GetString("Unterminated_comment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unterminated string. + /// + internal static string Unterminated_string { + get { + return ResourceManager.GetString("Unterminated_string", resourceCulture); + } + } + /// /// Looks up a localized string similar to Usage:. /// @@ -1467,6 +1701,15 @@ internal static string Usage_colon { } } + /// + /// Looks up a localized string similar to Value required. + /// + internal static string Value_required { + get { + return ResourceManager.GetString("Value_required", resourceCulture); + } + } + /// /// Looks up a localized string similar to Value too large to be represented as a 30 bit unsigned integer.. /// diff --git a/src/Workspaces/Core/Portable/WorkspacesResources.resx b/src/Workspaces/Core/Portable/WorkspacesResources.resx index acb00e35c50f3..6aeaf3556117a 100644 --- a/src/Workspaces/Core/Portable/WorkspacesResources.resx +++ b/src/Workspaces/Core/Portable/WorkspacesResources.resx @@ -616,4 +616,85 @@ Changing document properties is not supported + + Invalid number + + + Unterminated comment + + + Unterminated string + + + '{0}' expected + + + '{0}' unexpected + + + Invalid escape sequence + + + Error parsing comment + + + Syntax error + + + Invalid property name + + + Missing property value + + + Nested properties not allowed + + + Name expected + + + Invalid constructor name + + + Comments not allowed + + + Constructors not allowed + + + Illegal string character + + + Illegal whitespace character + + + Only properties allowed in an object + + + Properties not allowed in an array + + + Property name must be a string + + + Strings must start with " not ' + + + Trailing comma not allowed + + + Value required + + + '{0}' literal not allowed + + + JSON issue: {0} + + + Probable JSON string detected + + + Enable JSON editor features + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf index 9b89c605bdbcc..5aedd136c0bff 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf index f03d1482a03f0..3fa9d30983ad3 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf index f6d4b2cda19ec..e0c3e89b2102e 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf index 55e9e200dab08..de8dac49ba93b 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf index 573cce32ba000..0dea6c52e98a7 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf index c962e1f563bc8..1339ceeeba4e3 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf index 9b4366aaef710..95a613449ea02 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf index c4927dc46c26a..f496e55a2ccb3 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf index e0d6ff96f78b2..dc9a9d7d43120 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf index 368c9db2b9261..76748d2fb85ee 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf index e15436682817a..3fc1b8f6582cf 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf index fc8060d2f44f8..d81f655cd0aeb 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf index 77f65e5f66866..178dfbf1d08c8 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf @@ -802,6 +802,141 @@ Variables captured: + + Invalid number + Invalid number + + + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + '{0}' expected + '{0}' expected + + + + '{0}' unexpected + '{0}' unexpected + + + + Invalid escape sequence + Invalid escape sequence + + + + Error parsing comment + Error parsing comment + + + + Syntax error + Syntax error + + + + Invalid property name + Invalid property name + + + + Missing property value + Missing property value + + + + Nested properties not allowed + Nested properties not allowed + + + + Name expected + Name expected + + + + Invalid constructor name + Invalid constructor name + + + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + + + Only properties allowed in an object + Only properties allowed in an object + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + + + Strings must start with " not ' + Strings must start with " not ' + + + + Trailing comma not allowed + Trailing comma not allowed + + + + Value required + Value required + + + + '{0}' literal not allowed + '{0}' literal not allowed + + + + JSON issue: {0} + JSON issue: {0} + + + + Probable JSON string detected + Probable JSON string detected + + + + Enable JSON editor features + Enable JSON editor features + + \ No newline at end of file From e99755f8c7a09a916630e90dbf75d39d4c1ba993 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 20:13:29 -0700 Subject: [PATCH 008/110] fix test --- .../CSharpTest/CSharpServicesTest.csproj | 1 + .../Json/CSharpJsonParserTests_BasicTests.cs | 67 +++-- .../CSharpJsonParserTests_TestGeneration.cs | 260 ++++++++++-------- 3 files changed, 188 insertions(+), 140 deletions(-) diff --git a/src/Workspaces/CSharpTest/CSharpServicesTest.csproj b/src/Workspaces/CSharpTest/CSharpServicesTest.csproj index 69ad73ce552c3..a4ff60d082e36 100644 --- a/src/Workspaces/CSharpTest/CSharpServicesTest.csproj +++ b/src/Workspaces/CSharpTest/CSharpServicesTest.csproj @@ -36,6 +36,7 @@ + diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index b7688007aa46f..3bc79d31e8f18 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -3352,10 +3352,13 @@ public void TestObjectLiteralComments() /*comment*/ { /*comment*/ - + - 'Name' + + + + 'Name' : /*comment*/ 'Apple' /*comment*/ @@ -3363,10 +3366,13 @@ public void TestObjectLiteralComments() , /*comment*/ - + - 'ExpiryDate' + + + + 'ExpiryDate' : '1' @@ -3374,10 +3380,13 @@ public void TestObjectLiteralComments() , - + - 'Price' + + + + 'Price' : 3.99 @@ -3385,40 +3394,62 @@ public void TestObjectLiteralComments() , - + - 'Sizes' + + + + 'Sizes' : /*comment*/ [ /*comment*/ - + - 'Small' + + + + 'Small' , /*comment*/ - + - 'Medium' /*comment*/ + + + + 'Medium' /*comment*/ , - /*comment*/ + - 'Large' - /*comment*/ + + + + /*comment*/ + + 'Large' + - ] /*comment*/ - + + + + /*comment*/ + + ] /*comment*/ + - } /*comment*/ + + + + } /*comment*/ diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs index 592c0236cd02a..f57dc5bc2ce93 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs @@ -1,122 +1,138 @@ -//// Copyright (c) Microsoft. 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.Runtime.CompilerServices; -//using System.Text; -//using System.Text.RegularExpressions; -//using Microsoft.CodeAnalysis.CSharp.Syntax; -//using Microsoft.CodeAnalysis.Json; -//using Xunit; - -//namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Json -//{ -// public class Fixture : IDisposable -// { -// public void Dispose() -// { -// var other = new Dictionary(); - -// var tree = SyntaxFactory.ParseSyntaxTree( -// File.ReadAllText(@"C:\GitHub\roslyn-internal\Open\src\Workspaces\CSharpTest\Json\CSharpJsonParserTests_BasicTests.cs")); - -// var methodNames = tree.GetRoot().DescendantNodes().OfType().Select(m => m.Identifier.ValueText); -// var nameToIndex = new Dictionary(); - -// var index = 0; -// foreach (var name in methodNames) -// { -// nameToIndex[name] = index; -// index++; -// } - -//#if true -// var tests = -// CSharpJsonParserTests.nameToTest.Where(kvp => !kvp.Key.StartsWith("NegativeTest") && !kvp.Key.StartsWith("Reference")) -// .OrderBy(kvp => nameToIndex[kvp.Key]) -// .Select(kvp => kvp.Value); -//#elif false -// var tests = -// CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("NegativeTest")) -// .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) -// .Select(kvp => kvp.Value); -//#else -// var tests = -// CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("Reference")) -// .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) -// .Select(kvp => kvp.Value); -//#endif - - -// var val = string.Join("\r\n", tests); -// } -// } - -// [CollectionDefinition(nameof(MyCollection))] -// public class MyCollection : ICollectionFixture -// { -// } - -// [Collection(nameof(MyCollection))] -// public partial class CSharpJsonParserTests -// { -// private readonly Fixture _fixture; - -// public CSharpJsonParserTests(Fixture fixture) -// { -// _fixture = fixture; -// } - - -// public static Dictionary nameToTest = new Dictionary(); - -// private void Test(string stringText, string expected, bool runJsonNetCheck = true, bool runJsonNetSubTreeTests = true, [CallerMemberName]string name = "") -// { -// var test = GenerateTests(stringText, runJsonNetCheck, runJsonNetSubTreeTests, name); -// nameToTest.Add(name, test); -// } - -// private string GenerateTests(string val, bool runJsonNetCheck, bool runJsonNetSubTreeTests, string testName) -// { -// var builder = new StringBuilder(); -// builder.AppendLine("[Fact]"); -// builder.AppendLine("public void " + testName + "()"); -// builder.AppendLine("{"); -// builder.Append(@" Test("); - -// var escaped = val.Replace("\"", "\"\""); -// var quoted = "" + '@' + '"' + escaped + '"'; -// builder.Append(quoted); - -// var token = GetStringToken(val); -// var allChars = _service.TryConvertToVirtualChars(token); -// var tree = JsonParser.TryParse(allChars, strict: false); - -// builder.Append(", " + '@' + '"'); -// builder.Append(TreeToText(tree).Replace("\"", "\"\"")); - -// builder.AppendLine("" + '"' + ','); -// builder.Append("" + '@' + '"'); -// builder.Append(DiagnosticsToText(tree.Diagnostics).Replace("\"", "\"\"")); -// builder.AppendLine("" + '"' + ','); -// builder.Append("" + '@' + '"' + '"'); - -// if (!runJsonNetCheck) -// { -// builder.Append(", runLooseTreeCheck: false"); -// } - -// if (!runJsonNetSubTreeTests) -// { -// builder.Append(", runLooseSubTreeCheck: false"); -// } - -// builder.AppendLine(");"); -// builder.AppendLine("}"); - -// return builder.ToString(); -// } -// } -//} +// Copyright (c) Microsoft. 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.Runtime.CompilerServices; +using System.Text; +using System.Text.RegularExpressions; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.EmbeddedLanguages.Json; +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json +{ + public class Fixture : IDisposable + { + public void Dispose() + { +#if false + var other = new Dictionary(); + + var tree = SyntaxFactory.ParseSyntaxTree( + File.ReadAllText(@"C:\GitHub\roslyn-internal\Open\src\Workspaces\CSharpTest\Json\CSharpJsonParserTests_BasicTests.cs")); + + var methodNames = tree.GetRoot().DescendantNodes().OfType().Select(m => m.Identifier.ValueText); + var nameToIndex = new Dictionary(); + + var index = 0; + foreach (var name in methodNames) + { + nameToIndex[name] = index; + index++; + } + +#if true + var tests = + CSharpJsonParserTests.nameToTest.Where(kvp => !kvp.Key.StartsWith("NegativeTest") && !kvp.Key.StartsWith("Reference")) + .OrderBy(kvp => nameToIndex[kvp.Key]) + .Select(kvp => kvp.Value); +#elif false + var tests = + CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("NegativeTest")) + .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) + .Select(kvp => kvp.Value); +#else + var tests = + CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("Reference")) + .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) + .Select(kvp => kvp.Value); +#endif +#endif + var tests = + CSharpJsonParserTests.nameToTest.Values; + var val = string.Join("\r\n", tests); + } + } + + [CollectionDefinition(nameof(MyCollection))] + public class MyCollection : ICollectionFixture + { + } + + [Collection(nameof(MyCollection))] + public partial class CSharpJsonParserTests + { + private readonly Fixture _fixture; + + public CSharpJsonParserTests(Fixture fixture) + { + _fixture = fixture; + } + + public static Dictionary nameToTest = new Dictionary(); + + [Fact] + private void GenerateTestSuiteTests() + { + Process(@"C:\GitHub\JSONTestSuite\test_parsing"); + Process(@"C:\GitHub\JSONTestSuite\test_transform"); + } + + private void Process(string path) + { + foreach (var file in Directory.EnumerateFiles(path, "*.json")) + { + + } + } + + //private void Test(string stringText, string expected, bool runJsonNetCheck = true, bool runJsonNetSubTreeTests = true, [CallerMemberName]string name = "") + //{ + // var test = GenerateTests(stringText, runJsonNetCheck, runJsonNetSubTreeTests, name); + // nameToTest.Add(name, test); + //} + + private string GenerateTests(string val, bool runJsonNetCheck, bool runJsonNetSubTreeTests, string testName) + { + var builder = new StringBuilder(); + builder.AppendLine("[Fact]"); + builder.AppendLine("public void " + testName + "()"); + builder.AppendLine("{"); + builder.Append(@" Test("); + + var escaped = val.Replace("\"", "\"\""); + var quoted = "" + '@' + '"' + escaped + '"'; + builder.Append(quoted); + + var token = GetStringToken(val); + var allChars = _service.TryConvertToVirtualChars(token); + var tree = JsonParser.TryParse(allChars, strict: false); + + builder.Append(", " + '@' + '"'); + builder.Append(TreeToText(tree).Replace("\"", "\"\"")); + + builder.AppendLine("" + '"' + ','); + builder.Append("" + '@' + '"'); + builder.Append(DiagnosticsToText(tree.Diagnostics).Replace("\"", "\"\"")); + builder.AppendLine("" + '"' + ','); + builder.Append("" + '@' + '"' + '"'); + + if (!runJsonNetCheck) + { + builder.Append(", runLooseTreeCheck: false"); + } + + if (!runJsonNetSubTreeTests) + { + builder.Append(", runLooseSubTreeCheck: false"); + } + + builder.AppendLine(");"); + builder.AppendLine("}"); + + return builder.ToString(); + } + } +} From 0cb389935d255cfa9ca16699835c96f8c80056f3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 20:15:09 -0700 Subject: [PATCH 009/110] fix test --- .../Json/CSharpJsonParserTests_BasicTests.cs | 70 +++++++++++++------ 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 3bc79d31e8f18..82acb2032f465 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -2804,10 +2804,13 @@ public void TestNestedObject1() { - + - ""description"" + + + + ""description"" : ""A person"" @@ -2815,10 +2818,13 @@ public void TestNestedObject1() , - + - ""type"" + + + + ""type"" : ""object"" @@ -2826,18 +2832,27 @@ public void TestNestedObject1() , - + - ""properties"" + + + + ""properties"" : - + - { - + + + + { + - ""name"" + + + + ""name"" : { @@ -2855,17 +2870,23 @@ public void TestNestedObject1() , - + - ""hobbies"" + + + + ""hobbies"" : { - + - ""type"" + + + + ""type"" : ""array"" @@ -2873,10 +2894,13 @@ public void TestNestedObject1() , - + - ""items"" + + + + ""items"" : { @@ -2890,16 +2914,22 @@ public void TestNestedObject1() } - + - } - + + + + } + - } + + + + } From 25b49693b2f2b5d0639824548cfdf3485a7210c8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 20:16:43 -0700 Subject: [PATCH 010/110] fix test --- .../Json/CSharpJsonParserTests_BasicTests.cs | 70 +++++++++++++------ 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 82acb2032f465..957436983eef5 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -1208,10 +1208,13 @@ public void TestNestedPropertyMissingColon() { - + - ""description"" + + + + ""description"" : ""A person"" @@ -1219,10 +1222,13 @@ public void TestNestedPropertyMissingColon() , - + - ""type"" + + + + ""type"" : ""object"" @@ -1230,18 +1236,27 @@ public void TestNestedPropertyMissingColon() , - + - ""properties"" + + + + ""properties"" : - + - { - + + + + { + - ""name"" + + + + ""name"" { @@ -1258,17 +1273,23 @@ public void TestNestedPropertyMissingColon() , - + - ""hobbies"" + + + + ""hobbies"" : { - + - ""type"" + + + + ""type"" : ""array"" @@ -1276,10 +1297,13 @@ public void TestNestedPropertyMissingColon() , - + - ""items"" + + + + ""items"" : { @@ -1293,16 +1317,22 @@ public void TestNestedPropertyMissingColon() } - + - } - + + + + } + - } + + + + } From 65e19782775cb66119496342d5dafde5ca2c84c7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 20:18:14 -0700 Subject: [PATCH 011/110] fix test --- .../Json/CSharpJsonParserTests_BasicTests.cs | 115 +++++++++++++----- 1 file changed, 83 insertions(+), 32 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 957436983eef5..270f34637f0fe 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -3146,110 +3146,161 @@ public void TestLiterals3() [ - + - 1 + + + + 1 , - + - 0 + + + + 0 , - + - 1.1 + + + + 1.1 , - + - 0.0 + + + + 0.0 , - + - 0.000000000001 + + + + 0.000000000001 , - + - 9999999999 + + + + 9999999999 , - + - -9999999999 + + + + -9999999999 , - + - 9999999999999999999999999999999999999999999999999999999999999999999999 + + + + 9999999999999999999999999999999999999999999999999999999999999999999999 , - + - -9999999999999999999999999999999999999999999999999999999999999999999999 + + + + -9999999999999999999999999999999999999999999999999999999999999999999999 , - + - 'true' + + + + 'true' , - + - 'TRUE' + + + + 'TRUE' , - + - 'false' + + + + 'false' , - + - 'FALSE' + + + + 'FALSE' , - // comment! - /* comment! */ - + - '' + + + + // comment! + + + + /* comment! */ + + + + '' , - + - null + + + + null From af8a0d38c892ffeb166f380e1b3083821cde7313 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 20:20:04 -0700 Subject: [PATCH 012/110] fix test --- .../Json/CSharpJsonParserTests_BasicTests.cs | 70 +++++++++++++------ 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 270f34637f0fe..d0a3028b0a38d 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -2698,10 +2698,13 @@ public void TestNestedObject() { - + - 'description' + + + + 'description' : 'A person' @@ -2709,10 +2712,13 @@ public void TestNestedObject() , - + - 'type' + + + + 'type' : 'object' @@ -2720,18 +2726,27 @@ public void TestNestedObject() , - + - 'properties' + + + + 'properties' : - + - { - + + + + { + - 'name' + + + + 'name' : { @@ -2749,17 +2764,23 @@ public void TestNestedObject() , - + - 'hobbies' + + + + 'hobbies' : { - + - 'type' + + + + 'type' : 'array' @@ -2767,10 +2788,13 @@ public void TestNestedObject() , - + - 'items' + + + + 'items' : { @@ -2784,16 +2808,22 @@ public void TestNestedObject() } - + - } - + + + + } + - } + + + + } From 8c6d6cdd6fc453ac62c31ee55db4a15d7c146d93 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 21:39:42 -0700 Subject: [PATCH 013/110] nst tests.' --- .../Json/CSharpJsonParserTests_NstTests.cs | 8506 +++++++++++++++++ .../CSharpJsonParserTests_TestGeneration.cs | 42 +- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 4 + .../Json/JsonParser.StrictSyntaxChecker.cs | 16 +- 4 files changed, 8554 insertions(+), 14 deletions(-) create mode 100644 src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs new file mode 100644 index 0000000000000..22bf2a10be054 --- /dev/null +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs @@ -0,0 +1,8506 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +// tests from: https://github.com/nst/JSONTestSuite +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json +{ + public partial class CSharpJsonParserTests + { + [Fact] + public void i_number_double_huge_neg_exp_json() + { + Test(@"@""[123.456e-789]""", @" + + + + [ + + + 123.456e-789 + + + ] + + + + i_number_huge_exp_json +", + @"", + @""); + } + + [Fact] + public void i_number_huge_exp_json() + { + Test(@"@""[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]""", @" + + + + [ + + + 0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006 + + + ] + + + + +", + @" + +", + @" + +", + runStrictTreeCheck: false, runLooseSubTreeCheck: false, + runStrictSubTreeCheck: false, runLooseTreeCheck: false); + } + + [Fact] + public void i_number_neg_int_huge_exp_json() + { + Test(@"@""[-1e+9999]""", @" + + + + [ + + + -1e+9999 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void i_number_pos_double_huge_exp_json() + { + Test(@"@""[1.5e+9999]""", @" + + + + [ + + + 1.5e+9999 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void i_number_real_neg_overflow_json() + { + Test(@"@""[-123123e100000]""", @" + + + + [ + + + -123123e100000 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void i_number_real_pos_overflow_json() + { + Test(@"@""[123123e100000]""", @" + + + + [ + + + 123123e100000 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void i_number_real_underflow_json() + { + Test(@"@""[123e-10000000]""", @" + + + + [ + + + 123e-10000000 + + + ] + + + + +", + @"", + @"", runStrictSubTreeCheck: false); + } + + [Fact] + public void i_number_too_big_neg_int_json() + { + Test(@"@""[-123123123123123123123123123123]""", @" + + + + [ + + + -123123123123123123123123123123 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_number_too_big_pos_int_json() + { + Test(@"@""[100000000000000000000]""", @" + + + + [ + + + 100000000000000000000 + + + ] + + + + +", + @"", + @"", runStrictSubTreeCheck: false); + } + + [Fact] + public void i_number_very_big_negative_int_json() + { + Test(@"@""[-237462374673276894279832749832423479823246327846]""", @" + + + + [ + + + -237462374673276894279832749832423479823246327846 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_object_key_lone_2nd_surrogate_json() + { + Test(@"@""{""""\uDFAA"""":0}""", @" + + + + { + + + ""\uDFAA"" + : + + 0 + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_1st_surrogate_but_2nd_missing_json() + { + Test(@"@""[""""\uDADA""""]""", @" + + + + [ + + + ""\uDADA"" + + + ] + + + + +", + @"", + @"", runLooseTreeCheck: false); + } + + [Fact] + public void i_string_1st_valid_surrogate_2nd_invalid_json() + { + Test(@"@""[""""\uD888\u1234""""]""", @" + + + + [ + + + ""\uD888\u1234"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_incomplete_surrogates_escape_valid_json() + { + Test(@"@""[""""\uD800\uD800\n""""]""", @" + + + + [ + + + ""\uD800\uD800\n"" + + + ] + + + + +", + @"", + @"", runStrictTreeCheck: false, runStrictSubTreeCheck: false); + } + + [Fact] + public void i_string_incomplete_surrogate_and_escape_valid_json() + { + Test(@"@""[""""\uD800\n""""]""", @" + + + + [ + + + ""\uD800\n"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_incomplete_surrogate_pair_json() + { + Test(@"@""[""""\uDd1ea""""]""", @" + + + + [ + + + ""\uDd1ea"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_invalid_lonely_surrogate_json() + { + Test(@"@""[""""\ud800""""]""", @" + + + + [ + + + ""\ud800"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_invalid_surrogate_json() + { + Test(@"@""[""""\ud800abc""""]""", @" + + + + [ + + + ""\ud800abc"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_invalid_utf_8_json() + { + Test(@"@""[""""�""""]""", @" + + + + [ + + + ""�"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_inverted_surrogates_U_1D11E_json() + { + Test(@"@""[""""\uDd1e\uD834""""]""", @" + + + + [ + + + ""\uDd1e\uD834"" + + + ] + + + + +", + @"", + @"", runLooseSubTreeCheck: false); + } + + [Fact] + public void i_string_iso_latin_1_json() + { + Test(@"@""[""""�""""]""", @" + + + + [ + + + ""�"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_lone_second_surrogate_json() + { + Test(@"@""[""""\uDFAA""""]""", @" + + + + [ + + + ""\uDFAA"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_lone_utf8_continuation_byte_json() + { + Test(@"@""[""""�""""]""", @" + + + + [ + + + ""�"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_not_in_unicode_range_json() + { + Test(@"@""[""""���""""]""", @" + + + + [ + + + ""���"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_overlong_sequence_2_bytes_json() + { + Test(@"@""[""""��""""]""", @" + + + + [ + + + ""��"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_overlong_sequence_6_bytes_json() + { + Test(@"@""[""""������""""]""", @" + + + + [ + + + ""������"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_overlong_sequence_6_bytes_null_json() + { + Test(@"@""[""""������""""]""", @" + + + + [ + + + ""������"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_truncated_utf_8_json() + { + Test(@"@""[""""��""""]""", @" + + + + [ + + + ""��"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_UTF_16LE_with_BOM_json() + { + Test(@"@""[""""é""""]""", @" + + + + [ + + + ""é"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_UTF_8_invalid_sequence_json() + { + Test(@"@""[""""日ш�""""]""", @" + + + + [ + + + ""日ш�"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_string_UTF8_surrogate_U_D800_json() + { + Test(@"@""[""""��""""]""", @" + + + + [ + + + ""��"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void i_structure_UTF_8_BOM_empty_object_json() + { + Test(@"@""{}""", @" + + + + { + + } + + + + +", + @"", + @""); + } + + [Fact] + public void n_array_1_true_without_comma_json() + { + Test(@"@""[1 true]""", @" + + + + [ + + + 1 + + + true + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_a_invalid_utf8_json() + { + Test(@"@""[a�]""", @" + + + + [ + + + a� + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_colon_instead_of_comma_json() + { + Test(@"@""["""""""": 1]""", @" + + + + [ + + + """" + : + + 1 + + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_comma_after_close_json() + { + Test(@"@""[""""""""],""", @" + + + + [ + + + """" + + + ] + + + , + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_comma_and_number_json() + { + Test(@"@""[,1]""", @" + + + + [ + + + , + + + 1 + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_array_double_comma_json() + { + Test(@"@""[1,,2]""", @" + + + + [ + + + 1 + + + , + + + , + + + 2 + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_array_double_extra_comma_json() + { + Test(@"@""[""""x"""",,]""", @" + + + + [ + + + ""x"" + + + , + + + , + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_array_extra_close_json() + { + Test(@"@""[""""x""""]]""", @" + + + + [ + + + ""x"" + + + ] + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_extra_comma_json() + { + Test(@"@""["""""""",]""", @" + + + + [ + + + """" + + + , + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_array_incomplete_json() + { + Test(@"@""[""""x""""""", @" + + + + [ + + + ""x"" + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_incomplete_invalid_value_json() + { + Test(@"@""[x""", @" + + + + [ + + + x + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_inner_array_no_comma_json() + { + Test(@"@""[3[4]]""", @" + + + + [ + + + 3 + + + [ + + + 4 + + + ] + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_invalid_utf8_json() + { + Test(@"@""[�]""", @" + + + + [ + + + + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_items_separated_by_semicolon_json() + { + Test(@"@""[1:2]""", @" + + + + [ + + + 1 + : + + 2 + + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_just_comma_json() + { + Test(@"@""[,]""", @" + + + + [ + + + , + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_array_just_minus_json() + { + Test(@"@""[-]""", @" + + + + [ + + + - + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_missing_value_json() + { + Test(@"@""[ , """"""""]""", @" + + + + [ + + + , + + + """" + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_array_newlines_unclosed_json() + { + Test(@"@""[""""a"""", +4 +,1,""", @" + + + + [ + + + ""a"" + + + , + + + + 4 + + + + , + + + 1 + + + , + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_number_and_comma_json() + { + Test(@"@""[1,]""", @" + + + + [ + + + 1 + + + , + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_array_number_and_several_commas_json() + { + Test(@"@""[1,,]""", @" + + + + [ + + + 1 + + + , + + + , + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_array_star_inside_json() + { + Test(@"@""[*]""", @" + + + + [ + + + * + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_unclosed_json() + { + Test(@"@""[""""""""""", @" + + + + [ + + + """" + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_unclosed_trailing_comma_json() + { + Test(@"@""[1,""", @" + + + + [ + + + 1 + + + , + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_unclosed_with_new_lines_json() + { + Test(@"@""[1, +1 +,1""", @" + + + + [ + + + 1 + + + , + + + + 1 + + + + , + + + 1 + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_array_unclosed_with_object_inside_json() + { + Test(@"@""[{}""", @" + + + + [ + + + { + + } + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_incomplete_false_json() + { + Test(@"@""[fals]""", @" + + + + [ + + + fals + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_incomplete_null_json() + { + Test(@"@""[nul]""", @" + + + + [ + + + nul + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_incomplete_true_json() + { + Test(@"@""[tru]""", @" + + + + [ + + + tru + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number____json() + { + Test(@"@""[++1234]""", @" + + + + [ + + + ++1234 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number__1_json() + { + Test(@"@""[+1]""", @" + + + + [ + + + +1 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number__Inf_json() + { + Test(@"@""[+Inf]""", @" + + + + [ + + + +Inf + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number__01_json() + { + Test(@"@""[-01]""", @" + + + + [ + + + -01 + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_number__1_0__json() + { + Test(@"@""[-1.0.]""", @" + + + + [ + + + -1.0. + + + ] + + + + +", + @" + +", + @" + +", runStrictSubTreeCheck: false); + } + + [Fact] + public void n_number__2__json() + { + Test(@"@""[-2.]""", @" + + + + [ + + + -2. + + + ] + + + + +", + @"", + @" + +", runStrictTreeCheck: false); + } + + [Fact] + public void n_number__NaN_json() + { + Test(@"@""[-NaN]""", @" + + + + [ + + + -NaN + + + ] + + + + +", + @" + +", + @" + +", runStrictSubTreeCheck: false); + } + + [Fact] + public void n_number___1_json() + { + Test(@"@""[.-1]""", @" + + + + [ + + + .-1 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number__2e_3_json() + { + Test(@"@""[.2e-3]""", @" + + + + [ + + + .2e-3 + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_number_0_1_2_json() + { + Test(@"@""[0.1.2]""", @" + + + + [ + + + 0.1.2 + + + ] + + + + +", + @" + +", + @" + +", runStrictSubTreeCheck: false); + } + + [Fact] + public void n_number_0_3e__json() + { + Test(@"@""[0.3e+]""", @" + + + + [ + + + 0.3e+ + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_0_3e_json() + { + Test(@"@""[0.3e]""", @" + + + + [ + + + 0.3e + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_0_e1_json() + { + Test(@"@""[0.e1]""", @" + + + + [ + + + 0.e1 + + + ] + + + + +", + @"", + @" + +", runStrictTreeCheck: false, runStrictSubTreeCheck: false); + } + + [Fact] + public void n_number_0e__json() + { + Test(@"@""[0e+]""", @" + + + + [ + + + 0e+ + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_0e_json() + { + Test(@"@""[0e]""", @" + + + + [ + + + 0e + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_0_capital_E__json() + { + Test(@"@""[0E+]""", @" + + + + [ + + + 0E+ + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_0_capital_E_json() + { + Test(@"@""[0E]""", @" + + + + [ + + + 0E + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_1_0e__json() + { + Test(@"@""[1.0e+]""", @" + + + + [ + + + 1.0e+ + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_1_0e_json() + { + Test(@"@""[1.0e]""", @" + + + + [ + + + 1.0e + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_1eE2_json() + { + Test(@"@""[1eE2]""", @" + + + + [ + + + 1eE2 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_1_000_json() + { + Test(@"@""[1 000.0]""", @" + + + + [ + + + 1 + + + 000.0 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_2_e_3_json() + { + Test(@"@""[2.e+3]""", @" + + + + [ + + + 2.e+3 + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_number_2_e3_json() + { + Test(@"@""[2.e3]""", @" + + + + [ + + + 2.e3 + + + ] + + + + +", + @"", + @" + +", runStrictTreeCheck: false, runStrictSubTreeCheck: false); + } + + [Fact] + public void n_number_9_e__json() + { + Test(@"@""[9.e+]""", @" + + + + [ + + + 9.e+ + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_expression_json() + { + Test(@"@""[1+2]""", @" + + + + [ + + + 1+2 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_hex_1_digit_json() + { + Test(@"@""[0x1]""", @" + + + + [ + + + 0x1 + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_number_hex_2_digits_json() + { + Test(@"@""[0x42]""", @" + + + + [ + + + 0x42 + + + ] + + + + +", + @"", + @" + +", runStrictSubTreeCheck: false); + } + + [Fact] + public void n_number_Inf_json() + { + Test(@"@""[Inf]""", @" + + + + [ + + + Inf + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_infinity_json() + { + Test(@"@""[Infinity]""", @" + + + + [ + + + Infinity + + + ] + + + + +", + @"", + @" + +", runStrictTreeCheck: false); + } + + [Fact] + public void n_number_invalid___json() + { + Test(@"@""[0e+-1]""", @" + + + + [ + + + 0e+-1 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_invalid_negative_real_json() + { + Test(@"@""[-123.123foo]""", @" + + + + [ + + + -123.123foo + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_invalid_utf_8_in_bigger_int_json() + { + Test(@"@""[123�]""", @" + + + + [ + + + 123� + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_invalid_utf_8_in_exponent_json() + { + Test(@"@""[1e1�]""", @" + + + + [ + + + 1e1� + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_invalid_utf_8_in_int_json() + { + Test(@"@""[0�] +""", @" + + + + [ + + + 0� + + + ] + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_minus_infinity_json() + { + Test(@"@""[-Infinity]""", @" + + + + [ + + + - + Infinity + + + ] + + + + +", + @"", + @" + +", runStrictTreeCheck: false); + } + + [Fact] + public void n_number_minus_sign_with_trailing_garbage_json() + { + Test(@"@""[-foo]""", @" + + + + [ + + + -foo + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_minus_space_1_json() + { + Test(@"@""[- 1]""", @" + + + + [ + + + - + + + 1 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_NaN_json() + { + Test(@"@""[NaN]""", @" + + + + [ + + + NaN + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_number_neg_int_starting_with_zero_json() + { + Test(@"@""[-012]""", @" + + + + [ + + + -012 + + + ] + + + + +", + @"", + @" + +", runStrictTreeCheck: false, runStrictSubTreeCheck: false); + } + + [Fact] + public void n_number_neg_real_without_int_part_json() + { + Test(@"@""[-.123]""", @" + + + + [ + + + -.123 + + + ] + + + + +", + @"", + @" + +", runStrictTreeCheck: false, runStrictSubTreeCheck: false); + } + + [Fact] + public void n_number_neg_with_garbage_at_end_json() + { + Test(@"@""[-1x]""", @" + + + + [ + + + -1x + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_real_garbage_after_e_json() + { + Test(@"@""[1ea]""", @" + + + + [ + + + 1ea + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_real_without_fractional_part_json() + { + Test(@"@""[1.]""", @" + + + + [ + + + 1. + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_number_real_with_invalid_utf8_after_e_json() + { + Test(@"@""[1e�]""", @" + + + + [ + + + 1e� + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_starting_with_dot_json() + { + Test(@"@""[.123]""", @" + + + + [ + + + .123 + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_number_U_FF11_fullwidth_digit_one_json() + { + Test(@"@""[1]""", @" + + + + [ + + + + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_with_alpha_json() + { + Test(@"@""[1.2a-3]""", @" + + + + [ + + + 1.2a-3 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_with_alpha_char_json() + { + Test(@"@""[1.8011670033376514H-308]""", @" + + + + [ + + + 1.8011670033376514H-308 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_number_with_leading_zero_json() + { + Test(@"@""[012]""", @" + + + + [ + + + 012 + + + ] + + + + +", + @"", + @" + +", runStrictTreeCheck: false, runStrictSubTreeCheck: false); + } + + [Fact] + public void n_object_bad_value_json() + { + Test(@"@""[""""x"""", truth]""", @" + + + + [ + + + ""x"" + + + , + + + truth + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_bracket_key_json() + { + Test(@"@""{[: """"x""""} +""", @" + + + + { + + + [ + + + : + + + ""x"" + + + + + + } + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_comma_instead_of_colon_json() + { + Test(@"@""{""""x"""", null}""", @" + + + + { + + + ""x"" + + + , + + + null + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_double_colon_json() + { + Test(@"@""{""""x""""::""""b""""}""", @" + + + + { + + + ""x"" + : + + : + + + + ""b"" + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_garbage_at_end_json() + { + Test(@"@""{""""a"""":""""a"""" 123}""", @" + + + + { + + + ""a"" + : + + ""a"" + + + + 123 + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_key_with_single_quotes_json() + { + Test(@"@""{key: 'value'}""", @" + + + + { + + + key + : + + 'value' + + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_lone_continuation_byte_in_key_and_trailing_comma_json() + { + Test(@"@""{""""�"""":""""0"""",}""", @" + + + + { + + + ""�"" + : + + ""0"" + + + + , + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_missing_colon_json() + { + Test(@"@""{""""a"""" b}""", @" + + + + { + + + ""a"" + + + b + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_missing_key_json() + { + Test(@"@""{:""""b""""}""", @" + + + + { + + + : + + + ""b"" + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_missing_semicolon_json() + { + Test(@"@""{""""a"""" """"b""""}""", @" + + + + { + + + ""a"" + + + ""b"" + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_missing_value_json() + { + Test(@"@""{""""a"""":""", @" + + + + { + + + ""a"" + : + + + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_no_colon_json() + { + Test(@"@""{""""a""""""", @" + + + + { + + + ""a"" + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_non_string_key_json() + { + Test(@"@""{1:1}""", @" + + + + { + + + 1 + : + + 1 + + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_non_string_key_but_huge_number_instead_json() + { + Test(@"@""{9999E9999:1}""", @" + + + + { + + + 9999E9999 + : + + 1 + + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_repeated_null_null_json() + { + Test(@"@""{null:null,null:null}""", @" + + + + { + + + null + : + + null + + + + , + + + null + : + + null + + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_several_trailing_commas_json() + { + Test(@"@""{""""id"""":0,,,,,}""", @" + + + + { + + + ""id"" + : + + 0 + + + + , + + + , + + + , + + + , + + + , + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_single_quote_json() + { + Test(@"@""{'a':0}""", @" + + + + { + + + 'a' + : + + 0 + + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_trailing_comma_json() + { + Test(@"@""{""""id"""":0,}""", @" + + + + { + + + ""id"" + : + + 0 + + + + , + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_trailing_comment_json() + { + Test(@"@""{""""a"""":""""b""""}/**/""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + }/**/ + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_trailing_comment_open_json() + { + Test(@"@""{""""a"""":""""b""""}/**//""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + }/**// + + + + +", + @" + +", + @" + +", runLooseTreeCheck: false); + } + + [Fact] + public void n_object_trailing_comment_slash_open_json() + { + Test(@"@""{""""a"""":""""b""""}//""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + }// + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_trailing_comment_slash_open_incomplete_json() + { + Test(@"@""{""""a"""":""""b""""}/""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + }/ + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_two_commas_in_a_row_json() + { + Test(@"@""{""""a"""":""""b"""",,""""c"""":""""d""""}""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + , + + + , + + + ""c"" + : + + ""d"" + + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_unquoted_key_json() + { + Test(@"@""{a: """"b""""}""", @" + + + + { + + + a + : + + ""b"" + + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_object_unterminated_value_json() + { + Test(@"@""{""""a"""":""""a""", @" + + + + { + + + ""a"" + : + + ""a + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_with_single_string_json() + { + Test(@"@""{ """"foo"""" : """"bar"""", """"a"""" }""", @" + + + + { + + + ""foo"" + : + + ""bar"" + + + + , + + + ""a"" + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_object_with_trailing_garbage_json() + { + Test(@"@""{""""a"""":""""b""""}#""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + } + + + # + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_single_space_json() + { + Test(@"@"" """, @" + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_1_surrogate_then_escape_json() + { + Test(@"@""[""""\uD800\""""]""", @" + + + + [ + + + ""\uD800\""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_1_surrogate_then_escape_u_json() + { + Test(@"@""[""""\uD800\u""""]""", @" + + + + [ + + + ""\uD800\u""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_1_surrogate_then_escape_u1_json() + { + Test(@"@""[""""\uD800\u1""""]""", @" + + + + [ + + + ""\uD800\u1""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_1_surrogate_then_escape_u1x_json() + { + Test(@"@""[""""\uD800\u1x""""]""", @" + + + + [ + + + ""\uD800\u1x""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_accentuated_char_no_quotes_json() + { + Test(@"@""[é]""", @" + + + + [ + + + é + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_escaped_backslash_bad_json() + { + Test(@"@""[""""\\\""""]""", @" + + + + [ + + + ""\\\""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_escaped_ctrl_char_tab_json() + { + Test(@"@""[""""\ """"]""", @" + + + + [ + + + ""\ "" + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_escaped_emoji_json() + { + Test(@"@""[""""\🌀""""]""", @" + + + + [ + + + ""\🌀"" + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_escape_x_json() + { + Test(@"@""[""""\x00""""]""", @" + + + + [ + + + ""\x00"" + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_incomplete_escape_json() + { + Test(@"@""[""""\""""]""", @" + + + + [ + + + ""\""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_incomplete_escaped_character_json() + { + Test(@"@""[""""\u00A""""]""", @" + + + + [ + + + ""\u00A""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_incomplete_surrogate_json() + { + Test(@"@""[""""\uD834\uDd""""]""", @" + + + + [ + + + ""\uD834\uDd""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_incomplete_surrogate_escape_invalid_json() + { + Test(@"@""[""""\uD800\uD800\x""""]""", @" + + + + [ + + + ""\uD800\uD800\x"" + + + ] + + + + +", + @" + +", + @" + +", runStrictSubTreeCheck: false); + } + + [Fact] + public void n_string_invalid_utf_8_in_escape_json() + { + Test(@"@""[""""\u�""""]""", @" + + + + [ + + + ""\u�""] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_invalid_backslash_esc_json() + { + Test(@"@""[""""\a""""]""", @" + + + + [ + + + ""\a"" + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_invalid_unicode_escape_json() + { + Test(@"@""[""""\uqqqq""""]""", @" + + + + [ + + + ""\uqqqq"" + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_invalid_utf8_after_escape_json() + { + Test(@"@""[""""\�""""]""", @" + + + + [ + + + ""\�"" + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_leading_uescaped_thinspace_json() + { + Test(@"@""[\u0020""""asd""""]""", @" + + + + [ + + + \u0020 + + + ""asd"" + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_no_quotes_with_bad_escape_json() + { + Test(@"@""[\n]""", @" + + + + [ + + + \n + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_single_doublequote_json() + { + Test(@"@""""""""", @" + + + + "" + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_single_quote_json() + { + Test(@"@""['single quote']""", @" + + + + [ + + + 'single quote' + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_string_single_string_no_double_quotes_json() + { + Test(@"@""abc""", @" + + + + abc + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_start_escape_unclosed_json() + { + Test(@"@""[""""\""", @" + + + + [ + + + ""\ + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_unescaped_newline_json() + { + Test(@"@""[""""new +line""""]""", @" + + + + [ + + + ""new +line"" + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_string_unescaped_tab_json() + { + Test(@"@""["""" """"]""", @" + + + + [ + + + "" "" + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_string_unicode_CapitalU_json() + { + Test(@"@""""""\UA66D""""""", @" + + + + ""\UA66D"" + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_string_with_trailing_garbage_json() + { + Test(@"@""""""""""x""", @" + + + + """" + + + x + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_angle_bracket___json() + { + Test(@"@""<.>""", @" + + + + <.> + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_angle_bracket_null_json() + { + Test(@"@""[]""", @" + + + + [ + + + <null> + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_array_trailing_garbage_json() + { + Test(@"@""[1]x""", @" + + + + [ + + + 1 + + + ] + + + x + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_array_with_extra_array_close_json() + { + Test(@"@""[1]]""", @" + + + + [ + + + 1 + + + ] + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_array_with_unclosed_string_json() + { + Test(@"@""[""""asd]""", @" + + + + [ + + + ""asd] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_ascii_unicode_identifier_json() + { + Test(@"@""aå""", @" + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_capitalized_True_json() + { + Test(@"@""[True]""", @" + + + + [ + + + True + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_close_unopened_array_json() + { + Test(@"@""1]""", @" + + + + 1 + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_comma_instead_of_closing_brace_json() + { + Test(@"@""{""""x"""": true,""", @" + + + + { + + + ""x"" + : + + true + + + + , + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_double_array_json() + { + Test(@"@""[][]""", @" + + + + [ + + ] + + + [ + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_end_array_json() + { + Test(@"@""]""", @" + + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_incomplete_UTF8_BOM_json() + { + Test(@"@""�{}""", @" + + + + + + + { + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_lone_invalid_utf_8_json() + { + Test(@"@""""", @" + + + + +", + @"", + @""); + } + + [Fact] + public void n_structure_lone_open_bracket_json() + { + Test(@"@""[""", @" + + + + [ + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_no_data_json() + { + Test(@"@""""", @" + + + + +", + @"", + @""); + } + + [Fact] + public void n_structure_number_with_trailing_garbage_json() + { + Test(@"@""2@""", @" + + + + 2@ + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_object_followed_by_closing_object_json() + { + Test(@"@""{}}""", @" + + + + { + + } + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_object_unclosed_no_value_json() + { + Test(@"@""{"""""""":""", @" + + + + { + + + """" + : + + + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_object_with_comment_json() + { + Test(@"@""{""""a"""":/*comment*/""""b""""}""", @" + + + + { + + + ""a"" + :/*comment*/ + + ""b"" + + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_structure_object_with_trailing_garbage_json() + { + Test(@"@""{""""a"""": true} """"x""""""", @" + + + + { + + + ""a"" + : + + true + + + + } + + + ""x"" + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_array_apostrophe_json() + { + Test(@"@""['""", @" + + + + [ + + + ' + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_array_comma_json() + { + Test(@"@""[,""", @" + + + + [ + + + , + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_array_open_object_json() + { + Test(@"@""[{""", @" + + + + [ + + + { + + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_array_open_string_json() + { + Test(@"@""[""""a""", @" + + + + [ + + + ""a + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_array_string_json() + { + Test(@"@""[""""a""""""", @" + + + + [ + + + ""a"" + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_object_json() + { + Test(@"@""{""", @" + + + + { + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_object_close_array_json() + { + Test(@"@""{]""", @" + + + + { + + + ] + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_object_comma_json() + { + Test(@"@""{,""", @" + + + + { + + + , + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_object_open_array_json() + { + Test(@"@""{[""", @" + + + + { + + + [ + + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_object_open_string_json() + { + Test(@"@""{""""a""", @" + + + + { + + + ""a + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_object_string_with_apostrophes_json() + { + Test(@"@""{'a'""", @" + + + + { + + + 'a' + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_open_open_json() + { + Test(@"@""[""""\{[""""\{[""""\{[""""\{""", @" + + + + [ + + + ""\{["" + + + \ + + + { + + + [ + + + ""\{["" + + + \ + + + { + + + + + + + + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_single_eacute_json() + { + Test(@"@""""", @" + + + + +", + @"", + @""); + } + + [Fact] + public void n_structure_single_star_json() + { + Test(@"@""*""", @" + + + + * + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_trailing___json() + { + Test(@"@""{""""a"""":""""b""""}#{}""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + } + + + # + + + { + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_U_2060_word_joined_json() + { + Test(@"@""[⁠]""", @" + + + + [ + + + + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_uescaped_LF_before_string_json() + { + Test(@"@""[\u000A""""""""]""", @" + + + + [ + + + \u000A + + + """" + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_unclosed_array_json() + { + Test(@"@""[1""", @" + + + + [ + + + 1 + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_unclosed_array_partial_null_json() + { + Test(@"@""[ false, nul""", @" + + + + [ + + + false + + + , + + + nul + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_unclosed_array_unfinished_false_json() + { + Test(@"@""[ true, fals""", @" + + + + [ + + + true + + + , + + + fals + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_unclosed_array_unfinished_true_json() + { + Test(@"@""[ false, tru""", @" + + + + [ + + + false + + + , + + + tru + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_unclosed_object_json() + { + Test(@"@""{""""asd"""":""""asd""""""", @" + + + + { + + + ""asd"" + : + + ""asd"" + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_unicode_identifier_json() + { + Test(@"@""å""", @" + + + + å + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void n_structure_UTF8_BOM_no_data_json() + { + Test(@"@""""", @" + + + + +", + @"", + @""); + } + + [Fact] + public void n_structure_whitespace_formfeed_json() + { + Test(@"@""[ ]""", @" + + + + [\f + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void n_structure_whitespace_U_2060_word_joiner_json() + { + Test(@"@""[⁠]""", @" + + + + [ + + + + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void y_array_arraysWithSpaces_json() + { + Test(@"@""[[] ]""", @" + + + + [ + + + [ + + ] + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_empty_string_json() + { + Test(@"@""[""""""""]""", @" + + + + [ + + + """" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_empty_json() + { + Test(@"@""[]""", @" + + + + [ + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_ending_with_newline_json() + { + Test(@"@""[""""a""""]""", @" + + + + [ + + + ""a"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_false_json() + { + Test(@"@""[false]""", @" + + + + [ + + + false + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_heterogeneous_json() + { + Test(@"@""[null, 1, """"1"""", {}]""", @" + + + + [ + + + null + + + , + + + 1 + + + , + + + ""1"" + + + , + + + { + + } + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_null_json() + { + Test(@"@""[null]""", @" + + + + [ + + + null + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_with_1_and_newline_json() + { + Test(@"@""[1 +]""", @" + + + + [ + + + 1 + + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_with_leading_space_json() + { + Test(@"@"" [1]""", @" + + + + + + + [ + + + 1 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_with_several_null_json() + { + Test(@"@""[1,null,null,null,2]""", @" + + + + [ + + + 1 + + + , + + + null + + + , + + + null + + + , + + + null + + + , + + + 2 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_array_with_trailing_space_json() + { + Test(@"@""[2] """, @" + + + + [ + + + 2 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_json() + { + Test(@"@""[123e65]""", @" + + + + [ + + + 123e65 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_0e_1_json() + { + Test(@"@""[0e+1]""", @" + + + + [ + + + 0e+1 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_0e1_json() + { + Test(@"@""[0e1]""", @" + + + + [ + + + 0e1 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_after_space_json() + { + Test(@"@""[ 4]""", @" + + + + [ + + + 4 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_double_close_to_zero_json() + { + Test(@"@""[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001] +""", @" + + + + [ + + + -0.000000000000000000000000000000000000000000000000000000000000000000000000000001 + + + ] + + + + + +", + @"", + @"", runStrictSubTreeCheck: false); + } + + [Fact] + public void y_number_int_with_exp_json() + { + Test(@"@""[20e1]""", @" + + + + [ + + + 20e1 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_minus_zero_json() + { + Test(@"@""[-0]""", @" + + + + [ + + + -0 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_negative_int_json() + { + Test(@"@""[-123]""", @" + + + + [ + + + -123 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_negative_one_json() + { + Test(@"@""[-1]""", @" + + + + [ + + + -1 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_negative_zero_json() + { + Test(@"@""[-0]""", @" + + + + [ + + + -0 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_real_capital_e_json() + { + Test(@"@""[1E22]""", @" + + + + [ + + + 1E22 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_real_capital_e_neg_exp_json() + { + Test(@"@""[1E-2]""", @" + + + + [ + + + 1E-2 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_real_capital_e_pos_exp_json() + { + Test(@"@""[1E+2]""", @" + + + + [ + + + 1E+2 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_real_exponent_json() + { + Test(@"@""[123e45]""", @" + + + + [ + + + 123e45 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_real_fraction_exponent_json() + { + Test(@"@""[123.456e78]""", @" + + + + [ + + + 123.456e78 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_real_neg_exp_json() + { + Test(@"@""[1e-2]""", @" + + + + [ + + + 1e-2 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_real_pos_exponent_json() + { + Test(@"@""[1e+2]""", @" + + + + [ + + + 1e+2 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_simple_int_json() + { + Test(@"@""[123]""", @" + + + + [ + + + 123 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_number_simple_real_json() + { + Test(@"@""[123.456789]""", @" + + + + [ + + + 123.456789 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_json() + { + Test(@"@""{""""asd"""":""""sdf"""", """"dfg"""":""""fgh""""}""", @" + + + + { + + + ""asd"" + : + + ""sdf"" + + + + , + + + ""dfg"" + : + + ""fgh"" + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_basic_json() + { + Test(@"@""{""""asd"""":""""sdf""""}""", @" + + + + { + + + ""asd"" + : + + ""sdf"" + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_duplicated_key_json() + { + Test(@"@""{""""a"""":""""b"""",""""a"""":""""c""""}""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + , + + + ""a"" + : + + ""c"" + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_duplicated_key_and_value_json() + { + Test(@"@""{""""a"""":""""b"""",""""a"""":""""b""""}""", @" + + + + { + + + ""a"" + : + + ""b"" + + + + , + + + ""a"" + : + + ""b"" + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_empty_json() + { + Test(@"@""{}""", @" + + + + { + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_empty_key_json() + { + Test(@"@""{"""""""":0}""", @" + + + + { + + + """" + : + + 0 + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_escaped_null_in_key_json() + { + Test(@"@""{""""foo\u0000bar"""": 42}""", @" + + + + { + + + ""foo\u0000bar"" + : + + 42 + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_extreme_numbers_json() + { + Test(@"@""{ """"min"""": -1.0e+28, """"max"""": 1.0e+28 }""", @" + + + + { + + + ""min"" + : + + -1.0e+28 + + + + , + + + ""max"" + : + + 1.0e+28 + + + + } + + + + +", + @"", + @"", runStrictSubTreeCheck: false); + } + + [Fact] + public void y_object_long_strings_json() + { + Test(@"@""{""""x"""":[{""""id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}], """"id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}""", @" + + + + { + + + ""x"" + : + + [ + + + { + + + ""id"" + : + + ""xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"" + + + + } + + + ] + + + + , + + + ""id"" + : + + ""xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"" + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_simple_json() + { + Test(@"@""{""""a"""":[]}""", @" + + + + { + + + ""a"" + : + + [ + + ] + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_string_unicode_json() + { + Test(@"@""{""""title"""":""""\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430"""" }""", @" + + + + { + + + ""title"" + : + + ""\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430"" + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_object_with_newlines_json() + { + Test(@"@""{ +""""a"""": """"b"""" +}""", @" + + + + { + + + + ""a"" + : + + ""b"" + + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_1_2_3_bytes_UTF_8_sequences_json() + { + Test(@"@""[""""\u0060\u012a\u12AB""""]""", @" + + + + [ + + + ""\u0060\u012a\u12AB"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_accepted_surrogate_pair_json() + { + Test(@"@""[""""\uD801\udc37""""]""", @" + + + + [ + + + ""\uD801\udc37"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_accepted_surrogate_pairs_json() + { + Test(@"@""[""""\ud83d\ude39\ud83d\udc8d""""]""", @" + + + + [ + + + ""\ud83d\ude39\ud83d\udc8d"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_allowed_escapes_json() + { + Test(@"@""[""""\""""\\\/\b\f\n\r\t""""]""", @" + + + + [ + + + ""\""\\\/\b\f\n\r\t"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_backslash_and_u_escaped_zero_json() + { + Test(@"@""[""""\\u0000""""]""", @" + + + + [ + + + ""\\u0000"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_backslash_doublequotes_json() + { + Test(@"@""[""""\""""""""]""", @" + + + + [ + + + ""\"""" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_comments_json() + { + Test(@"@""[""""a/*b*/c/*d//e""""]""", @" + + + + [ + + + ""a/*b*/c/*d//e"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_double_escape_a_json() + { + Test(@"@""[""""\\a""""]""", @" + + + + [ + + + ""\\a"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_double_escape_n_json() + { + Test(@"@""[""""\\n""""]""", @" + + + + [ + + + ""\\n"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_escaped_control_character_json() + { + Test(@"@""[""""\u0012""""]""", @" + + + + [ + + + ""\u0012"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_escaped_noncharacter_json() + { + Test(@"@""[""""\uFFFF""""]""", @" + + + + [ + + + ""\uFFFF"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_in_array_json() + { + Test(@"@""[""""asd""""]""", @" + + + + [ + + + ""asd"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_in_array_with_leading_space_json() + { + Test(@"@""[ """"asd""""]""", @" + + + + [ + + + ""asd"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_last_surrogates_1_and_2_json() + { + Test(@"@""[""""\uDBFF\uDFFF""""]""", @" + + + + [ + + + ""\uDBFF\uDFFF"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_nbsp_uescaped_json() + { + Test(@"@""[""""new\u00A0line""""]""", @" + + + + [ + + + ""new\u00A0line"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_nonCharacterInUTF_8_U_10FFFF_json() + { + Test(@"@""[""""􏿿""""]""", @" + + + + [ + + + ""􏿿"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_null_escape_json() + { + Test(@"@""[""""\u0000""""]""", @" + + + + [ + + + ""\u0000"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_one_byte_utf_8_json() + { + Test(@"@""[""""\u002c""""]""", @" + + + + [ + + + ""\u002c"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_pi_json() + { + Test(@"@""[""""π""""]""", @" + + + + [ + + + ""π"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_reservedCharacterInUTF_8_U_1BFFF_json() + { + Test(@"@""[""""𛿿""""]""", @" + + + + [ + + + ""𛿿"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_simple_ascii_json() + { + Test(@"@""[""""asd """"]""", @" + + + + [ + + + ""asd "" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_space_json() + { + Test(@"@"""""" """"""", @" + + + + "" "" + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_surrogates_U_1D11E_MUSICAL_SYMBOL_G_CLEF_json() + { + Test(@"@""[""""\uD834\uDd1e""""]""", @" + + + + [ + + + ""\uD834\uDd1e"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_three_byte_utf_8_json() + { + Test(@"@""[""""\u0821""""]""", @" + + + + [ + + + ""\u0821"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_two_byte_utf_8_json() + { + Test(@"@""[""""\u0123""""]""", @" + + + + [ + + + ""\u0123"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_u_2028_line_sep_json() + { + Test(@"@""[""""
""""]""", @" + + + + [ + + + ""
"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_u_2029_par_sep_json() + { + Test(@"@""[""""
""""]""", @" + + + + [ + + + ""
"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_uEscape_json() + { + Test(@"@""[""""\u0061\u30af\u30EA\u30b9""""]""", @" + + + + [ + + + ""\u0061\u30af\u30EA\u30b9"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_uescaped_newline_json() + { + Test(@"@""[""""new\u000Aline""""]""", @" + + + + [ + + + ""new\u000Aline"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unescaped_char_delete_json() + { + Test(@"@""[""""""""]""", @" + + + + [ + + + """" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_json() + { + Test(@"@""[""""\uA66D""""]""", @" + + + + [ + + + ""\uA66D"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicodeEscapedBackslash_json() + { + Test(@"@""[""""\u005C""""]""", @" + + + + [ + + + ""\u005C"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_2_json() + { + Test(@"@""[""""⍂㈴⍂""""]""", @" + + + + [ + + + ""⍂㈴⍂"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_escaped_double_quote_json() + { + Test(@"@""[""""\u0022""""]""", @" + + + + [ + + + ""\u0022"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_U_10FFFE_nonchar_json() + { + Test(@"@""[""""\uDBFF\uDFFE""""]""", @" + + + + [ + + + ""\uDBFF\uDFFE"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_U_1FFFE_nonchar_json() + { + Test(@"@""[""""\uD83F\uDFFE""""]""", @" + + + + [ + + + ""\uD83F\uDFFE"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_U_200B_ZERO_WIDTH_SPACE_json() + { + Test(@"@""[""""\u200B""""]""", @" + + + + [ + + + ""\u200B"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_U_2064_invisible_plus_json() + { + Test(@"@""[""""\u2064""""]""", @" + + + + [ + + + ""\u2064"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_U_FDD0_nonchar_json() + { + Test(@"@""[""""\uFDD0""""]""", @" + + + + [ + + + ""\uFDD0"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_unicode_U_FFFE_nonchar_json() + { + Test(@"@""[""""\uFFFE""""]""", @" + + + + [ + + + ""\uFFFE"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_utf8_json() + { + Test(@"@""[""""€𝄞""""]""", @" + + + + [ + + + ""€𝄞"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_string_with_del_character_json() + { + Test(@"@""[""""aa""""]""", @" + + + + [ + + + ""aa"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_lonely_false_json() + { + Test(@"@""false""", @" + + + + false + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_lonely_int_json() + { + Test(@"@""42""", @" + + + + 42 + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_lonely_negative_real_json() + { + Test(@"@""-0.1""", @" + + + + -0.1 + + + + +", + @"", + @"", runStrictSubTreeCheck: false); + } + + [Fact] + public void y_structure_lonely_null_json() + { + Test(@"@""null""", @" + + + + null + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_lonely_string_json() + { + Test(@"@""""""asd""""""", @" + + + + ""asd"" + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_lonely_true_json() + { + Test(@"@""true""", @" + + + + true + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_string_empty_json() + { + Test(@"@""""""""""""", @" + + + + """" + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_trailing_newline_json() + { + Test(@"@""[""""a""""] +""", @" + + + + [ + + + ""a"" + + + ] + + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_true_in_array_json() + { + Test(@"@""[true]""", @" + + + + [ + + + true + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void y_structure_whitespace_array_json() + { + Test(@"@"" [] """, @" + + + + + + + [ + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void number_1_0_json() + { + Test(@"@""[1.0]""", @" + + + + [ + + + 1.0 + + + ] + + + + +", + @"", + @"", runStrictSubTreeCheck: false); + } + + [Fact] + public void number_1_000000000000000005_json() + { + Test(@"@""[1.000000000000000005]""", @" + + + + [ + + + 1.000000000000000005 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void number_1000000000000000_json() + { + Test(@"@""[1000000000000000] +""", @" + + + + [ + + + 1000000000000000 + + + ] + + + + + +", + @"", + @""); + } + + [Fact] + public void number_10000000000000000999_json() + { + Test(@"@""[10000000000000000999]""", @" + + + + [ + + + 10000000000000000999 + + + ] + + + + +", + @"", + @"", runStrictSubTreeCheck: false); + } + + [Fact] + public void number_1e_999_json() + { + Test(@"@""[1E-999]""", @" + + + + [ + + + 1E-999 + + + ] + + + + +", + @"", + @"", runStrictSubTreeCheck: false); + } + + [Fact] + public void number_1e6_json() + { + Test(@"@""[1E6]""", @" + + + + [ + + + 1E6 + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void object_key_nfc_nfd_json() + { + Test(@"@""{""""é"""":""""NFC"""",""""é"""":""""NFD""""}""", @" + + + + { + + + ""é"" + : + + ""NFC"" + + + + , + + + ""é"" + : + + ""NFD"" + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void object_key_nfd_nfc_json() + { + Test(@"@""{""""é"""":""""NFD"""",""""é"""":""""NFC""""}""", @" + + + + { + + + ""é"" + : + + ""NFD"" + + + + , + + + ""é"" + : + + ""NFC"" + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void object_same_key_different_values_json() + { + Test(@"@""{""""a"""":1,""""a"""":2}""", @" + + + + { + + + ""a"" + : + + 1 + + + + , + + + ""a"" + : + + 2 + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void object_same_key_same_value_json() + { + Test(@"@""{""""a"""":1,""""a"""":1}""", @" + + + + { + + + ""a"" + : + + 1 + + + + , + + + ""a"" + : + + 1 + + + + } + + + + +", + @"", + @""); + } + + [Fact] + public void object_same_key_unclear_values_json() + { + Test(@"@""{""""a"""":0, """"a"""":-0} +""", @" + + + + { + + + ""a"" + : + + 0 + + + + , + + + ""a"" + : + + -0 + + + + } + + + + + +", + @"", + @""); + } + + [Fact] + public void string_1_escaped_invalid_codepoint_json() + { + Test(@"@""[""""\uD800""""]""", @" + + + + [ + + + ""\uD800"" + + + ] + + + + +", + @"", + @"", runLooseSubTreeCheck: false); + } + + [Fact] + public void string_1_invalid_codepoint_json() + { + Test(@"@""[""""��""""]""", @" + + + + [ + + + ""��"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void string_2_escaped_invalid_codepoints_json() + { + Test(@"@""[""""\uD800\uD800""""]""", @" + + + + [ + + + ""\uD800\uD800"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void string_2_invalid_codepoints_json() + { + Test(@"@""[""""����""""]""", @" + + + + [ + + + ""����"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void string_3_escaped_invalid_codepoints_json() + { + Test(@"@""[""""\uD800\uD800\uD800""""]""", @" + + + + [ + + + ""\uD800\uD800\uD800"" + + + ] + + + + +", + @"", + @"", runLooseSubTreeCheck: false); + } + + [Fact] + public void string_3_invalid_codepoints_json() + { + Test(@"@""[""""������""""]""", @" + + + + [ + + + ""������"" + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void string_with_escaped_NULL_json() + { + Test(@"@""[""""A\u0000B""""]""", @" + + + + [ + + + ""A\u0000B"" + + + ] + + + + +", + @"", + @""); + } + } +} diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs index f57dc5bc2ce93..941f8d39f52df 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs @@ -82,12 +82,33 @@ private void GenerateTestSuiteTests() private void Process(string path) { - foreach (var file in Directory.EnumerateFiles(path, "*.json")) + foreach (var entry in Directory.EnumerateFiles(path, "*.json")) { - + try + { + var contents = "@\"" + File.ReadAllText(entry).Replace("\"", "\"\"") + "\""; + if (contents.Contains((char)0)) + { + continue; + } + + var fileName = Massage(new FileInfo(entry).Name); + + var test = GenerateTests(contents, true, true, fileName); + nameToTest.Add(fileName, test); + } + catch (ArgumentException) + { + } } } + private static readonly Regex _regex = new Regex("[^0-9a-zA-Z_]"); + private string Massage(string name) + { + return _regex.Replace(name, "_"); + } + //private void Test(string stringText, string expected, bool runJsonNetCheck = true, bool runJsonNetSubTreeTests = true, [CallerMemberName]string name = "") //{ // var test = GenerateTests(stringText, runJsonNetCheck, runJsonNetSubTreeTests, name); @@ -108,16 +129,25 @@ private string GenerateTests(string val, bool runJsonNetCheck, bool runJsonNetSu var token = GetStringToken(val); var allChars = _service.TryConvertToVirtualChars(token); - var tree = JsonParser.TryParse(allChars, strict: false); + var looseTree = JsonParser.TryParse(allChars, strict: false); + if (looseTree == null) + { + throw new ArgumentException(); + } builder.Append(", " + '@' + '"'); - builder.Append(TreeToText(tree).Replace("\"", "\"\"")); + builder.Append(TreeToText(looseTree).Replace("\"", "\"\"")); builder.AppendLine("" + '"' + ','); builder.Append("" + '@' + '"'); - builder.Append(DiagnosticsToText(tree.Diagnostics).Replace("\"", "\"\"")); + builder.Append(DiagnosticsToText(looseTree.Diagnostics).Replace("\"", "\"\"")); builder.AppendLine("" + '"' + ','); - builder.Append("" + '@' + '"' + '"'); + + + var strictTree = JsonParser.TryParse(allChars, strict: true); + builder.Append("" + '@' + '"'); + builder.Append(DiagnosticsToText(strictTree.Diagnostics).Replace("\"", "\"\"")); + builder.Append('"'); if (!runJsonNetCheck) { diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 46b8cb7bef356..31004220988dd 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -59,6 +59,10 @@ private void Test( bool runTreeCheck, bool runSubTreeChecks) { var tree = TryParseTree(stringText, strict, runTreeCheck, conversionFailureOk: false); + if (tree == null) + { + return; + } // Tests are allowed to not run the subtree tests. This is because some // subtrees can cause the native regex parser to exhibit very bad behavior diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 36a7be4fcd832..f7e4a5eb838cf 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -255,14 +255,14 @@ Numeric values that cannot be represented in the grammar below (such literalToken.GetSpan()); } - if (!double.TryParse(literalText, out var val) || - double.IsNaN(val) || - double.IsInfinity(val)) - { - return new EmbeddedDiagnostic( - WorkspacesResources.Invalid_number, - literalToken.GetSpan()); - } + //if (!double.TryParse(literalText, out var val) || + // double.IsNaN(val) || + // double.IsInfinity(val)) + //{ + // return new EmbeddedDiagnostic( + // WorkspacesResources.Invalid_number, + // literalToken.GetSpan()); + //} return CheckToken(literalToken); } From 1c7f29246dfe602046dd697d4fdfc5f85d1d675a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 21:50:57 -0700 Subject: [PATCH 014/110] Add nst tests. --- .../Json/CSharpJsonParserTests_NstTests.cs | 4221 +++++++++++++---- .../CSharpJsonParserTests_TestGeneration.cs | 12 +- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 33 +- 3 files changed, 3373 insertions(+), 893 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs index 22bf2a10be054..730f7b51bb020 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs @@ -10,7 +10,7 @@ public partial class CSharpJsonParserTests [Fact] public void i_number_double_huge_neg_exp_json() { - Test(@"@""[123.456e-789]""", @" + TestNST(@"@""[123.456e-789]""", @" @@ -24,7 +24,7 @@ public void i_number_double_huge_neg_exp_json() - i_number_huge_exp_json + ", @"", @""); @@ -33,7 +33,7 @@ public void i_number_double_huge_neg_exp_json() [Fact] public void i_number_huge_exp_json() { - Test(@"@""[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]""", @" + TestNST(@"@""[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]""", @" @@ -52,17 +52,13 @@ public void i_number_huge_exp_json() @" ", - @" - -", - runStrictTreeCheck: false, runLooseSubTreeCheck: false, - runStrictSubTreeCheck: false, runLooseTreeCheck: false); + @""); } [Fact] public void i_number_neg_int_huge_exp_json() { - Test(@"@""[-1e+9999]""", @" + TestNST(@"@""[-1e+9999]""", @" @@ -81,15 +77,13 @@ public void i_number_neg_int_huge_exp_json() @" ", - @" - -"); + @""); } [Fact] public void i_number_pos_double_huge_exp_json() { - Test(@"@""[1.5e+9999]""", @" + TestNST(@"@""[1.5e+9999]""", @" @@ -108,15 +102,13 @@ public void i_number_pos_double_huge_exp_json() @" ", - @" - -"); + @""); } [Fact] public void i_number_real_neg_overflow_json() { - Test(@"@""[-123123e100000]""", @" + TestNST(@"@""[-123123e100000]""", @" @@ -135,15 +127,13 @@ public void i_number_real_neg_overflow_json() @" ", - @" - -"); + @""); } [Fact] public void i_number_real_pos_overflow_json() { - Test(@"@""[123123e100000]""", @" + TestNST(@"@""[123123e100000]""", @" @@ -162,15 +152,13 @@ public void i_number_real_pos_overflow_json() @" ", - @" - -"); + @""); } [Fact] public void i_number_real_underflow_json() { - Test(@"@""[123e-10000000]""", @" + TestNST(@"@""[123e-10000000]""", @" @@ -187,13 +175,13 @@ public void i_number_real_underflow_json() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] public void i_number_too_big_neg_int_json() { - Test(@"@""[-123123123123123123123123123123]""", @" + TestNST(@"@""[-123123123123123123123123123123]""", @" @@ -216,7 +204,7 @@ public void i_number_too_big_neg_int_json() [Fact] public void i_number_too_big_pos_int_json() { - Test(@"@""[100000000000000000000]""", @" + TestNST(@"@""[100000000000000000000]""", @" @@ -233,13 +221,13 @@ public void i_number_too_big_pos_int_json() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] public void i_number_very_big_negative_int_json() { - Test(@"@""[-237462374673276894279832749832423479823246327846]""", @" + TestNST(@"@""[-237462374673276894279832749832423479823246327846]""", @" @@ -262,7 +250,7 @@ public void i_number_very_big_negative_int_json() [Fact] public void i_object_key_lone_2nd_surrogate_json() { - Test(@"@""{""""\uDFAA"""":0}""", @" + TestNST(@"@""{""""\uDFAA"""":0}""", @" @@ -289,7 +277,7 @@ public void i_object_key_lone_2nd_surrogate_json() [Fact] public void i_string_1st_surrogate_but_2nd_missing_json() { - Test(@"@""[""""\uDADA""""]""", @" + TestNST(@"@""[""""\uDADA""""]""", @" @@ -306,13 +294,13 @@ public void i_string_1st_surrogate_but_2nd_missing_json() ", @"", - @"", runLooseTreeCheck: false); + @""); } [Fact] public void i_string_1st_valid_surrogate_2nd_invalid_json() { - Test(@"@""[""""\uD888\u1234""""]""", @" + TestNST(@"@""[""""\uD888\u1234""""]""", @" @@ -335,7 +323,7 @@ public void i_string_1st_valid_surrogate_2nd_invalid_json() [Fact] public void i_string_incomplete_surrogates_escape_valid_json() { - Test(@"@""[""""\uD800\uD800\n""""]""", @" + TestNST(@"@""[""""\uD800\uD800\n""""]""", @" @@ -352,13 +340,13 @@ public void i_string_incomplete_surrogates_escape_valid_json() ", @"", - @"", runStrictTreeCheck: false, runStrictSubTreeCheck: false); + @""); } [Fact] public void i_string_incomplete_surrogate_and_escape_valid_json() { - Test(@"@""[""""\uD800\n""""]""", @" + TestNST(@"@""[""""\uD800\n""""]""", @" @@ -381,7 +369,7 @@ public void i_string_incomplete_surrogate_and_escape_valid_json() [Fact] public void i_string_incomplete_surrogate_pair_json() { - Test(@"@""[""""\uDd1ea""""]""", @" + TestNST(@"@""[""""\uDd1ea""""]""", @" @@ -404,7 +392,7 @@ public void i_string_incomplete_surrogate_pair_json() [Fact] public void i_string_invalid_lonely_surrogate_json() { - Test(@"@""[""""\ud800""""]""", @" + TestNST(@"@""[""""\ud800""""]""", @" @@ -427,7 +415,7 @@ public void i_string_invalid_lonely_surrogate_json() [Fact] public void i_string_invalid_surrogate_json() { - Test(@"@""[""""\ud800abc""""]""", @" + TestNST(@"@""[""""\ud800abc""""]""", @" @@ -450,7 +438,7 @@ public void i_string_invalid_surrogate_json() [Fact] public void i_string_invalid_utf_8_json() { - Test(@"@""[""""�""""]""", @" + TestNST(@"@""[""""�""""]""", @" @@ -473,7 +461,7 @@ public void i_string_invalid_utf_8_json() [Fact] public void i_string_inverted_surrogates_U_1D11E_json() { - Test(@"@""[""""\uDd1e\uD834""""]""", @" + TestNST(@"@""[""""\uDd1e\uD834""""]""", @" @@ -490,13 +478,13 @@ public void i_string_inverted_surrogates_U_1D11E_json() ", @"", - @"", runLooseSubTreeCheck: false); + @""); } [Fact] public void i_string_iso_latin_1_json() { - Test(@"@""[""""�""""]""", @" + TestNST(@"@""[""""�""""]""", @" @@ -519,7 +507,7 @@ public void i_string_iso_latin_1_json() [Fact] public void i_string_lone_second_surrogate_json() { - Test(@"@""[""""\uDFAA""""]""", @" + TestNST(@"@""[""""\uDFAA""""]""", @" @@ -542,7 +530,7 @@ public void i_string_lone_second_surrogate_json() [Fact] public void i_string_lone_utf8_continuation_byte_json() { - Test(@"@""[""""�""""]""", @" + TestNST(@"@""[""""�""""]""", @" @@ -565,7 +553,7 @@ public void i_string_lone_utf8_continuation_byte_json() [Fact] public void i_string_not_in_unicode_range_json() { - Test(@"@""[""""���""""]""", @" + TestNST(@"@""[""""���""""]""", @" @@ -588,7 +576,7 @@ public void i_string_not_in_unicode_range_json() [Fact] public void i_string_overlong_sequence_2_bytes_json() { - Test(@"@""[""""��""""]""", @" + TestNST(@"@""[""""��""""]""", @" @@ -611,7 +599,7 @@ public void i_string_overlong_sequence_2_bytes_json() [Fact] public void i_string_overlong_sequence_6_bytes_json() { - Test(@"@""[""""������""""]""", @" + TestNST(@"@""[""""������""""]""", @" @@ -634,7 +622,7 @@ public void i_string_overlong_sequence_6_bytes_json() [Fact] public void i_string_overlong_sequence_6_bytes_null_json() { - Test(@"@""[""""������""""]""", @" + TestNST(@"@""[""""������""""]""", @" @@ -657,7 +645,7 @@ public void i_string_overlong_sequence_6_bytes_null_json() [Fact] public void i_string_truncated_utf_8_json() { - Test(@"@""[""""��""""]""", @" + TestNST(@"@""[""""��""""]""", @" @@ -680,7 +668,7 @@ public void i_string_truncated_utf_8_json() [Fact] public void i_string_UTF_16LE_with_BOM_json() { - Test(@"@""[""""é""""]""", @" + TestNST(@"@""[""""é""""]""", @" @@ -703,7 +691,7 @@ public void i_string_UTF_16LE_with_BOM_json() [Fact] public void i_string_UTF_8_invalid_sequence_json() { - Test(@"@""[""""日ш�""""]""", @" + TestNST(@"@""[""""日ш�""""]""", @" @@ -726,7 +714,7 @@ public void i_string_UTF_8_invalid_sequence_json() [Fact] public void i_string_UTF8_surrogate_U_D800_json() { - Test(@"@""[""""��""""]""", @" + TestNST(@"@""[""""��""""]""", @" @@ -746,10 +734,3023 @@ public void i_string_UTF8_surrogate_U_D800_json() @""); } + [Fact] + public void i_structure_500_nested_arrays_json() + { + TestNST(@"@""[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]""", @" + + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + + [ + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + ] + + + + +", + @"", + @""); + } + [Fact] public void i_structure_UTF_8_BOM_empty_object_json() { - Test(@"@""{}""", @" + TestNST(@"@""{}""", @" @@ -768,7 +3769,7 @@ public void i_structure_UTF_8_BOM_empty_object_json() [Fact] public void n_array_1_true_without_comma_json() { - Test(@"@""[1 true]""", @" + TestNST(@"@""[1 true]""", @" @@ -798,7 +3799,7 @@ public void n_array_1_true_without_comma_json() [Fact] public void n_array_a_invalid_utf8_json() { - Test(@"@""[a�]""", @" + TestNST(@"@""[a�]""", @" @@ -825,7 +3826,7 @@ public void n_array_a_invalid_utf8_json() [Fact] public void n_array_colon_instead_of_comma_json() { - Test(@"@""["""""""": 1]""", @" + TestNST(@"@""["""""""": 1]""", @" @@ -856,7 +3857,7 @@ public void n_array_colon_instead_of_comma_json() [Fact] public void n_array_comma_after_close_json() { - Test(@"@""[""""""""],""", @" + TestNST(@"@""[""""""""],""", @" @@ -886,7 +3887,7 @@ public void n_array_comma_after_close_json() [Fact] public void n_array_comma_and_number_json() { - Test(@"@""[,1]""", @" + TestNST(@"@""[,1]""", @" @@ -914,7 +3915,7 @@ public void n_array_comma_and_number_json() [Fact] public void n_array_double_comma_json() { - Test(@"@""[1,,2]""", @" + TestNST(@"@""[1,,2]""", @" @@ -948,7 +3949,7 @@ public void n_array_double_comma_json() [Fact] public void n_array_double_extra_comma_json() { - Test(@"@""[""""x"""",,]""", @" + TestNST(@"@""[""""x"""",,]""", @" @@ -979,7 +3980,7 @@ public void n_array_double_extra_comma_json() [Fact] public void n_array_extra_close_json() { - Test(@"@""[""""x""""]]""", @" + TestNST(@"@""[""""x""""]]""", @" @@ -1009,7 +4010,7 @@ public void n_array_extra_close_json() [Fact] public void n_array_extra_comma_json() { - Test(@"@""["""""""",]""", @" + TestNST(@"@""["""""""",]""", @" @@ -1037,7 +4038,7 @@ public void n_array_extra_comma_json() [Fact] public void n_array_incomplete_json() { - Test(@"@""[""""x""""""", @" + TestNST(@"@""[""""x""""""", @" @@ -1064,7 +4065,7 @@ public void n_array_incomplete_json() [Fact] public void n_array_incomplete_invalid_value_json() { - Test(@"@""[x""", @" + TestNST(@"@""[x""", @" @@ -1091,7 +4092,7 @@ public void n_array_incomplete_invalid_value_json() [Fact] public void n_array_inner_array_no_comma_json() { - Test(@"@""[3[4]]""", @" + TestNST(@"@""[3[4]]""", @" @@ -1127,7 +4128,7 @@ public void n_array_inner_array_no_comma_json() [Fact] public void n_array_invalid_utf8_json() { - Test(@"@""[�]""", @" + TestNST(@"@""[�]""", @" @@ -1154,7 +4155,7 @@ public void n_array_invalid_utf8_json() [Fact] public void n_array_items_separated_by_semicolon_json() { - Test(@"@""[1:2]""", @" + TestNST(@"@""[1:2]""", @" @@ -1185,7 +4186,7 @@ public void n_array_items_separated_by_semicolon_json() [Fact] public void n_array_just_comma_json() { - Test(@"@""[,]""", @" + TestNST(@"@""[,]""", @" @@ -1210,7 +4211,7 @@ public void n_array_just_comma_json() [Fact] public void n_array_just_minus_json() { - Test(@"@""[-]""", @" + TestNST(@"@""[-]""", @" @@ -1237,7 +4238,7 @@ public void n_array_just_minus_json() [Fact] public void n_array_missing_value_json() { - Test(@"@""[ , """"""""]""", @" + TestNST(@"@""[ , """"""""]""", @" @@ -1265,7 +4266,7 @@ public void n_array_missing_value_json() [Fact] public void n_array_newlines_unclosed_json() { - Test(@"@""[""""a"""", + TestNST(@"@""[""""a"""", 4 ,1,""", @" @@ -1311,7 +4312,7 @@ public void n_array_newlines_unclosed_json() [Fact] public void n_array_number_and_comma_json() { - Test(@"@""[1,]""", @" + TestNST(@"@""[1,]""", @" @@ -1339,7 +4340,7 @@ public void n_array_number_and_comma_json() [Fact] public void n_array_number_and_several_commas_json() { - Test(@"@""[1,,]""", @" + TestNST(@"@""[1,,]""", @" @@ -1370,7 +4371,7 @@ public void n_array_number_and_several_commas_json() [Fact] public void n_array_star_inside_json() { - Test(@"@""[*]""", @" + TestNST(@"@""[*]""", @" @@ -1397,7 +4398,7 @@ public void n_array_star_inside_json() [Fact] public void n_array_unclosed_json() { - Test(@"@""[""""""""""", @" + TestNST(@"@""[""""""""""", @" @@ -1424,7 +4425,7 @@ public void n_array_unclosed_json() [Fact] public void n_array_unclosed_trailing_comma_json() { - Test(@"@""[1,""", @" + TestNST(@"@""[1,""", @" @@ -1454,7 +4455,7 @@ public void n_array_unclosed_trailing_comma_json() [Fact] public void n_array_unclosed_with_new_lines_json() { - Test(@"@""[1, + TestNST(@"@""[1, 1 ,1""", @" @@ -1497,7 +4498,7 @@ public void n_array_unclosed_with_new_lines_json() [Fact] public void n_array_unclosed_with_object_inside_json() { - Test(@"@""[{}""", @" + TestNST(@"@""[{}""", @" @@ -1526,7 +4527,7 @@ public void n_array_unclosed_with_object_inside_json() [Fact] public void n_incomplete_false_json() { - Test(@"@""[fals]""", @" + TestNST(@"@""[fals]""", @" @@ -1553,7 +4554,7 @@ public void n_incomplete_false_json() [Fact] public void n_incomplete_null_json() { - Test(@"@""[nul]""", @" + TestNST(@"@""[nul]""", @" @@ -1580,7 +4581,7 @@ public void n_incomplete_null_json() [Fact] public void n_incomplete_true_json() { - Test(@"@""[tru]""", @" + TestNST(@"@""[tru]""", @" @@ -1607,7 +4608,7 @@ public void n_incomplete_true_json() [Fact] public void n_number____json() { - Test(@"@""[++1234]""", @" + TestNST(@"@""[++1234]""", @" @@ -1634,7 +4635,7 @@ public void n_number____json() [Fact] public void n_number__1_json() { - Test(@"@""[+1]""", @" + TestNST(@"@""[+1]""", @" @@ -1661,7 +4662,7 @@ public void n_number__1_json() [Fact] public void n_number__Inf_json() { - Test(@"@""[+Inf]""", @" + TestNST(@"@""[+Inf]""", @" @@ -1688,7 +4689,7 @@ public void n_number__Inf_json() [Fact] public void n_number__01_json() { - Test(@"@""[-01]""", @" + TestNST(@"@""[-01]""", @" @@ -1713,7 +4714,7 @@ public void n_number__01_json() [Fact] public void n_number__1_0__json() { - Test(@"@""[-1.0.]""", @" + TestNST(@"@""[-1.0.]""", @" @@ -1734,13 +4735,13 @@ public void n_number__1_0__json() ", @" -", runStrictSubTreeCheck: false); +"); } [Fact] public void n_number__2__json() { - Test(@"@""[-2.]""", @" + TestNST(@"@""[-2.]""", @" @@ -1759,13 +4760,13 @@ public void n_number__2__json() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] public void n_number__NaN_json() { - Test(@"@""[-NaN]""", @" + TestNST(@"@""[-NaN]""", @" @@ -1786,13 +4787,13 @@ public void n_number__NaN_json() ", @" -", runStrictSubTreeCheck: false); +"); } [Fact] public void n_number___1_json() { - Test(@"@""[.-1]""", @" + TestNST(@"@""[.-1]""", @" @@ -1819,7 +4820,7 @@ public void n_number___1_json() [Fact] public void n_number__2e_3_json() { - Test(@"@""[.2e-3]""", @" + TestNST(@"@""[.2e-3]""", @" @@ -1844,7 +4845,7 @@ public void n_number__2e_3_json() [Fact] public void n_number_0_1_2_json() { - Test(@"@""[0.1.2]""", @" + TestNST(@"@""[0.1.2]""", @" @@ -1865,13 +4866,13 @@ public void n_number_0_1_2_json() ", @" -", runStrictSubTreeCheck: false); +"); } [Fact] public void n_number_0_3e__json() { - Test(@"@""[0.3e+]""", @" + TestNST(@"@""[0.3e+]""", @" @@ -1898,7 +4899,7 @@ public void n_number_0_3e__json() [Fact] public void n_number_0_3e_json() { - Test(@"@""[0.3e]""", @" + TestNST(@"@""[0.3e]""", @" @@ -1925,7 +4926,7 @@ public void n_number_0_3e_json() [Fact] public void n_number_0_e1_json() { - Test(@"@""[0.e1]""", @" + TestNST(@"@""[0.e1]""", @" @@ -1944,13 +4945,13 @@ public void n_number_0_e1_json() @"", @" -", runStrictTreeCheck: false, runStrictSubTreeCheck: false); +"); } [Fact] public void n_number_0e__json() { - Test(@"@""[0e+]""", @" + TestNST(@"@""[0e+]""", @" @@ -1977,7 +4978,7 @@ public void n_number_0e__json() [Fact] public void n_number_0e_json() { - Test(@"@""[0e]""", @" + TestNST(@"@""[0e]""", @" @@ -2004,7 +5005,7 @@ public void n_number_0e_json() [Fact] public void n_number_0_capital_E__json() { - Test(@"@""[0E+]""", @" + TestNST(@"@""[0E+]""", @" @@ -2031,7 +5032,7 @@ public void n_number_0_capital_E__json() [Fact] public void n_number_0_capital_E_json() { - Test(@"@""[0E]""", @" + TestNST(@"@""[0E]""", @" @@ -2058,7 +5059,7 @@ public void n_number_0_capital_E_json() [Fact] public void n_number_1_0e__json() { - Test(@"@""[1.0e+]""", @" + TestNST(@"@""[1.0e+]""", @" @@ -2085,7 +5086,7 @@ public void n_number_1_0e__json() [Fact] public void n_number_1_0e_json() { - Test(@"@""[1.0e]""", @" + TestNST(@"@""[1.0e]""", @" @@ -2112,7 +5113,7 @@ public void n_number_1_0e_json() [Fact] public void n_number_1eE2_json() { - Test(@"@""[1eE2]""", @" + TestNST(@"@""[1eE2]""", @" @@ -2139,7 +5140,7 @@ public void n_number_1eE2_json() [Fact] public void n_number_1_000_json() { - Test(@"@""[1 000.0]""", @" + TestNST(@"@""[1 000.0]""", @" @@ -2169,7 +5170,7 @@ public void n_number_1_000_json() [Fact] public void n_number_2_e_3_json() { - Test(@"@""[2.e+3]""", @" + TestNST(@"@""[2.e+3]""", @" @@ -2194,7 +5195,7 @@ public void n_number_2_e_3_json() [Fact] public void n_number_2_e3_json() { - Test(@"@""[2.e3]""", @" + TestNST(@"@""[2.e3]""", @" @@ -2213,13 +5214,13 @@ public void n_number_2_e3_json() @"", @" -", runStrictTreeCheck: false, runStrictSubTreeCheck: false); +"); } [Fact] public void n_number_9_e__json() { - Test(@"@""[9.e+]""", @" + TestNST(@"@""[9.e+]""", @" @@ -2246,7 +5247,7 @@ public void n_number_9_e__json() [Fact] public void n_number_expression_json() { - Test(@"@""[1+2]""", @" + TestNST(@"@""[1+2]""", @" @@ -2273,7 +5274,7 @@ public void n_number_expression_json() [Fact] public void n_number_hex_1_digit_json() { - Test(@"@""[0x1]""", @" + TestNST(@"@""[0x1]""", @" @@ -2298,7 +5299,7 @@ public void n_number_hex_1_digit_json() [Fact] public void n_number_hex_2_digits_json() { - Test(@"@""[0x42]""", @" + TestNST(@"@""[0x42]""", @" @@ -2317,13 +5318,13 @@ public void n_number_hex_2_digits_json() @"", @" -", runStrictSubTreeCheck: false); +"); } [Fact] public void n_number_Inf_json() { - Test(@"@""[Inf]""", @" + TestNST(@"@""[Inf]""", @" @@ -2350,7 +5351,7 @@ public void n_number_Inf_json() [Fact] public void n_number_infinity_json() { - Test(@"@""[Infinity]""", @" + TestNST(@"@""[Infinity]""", @" @@ -2369,13 +5370,13 @@ public void n_number_infinity_json() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] public void n_number_invalid___json() { - Test(@"@""[0e+-1]""", @" + TestNST(@"@""[0e+-1]""", @" @@ -2402,7 +5403,7 @@ public void n_number_invalid___json() [Fact] public void n_number_invalid_negative_real_json() { - Test(@"@""[-123.123foo]""", @" + TestNST(@"@""[-123.123foo]""", @" @@ -2429,7 +5430,7 @@ public void n_number_invalid_negative_real_json() [Fact] public void n_number_invalid_utf_8_in_bigger_int_json() { - Test(@"@""[123�]""", @" + TestNST(@"@""[123�]""", @" @@ -2456,7 +5457,7 @@ public void n_number_invalid_utf_8_in_bigger_int_json() [Fact] public void n_number_invalid_utf_8_in_exponent_json() { - Test(@"@""[1e1�]""", @" + TestNST(@"@""[1e1�]""", @" @@ -2483,7 +5484,7 @@ public void n_number_invalid_utf_8_in_exponent_json() [Fact] public void n_number_invalid_utf_8_in_int_json() { - Test(@"@""[0�] + TestNST(@"@""[0�] """, @" @@ -2512,7 +5513,7 @@ public void n_number_invalid_utf_8_in_int_json() [Fact] public void n_number_minus_infinity_json() { - Test(@"@""[-Infinity]""", @" + TestNST(@"@""[-Infinity]""", @" @@ -2532,13 +5533,13 @@ public void n_number_minus_infinity_json() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] public void n_number_minus_sign_with_trailing_garbage_json() { - Test(@"@""[-foo]""", @" + TestNST(@"@""[-foo]""", @" @@ -2565,7 +5566,7 @@ public void n_number_minus_sign_with_trailing_garbage_json() [Fact] public void n_number_minus_space_1_json() { - Test(@"@""[- 1]""", @" + TestNST(@"@""[- 1]""", @" @@ -2595,7 +5596,7 @@ public void n_number_minus_space_1_json() [Fact] public void n_number_NaN_json() { - Test(@"@""[NaN]""", @" + TestNST(@"@""[NaN]""", @" @@ -2620,7 +5621,7 @@ public void n_number_NaN_json() [Fact] public void n_number_neg_int_starting_with_zero_json() { - Test(@"@""[-012]""", @" + TestNST(@"@""[-012]""", @" @@ -2639,13 +5640,13 @@ public void n_number_neg_int_starting_with_zero_json() @"", @" -", runStrictTreeCheck: false, runStrictSubTreeCheck: false); +"); } [Fact] public void n_number_neg_real_without_int_part_json() { - Test(@"@""[-.123]""", @" + TestNST(@"@""[-.123]""", @" @@ -2664,13 +5665,13 @@ public void n_number_neg_real_without_int_part_json() @"", @" -", runStrictTreeCheck: false, runStrictSubTreeCheck: false); +"); } [Fact] public void n_number_neg_with_garbage_at_end_json() { - Test(@"@""[-1x]""", @" + TestNST(@"@""[-1x]""", @" @@ -2697,7 +5698,7 @@ public void n_number_neg_with_garbage_at_end_json() [Fact] public void n_number_real_garbage_after_e_json() { - Test(@"@""[1ea]""", @" + TestNST(@"@""[1ea]""", @" @@ -2724,7 +5725,7 @@ public void n_number_real_garbage_after_e_json() [Fact] public void n_number_real_without_fractional_part_json() { - Test(@"@""[1.]""", @" + TestNST(@"@""[1.]""", @" @@ -2749,7 +5750,7 @@ public void n_number_real_without_fractional_part_json() [Fact] public void n_number_real_with_invalid_utf8_after_e_json() { - Test(@"@""[1e�]""", @" + TestNST(@"@""[1e�]""", @" @@ -2776,7 +5777,7 @@ public void n_number_real_with_invalid_utf8_after_e_json() [Fact] public void n_number_starting_with_dot_json() { - Test(@"@""[.123]""", @" + TestNST(@"@""[.123]""", @" @@ -2801,7 +5802,7 @@ public void n_number_starting_with_dot_json() [Fact] public void n_number_U_FF11_fullwidth_digit_one_json() { - Test(@"@""[1]""", @" + TestNST(@"@""[1]""", @" @@ -2828,7 +5829,7 @@ public void n_number_U_FF11_fullwidth_digit_one_json() [Fact] public void n_number_with_alpha_json() { - Test(@"@""[1.2a-3]""", @" + TestNST(@"@""[1.2a-3]""", @" @@ -2855,7 +5856,7 @@ public void n_number_with_alpha_json() [Fact] public void n_number_with_alpha_char_json() { - Test(@"@""[1.8011670033376514H-308]""", @" + TestNST(@"@""[1.8011670033376514H-308]""", @" @@ -2882,7 +5883,7 @@ public void n_number_with_alpha_char_json() [Fact] public void n_number_with_leading_zero_json() { - Test(@"@""[012]""", @" + TestNST(@"@""[012]""", @" @@ -2901,13 +5902,13 @@ public void n_number_with_leading_zero_json() @"", @" -", runStrictTreeCheck: false, runStrictSubTreeCheck: false); +"); } [Fact] public void n_object_bad_value_json() { - Test(@"@""[""""x"""", truth]""", @" + TestNST(@"@""[""""x"""", truth]""", @" @@ -2940,7 +5941,7 @@ public void n_object_bad_value_json() [Fact] public void n_object_bracket_key_json() { - Test(@"@""{[: """"x""""} + TestNST(@"@""{[: """"x""""} """, @" @@ -2978,7 +5979,7 @@ public void n_object_bracket_key_json() [Fact] public void n_object_comma_instead_of_colon_json() { - Test(@"@""{""""x"""", null}""", @" + TestNST(@"@""{""""x"""", null}""", @" @@ -3011,7 +6012,7 @@ public void n_object_comma_instead_of_colon_json() [Fact] public void n_object_double_colon_json() { - Test(@"@""{""""x""""::""""b""""}""", @" + TestNST(@"@""{""""x""""::""""b""""}""", @" @@ -3045,7 +6046,7 @@ public void n_object_double_colon_json() [Fact] public void n_object_garbage_at_end_json() { - Test(@"@""{""""a"""":""""a"""" 123}""", @" + TestNST(@"@""{""""a"""":""""a"""" 123}""", @" @@ -3079,7 +6080,7 @@ public void n_object_garbage_at_end_json() [Fact] public void n_object_key_with_single_quotes_json() { - Test(@"@""{key: 'value'}""", @" + TestNST(@"@""{key: 'value'}""", @" @@ -3108,7 +6109,7 @@ public void n_object_key_with_single_quotes_json() [Fact] public void n_object_lone_continuation_byte_in_key_and_trailing_comma_json() { - Test(@"@""{""""�"""":""""0"""",}""", @" + TestNST(@"@""{""""�"""":""""0"""",}""", @" @@ -3140,7 +6141,7 @@ public void n_object_lone_continuation_byte_in_key_and_trailing_comma_json() [Fact] public void n_object_missing_colon_json() { - Test(@"@""{""""a"""" b}""", @" + TestNST(@"@""{""""a"""" b}""", @" @@ -3170,7 +6171,7 @@ public void n_object_missing_colon_json() [Fact] public void n_object_missing_key_json() { - Test(@"@""{:""""b""""}""", @" + TestNST(@"@""{:""""b""""}""", @" @@ -3200,7 +6201,7 @@ public void n_object_missing_key_json() [Fact] public void n_object_missing_semicolon_json() { - Test(@"@""{""""a"""" """"b""""}""", @" + TestNST(@"@""{""""a"""" """"b""""}""", @" @@ -3230,7 +6231,7 @@ public void n_object_missing_semicolon_json() [Fact] public void n_object_missing_value_json() { - Test(@"@""{""""a"""":""", @" + TestNST(@"@""{""""a"""":""", @" @@ -3261,7 +6262,7 @@ public void n_object_missing_value_json() [Fact] public void n_object_no_colon_json() { - Test(@"@""{""""a""""""", @" + TestNST(@"@""{""""a""""""", @" @@ -3288,7 +6289,7 @@ public void n_object_no_colon_json() [Fact] public void n_object_non_string_key_json() { - Test(@"@""{1:1}""", @" + TestNST(@"@""{1:1}""", @" @@ -3317,7 +6318,7 @@ public void n_object_non_string_key_json() [Fact] public void n_object_non_string_key_but_huge_number_instead_json() { - Test(@"@""{9999E9999:1}""", @" + TestNST(@"@""{9999E9999:1}""", @" @@ -3346,7 +6347,7 @@ public void n_object_non_string_key_but_huge_number_instead_json() [Fact] public void n_object_repeated_null_null_json() { - Test(@"@""{null:null,null:null}""", @" + TestNST(@"@""{null:null,null:null}""", @" @@ -3385,7 +6386,7 @@ public void n_object_repeated_null_null_json() [Fact] public void n_object_several_trailing_commas_json() { - Test(@"@""{""""id"""":0,,,,,}""", @" + TestNST(@"@""{""""id"""":0,,,,,}""", @" @@ -3431,7 +6432,7 @@ public void n_object_several_trailing_commas_json() [Fact] public void n_object_single_quote_json() { - Test(@"@""{'a':0}""", @" + TestNST(@"@""{'a':0}""", @" @@ -3460,7 +6461,7 @@ public void n_object_single_quote_json() [Fact] public void n_object_trailing_comma_json() { - Test(@"@""{""""id"""":0,}""", @" + TestNST(@"@""{""""id"""":0,}""", @" @@ -3492,7 +6493,7 @@ public void n_object_trailing_comma_json() [Fact] public void n_object_trailing_comment_json() { - Test(@"@""{""""a"""":""""b""""}/**/""", @" + TestNST(@"@""{""""a"""":""""b""""}/**/""", @" @@ -3521,7 +6522,7 @@ public void n_object_trailing_comment_json() [Fact] public void n_object_trailing_comment_open_json() { - Test(@"@""{""""a"""":""""b""""}/**//""", @" + TestNST(@"@""{""""a"""":""""b""""}/**//""", @" @@ -3546,13 +6547,13 @@ public void n_object_trailing_comment_open_json() ", @" -", runLooseTreeCheck: false); +"); } [Fact] public void n_object_trailing_comment_slash_open_json() { - Test(@"@""{""""a"""":""""b""""}//""", @" + TestNST(@"@""{""""a"""":""""b""""}//""", @" @@ -3583,7 +6584,7 @@ public void n_object_trailing_comment_slash_open_json() [Fact] public void n_object_trailing_comment_slash_open_incomplete_json() { - Test(@"@""{""""a"""":""""b""""}/""", @" + TestNST(@"@""{""""a"""":""""b""""}/""", @" @@ -3614,7 +6615,7 @@ public void n_object_trailing_comment_slash_open_incomplete_json() [Fact] public void n_object_two_commas_in_a_row_json() { - Test(@"@""{""""a"""":""""b"""",,""""c"""":""""d""""}""", @" + TestNST(@"@""{""""a"""":""""b"""",,""""c"""":""""d""""}""", @" @@ -3658,7 +6659,7 @@ public void n_object_two_commas_in_a_row_json() [Fact] public void n_object_unquoted_key_json() { - Test(@"@""{a: """"b""""}""", @" + TestNST(@"@""{a: """"b""""}""", @" @@ -3687,7 +6688,7 @@ public void n_object_unquoted_key_json() [Fact] public void n_object_unterminated_value_json() { - Test(@"@""{""""a"""":""""a""", @" + TestNST(@"@""{""""a"""":""""a""", @" @@ -3718,7 +6719,7 @@ public void n_object_unterminated_value_json() [Fact] public void n_object_with_single_string_json() { - Test(@"@""{ """"foo"""" : """"bar"""", """"a"""" }""", @" + TestNST(@"@""{ """"foo"""" : """"bar"""", """"a"""" }""", @" @@ -3755,7 +6756,7 @@ public void n_object_with_single_string_json() [Fact] public void n_object_with_trailing_garbage_json() { - Test(@"@""{""""a"""":""""b""""}#""", @" + TestNST(@"@""{""""a"""":""""b""""}#""", @" @@ -3789,7 +6790,7 @@ public void n_object_with_trailing_garbage_json() [Fact] public void n_single_space_json() { - Test(@"@"" """, @" + TestNST(@"@"" """, @" @@ -3810,7 +6811,7 @@ public void n_single_space_json() [Fact] public void n_string_1_surrogate_then_escape_json() { - Test(@"@""[""""\uD800\""""]""", @" + TestNST(@"@""[""""\uD800\""""]""", @" @@ -3837,7 +6838,7 @@ public void n_string_1_surrogate_then_escape_json() [Fact] public void n_string_1_surrogate_then_escape_u_json() { - Test(@"@""[""""\uD800\u""""]""", @" + TestNST(@"@""[""""\uD800\u""""]""", @" @@ -3864,7 +6865,7 @@ public void n_string_1_surrogate_then_escape_u_json() [Fact] public void n_string_1_surrogate_then_escape_u1_json() { - Test(@"@""[""""\uD800\u1""""]""", @" + TestNST(@"@""[""""\uD800\u1""""]""", @" @@ -3891,7 +6892,7 @@ public void n_string_1_surrogate_then_escape_u1_json() [Fact] public void n_string_1_surrogate_then_escape_u1x_json() { - Test(@"@""[""""\uD800\u1x""""]""", @" + TestNST(@"@""[""""\uD800\u1x""""]""", @" @@ -3918,7 +6919,7 @@ public void n_string_1_surrogate_then_escape_u1x_json() [Fact] public void n_string_accentuated_char_no_quotes_json() { - Test(@"@""[é]""", @" + TestNST(@"@""[é]""", @" @@ -3945,7 +6946,7 @@ public void n_string_accentuated_char_no_quotes_json() [Fact] public void n_string_escaped_backslash_bad_json() { - Test(@"@""[""""\\\""""]""", @" + TestNST(@"@""[""""\\\""""]""", @" @@ -3972,7 +6973,7 @@ public void n_string_escaped_backslash_bad_json() [Fact] public void n_string_escaped_ctrl_char_tab_json() { - Test(@"@""[""""\ """"]""", @" + TestNST(@"@""[""""\ """"]""", @" @@ -3999,7 +7000,7 @@ public void n_string_escaped_ctrl_char_tab_json() [Fact] public void n_string_escaped_emoji_json() { - Test(@"@""[""""\🌀""""]""", @" + TestNST(@"@""[""""\🌀""""]""", @" @@ -4026,7 +7027,7 @@ public void n_string_escaped_emoji_json() [Fact] public void n_string_escape_x_json() { - Test(@"@""[""""\x00""""]""", @" + TestNST(@"@""[""""\x00""""]""", @" @@ -4053,7 +7054,7 @@ public void n_string_escape_x_json() [Fact] public void n_string_incomplete_escape_json() { - Test(@"@""[""""\""""]""", @" + TestNST(@"@""[""""\""""]""", @" @@ -4080,7 +7081,7 @@ public void n_string_incomplete_escape_json() [Fact] public void n_string_incomplete_escaped_character_json() { - Test(@"@""[""""\u00A""""]""", @" + TestNST(@"@""[""""\u00A""""]""", @" @@ -4107,7 +7108,7 @@ public void n_string_incomplete_escaped_character_json() [Fact] public void n_string_incomplete_surrogate_json() { - Test(@"@""[""""\uD834\uDd""""]""", @" + TestNST(@"@""[""""\uD834\uDd""""]""", @" @@ -4134,7 +7135,7 @@ public void n_string_incomplete_surrogate_json() [Fact] public void n_string_incomplete_surrogate_escape_invalid_json() { - Test(@"@""[""""\uD800\uD800\x""""]""", @" + TestNST(@"@""[""""\uD800\uD800\x""""]""", @" @@ -4155,13 +7156,13 @@ public void n_string_incomplete_surrogate_escape_invalid_json() ", @" -", runStrictSubTreeCheck: false); +"); } [Fact] public void n_string_invalid_utf_8_in_escape_json() { - Test(@"@""[""""\u�""""]""", @" + TestNST(@"@""[""""\u�""""]""", @" @@ -4188,7 +7189,7 @@ public void n_string_invalid_utf_8_in_escape_json() [Fact] public void n_string_invalid_backslash_esc_json() { - Test(@"@""[""""\a""""]""", @" + TestNST(@"@""[""""\a""""]""", @" @@ -4215,7 +7216,7 @@ public void n_string_invalid_backslash_esc_json() [Fact] public void n_string_invalid_unicode_escape_json() { - Test(@"@""[""""\uqqqq""""]""", @" + TestNST(@"@""[""""\uqqqq""""]""", @" @@ -4242,7 +7243,7 @@ public void n_string_invalid_unicode_escape_json() [Fact] public void n_string_invalid_utf8_after_escape_json() { - Test(@"@""[""""\�""""]""", @" + TestNST(@"@""[""""\�""""]""", @" @@ -4269,7 +7270,7 @@ public void n_string_invalid_utf8_after_escape_json() [Fact] public void n_string_leading_uescaped_thinspace_json() { - Test(@"@""[\u0020""""asd""""]""", @" + TestNST(@"@""[\u0020""""asd""""]""", @" @@ -4299,7 +7300,7 @@ public void n_string_leading_uescaped_thinspace_json() [Fact] public void n_string_no_quotes_with_bad_escape_json() { - Test(@"@""[\n]""", @" + TestNST(@"@""[\n]""", @" @@ -4326,7 +7327,7 @@ public void n_string_no_quotes_with_bad_escape_json() [Fact] public void n_string_single_doublequote_json() { - Test(@"@""""""""", @" + TestNST(@"@""""""""", @" @@ -4347,7 +7348,7 @@ public void n_string_single_doublequote_json() [Fact] public void n_string_single_quote_json() { - Test(@"@""['single quote']""", @" + TestNST(@"@""['single quote']""", @" @@ -4372,7 +7373,7 @@ public void n_string_single_quote_json() [Fact] public void n_string_single_string_no_double_quotes_json() { - Test(@"@""abc""", @" + TestNST(@"@""abc""", @" @@ -4393,7 +7394,7 @@ public void n_string_single_string_no_double_quotes_json() [Fact] public void n_string_start_escape_unclosed_json() { - Test(@"@""[""""\""", @" + TestNST(@"@""[""""\""", @" @@ -4420,7 +7421,7 @@ public void n_string_start_escape_unclosed_json() [Fact] public void n_string_unescaped_newline_json() { - Test(@"@""[""""new + TestNST(@"@""[""""new line""""]""", @" @@ -4447,7 +7448,7 @@ public void n_string_unescaped_newline_json() [Fact] public void n_string_unescaped_tab_json() { - Test(@"@""["""" """"]""", @" + TestNST(@"@""["""" """"]""", @" @@ -4472,7 +7473,7 @@ public void n_string_unescaped_tab_json() [Fact] public void n_string_unicode_CapitalU_json() { - Test(@"@""""""\UA66D""""""", @" + TestNST(@"@""""""\UA66D""""""", @" @@ -4493,7 +7494,7 @@ public void n_string_unicode_CapitalU_json() [Fact] public void n_string_with_trailing_garbage_json() { - Test(@"@""""""""""x""", @" + TestNST(@"@""""""""""x""", @" @@ -4517,7 +7518,7 @@ public void n_string_with_trailing_garbage_json() [Fact] public void n_structure_angle_bracket___json() { - Test(@"@""<.>""", @" + TestNST(@"@""<.>""", @" @@ -4538,7 +7539,7 @@ public void n_structure_angle_bracket___json() [Fact] public void n_structure_angle_bracket_null_json() { - Test(@"@""[]""", @" + TestNST(@"@""[]""", @" @@ -4565,7 +7566,7 @@ public void n_structure_angle_bracket_null_json() [Fact] public void n_structure_array_trailing_garbage_json() { - Test(@"@""[1]x""", @" + TestNST(@"@""[1]x""", @" @@ -4595,7 +7596,7 @@ public void n_structure_array_trailing_garbage_json() [Fact] public void n_structure_array_with_extra_array_close_json() { - Test(@"@""[1]]""", @" + TestNST(@"@""[1]]""", @" @@ -4625,7 +7626,7 @@ public void n_structure_array_with_extra_array_close_json() [Fact] public void n_structure_array_with_unclosed_string_json() { - Test(@"@""[""""asd]""", @" + TestNST(@"@""[""""asd]""", @" @@ -4652,7 +7653,7 @@ public void n_structure_array_with_unclosed_string_json() [Fact] public void n_structure_ascii_unicode_identifier_json() { - Test(@"@""aå""", @" + TestNST(@"@""aå""", @" @@ -4673,7 +7674,7 @@ public void n_structure_ascii_unicode_identifier_json() [Fact] public void n_structure_capitalized_True_json() { - Test(@"@""[True]""", @" + TestNST(@"@""[True]""", @" @@ -4700,7 +7701,7 @@ public void n_structure_capitalized_True_json() [Fact] public void n_structure_close_unopened_array_json() { - Test(@"@""1]""", @" + TestNST(@"@""1]""", @" @@ -4724,7 +7725,7 @@ public void n_structure_close_unopened_array_json() [Fact] public void n_structure_comma_instead_of_closing_brace_json() { - Test(@"@""{""""x"""": true,""", @" + TestNST(@"@""{""""x"""": true,""", @" @@ -4758,7 +7759,7 @@ public void n_structure_comma_instead_of_closing_brace_json() [Fact] public void n_structure_double_array_json() { - Test(@"@""[][]""", @" + TestNST(@"@""[][]""", @" @@ -4786,7 +7787,7 @@ public void n_structure_double_array_json() [Fact] public void n_structure_end_array_json() { - Test(@"@""]""", @" + TestNST(@"@""]""", @" @@ -4807,7 +7808,7 @@ public void n_structure_end_array_json() [Fact] public void n_structure_incomplete_UTF8_BOM_json() { - Test(@"@""�{}""", @" + TestNST(@"@""�{}""", @" @@ -4830,23 +7831,10 @@ public void n_structure_incomplete_UTF8_BOM_json() "); } - [Fact] - public void n_structure_lone_invalid_utf_8_json() - { - Test(@"@""""", @" - - - - -", - @"", - @""); - } - [Fact] public void n_structure_lone_open_bracket_json() { - Test(@"@""[""", @" + TestNST(@"@""[""", @" @@ -4866,23 +7854,10 @@ public void n_structure_lone_open_bracket_json() "); } - [Fact] - public void n_structure_no_data_json() - { - Test(@"@""""", @" - - - - -", - @"", - @""); - } - [Fact] public void n_structure_number_with_trailing_garbage_json() { - Test(@"@""2@""", @" + TestNST(@"@""2@""", @" @@ -4903,7 +7878,7 @@ public void n_structure_number_with_trailing_garbage_json() [Fact] public void n_structure_object_followed_by_closing_object_json() { - Test(@"@""{}}""", @" + TestNST(@"@""{}}""", @" @@ -4929,7 +7904,7 @@ public void n_structure_object_followed_by_closing_object_json() [Fact] public void n_structure_object_unclosed_no_value_json() { - Test(@"@""{"""""""":""", @" + TestNST(@"@""{"""""""":""", @" @@ -4960,7 +7935,7 @@ public void n_structure_object_unclosed_no_value_json() [Fact] public void n_structure_object_with_comment_json() { - Test(@"@""{""""a"""":/*comment*/""""b""""}""", @" + TestNST(@"@""{""""a"""":/*comment*/""""b""""}""", @" @@ -4989,7 +7964,7 @@ public void n_structure_object_with_comment_json() [Fact] public void n_structure_object_with_trailing_garbage_json() { - Test(@"@""{""""a"""": true} """"x""""""", @" + TestNST(@"@""{""""a"""": true} """"x""""""", @" @@ -5023,7 +7998,7 @@ public void n_structure_object_with_trailing_garbage_json() [Fact] public void n_structure_open_array_apostrophe_json() { - Test(@"@""['""", @" + TestNST(@"@""['""", @" @@ -5050,7 +8025,7 @@ public void n_structure_open_array_apostrophe_json() [Fact] public void n_structure_open_array_comma_json() { - Test(@"@""[,""", @" + TestNST(@"@""[,""", @" @@ -5077,7 +8052,7 @@ public void n_structure_open_array_comma_json() [Fact] public void n_structure_open_array_open_object_json() { - Test(@"@""[{""", @" + TestNST(@"@""[{""", @" @@ -5106,7 +8081,7 @@ public void n_structure_open_array_open_object_json() [Fact] public void n_structure_open_array_open_string_json() { - Test(@"@""[""""a""", @" + TestNST(@"@""[""""a""", @" @@ -5133,7 +8108,7 @@ public void n_structure_open_array_open_string_json() [Fact] public void n_structure_open_array_string_json() { - Test(@"@""[""""a""""""", @" + TestNST(@"@""[""""a""""""", @" @@ -5160,7 +8135,7 @@ public void n_structure_open_array_string_json() [Fact] public void n_structure_open_object_json() { - Test(@"@""{""", @" + TestNST(@"@""{""", @" @@ -5183,7 +8158,7 @@ public void n_structure_open_object_json() [Fact] public void n_structure_open_object_close_array_json() { - Test(@"@""{]""", @" + TestNST(@"@""{]""", @" @@ -5210,7 +8185,7 @@ public void n_structure_open_object_close_array_json() [Fact] public void n_structure_open_object_comma_json() { - Test(@"@""{,""", @" + TestNST(@"@""{,""", @" @@ -5237,7 +8212,7 @@ public void n_structure_open_object_comma_json() [Fact] public void n_structure_open_object_open_array_json() { - Test(@"@""{[""", @" + TestNST(@"@""{[""", @" @@ -5266,7 +8241,7 @@ public void n_structure_open_object_open_array_json() [Fact] public void n_structure_open_object_open_string_json() { - Test(@"@""{""""a""", @" + TestNST(@"@""{""""a""", @" @@ -5293,7 +8268,7 @@ public void n_structure_open_object_open_string_json() [Fact] public void n_structure_open_object_string_with_apostrophes_json() { - Test(@"@""{'a'""", @" + TestNST(@"@""{'a'""", @" @@ -5320,7 +8295,7 @@ public void n_structure_open_object_string_with_apostrophes_json() [Fact] public void n_structure_open_open_json() { - Test(@"@""[""""\{[""""\{[""""\{[""""\{""", @" + TestNST(@"@""[""""\{[""""\{[""""\{[""""\{""", @" @@ -5370,23 +8345,10 @@ public void n_structure_open_open_json() "); } - [Fact] - public void n_structure_single_eacute_json() - { - Test(@"@""""", @" - - - - -", - @"", - @""); - } - [Fact] public void n_structure_single_star_json() { - Test(@"@""*""", @" + TestNST(@"@""*""", @" @@ -5407,7 +8369,7 @@ public void n_structure_single_star_json() [Fact] public void n_structure_trailing___json() { - Test(@"@""{""""a"""":""""b""""}#{}""", @" + TestNST(@"@""{""""a"""":""""b""""}#{}""", @" @@ -5446,7 +8408,7 @@ public void n_structure_trailing___json() [Fact] public void n_structure_U_2060_word_joined_json() { - Test(@"@""[⁠]""", @" + TestNST(@"@""[⁠]""", @" @@ -5473,7 +8435,7 @@ public void n_structure_U_2060_word_joined_json() [Fact] public void n_structure_uescaped_LF_before_string_json() { - Test(@"@""[\u000A""""""""]""", @" + TestNST(@"@""[\u000A""""""""]""", @" @@ -5503,7 +8465,7 @@ public void n_structure_uescaped_LF_before_string_json() [Fact] public void n_structure_unclosed_array_json() { - Test(@"@""[1""", @" + TestNST(@"@""[1""", @" @@ -5530,7 +8492,7 @@ public void n_structure_unclosed_array_json() [Fact] public void n_structure_unclosed_array_partial_null_json() { - Test(@"@""[ false, nul""", @" + TestNST(@"@""[ false, nul""", @" @@ -5563,7 +8525,7 @@ public void n_structure_unclosed_array_partial_null_json() [Fact] public void n_structure_unclosed_array_unfinished_false_json() { - Test(@"@""[ true, fals""", @" + TestNST(@"@""[ true, fals""", @" @@ -5596,7 +8558,7 @@ public void n_structure_unclosed_array_unfinished_false_json() [Fact] public void n_structure_unclosed_array_unfinished_true_json() { - Test(@"@""[ false, tru""", @" + TestNST(@"@""[ false, tru""", @" @@ -5629,7 +8591,7 @@ public void n_structure_unclosed_array_unfinished_true_json() [Fact] public void n_structure_unclosed_object_json() { - Test(@"@""{""""asd"""":""""asd""""""", @" + TestNST(@"@""{""""asd"""":""""asd""""""", @" @@ -5660,7 +8622,7 @@ public void n_structure_unclosed_object_json() [Fact] public void n_structure_unicode_identifier_json() { - Test(@"@""å""", @" + TestNST(@"@""å""", @" @@ -5678,23 +8640,10 @@ public void n_structure_unicode_identifier_json() "); } - [Fact] - public void n_structure_UTF8_BOM_no_data_json() - { - Test(@"@""""", @" - - - - -", - @"", - @""); - } - [Fact] public void n_structure_whitespace_formfeed_json() { - Test(@"@""[ ]""", @" + TestNST(@"@""[ ]""", @" @@ -5715,7 +8664,7 @@ public void n_structure_whitespace_formfeed_json() [Fact] public void n_structure_whitespace_U_2060_word_joiner_json() { - Test(@"@""[⁠]""", @" + TestNST(@"@""[⁠]""", @" @@ -5742,7 +8691,7 @@ public void n_structure_whitespace_U_2060_word_joiner_json() [Fact] public void y_array_arraysWithSpaces_json() { - Test(@"@""[[] ]""", @" + TestNST(@"@""[[] ]""", @" @@ -5767,7 +8716,7 @@ public void y_array_arraysWithSpaces_json() [Fact] public void y_array_empty_string_json() { - Test(@"@""[""""""""]""", @" + TestNST(@"@""[""""""""]""", @" @@ -5790,7 +8739,7 @@ public void y_array_empty_string_json() [Fact] public void y_array_empty_json() { - Test(@"@""[]""", @" + TestNST(@"@""[]""", @" @@ -5809,7 +8758,7 @@ public void y_array_empty_json() [Fact] public void y_array_ending_with_newline_json() { - Test(@"@""[""""a""""]""", @" + TestNST(@"@""[""""a""""]""", @" @@ -5832,7 +8781,7 @@ public void y_array_ending_with_newline_json() [Fact] public void y_array_false_json() { - Test(@"@""[false]""", @" + TestNST(@"@""[false]""", @" @@ -5855,7 +8804,7 @@ public void y_array_false_json() [Fact] public void y_array_heterogeneous_json() { - Test(@"@""[null, 1, """"1"""", {}]""", @" + TestNST(@"@""[null, 1, """"1"""", {}]""", @" @@ -5898,7 +8847,7 @@ public void y_array_heterogeneous_json() [Fact] public void y_array_null_json() { - Test(@"@""[null]""", @" + TestNST(@"@""[null]""", @" @@ -5921,7 +8870,7 @@ public void y_array_null_json() [Fact] public void y_array_with_1_and_newline_json() { - Test(@"@""[1 + TestNST(@"@""[1 ]""", @" @@ -5946,7 +8895,7 @@ public void y_array_with_1_and_newline_json() [Fact] public void y_array_with_leading_space_json() { - Test(@"@"" [1]""", @" + TestNST(@"@"" [1]""", @" @@ -5972,7 +8921,7 @@ public void y_array_with_leading_space_json() [Fact] public void y_array_with_several_null_json() { - Test(@"@""[1,null,null,null,2]""", @" + TestNST(@"@""[1,null,null,null,2]""", @" @@ -6019,7 +8968,7 @@ public void y_array_with_several_null_json() [Fact] public void y_array_with_trailing_space_json() { - Test(@"@""[2] """, @" + TestNST(@"@""[2] """, @" @@ -6042,7 +8991,7 @@ public void y_array_with_trailing_space_json() [Fact] public void y_number_json() { - Test(@"@""[123e65]""", @" + TestNST(@"@""[123e65]""", @" @@ -6065,7 +9014,7 @@ public void y_number_json() [Fact] public void y_number_0e_1_json() { - Test(@"@""[0e+1]""", @" + TestNST(@"@""[0e+1]""", @" @@ -6088,7 +9037,7 @@ public void y_number_0e_1_json() [Fact] public void y_number_0e1_json() { - Test(@"@""[0e1]""", @" + TestNST(@"@""[0e1]""", @" @@ -6111,7 +9060,7 @@ public void y_number_0e1_json() [Fact] public void y_number_after_space_json() { - Test(@"@""[ 4]""", @" + TestNST(@"@""[ 4]""", @" @@ -6134,7 +9083,7 @@ public void y_number_after_space_json() [Fact] public void y_number_double_close_to_zero_json() { - Test(@"@""[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001] + TestNST(@"@""[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001] """, @" @@ -6153,13 +9102,13 @@ public void y_number_double_close_to_zero_json() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] public void y_number_int_with_exp_json() { - Test(@"@""[20e1]""", @" + TestNST(@"@""[20e1]""", @" @@ -6182,7 +9131,7 @@ public void y_number_int_with_exp_json() [Fact] public void y_number_minus_zero_json() { - Test(@"@""[-0]""", @" + TestNST(@"@""[-0]""", @" @@ -6205,7 +9154,7 @@ public void y_number_minus_zero_json() [Fact] public void y_number_negative_int_json() { - Test(@"@""[-123]""", @" + TestNST(@"@""[-123]""", @" @@ -6228,7 +9177,7 @@ public void y_number_negative_int_json() [Fact] public void y_number_negative_one_json() { - Test(@"@""[-1]""", @" + TestNST(@"@""[-1]""", @" @@ -6251,7 +9200,7 @@ public void y_number_negative_one_json() [Fact] public void y_number_negative_zero_json() { - Test(@"@""[-0]""", @" + TestNST(@"@""[-0]""", @" @@ -6274,7 +9223,7 @@ public void y_number_negative_zero_json() [Fact] public void y_number_real_capital_e_json() { - Test(@"@""[1E22]""", @" + TestNST(@"@""[1E22]""", @" @@ -6297,7 +9246,7 @@ public void y_number_real_capital_e_json() [Fact] public void y_number_real_capital_e_neg_exp_json() { - Test(@"@""[1E-2]""", @" + TestNST(@"@""[1E-2]""", @" @@ -6320,7 +9269,7 @@ public void y_number_real_capital_e_neg_exp_json() [Fact] public void y_number_real_capital_e_pos_exp_json() { - Test(@"@""[1E+2]""", @" + TestNST(@"@""[1E+2]""", @" @@ -6343,7 +9292,7 @@ public void y_number_real_capital_e_pos_exp_json() [Fact] public void y_number_real_exponent_json() { - Test(@"@""[123e45]""", @" + TestNST(@"@""[123e45]""", @" @@ -6366,7 +9315,7 @@ public void y_number_real_exponent_json() [Fact] public void y_number_real_fraction_exponent_json() { - Test(@"@""[123.456e78]""", @" + TestNST(@"@""[123.456e78]""", @" @@ -6389,7 +9338,7 @@ public void y_number_real_fraction_exponent_json() [Fact] public void y_number_real_neg_exp_json() { - Test(@"@""[1e-2]""", @" + TestNST(@"@""[1e-2]""", @" @@ -6412,7 +9361,7 @@ public void y_number_real_neg_exp_json() [Fact] public void y_number_real_pos_exponent_json() { - Test(@"@""[1e+2]""", @" + TestNST(@"@""[1e+2]""", @" @@ -6435,7 +9384,7 @@ public void y_number_real_pos_exponent_json() [Fact] public void y_number_simple_int_json() { - Test(@"@""[123]""", @" + TestNST(@"@""[123]""", @" @@ -6458,7 +9407,7 @@ public void y_number_simple_int_json() [Fact] public void y_number_simple_real_json() { - Test(@"@""[123.456789]""", @" + TestNST(@"@""[123.456789]""", @" @@ -6481,7 +9430,7 @@ public void y_number_simple_real_json() [Fact] public void y_object_json() { - Test(@"@""{""""asd"""":""""sdf"""", """"dfg"""":""""fgh""""}""", @" + TestNST(@"@""{""""asd"""":""""sdf"""", """"dfg"""":""""fgh""""}""", @" @@ -6518,7 +9467,7 @@ public void y_object_json() [Fact] public void y_object_basic_json() { - Test(@"@""{""""asd"""":""""sdf""""}""", @" + TestNST(@"@""{""""asd"""":""""sdf""""}""", @" @@ -6545,7 +9494,7 @@ public void y_object_basic_json() [Fact] public void y_object_duplicated_key_json() { - Test(@"@""{""""a"""":""""b"""",""""a"""":""""c""""}""", @" + TestNST(@"@""{""""a"""":""""b"""",""""a"""":""""c""""}""", @" @@ -6582,7 +9531,7 @@ public void y_object_duplicated_key_json() [Fact] public void y_object_duplicated_key_and_value_json() { - Test(@"@""{""""a"""":""""b"""",""""a"""":""""b""""}""", @" + TestNST(@"@""{""""a"""":""""b"""",""""a"""":""""b""""}""", @" @@ -6619,7 +9568,7 @@ public void y_object_duplicated_key_and_value_json() [Fact] public void y_object_empty_json() { - Test(@"@""{}""", @" + TestNST(@"@""{}""", @" @@ -6638,7 +9587,7 @@ public void y_object_empty_json() [Fact] public void y_object_empty_key_json() { - Test(@"@""{"""""""":0}""", @" + TestNST(@"@""{"""""""":0}""", @" @@ -6665,7 +9614,7 @@ public void y_object_empty_key_json() [Fact] public void y_object_escaped_null_in_key_json() { - Test(@"@""{""""foo\u0000bar"""": 42}""", @" + TestNST(@"@""{""""foo\u0000bar"""": 42}""", @" @@ -6692,7 +9641,7 @@ public void y_object_escaped_null_in_key_json() [Fact] public void y_object_extreme_numbers_json() { - Test(@"@""{ """"min"""": -1.0e+28, """"max"""": 1.0e+28 }""", @" + TestNST(@"@""{ """"min"""": -1.0e+28, """"max"""": 1.0e+28 }""", @" @@ -6723,13 +9672,13 @@ public void y_object_extreme_numbers_json() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] public void y_object_long_strings_json() { - Test(@"@""{""""x"""":[{""""id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}], """"id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}""", @" + TestNST(@"@""{""""x"""":[{""""id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}], """"id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}""", @" @@ -6782,7 +9731,7 @@ public void y_object_long_strings_json() [Fact] public void y_object_simple_json() { - Test(@"@""{""""a"""":[]}""", @" + TestNST(@"@""{""""a"""":[]}""", @" @@ -6811,7 +9760,7 @@ public void y_object_simple_json() [Fact] public void y_object_string_unicode_json() { - Test(@"@""{""""title"""":""""\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430"""" }""", @" + TestNST(@"@""{""""title"""":""""\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430"""" }""", @" @@ -6838,7 +9787,7 @@ public void y_object_string_unicode_json() [Fact] public void y_object_with_newlines_json() { - Test(@"@""{ + TestNST(@"@""{ """"a"""": """"b"""" }""", @" @@ -6869,7 +9818,7 @@ public void y_object_with_newlines_json() [Fact] public void y_string_1_2_3_bytes_UTF_8_sequences_json() { - Test(@"@""[""""\u0060\u012a\u12AB""""]""", @" + TestNST(@"@""[""""\u0060\u012a\u12AB""""]""", @" @@ -6892,7 +9841,7 @@ public void y_string_1_2_3_bytes_UTF_8_sequences_json() [Fact] public void y_string_accepted_surrogate_pair_json() { - Test(@"@""[""""\uD801\udc37""""]""", @" + TestNST(@"@""[""""\uD801\udc37""""]""", @" @@ -6915,7 +9864,7 @@ public void y_string_accepted_surrogate_pair_json() [Fact] public void y_string_accepted_surrogate_pairs_json() { - Test(@"@""[""""\ud83d\ude39\ud83d\udc8d""""]""", @" + TestNST(@"@""[""""\ud83d\ude39\ud83d\udc8d""""]""", @" @@ -6938,7 +9887,7 @@ public void y_string_accepted_surrogate_pairs_json() [Fact] public void y_string_allowed_escapes_json() { - Test(@"@""[""""\""""\\\/\b\f\n\r\t""""]""", @" + TestNST(@"@""[""""\""""\\\/\b\f\n\r\t""""]""", @" @@ -6961,7 +9910,7 @@ public void y_string_allowed_escapes_json() [Fact] public void y_string_backslash_and_u_escaped_zero_json() { - Test(@"@""[""""\\u0000""""]""", @" + TestNST(@"@""[""""\\u0000""""]""", @" @@ -6984,7 +9933,7 @@ public void y_string_backslash_and_u_escaped_zero_json() [Fact] public void y_string_backslash_doublequotes_json() { - Test(@"@""[""""\""""""""]""", @" + TestNST(@"@""[""""\""""""""]""", @" @@ -7007,7 +9956,7 @@ public void y_string_backslash_doublequotes_json() [Fact] public void y_string_comments_json() { - Test(@"@""[""""a/*b*/c/*d//e""""]""", @" + TestNST(@"@""[""""a/*b*/c/*d//e""""]""", @" @@ -7030,7 +9979,7 @@ public void y_string_comments_json() [Fact] public void y_string_double_escape_a_json() { - Test(@"@""[""""\\a""""]""", @" + TestNST(@"@""[""""\\a""""]""", @" @@ -7053,7 +10002,7 @@ public void y_string_double_escape_a_json() [Fact] public void y_string_double_escape_n_json() { - Test(@"@""[""""\\n""""]""", @" + TestNST(@"@""[""""\\n""""]""", @" @@ -7076,7 +10025,7 @@ public void y_string_double_escape_n_json() [Fact] public void y_string_escaped_control_character_json() { - Test(@"@""[""""\u0012""""]""", @" + TestNST(@"@""[""""\u0012""""]""", @" @@ -7099,7 +10048,7 @@ public void y_string_escaped_control_character_json() [Fact] public void y_string_escaped_noncharacter_json() { - Test(@"@""[""""\uFFFF""""]""", @" + TestNST(@"@""[""""\uFFFF""""]""", @" @@ -7122,7 +10071,7 @@ public void y_string_escaped_noncharacter_json() [Fact] public void y_string_in_array_json() { - Test(@"@""[""""asd""""]""", @" + TestNST(@"@""[""""asd""""]""", @" @@ -7145,7 +10094,7 @@ public void y_string_in_array_json() [Fact] public void y_string_in_array_with_leading_space_json() { - Test(@"@""[ """"asd""""]""", @" + TestNST(@"@""[ """"asd""""]""", @" @@ -7168,7 +10117,7 @@ public void y_string_in_array_with_leading_space_json() [Fact] public void y_string_last_surrogates_1_and_2_json() { - Test(@"@""[""""\uDBFF\uDFFF""""]""", @" + TestNST(@"@""[""""\uDBFF\uDFFF""""]""", @" @@ -7191,7 +10140,7 @@ public void y_string_last_surrogates_1_and_2_json() [Fact] public void y_string_nbsp_uescaped_json() { - Test(@"@""[""""new\u00A0line""""]""", @" + TestNST(@"@""[""""new\u00A0line""""]""", @" @@ -7214,7 +10163,7 @@ public void y_string_nbsp_uescaped_json() [Fact] public void y_string_nonCharacterInUTF_8_U_10FFFF_json() { - Test(@"@""[""""􏿿""""]""", @" + TestNST(@"@""[""""􏿿""""]""", @" @@ -7237,7 +10186,7 @@ public void y_string_nonCharacterInUTF_8_U_10FFFF_json() [Fact] public void y_string_null_escape_json() { - Test(@"@""[""""\u0000""""]""", @" + TestNST(@"@""[""""\u0000""""]""", @" @@ -7260,7 +10209,7 @@ public void y_string_null_escape_json() [Fact] public void y_string_one_byte_utf_8_json() { - Test(@"@""[""""\u002c""""]""", @" + TestNST(@"@""[""""\u002c""""]""", @" @@ -7283,7 +10232,7 @@ public void y_string_one_byte_utf_8_json() [Fact] public void y_string_pi_json() { - Test(@"@""[""""π""""]""", @" + TestNST(@"@""[""""π""""]""", @" @@ -7306,7 +10255,7 @@ public void y_string_pi_json() [Fact] public void y_string_reservedCharacterInUTF_8_U_1BFFF_json() { - Test(@"@""[""""𛿿""""]""", @" + TestNST(@"@""[""""𛿿""""]""", @" @@ -7329,7 +10278,7 @@ public void y_string_reservedCharacterInUTF_8_U_1BFFF_json() [Fact] public void y_string_simple_ascii_json() { - Test(@"@""[""""asd """"]""", @" + TestNST(@"@""[""""asd """"]""", @" @@ -7352,7 +10301,7 @@ public void y_string_simple_ascii_json() [Fact] public void y_string_space_json() { - Test(@"@"""""" """"""", @" + TestNST(@"@"""""" """"""", @" @@ -7369,7 +10318,7 @@ public void y_string_space_json() [Fact] public void y_string_surrogates_U_1D11E_MUSICAL_SYMBOL_G_CLEF_json() { - Test(@"@""[""""\uD834\uDd1e""""]""", @" + TestNST(@"@""[""""\uD834\uDd1e""""]""", @" @@ -7392,7 +10341,7 @@ public void y_string_surrogates_U_1D11E_MUSICAL_SYMBOL_G_CLEF_json() [Fact] public void y_string_three_byte_utf_8_json() { - Test(@"@""[""""\u0821""""]""", @" + TestNST(@"@""[""""\u0821""""]""", @" @@ -7415,7 +10364,7 @@ public void y_string_three_byte_utf_8_json() [Fact] public void y_string_two_byte_utf_8_json() { - Test(@"@""[""""\u0123""""]""", @" + TestNST(@"@""[""""\u0123""""]""", @" @@ -7438,7 +10387,7 @@ public void y_string_two_byte_utf_8_json() [Fact] public void y_string_u_2028_line_sep_json() { - Test(@"@""[""""
""""]""", @" + TestNST(@"@""[""""
""""]""", @" @@ -7461,7 +10410,7 @@ public void y_string_u_2028_line_sep_json() [Fact] public void y_string_u_2029_par_sep_json() { - Test(@"@""[""""
""""]""", @" + TestNST(@"@""[""""
""""]""", @" @@ -7484,7 +10433,7 @@ public void y_string_u_2029_par_sep_json() [Fact] public void y_string_uEscape_json() { - Test(@"@""[""""\u0061\u30af\u30EA\u30b9""""]""", @" + TestNST(@"@""[""""\u0061\u30af\u30EA\u30b9""""]""", @" @@ -7507,7 +10456,7 @@ public void y_string_uEscape_json() [Fact] public void y_string_uescaped_newline_json() { - Test(@"@""[""""new\u000Aline""""]""", @" + TestNST(@"@""[""""new\u000Aline""""]""", @" @@ -7530,7 +10479,7 @@ public void y_string_uescaped_newline_json() [Fact] public void y_string_unescaped_char_delete_json() { - Test(@"@""[""""""""]""", @" + TestNST(@"@""[""""""""]""", @" @@ -7553,7 +10502,7 @@ public void y_string_unescaped_char_delete_json() [Fact] public void y_string_unicode_json() { - Test(@"@""[""""\uA66D""""]""", @" + TestNST(@"@""[""""\uA66D""""]""", @" @@ -7576,7 +10525,7 @@ public void y_string_unicode_json() [Fact] public void y_string_unicodeEscapedBackslash_json() { - Test(@"@""[""""\u005C""""]""", @" + TestNST(@"@""[""""\u005C""""]""", @" @@ -7599,7 +10548,7 @@ public void y_string_unicodeEscapedBackslash_json() [Fact] public void y_string_unicode_2_json() { - Test(@"@""[""""⍂㈴⍂""""]""", @" + TestNST(@"@""[""""⍂㈴⍂""""]""", @" @@ -7622,7 +10571,7 @@ public void y_string_unicode_2_json() [Fact] public void y_string_unicode_escaped_double_quote_json() { - Test(@"@""[""""\u0022""""]""", @" + TestNST(@"@""[""""\u0022""""]""", @" @@ -7645,7 +10594,7 @@ public void y_string_unicode_escaped_double_quote_json() [Fact] public void y_string_unicode_U_10FFFE_nonchar_json() { - Test(@"@""[""""\uDBFF\uDFFE""""]""", @" + TestNST(@"@""[""""\uDBFF\uDFFE""""]""", @" @@ -7668,7 +10617,7 @@ public void y_string_unicode_U_10FFFE_nonchar_json() [Fact] public void y_string_unicode_U_1FFFE_nonchar_json() { - Test(@"@""[""""\uD83F\uDFFE""""]""", @" + TestNST(@"@""[""""\uD83F\uDFFE""""]""", @" @@ -7691,7 +10640,7 @@ public void y_string_unicode_U_1FFFE_nonchar_json() [Fact] public void y_string_unicode_U_200B_ZERO_WIDTH_SPACE_json() { - Test(@"@""[""""\u200B""""]""", @" + TestNST(@"@""[""""\u200B""""]""", @" @@ -7714,7 +10663,7 @@ public void y_string_unicode_U_200B_ZERO_WIDTH_SPACE_json() [Fact] public void y_string_unicode_U_2064_invisible_plus_json() { - Test(@"@""[""""\u2064""""]""", @" + TestNST(@"@""[""""\u2064""""]""", @" @@ -7737,7 +10686,7 @@ public void y_string_unicode_U_2064_invisible_plus_json() [Fact] public void y_string_unicode_U_FDD0_nonchar_json() { - Test(@"@""[""""\uFDD0""""]""", @" + TestNST(@"@""[""""\uFDD0""""]""", @" @@ -7760,7 +10709,7 @@ public void y_string_unicode_U_FDD0_nonchar_json() [Fact] public void y_string_unicode_U_FFFE_nonchar_json() { - Test(@"@""[""""\uFFFE""""]""", @" + TestNST(@"@""[""""\uFFFE""""]""", @" @@ -7783,7 +10732,7 @@ public void y_string_unicode_U_FFFE_nonchar_json() [Fact] public void y_string_utf8_json() { - Test(@"@""[""""€𝄞""""]""", @" + TestNST(@"@""[""""€𝄞""""]""", @" @@ -7806,7 +10755,7 @@ public void y_string_utf8_json() [Fact] public void y_string_with_del_character_json() { - Test(@"@""[""""aa""""]""", @" + TestNST(@"@""[""""aa""""]""", @" @@ -7829,7 +10778,7 @@ public void y_string_with_del_character_json() [Fact] public void y_structure_lonely_false_json() { - Test(@"@""false""", @" + TestNST(@"@""false""", @" @@ -7846,7 +10795,7 @@ public void y_structure_lonely_false_json() [Fact] public void y_structure_lonely_int_json() { - Test(@"@""42""", @" + TestNST(@"@""42""", @" @@ -7863,7 +10812,7 @@ public void y_structure_lonely_int_json() [Fact] public void y_structure_lonely_negative_real_json() { - Test(@"@""-0.1""", @" + TestNST(@"@""-0.1""", @" @@ -7874,13 +10823,13 @@ public void y_structure_lonely_negative_real_json() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] public void y_structure_lonely_null_json() { - Test(@"@""null""", @" + TestNST(@"@""null""", @" @@ -7897,7 +10846,7 @@ public void y_structure_lonely_null_json() [Fact] public void y_structure_lonely_string_json() { - Test(@"@""""""asd""""""", @" + TestNST(@"@""""""asd""""""", @" @@ -7914,7 +10863,7 @@ public void y_structure_lonely_string_json() [Fact] public void y_structure_lonely_true_json() { - Test(@"@""true""", @" + TestNST(@"@""true""", @" @@ -7931,7 +10880,7 @@ public void y_structure_lonely_true_json() [Fact] public void y_structure_string_empty_json() { - Test(@"@""""""""""""", @" + TestNST(@"@""""""""""""", @" @@ -7948,7 +10897,7 @@ public void y_structure_string_empty_json() [Fact] public void y_structure_trailing_newline_json() { - Test(@"@""[""""a""""] + TestNST(@"@""[""""a""""] """, @" @@ -7973,7 +10922,7 @@ public void y_structure_trailing_newline_json() [Fact] public void y_structure_true_in_array_json() { - Test(@"@""[true]""", @" + TestNST(@"@""[true]""", @" @@ -7996,7 +10945,7 @@ public void y_structure_true_in_array_json() [Fact] public void y_structure_whitespace_array_json() { - Test(@"@"" [] """, @" + TestNST(@"@"" [] """, @" @@ -8010,494 +10959,6 @@ public void y_structure_whitespace_array_json() -", - @"", - @""); - } - - [Fact] - public void number_1_0_json() - { - Test(@"@""[1.0]""", @" - - - - [ - - - 1.0 - - - ] - - - - -", - @"", - @"", runStrictSubTreeCheck: false); - } - - [Fact] - public void number_1_000000000000000005_json() - { - Test(@"@""[1.000000000000000005]""", @" - - - - [ - - - 1.000000000000000005 - - - ] - - - - -", - @"", - @""); - } - - [Fact] - public void number_1000000000000000_json() - { - Test(@"@""[1000000000000000] -""", @" - - - - [ - - - 1000000000000000 - - - ] - - - - - -", - @"", - @""); - } - - [Fact] - public void number_10000000000000000999_json() - { - Test(@"@""[10000000000000000999]""", @" - - - - [ - - - 10000000000000000999 - - - ] - - - - -", - @"", - @"", runStrictSubTreeCheck: false); - } - - [Fact] - public void number_1e_999_json() - { - Test(@"@""[1E-999]""", @" - - - - [ - - - 1E-999 - - - ] - - - - -", - @"", - @"", runStrictSubTreeCheck: false); - } - - [Fact] - public void number_1e6_json() - { - Test(@"@""[1E6]""", @" - - - - [ - - - 1E6 - - - ] - - - - -", - @"", - @""); - } - - [Fact] - public void object_key_nfc_nfd_json() - { - Test(@"@""{""""é"""":""""NFC"""",""""é"""":""""NFD""""}""", @" - - - - { - - - ""é"" - : - - ""NFC"" - - - - , - - - ""é"" - : - - ""NFD"" - - - - } - - - - -", - @"", - @""); - } - - [Fact] - public void object_key_nfd_nfc_json() - { - Test(@"@""{""""é"""":""""NFD"""",""""é"""":""""NFC""""}""", @" - - - - { - - - ""é"" - : - - ""NFD"" - - - - , - - - ""é"" - : - - ""NFC"" - - - - } - - - - -", - @"", - @""); - } - - [Fact] - public void object_same_key_different_values_json() - { - Test(@"@""{""""a"""":1,""""a"""":2}""", @" - - - - { - - - ""a"" - : - - 1 - - - - , - - - ""a"" - : - - 2 - - - - } - - - - -", - @"", - @""); - } - - [Fact] - public void object_same_key_same_value_json() - { - Test(@"@""{""""a"""":1,""""a"""":1}""", @" - - - - { - - - ""a"" - : - - 1 - - - - , - - - ""a"" - : - - 1 - - - - } - - - - -", - @"", - @""); - } - - [Fact] - public void object_same_key_unclear_values_json() - { - Test(@"@""{""""a"""":0, """"a"""":-0} -""", @" - - - - { - - - ""a"" - : - - 0 - - - - , - - - ""a"" - : - - -0 - - - - } - - - - - -", - @"", - @""); - } - - [Fact] - public void string_1_escaped_invalid_codepoint_json() - { - Test(@"@""[""""\uD800""""]""", @" - - - - [ - - - ""\uD800"" - - - ] - - - - -", - @"", - @"", runLooseSubTreeCheck: false); - } - - [Fact] - public void string_1_invalid_codepoint_json() - { - Test(@"@""[""""��""""]""", @" - - - - [ - - - ""��"" - - - ] - - - - -", - @"", - @""); - } - - [Fact] - public void string_2_escaped_invalid_codepoints_json() - { - Test(@"@""[""""\uD800\uD800""""]""", @" - - - - [ - - - ""\uD800\uD800"" - - - ] - - - - -", - @"", - @""); - } - - [Fact] - public void string_2_invalid_codepoints_json() - { - Test(@"@""[""""����""""]""", @" - - - - [ - - - ""����"" - - - ] - - - - -", - @"", - @""); - } - - [Fact] - public void string_3_escaped_invalid_codepoints_json() - { - Test(@"@""[""""\uD800\uD800\uD800""""]""", @" - - - - [ - - - ""\uD800\uD800\uD800"" - - - ] - - - - -", - @"", - @"", runLooseSubTreeCheck: false); - } - - [Fact] - public void string_3_invalid_codepoints_json() - { - Test(@"@""[""""������""""]""", @" - - - - [ - - - ""������"" - - - ] - - - - -", - @"", - @""); - } - - [Fact] - public void string_with_escaped_NULL_json() - { - Test(@"@""[""""A\u0000B""""]""", @" - - - - [ - - - ""A\u0000B"" - - - ] - - - - ", @"", @""); diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs index 941f8d39f52df..cfdabe27fa9a6 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs @@ -1,13 +1,12 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +#if false using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.EmbeddedLanguages.Json; using Xunit; @@ -51,7 +50,10 @@ public void Dispose() #endif #endif var tests = - CSharpJsonParserTests.nameToTest.Values; + CSharpJsonParserTests.nameToTest.Where( + kvp => kvp.Key.StartsWith("i_") || + kvp.Key.StartsWith("n_") || + kvp.Key.StartsWith("y_")).Select(kvp => kvp.Value); var val = string.Join("\r\n", tests); } } @@ -121,7 +123,7 @@ private string GenerateTests(string val, bool runJsonNetCheck, bool runJsonNetSu builder.AppendLine("[Fact]"); builder.AppendLine("public void " + testName + "()"); builder.AppendLine("{"); - builder.Append(@" Test("); + builder.Append(@" TestNST("); var escaped = val.Replace("\"", "\"\""); var quoted = "" + '@' + '"' + escaped + '"'; @@ -143,7 +145,6 @@ private string GenerateTests(string val, bool runJsonNetCheck, bool runJsonNetSu builder.Append(DiagnosticsToText(looseTree.Diagnostics).Replace("\"", "\"\"")); builder.AppendLine("" + '"' + ','); - var strictTree = JsonParser.TryParse(allChars, strict: true); builder.Append("" + '@' + '"'); builder.Append(DiagnosticsToText(strictTree.Diagnostics).Replace("\"", "\"\"")); @@ -166,3 +167,4 @@ private string GenerateTests(string val, bool runJsonNetCheck, bool runJsonNetSu } } } +#endif diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 31004220988dd..6bfcd9961fa68 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -145,14 +145,6 @@ private JsonTree TryParseTree( return null; } - //JavaScriptSerializer x = new JavaScriptSerializer(); - //x.DeserializeObject("{ x: 1 }"); - //var r = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes("{ \"x\": 1 } "), - // XmlDictionaryReaderQuotas.Max); - //var v1 = r.Read(); - //var v2 = r.Read(); - //var d = new DataContractJsonSerializer(typeof(object)); - //var o = d.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes("{ \"x\": 1 } "))); CheckInvariants(tree, allChars); if (runTreeCheck) @@ -321,6 +313,31 @@ private static void CheckCharacters(ImmutableArray virtualChars, re position += virtualChars.Length; } + private void TestNST( + string stringText, string expected, string looseDiagnostics, string strictDiagnostics, [CallerMemberName]string caller = "") + { + var (token, tree, allChars) = JustParseTree(stringText, strict: true, conversionFailureOk: false); + + var actualTree = TreeToText(tree).Replace("\"", "\"\""); + Assert.Equal(expected.Replace("\"", "\"\""), actualTree); + + var actualDiagnostics = DiagnosticsToText(tree.Diagnostics).Replace("\"", "\"\""); + Assert.Equal(strictDiagnostics.Replace("\"", "\"\""), actualDiagnostics); + + CheckInvariants(tree, allChars); + + if (caller.StartsWith("y_")) + { + // y_ tests must produce no diagnostics. + Assert.Empty(strictDiagnostics); + } + else if (caller.StartsWith("n_")) + { + // n_ tests must always produce diagnostics. + Assert.NotEmpty(strictDiagnostics); + } + } + [Fact] public void TestDeepRecursion() { From 453a2b51d5c8125d66e2bc59480810d6c0e04338 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 21:52:29 -0700 Subject: [PATCH 015/110] Remove commented code. --- .../Json/JsonParser.StrictSyntaxChecker.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index f7e4a5eb838cf..5a8c3fbd08c29 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -255,15 +255,6 @@ Numeric values that cannot be represented in the grammar below (such literalToken.GetSpan()); } - //if (!double.TryParse(literalText, out var val) || - // double.IsNaN(val) || - // double.IsInfinity(val)) - //{ - // return new EmbeddedDiagnostic( - // WorkspacesResources.Invalid_number, - // literalToken.GetSpan()); - //} - return CheckToken(literalToken); } From 3a8643a37d71fdd75e44bfb65cca1dfd4fdf192c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 21:53:29 -0700 Subject: [PATCH 016/110] Remove incorrect strict checks. --- .../Json/JsonParser.StrictSyntaxChecker.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 36a7be4fcd832..5a8c3fbd08c29 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -255,15 +255,6 @@ Numeric values that cannot be represented in the grammar below (such literalToken.GetSpan()); } - if (!double.TryParse(literalText, out var val) || - double.IsNaN(val) || - double.IsInfinity(val)) - { - return new EmbeddedDiagnostic( - WorkspacesResources.Invalid_number, - literalToken.GetSpan()); - } - return CheckToken(literalToken); } From e25c4f47a3b0cd6c0948c839cfff355b1caef0c6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 22:02:29 -0700 Subject: [PATCH 017/110] Add checks --- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 6bfcd9961fa68..fadf411ce6394 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -331,11 +331,22 @@ private void TestNST( // y_ tests must produce no diagnostics. Assert.Empty(strictDiagnostics); } + else if (caller.StartsWith("i_")) + { + // We don't want to have diagnostics for i_ tests even though we're allowed to. + // That's because we want our parser to be permissive when possible so we don't + // error on json that is legal under some other parser. + Assert.Empty(strictDiagnostics); + } else if (caller.StartsWith("n_")) { // n_ tests must always produce diagnostics. Assert.NotEmpty(strictDiagnostics); } + else + { + Assert.False(true, "Unexpected test name."); + } } [Fact] From f27bb043eac90c5350b9dfe1d6a1b0f011a8c082 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 22 Apr 2018 23:41:03 -0700 Subject: [PATCH 018/110] Remove stack overflow test. --- .../Json/CSharpJsonParserTests_NstTests.cs | 3013 ----------------- 1 file changed, 3013 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs index 730f7b51bb020..721a607bd6077 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs @@ -734,3019 +734,6 @@ public void i_string_UTF8_surrogate_U_D800_json() @""); } - [Fact] - public void i_structure_500_nested_arrays_json() - { - TestNST(@"@""[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]""", @" - - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - - [ - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - ] - - - - -", - @"", - @""); - } - [Fact] public void i_structure_UTF_8_BOM_empty_object_json() { From 515a3f9916b8e6c14d2a482e930c4dc4a327babc Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Jun 2018 15:58:53 -0400 Subject: [PATCH 019/110] Add comment --- .../EmbeddedLanguages/Json/JsonParser.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 8f657a26b57b0..4bbbbe8fff54b 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -19,6 +19,25 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json using JsonToken = EmbeddedSyntaxToken; using JsonTrivia = EmbeddedSyntaxTrivia; + /// + /// Parser used for reading in a sequence of s, and producing a out of it. Parsing will always succeed (except in the case of a + /// stack-overflow) and will consume the entire sequence of chars. General roslyn syntax + /// principles are held to (i.e. immutable, fully representative, etc.). + /// + /// The parser always parses out the same tree regardless of input. *However*, depending on the + /// flags passed to it, it may return a different set of *diagnostics*. Specifically, the + /// parser supports json.net parsing and strict RFC8259 (https://tools.ietf.org/html/rfc8259). + /// As such, the parser supports a superset of both, but then does a pass at the end to produce + /// appropriate diagnostics. + /// + /// Note: the json structure we parse out is actually very simple. It's effectively all lists + /// of values. We just treat almost everything as a 'value'. For + /// example, a (i.e. ```"x" = 0```) is a 'value'. As such, it + /// can show up in arrays (i.e. ```["x" = 0, "y" = 1]```). This is not legal, but it greatly + /// simplifies parsing. Effectively, we just have recursive list parsing, where we accept any + /// sort of value in any sort of context. A later pass will then report errors. + /// internal partial struct JsonParser { private static readonly string _closeBracketExpected = string.Format(WorkspacesResources._0_expected, ']'); From 5b37d74badf8fb745c4d8ec49808794243e7474a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Jun 2018 16:04:08 -0400 Subject: [PATCH 020/110] Add comment. --- .../Core/Portable/EmbeddedLanguages/Json/JsonParser.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 4bbbbe8fff54b..aa1bcd23018ed 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -36,7 +36,8 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// example, a (i.e. ```"x" = 0```) is a 'value'. As such, it /// can show up in arrays (i.e. ```["x" = 0, "y" = 1]```). This is not legal, but it greatly /// simplifies parsing. Effectively, we just have recursive list parsing, where we accept any - /// sort of value in any sort of context. A later pass will then report errors. + /// sort of value in any sort of context. A later pass will then report errors for the wrong + /// sorts of values showing up in incorrect contexts. /// internal partial struct JsonParser { @@ -110,7 +111,13 @@ private JsonTree ParseTree(bool strict) var root = new JsonCompilationUnit(arraySequence, _currentToken); + // We only report a single diagnostic when parsing out json. This helps prevent lots of + // cascading errors from being reported. First, we see if there are any diagnostics + // directly in tokens in the tree. If not, we then check for any incorrect tree + // structure (that would be incorrect for both json.net or strict-mode). If we don't + // run into any problems, we'll then perform specific json.net or strict-mode checks. var diagnostic = GetFirstDiagnostic(root) ?? CheckTopLevel(_lexer.Text, root); + if (diagnostic == null) { // We didn't have any diagnostics in the tree so far. Do the json.net/strict checks From 6757a471e12a7367c023a17d8c820ad21d4df110 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Jun 2018 16:23:30 -0400 Subject: [PATCH 021/110] Add comments. --- .../Json/IJsonNodeVisitor.cs | 2 +- .../EmbeddedLanguages/Json/JsonKind.cs | 2 +- .../EmbeddedLanguages/Json/JsonNodes.cs | 10 ++++-- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 8 +++-- .../Json/JsonParser.StrictSyntaxChecker.cs | 17 +++++++--- .../EmbeddedLanguages/Json/JsonParser.cs | 31 +++++++++++++------ 6 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs index 3529592a04a93..f96d504a3f308 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs @@ -13,6 +13,6 @@ internal interface IJsonNodeVisitor void Visit(JsonLiteralNode node); void Visit(JsonNegativeLiteralNode node); void Visit(JsonTextNode node); - void Visit(JsonEmptyValueNode node); + void Visit(JsonCommaValueNode node); } } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs index b37d295ff340b..7bf730a8f2098 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs @@ -14,7 +14,7 @@ internal enum JsonKind NegativeLiteral, Property, Constructor, - EmptyValue, + CommaValue, // Tokens EndOfFile, diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index ce7d9829b0cbe..2787e4670b522 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -22,6 +22,10 @@ public JsonCompilationUnit(JsonSequenceNode sequence, JsonToken endOfFileToken) EndOfFileToken = endOfFileToken; } + /// + /// For error recovery purposes, we support a sequence of nodes at the top level (even + /// though only a single node is actually allowed). + /// public JsonSequenceNode Sequence { get; } public JsonToken EndOfFileToken { get; } @@ -240,10 +244,10 @@ public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); } - internal sealed class JsonEmptyValueNode : JsonValueNode + internal sealed class JsonCommaValueNode : JsonValueNode { - public JsonEmptyValueNode(JsonToken commaToken) - : base(JsonKind.EmptyValue) + public JsonCommaValueNode(JsonToken commaToken) + : base(JsonKind.CommaValue) { Debug.Assert(commaToken.Kind == JsonKind.CommaToken); CommaToken = commaToken; diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index b254465d1b574..5a532a7626e60 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -159,14 +159,16 @@ private static bool IsValidConstructorName(JsonToken nameToken) private static EmbeddedDiagnostic? CheckCommasBetweenSequenceElements(JsonSequenceNode node) { + // Json.net allows sequences of commas. But after every non-comma value, you need + // a comma. for (int i = 0, n = node.ChildCount - 1; i < n; i++) { var child = node.ChildAt(i).Node; - if (child.Kind != JsonKind.EmptyValue) + if (child.Kind != JsonKind.CommaValue) { var next = node.ChildAt(i + 1).Node; - if (next.Kind != JsonKind.EmptyValue) + if (next.Kind != JsonKind.CommaValue) { return new EmbeddedDiagnostic( string.Format(WorkspacesResources._0_expected, ','), @@ -195,7 +197,7 @@ private static bool IsValidConstructorName(JsonToken nameToken) } else { - if (child.Kind != JsonKind.EmptyValue) + if (child.Kind != JsonKind.CommaValue) { return new EmbeddedDiagnostic( string.Format(WorkspacesResources._0_expected, ','), diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 5a8c3fbd08c29..2a36296402d29 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -16,6 +16,10 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json internal partial struct JsonParser { + /// + /// Checks the superset-tree for constructs that aren't allowed in strict rfc8259 + /// (https://tools.ietf.org/html/rfc8259) mode. + /// private static class StrictSyntaxChecker { private static EmbeddedDiagnostic? CheckChildren(JsonNode node) @@ -55,6 +59,7 @@ private static class StrictSyntaxChecker { case JsonKind.MultiLineCommentTrivia: case JsonKind.SingleLineCommentTrivia: + // Strict mode doesn't allow comments at all. return new EmbeddedDiagnostic( WorkspacesResources.Comments_not_allowed, GetSpan(trivia.VirtualChars)); @@ -75,6 +80,8 @@ private static class StrictSyntaxChecker break; default: + // Strict mode only allows spaces and horizontal tabs. Everything else + // is illegal. return new EmbeddedDiagnostic( WorkspacesResources.Illegal_whitespace_character, ch.Span); @@ -105,7 +112,7 @@ private static class StrictSyntaxChecker foreach (var child in sequence) { var childNode = child.Node; - if (childNode.Kind != JsonKind.Property && childNode.Kind != JsonKind.EmptyValue) + if (childNode.Kind != JsonKind.Property && childNode.Kind != JsonKind.CommaValue) { return new EmbeddedDiagnostic( WorkspacesResources.Only_properties_allowed_in_an_object, @@ -134,12 +141,13 @@ private static class StrictSyntaxChecker private static EmbeddedDiagnostic? CheckProperSeparation(JsonSequenceNode sequence) { + // Ensure that this sequence is actually a separated list. for (int i = 0, n = sequence.ChildCount; i < n; i++) { var child = sequence.ChildAt(i).Node; if (i % 2 == 0) { - if (child.Kind == JsonKind.EmptyValue) + if (child.Kind == JsonKind.CommaValue) { return new EmbeddedDiagnostic( string.Format(WorkspacesResources._0_unexpected, ","), @@ -148,7 +156,7 @@ private static class StrictSyntaxChecker } else { - if (child.Kind != JsonKind.EmptyValue) + if (child.Kind != JsonKind.CommaValue) { return new EmbeddedDiagnostic( string.Format(WorkspacesResources._0_expected, ","), @@ -176,7 +184,7 @@ private static class StrictSyntaxChecker node.NameToken.GetSpan()); } - if (node.Value.Kind == JsonKind.EmptyValue) + if (node.Value.Kind == JsonKind.CommaValue) { return new EmbeddedDiagnostic( WorkspacesResources.Value_required, @@ -193,6 +201,7 @@ private static class StrictSyntaxChecker case JsonKind.NaNLiteralToken: case JsonKind.InfinityLiteralToken: case JsonKind.UndefinedLiteralToken: + // These are all json.net extensions. Disallow them all. return InvalidLiteral(node.LiteralToken); case JsonKind.NumberToken: return CheckNumber(node.LiteralToken); diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index aa1bcd23018ed..1bec518bcb6be 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -38,6 +38,11 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// simplifies parsing. Effectively, we just have recursive list parsing, where we accept any /// sort of value in any sort of context. A later pass will then report errors for the wrong /// sorts of values showing up in incorrect contexts. + /// + /// Note: We also treat commas (```,```) as being a 'value' on its own. This simplifies parsing + /// by allowing us to not have to represent Lists and SeparatedLists. It also helps model + /// things that are supported in json.net (like ```[1,,2]```). Our post-parsing pass will + /// then ensure that these comma-values only show up in the right contexts. /// internal partial struct JsonParser { @@ -51,9 +56,9 @@ internal partial struct JsonParser private int _recursionDepth; // Fields used to keep track of what types of json values we're in. They're used for error - // recovery, specifically with respect to to encountering unexpected tokens while parsing - // out a sequence of values. For example, if we have: ```{ a: [1, 2, }```, we will mark - // that we're both in an object and in an array. When we then encounter the errant ```}```, + // recovery, specifically with respect to encountering unexpected tokens while parsing out a + // sequence of values. For example, if we have: ```{ a: [1, 2, }```, we will mark that + // we're both in an object and in an array. When we then encounter the errant ```}```, // we'll see that we were in an object, and thus should stop parsing out the sequence for // the array so that the ```}``` can be consume by the object we were in. However, if we // just had ```[1, 2, }```, we would not be in an object, and we would just consume the @@ -163,9 +168,10 @@ private JsonTree ParseTree(bool strict) foreach (var child in compilationUnit.Sequence) { - if (child.IsNode && child.Node.Kind == JsonKind.EmptyValue) + // Commas should never show up in the top level sequence. + if (child.IsNode && child.Node.Kind == JsonKind.CommaValue) { - var emptyValue = (JsonEmptyValueNode)child.Node; + var emptyValue = (JsonCommaValueNode)child.Node; return new EmbeddedDiagnostic( string.Format(WorkspacesResources._0_unexpected, ','), emptyValue.CommaToken.GetSpan()); @@ -281,7 +287,7 @@ private JsonValueNode ParseValue() case JsonKind.OpenBracketToken: return ParseArray(); case JsonKind.CommaToken: - return ParseEmptyValue(); + return ParseCommaValue(); default: return ParseLiteralOrPropertyOrConstructor(); } @@ -315,13 +321,13 @@ private JsonPropertyNode ParseProperty(JsonToken stringLiteralOrText) { return new JsonPropertyNode( stringLiteralOrText, colonToken, - new JsonEmptyValueNode(CreateMissingToken(JsonKind.CommaToken))); + new JsonCommaValueNode(CreateMissingToken(JsonKind.CommaToken))); } else if (_currentToken.Kind == JsonKind.EndOfFile) { return new JsonPropertyNode( stringLiteralOrText, colonToken, - new JsonEmptyValueNode(CreateMissingToken(JsonKind.CommaToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( + new JsonCommaValueNode(CreateMissingToken(JsonKind.CommaToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( WorkspacesResources.Missing_property_value, GetTokenStartPositionSpan(_currentToken))))); } @@ -329,6 +335,7 @@ private JsonPropertyNode ParseProperty(JsonToken stringLiteralOrText) var value = ParseValue(); if (value.Kind == JsonKind.Property) { + // It's always illegal to have something like ```"a" : "b" : 1``` var nestedProperty = (JsonPropertyNode)value; value = new JsonPropertyNode( nestedProperty.NameToken, @@ -360,11 +367,15 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) return new JsonLiteralNode(token); } + // Look for constructors (a json.net extension). We'll report them as an error + // in strict model. if (Matches(token, "new")) { return ParseConstructor(token); } + // Check for certain literal values. Some of these (like NaN) are json.net only. + // We'll check for these later in the strict-mode pass. Debug.Assert(token.VirtualChars.Length > 0); if (TryMatch(token, "NaN", JsonKind.NaNLiteralToken, out var newKind) || TryMatch(token, "true", JsonKind.TrueLiteralToken, out newKind) || @@ -459,8 +470,8 @@ private static JsonValueNode ParseNumber(JsonToken textToken) return new JsonLiteralNode(numberToken); } - private JsonEmptyValueNode ParseEmptyValue() - => new JsonEmptyValueNode(ConsumeCurrentToken()); + private JsonCommaValueNode ParseCommaValue() + => new JsonCommaValueNode(ConsumeCurrentToken()); private JsonArrayNode ParseArray() { From 93cbe8060e54e473e1f5bf0ebd7019d5f24b40fc Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Jun 2018 16:35:38 -0400 Subject: [PATCH 022/110] Update downstream. --- .../Json/CSharpJsonParserTests_BasicTests.cs | 520 +++++++++--------- .../Json/CSharpJsonParserTests_NstTests.cs | 204 +++---- 2 files changed, 362 insertions(+), 362 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index d0a3028b0a38d..a7b3b44c13d33 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -102,9 +102,9 @@ public void TestFormFeed2() 1 - + , - + 0 @@ -135,9 +135,9 @@ public void TestFormFeed3() 0\f - + , - + 1 @@ -326,9 +326,9 @@ public void TestArray5() [ - + , - + ] @@ -354,9 +354,9 @@ public void TestArray6() true - + , - + ] @@ -402,12 +402,12 @@ public void TestArray8() [ - + , - - + + , - + ] @@ -433,12 +433,12 @@ public void TestArray9() true - + , - - + + , - + ] @@ -461,15 +461,15 @@ public void TestArray10() [ - + , - + true - + , - + ] @@ -492,12 +492,12 @@ public void TestArray11() [ - + , - - + + , - + true @@ -1043,9 +1043,9 @@ public void TestMultiObject1() 1 - + , - + 'second' : @@ -1053,9 +1053,9 @@ public void TestMultiObject1() 2 - + , - + 'third' : @@ -1092,9 +1092,9 @@ public void TestMultiObject2() 1 - + , - + ""second"" : @@ -1102,9 +1102,9 @@ public void TestMultiObject2() 2 - + , - + ""third"" : @@ -1160,9 +1160,9 @@ public void TestMissingColon() 0 - + , - + 'b' @@ -1220,10 +1220,10 @@ public void TestNestedPropertyMissingColon() ""A person"" - + , - + @@ -1234,10 +1234,10 @@ public void TestNestedPropertyMissingColon() ""object"" - + , - + @@ -1271,10 +1271,10 @@ public void TestNestedPropertyMissingColon() } - + , - + @@ -1295,10 +1295,10 @@ public void TestNestedPropertyMissingColon() ""array"" - + , - + @@ -1367,9 +1367,9 @@ public void TestMissingColon2() 0 - + , - + ""b"" @@ -1408,17 +1408,17 @@ public void TestAdditionalContentComma() ""Small"" - + , - + ""Medium"" - + , - + ""Large"" @@ -1426,9 +1426,9 @@ public void TestAdditionalContentComma() ] - + , - + @@ -1458,17 +1458,17 @@ public void TestAdditionalContentText() ""Small"" - + , - + ""Medium"" - + , - + ""Large"" @@ -2174,13 +2174,13 @@ public void TestObjectWithEmptyPropValue1() 'first' : - + - + - + , - + } @@ -2206,13 +2206,13 @@ public void TestObjectWithEmptyPropValue2() ""first"" : - + - + - + , - + } @@ -2300,9 +2300,9 @@ public void TestObjectWithEmptyPropValue5() 'first' : - + - + @@ -2331,9 +2331,9 @@ public void TestObjectWithEmptyPropValue6() ""first"" : - + - + @@ -2442,9 +2442,9 @@ public void TestMultiItemList() } - + , - + { @@ -2458,32 +2458,32 @@ public void TestMultiItemList() } - + , - + 1 - + , - + null - + , - + [ ] - + , - - + + , - + 'string' @@ -2522,9 +2522,9 @@ public void TestMultiItemList2() } - + , - + { @@ -2538,32 +2538,32 @@ public void TestMultiItemList2() } - + , - + 1 - + , - + null - + , - + [ ] - + , - - + + , - + ""string"" @@ -2604,9 +2604,9 @@ public void TestMultiLine1() 'bc' - + , - + 'd' : @@ -2652,9 +2652,9 @@ public void TestMultiLine2() ""bc"" - + , - + ""d"" : @@ -2710,10 +2710,10 @@ public void TestNestedObject() 'A person' - + , - + @@ -2724,10 +2724,10 @@ public void TestNestedObject() 'object' - + , - + @@ -2762,10 +2762,10 @@ public void TestNestedObject() } - + , - + @@ -2786,10 +2786,10 @@ public void TestNestedObject() 'array' - + , - + @@ -2876,10 +2876,10 @@ public void TestNestedObject1() ""A person"" - + , - + @@ -2890,10 +2890,10 @@ public void TestNestedObject1() ""object"" - + , - + @@ -2928,10 +2928,10 @@ public void TestNestedObject1() } - + , - + @@ -2952,10 +2952,10 @@ public void TestNestedObject1() ""array"" - + , - + @@ -3020,9 +3020,9 @@ public void TestLiterals1() '' - + , - + B : @@ -3030,19 +3030,19 @@ public void TestLiterals1() 1 - + , - + C : - + - + - + , - + D : @@ -3050,9 +3050,9 @@ public void TestLiterals1() 1.23 - + , - + E : @@ -3060,9 +3060,9 @@ public void TestLiterals1() 3.45 - + , - + F : @@ -3099,9 +3099,9 @@ public void TestLiterals2() """" - + , - + ""B"" : @@ -3109,9 +3109,9 @@ public void TestLiterals2() 1 - + , - + ""D"" : @@ -3119,9 +3119,9 @@ public void TestLiterals2() 1.23 - + , - + ""E"" : @@ -3129,9 +3129,9 @@ public void TestLiterals2() 3.45 - + , - + ""F"" : @@ -3184,130 +3184,130 @@ public void TestLiterals3() 1 - + , - + 0 - + , - + 1.1 - + , - + 0.0 - + , - + 0.000000000001 - + , - + 9999999999 - + , - + -9999999999 - + , - + 9999999999999999999999999999999999999999999999999999999999999999999999 - + , - + -9999999999999999999999999999999999999999999999999999999999999999999999 - + , - + 'true' - + , - + 'TRUE' - + , - + 'false' - + , - + 'FALSE' - + , - + @@ -3322,10 +3322,10 @@ public void TestLiterals3() '' - + , - + @@ -3358,9 +3358,9 @@ public void TestCommentsInArray() 1/*hi*/ - + , - + 2/*hi*/ @@ -3447,15 +3447,15 @@ public void TestOctal1() 0372 - + , - + 0xFA - + , - + 0XFA @@ -3505,10 +3505,10 @@ public void TestObjectLiteralComments() 'Apple' /*comment*/ - + , /*comment*/ - + @@ -3519,10 +3519,10 @@ public void TestObjectLiteralComments() '1' - + , - + @@ -3533,10 +3533,10 @@ public void TestObjectLiteralComments() 3.99 - + , - + @@ -3553,20 +3553,20 @@ public void TestObjectLiteralComments() 'Small' - + , /*comment*/ - + 'Medium' /*comment*/ - + , - + @@ -3614,39 +3614,39 @@ public void TestEmptyStrings() '' - + , - + '' - + , - + '' - + , - + '' - + , - + '' - + , - + '' - + , - + '' @@ -3675,39 +3675,39 @@ public void TestEmptyStrings2() """" - + , - + """" - + , - + """" - + , - + """" - + , - + """" - + , - + """" - + , - + """" @@ -3755,69 +3755,69 @@ public void TestSimpleEscapes() false - + , - + true - + , - + true - + , - + false - + , - + 'test!' - + , - + 1.11 - + , - + 0e-10 - + , - + 0E-10 - + , - + 0.25e-5 - + , - + 0.3e10 - + , - + 6.0221418e23 - + , - + 'Purple\r \n monkey\'s:\tdishwasher' @@ -3846,69 +3846,69 @@ public void TestSimpleEscapes2() false - + , - + true - + , - + true - + , - + false - + , - + ""test!"" - + , - + 1.11 - + , - + 0e-10 - + , - + 0E-10 - + , - + 0.25e-5 - + , - + 0.3e10 - + , - + 6.0221418e23 - + , - + ""Purple\r \n monkey\'s:\tdishwasher"" @@ -4125,9 +4125,9 @@ public void TestConstructor6() 1 - + , - + 2 @@ -4192,9 +4192,9 @@ public void TestConstructor8() A ( - + , - + ) @@ -4222,9 +4222,9 @@ public void TestConstructor9() 1 - + , - + ) @@ -4249,9 +4249,9 @@ public void TestConstructor10() A ( - + , - + 1 @@ -4282,9 +4282,9 @@ public void TestConstructor11() 1 - + , - + 1 @@ -4315,12 +4315,12 @@ public void TestConstructor12() 1 - + , - - + + , - + 1 @@ -4410,12 +4410,12 @@ public void TestMultipleCommasInObject() 0 - + , - - + + , - + 1 : diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs index 721a607bd6077..2f7f61428e73b 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs @@ -856,9 +856,9 @@ public void n_array_comma_after_close_json() ] - + , - + @@ -880,9 +880,9 @@ public void n_array_comma_and_number_json() [ - + , - + 1 @@ -911,12 +911,12 @@ public void n_array_double_comma_json() 1 - + , - - + + , - + 2 @@ -945,12 +945,12 @@ public void n_array_double_extra_comma_json() ""x"" - + , - - + + , - + ] @@ -1006,9 +1006,9 @@ public void n_array_extra_comma_json() """" - + , - + ] @@ -1179,9 +1179,9 @@ public void n_array_just_comma_json() [ - + , - + ] @@ -1231,9 +1231,9 @@ public void n_array_missing_value_json() [ - + , - + """" @@ -1264,23 +1264,23 @@ public void n_array_newlines_unclosed_json() ""a"" - + , - + 4 - + , - + 1 - + , - + @@ -1308,9 +1308,9 @@ public void n_array_number_and_comma_json() 1 - + , - + ] @@ -1336,12 +1336,12 @@ public void n_array_number_and_several_commas_json() 1 - + , - - + + , - + ] @@ -1421,9 +1421,9 @@ public void n_array_unclosed_trailing_comma_json() 1 - + , - + @@ -1453,17 +1453,17 @@ public void n_array_unclosed_with_new_lines_json() 1 - + , - + 1 - + , - + 1 @@ -2904,9 +2904,9 @@ public void n_object_bad_value_json() ""x"" - + , - + truth @@ -2975,9 +2975,9 @@ public void n_object_comma_instead_of_colon_json() ""x"" - + , - + null @@ -3109,9 +3109,9 @@ public void n_object_lone_continuation_byte_in_key_and_trailing_comma_json() ""0"" - + , - + } @@ -3227,9 +3227,9 @@ public void n_object_missing_value_json() ""a"" : - + - + @@ -3347,9 +3347,9 @@ public void n_object_repeated_null_null_json() null - + , - + null : @@ -3386,21 +3386,21 @@ public void n_object_several_trailing_commas_json() 0 - + , - - + + , - - + + , - - + + , - - + + , - + } @@ -3461,9 +3461,9 @@ public void n_object_trailing_comma_json() 0 - + , - + } @@ -3615,12 +3615,12 @@ public void n_object_two_commas_in_a_row_json() ""b"" - + , - - + + , - + ""c"" : @@ -3719,9 +3719,9 @@ public void n_object_with_single_string_json() ""bar"" - + , - + ""a"" @@ -4725,9 +4725,9 @@ public void n_structure_comma_instead_of_closing_brace_json() true - + , - + @@ -4900,9 +4900,9 @@ public void n_structure_object_unclosed_no_value_json() """" : - + - + @@ -5018,9 +5018,9 @@ public void n_structure_open_array_comma_json() [ - + , - + @@ -5178,9 +5178,9 @@ public void n_structure_open_object_comma_json() { - + , - + @@ -5488,9 +5488,9 @@ public void n_structure_unclosed_array_partial_null_json() false - + , - + nul @@ -5521,9 +5521,9 @@ public void n_structure_unclosed_array_unfinished_false_json() true - + , - + fals @@ -5554,9 +5554,9 @@ public void n_structure_unclosed_array_unfinished_true_json() false - + , - + tru @@ -5800,21 +5800,21 @@ public void y_array_heterogeneous_json() null - + , - + 1 - + , - + ""1"" - + , - + { @@ -5917,27 +5917,27 @@ public void y_array_with_several_null_json() 1 - + , - + null - + , - + null - + , - + null - + , - + 2 @@ -6430,9 +6430,9 @@ public void y_object_json() ""sdf"" - + , - + ""dfg"" : @@ -6494,9 +6494,9 @@ public void y_object_duplicated_key_json() ""b"" - + , - + ""a"" : @@ -6531,9 +6531,9 @@ public void y_object_duplicated_key_and_value_json() ""b"" - + , - + ""a"" : @@ -6641,9 +6641,9 @@ public void y_object_extreme_numbers_json() -1.0e+28 - + , - + ""max"" : @@ -6694,9 +6694,9 @@ public void y_object_long_strings_json() ] - + , - + ""id"" : From 25c715b7c122bb352b127655cbcb019382c67115 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 11 Jul 2018 13:16:10 -0700 Subject: [PATCH 023/110] Stop using obsolete member. --- .../AbstractEmbeddedLanguageCodeFixProvider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageCodeFixProvider.cs b/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageCodeFixProvider.cs index c88f1e3b7fb70..aad1ecd2e0ed2 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageCodeFixProvider.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageCodeFixProvider.cs @@ -65,7 +65,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) context.Diagnostics); } - return SpecializedTasks.EmptyTask; + return Task.CompletedTask; } protected override Task FixAllAsync( @@ -82,7 +82,7 @@ protected override Task FixAllAsync( } } - return SpecializedTasks.EmptyTask; + return Task.CompletedTask; } private class MyCodeAction : CodeAction.DocumentChangeAction From e867aedff91628f540cd289b2cb7bb9713a44ff9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 21 Jan 2022 17:52:57 -0800 Subject: [PATCH 024/110] XLF --- .../Core/Portable/WorkspacesResources.resx | 3 - .../Portable/xlf/WorkspacesResources.cs.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.de.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.es.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.fr.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.it.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.ja.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.ko.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.pl.xlf | 135 ++++++++++++++++++ .../xlf/WorkspacesResources.pt-BR.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.ru.xlf | 135 ++++++++++++++++++ .../Portable/xlf/WorkspacesResources.tr.xlf | 135 ++++++++++++++++++ .../xlf/WorkspacesResources.zh-Hans.xlf | 135 ++++++++++++++++++ .../xlf/WorkspacesResources.zh-Hant.xlf | 135 ++++++++++++++++++ 14 files changed, 1755 insertions(+), 3 deletions(-) diff --git a/src/Workspaces/Core/Portable/WorkspacesResources.resx b/src/Workspaces/Core/Portable/WorkspacesResources.resx index 5054f9559ff73..31120b3369eb0 100644 --- a/src/Workspaces/Core/Portable/WorkspacesResources.resx +++ b/src/Workspaces/Core/Portable/WorkspacesResources.resx @@ -657,7 +657,4 @@ Predefined conversion from {0} to {1}. - - foo - \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf index 778c4b26985b7..615ec835a8820 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf @@ -42,6 +42,16 @@ Příkaz CodeAction {0} nevytvořil změněné řešení. "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Základní možnosti pro EditorConfig @@ -62,21 +72,86 @@ Dokument nepodporuje stromy syntaxe. + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. Při čtení obsahu zdrojového souboru {0} došlo k chybě -- {1} + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Odsazení a mezery + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Předvolby nových řádků + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Na projekty odeslání se může odkazovat jen projekt odeslání. @@ -92,11 +167,26 @@ Předdefinovaný převod z {0} na {1} + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference Projekt neobsahuje zadaný odkaz. + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Pouze refaktoring @@ -122,6 +212,11 @@ Řešení neobsahuje zadaný odkaz. + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. Symbol {0} nepochází ze zdroje. @@ -207,6 +302,11 @@ Synchronizovat obor názvů se strukturou složek + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. Obsah dokumentu SourceGeneratedDocument nesmí být změněn. @@ -222,11 +322,31 @@ Řešení už zadaný odkaz obsahuje. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Neznámý + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Soubory jazyka Visual Basic @@ -247,6 +367,11 @@ Pracovní prostor není platný. + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} se nachází v jiném projektu. @@ -387,6 +512,11 @@ Očekávalo se {0}. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. {0} musí být neprázdný řetězec, který nemá hodnotu null. @@ -752,6 +882,11 @@ Změna vlastností dokumentu není podporovaná. + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions Konvence kódování v .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf index 3b33ebc674923..a466c50245afc 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf @@ -42,6 +42,16 @@ Durch CodeAction "{0}" wurde keine geänderte Lösung erstellt. "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Wichtige EditorConfig-Optionen @@ -62,21 +72,86 @@ Das Dokument unterstützt keine Syntaxstrukturen. + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. Fehler beim Lesen des Inhalts der Quelldatei "{0}": "{1}". + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Einzüge und Abstände + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Einstellungen für neue Zeilen + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Nur ein Übermittlungsprojekt kann auf Übermittlungsprojekte verweisen. @@ -92,11 +167,26 @@ Vordefinierte Konvertierung von "{0}" in "{1}". + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference Der angegebene Verweis ist im Projekt nicht enthalten. + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Nur Refactoring @@ -122,6 +212,11 @@ Der angegebene Verweis ist nicht in der Projektmappe enthalten. + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. Symbol "{0}" ist nicht aus Quelle. @@ -207,6 +302,11 @@ Namespace mit Ordnerstruktur synchronisieren + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. Der Inhalt eines SourceGeneratedDocument kann nicht geändert werden. @@ -222,11 +322,31 @@ Der angegebene Verweis ist bereits in der Projektmappe enthalten. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Unbekannt + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Visual Basic-Dateien @@ -247,6 +367,11 @@ Arbeitsbereich ist nicht leer. + + '{0}' expected + '{0}' expected + + {0} is in a different project. "{0}" befindet sich in einem anderen Projekt. @@ -387,6 +512,11 @@ Erwartet wird {0}. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" muss eine Zeichenfolge sein, die nicht null und nicht leer ist. @@ -752,6 +882,11 @@ Das Ändern der Dokumenteigenschaften wird nicht unterstützt. + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions .NET-Codierungskonventionen diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf index 28f0516522f55..d6cceebc3db50 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf @@ -42,6 +42,16 @@ El tipo CodeAction "{0}" no generó una solución modificada "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Opciones principales de EditorConfig @@ -62,21 +72,86 @@ El documento no admite árboles de sintaxis + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. Error al leer el contenido del archivo de origen "{0}"--"{1}". + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Sangría y espaciado + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Nuevas preferencias de línea + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Solo un proyecto de envío puede hacer referencia a proyectos de envío. @@ -92,11 +167,26 @@ Conversión predefinida de {0} a {1} + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference El proyecto no contiene la referencia especificada. + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Solo refactorización @@ -122,6 +212,11 @@ La solución no contiene la referencia especificada + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. El símbolo "{0}" no procede del código fuente. @@ -207,6 +302,11 @@ Sincronizar espacio de nombres con estructura de carpetas + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. No se puede cambiar el contenido de un elemento SourceGeneratedDocument. @@ -222,11 +322,31 @@ La solución ya contiene la referencia especificada. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Desconocido + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Archivos de Visual Basic @@ -247,6 +367,11 @@ El área de trabajo no está vacía. + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} está en un proyecto distinto. @@ -387,6 +512,11 @@ Se esperaba {0}. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" debe ser una cadena que no sea Null ni esté vacía. @@ -752,6 +882,11 @@ No se admite el cambio de propiedades de documentos + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions Convenciones de codificación .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf index b28c49f5e07d0..f6a189ada6a10 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf @@ -42,6 +42,16 @@ Le CodeAction '{0}' n'a pas produit de solution contenant des changements "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Options EditorConfig principales @@ -62,21 +72,86 @@ Le document ne prend pas en charge les arborescences de syntaxe + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. Erreur durant la lecture du contenu du fichier source '{0}' -- '{1}'. + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Indentation et espacement + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Préférences de nouvelle ligne + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Seul un projet de soumission peut référencer des projets de soumission. @@ -92,11 +167,26 @@ Conversion prédéfinie de {0} en {1}. + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference Le projet ne contient pas la référence spécifiée + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Refactorisation uniquement @@ -122,6 +212,11 @@ La solution ne contient pas la référence spécifiée + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. Le symbole "{0}" ne provient pas de la source. @@ -207,6 +302,11 @@ Synchroniser l'espace de noms avec la structure de dossier + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. Le contenu de SourceGeneratedDocument ne doit pas être changé. @@ -222,11 +322,31 @@ La solution contient déjà la référence spécifiée. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Inconnue + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Fichiers Visual Basic @@ -247,6 +367,11 @@ L'espace de travail n'est pas vide. + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} est dans un autre projet. @@ -387,6 +512,11 @@ {0} attendu. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" doit être une chaîne non null et non vide. @@ -752,6 +882,11 @@ Le changement des propriétés du document n'est pas pris en charge + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions Conventions de codage .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf index 833722dc62843..f60273f1ba836 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf @@ -42,6 +42,16 @@ L'elemento CodeAction '{0}' non ha generato una soluzione modificata "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Opzioni EditorConfig di base @@ -62,21 +72,86 @@ Il documento non supporta alberi di sintassi + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. Si è verificato un errore durante la lettura del contenuto del file di origine '{0}' - '{1}'. + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Rientro e spaziatura + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Preferenze per nuova riga + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Solo il progetto di invio può fare riferimento a progetti di invio. @@ -92,11 +167,26 @@ Conversione predefinita da {0} a {1}. + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference Il progetto non contiene il riferimento specificato + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Solo refactoring @@ -122,6 +212,11 @@ La soluzione non contiene il riferimento specificato + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. Il simbolo "{0}" non proviene dall'origine. @@ -207,6 +302,11 @@ Sincronizza lo spazio dei nomi con la struttura di cartelle + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. Non è possibile modificare il contenuto di un elemento SourceGeneratedDocument. @@ -222,11 +322,31 @@ La soluzione contiene già il riferimento specificato. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Unbekannt + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files File Visual Basic @@ -247,6 +367,11 @@ L'area di lavoro non è vuota. + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} si trova in un progetto diverso. @@ -387,6 +512,11 @@ È previsto '{0}'. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" deve essere una stringa non Null e non vuota. @@ -752,6 +882,11 @@ La modifica delle proprietà del documento non è supportata + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions Convenzioni di scrittura codice .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf index 055f08def46cc..960c56cd001c3 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf @@ -42,6 +42,16 @@ CodeAction '{0}' は変更されたソリューションを生成しませんでした "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options コア EditorConfig オプション @@ -62,21 +72,86 @@ ドキュメントでは構文ツリーがサポートされません + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. ソース ファイル '{0}' のコンテンツの読み取りでエラーが発生しました -- '{1}'。 + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing インデントと間隔 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences 改行設定 + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. 送信プロジェクトを参照できるのは、送信プロジェクトのみです。 @@ -92,11 +167,26 @@ {0} から {1} への定義済みの変換 + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference 指定された参照がプロジェクトに含まれていません + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only リファクタリングのみ @@ -122,6 +212,11 @@ 指定された参照がソリューションに含まれていません + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. シンボル "{0}" は、ソースからではありません。 @@ -207,6 +302,11 @@ 名前空間とフォルダー構造の同期 + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. SourceGeneratedDocument のコンテンツが変更されない可能性があります。 @@ -222,11 +322,31 @@ このソリューションには、指定された参照が既に含まれています。 + + Trailing comma not allowed + Trailing comma not allowed + + Unknown 不明 + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Visual Basic ファイル @@ -247,6 +367,11 @@ ワークスペースが空ではありません。 + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} は別のプロジェクトに含まれています。 @@ -387,6 +512,11 @@ {0} が必要です。 + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" は、Null 以外の空でない文字列にする必要があります。 @@ -752,6 +882,11 @@ ドキュメントのプロパティの変更はサポートされていません + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions .NET コーディング規則 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf index 27fe20e964e11..5bc3991cbfe41 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf @@ -42,6 +42,16 @@ CodeAction '{0}'이(가) 변경된 솔루션을 생성하지 않았습니다. "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options 코어 EditorConfig 옵션 @@ -62,21 +72,86 @@ 문서가 구문 트리를 지원하지 않음 + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. 소스 파일 '{0}'의 콘텐츠를 읽는 동안 오류가 발생했습니다. -- '{1}'. + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing 들여쓰기 및 간격 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences 새 줄 기본 설정 + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. 제출 프로젝트만 제출 프로젝트를 참조할 수 있습니다. @@ -92,11 +167,26 @@ {0}에서 {1}(으)로의 미리 정의된 변환입니다. + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference 지정된 참조가 프로젝트에 포함되어 있지 않습니다. + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only 리팩터링만 @@ -122,6 +212,11 @@ 지정된 참조가 솔루션에 포함되어 있지 않습니다. + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. "{0}" 기호가 소스에 없습니다. @@ -207,6 +302,11 @@ 네임스페이스를 폴더 구조로 동기화 + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. SourceGeneratedDocument의 콘텐츠는 변경할 수 없습니다. @@ -222,11 +322,31 @@ 지정된 참조가 이미 솔루션에 포함되어 있습니다. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown 알 수 없음 + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Visual Basic 파일 @@ -247,6 +367,11 @@ 작업 영역이 비어 있지 않습니다. + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0}이(가) 다른 프로젝트에 있습니다. @@ -387,6 +512,11 @@ {0}이(가) 필요합니다. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}"은(는) null이 아니거나 비어 있지 않은 문자열이어야 합니다. @@ -752,6 +882,11 @@ 문서 속성 변경은 지원되지 않습니다. + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions .NET 코딩 규칙 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf index bf6c1799e126d..81cedf168c5ef 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf @@ -42,6 +42,16 @@ Element CodeAction „{0}” nie utworzył zmienionego rozwiązania "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Podstawowe opcje EditorConfig @@ -62,21 +72,86 @@ Dokument nie obsługuje drzew składni + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. Błąd podczas odczytywania zawartości pliku źródłowego „{0}”--„{1}”. + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Wcięcia i odstępy + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Preferencje nowego wiersza + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Tylko przesyłany projekt może odwoływać się do przesyłanych projektów. @@ -92,11 +167,26 @@ Wstępnie zdefiniowana konwersja z {0} na {1}. + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference Projekt nie zawiera określonego odwołania + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Tylko refaktoryzacja @@ -122,6 +212,11 @@ Rozwiązanie nie zawiera określonego odwołania + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. Symbol „{0}” nie pochodzi ze źródła. @@ -207,6 +302,11 @@ Synchronizuj przestrzeń nazw ze strukturą folderów + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. Nie można zmienić zawartości elementu SourceGeneratedDocument. @@ -222,11 +322,31 @@ Rozwiązanie już zawiera określone odwołanie. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Nieznany + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Pliki języka Visual Basic @@ -247,6 +367,11 @@ Obszar roboczy nie jest pusty. + + '{0}' expected + '{0}' expected + + {0} is in a different project. Element {0} znajduje się w innym projekcie. @@ -387,6 +512,11 @@ Oczekiwano elementu {0}. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. Element „{0}” musi być ciągiem, który nie ma wartości null i nie jest pusty. @@ -752,6 +882,11 @@ Zmiana właściwości dokumentów nie jest obsługiwana + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions Konwencje kodowania .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf index 4079e600970ba..206e46a8d0f07 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf @@ -42,6 +42,16 @@ A CodeAction '{0}' não produziu uma solução alterada "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Opções Principais do EditorConfig @@ -62,21 +72,86 @@ O documento não dá suporte a árvores de sintaxe + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. Erro ao ler o conteúdo do arquivo de origem '{0}' – '{1}'. + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Recuo e espaçamento + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Preferências de nova linha + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Somente o projeto de envio pode fazer referência a projetos de envio. @@ -92,11 +167,26 @@ Conversão predefinida de {0} em {1}. + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference O projeto não contém a referência especificada + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Somente Refatoração @@ -122,6 +212,11 @@ A solução não contém a referência especificada + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. Símbolo "{0}" não é da fonte. @@ -207,6 +302,11 @@ Sincronizar namespace com a estrutura de pasta + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. O conteúdo de um SourceGeneratedDocument não pode ser alterado. @@ -222,11 +322,31 @@ A solução já contém a referência especificada. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Desconhecido + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Arquivos do Visual Basic @@ -247,6 +367,11 @@ Workspace não está vazio. + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} está em um projeto diferente. @@ -387,6 +512,11 @@ Esperado {0}. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" deve ser uma cadeia de caracteres não nula e não vazia. @@ -752,6 +882,11 @@ Não há suporte para alterar as propriedades do documento + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions Convenções de codificação .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf index f84d7e5a5fce0..6cda3edb0d828 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf @@ -42,6 +42,16 @@ Действие кода "{0}" не сформировало измененное решение. "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Основные параметры EditorConfig @@ -62,21 +72,86 @@ Документ не поддерживает синтаксические деревья. + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. Ошибка при чтении содержимого исходного файла "{0}" — "{1}". + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Отступы и интервалы + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Предпочтения для новых строк + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Только проект отправки может ссылаться на другие проекты отправки. @@ -92,11 +167,26 @@ Предварительно определенное преобразование из {0} в {1}. + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference Проект не содержит указанную ссылку. + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Только рефакторинг @@ -122,6 +212,11 @@ Решение не содержит указанную ссылку. + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. Символ "{0}" не из источника. @@ -207,6 +302,11 @@ Синхронизировать пространство имен со структурой папок + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. Содержимое SourceGeneratedDocument не может быть изменено. @@ -222,11 +322,31 @@ Решение уже содержит указанную ссылку. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Unbekannt + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Файлы Visual Basic @@ -247,6 +367,11 @@ Рабочая область не пуста. + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} находится в другом проекте. @@ -387,6 +512,11 @@ Требуется {0}. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" не должен равняться Null и пустой строке. @@ -752,6 +882,11 @@ Изменение свойств документа не поддерживается + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions Рекомендации по написанию кода .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf index 134a34cbdb11b..27108f4e9c325 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf @@ -42,6 +42,16 @@ '{0}' CodeAction, değiştirilmiş çözüm üretmedi "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Çekirdek EditorConfig seçenekleri @@ -62,21 +72,86 @@ Belge, söz dizimi ağaçlarını desteklemiyor + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. '{0}' kaynak dosyasının içeriği okunurken hata oluştu -- '{1}'. + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing Girinti ve aralığı + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences Yeni satır tercihleri + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. Gönderim projelerine yalnızca gönderim projesi başvurabilir. @@ -92,11 +167,26 @@ {0} öğesinden {1} öğesine dönüştürme önceden tanımlandı. + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference Proje belirtilen başvuruyu içermiyor + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only Sadece Yeniden Düzenlenme @@ -122,6 +212,11 @@ Çözüm belirtilen başvuruyu içermiyor + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. "{0}" sembolü kaynağa ait değil. @@ -207,6 +302,11 @@ Ad alanını klasör yapısına eşitle + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. SourceGeneratedDocument'ın içeriği değiştirilemez. @@ -222,11 +322,31 @@ Çözüm belirtilen başvuruyu zaten içeriyor. + + Trailing comma not allowed + Trailing comma not allowed + + Unknown Bilinmiyor + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Visual Basic dosyaları @@ -247,6 +367,11 @@ Çalışma alanı boş değil. + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0}, farklı bir projede. @@ -387,6 +512,11 @@ {0} bekleniyor. + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" null olmayan ve boş olmayan bir dize olmalıdır. @@ -752,6 +882,11 @@ Belge özelliklerinin değiştirilmesi desteklenmiyor + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions .NET kodlama kuralları diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf index d7f065176dd1f..6cc5fd8bbb0ef 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf @@ -42,6 +42,16 @@ CodeAction "{0}" 未生成更改的解决方案 "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options Core EditorConfig 选项 @@ -62,21 +72,86 @@ 文档不支持语法树 + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. 读取源文件“{0}”中的内容时出错 -“{1}”。 + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing 缩进和间距 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences 新行首选项 + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. 只有提交项目才能引用提交项目。 @@ -92,11 +167,26 @@ 从 {0} 到 {1} 的预定义转换。 + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference 项目不包含指定的引用 + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only 仅重构 @@ -122,6 +212,11 @@ 解决方案不包含指定的引用 + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. 符号“{0}”不是来自源。 @@ -207,6 +302,11 @@ 将命名空间同步到文件夹结构 + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. 不能更改 SourceGeneratedDocument 的内容。 @@ -222,11 +322,31 @@ 解决方案已包含指定的引用。 + + Trailing comma not allowed + Trailing comma not allowed + + Unknown 未知 + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files visual basic 文件 @@ -247,6 +367,11 @@ 工作区不为空。 + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} 位于不同的项目中。 @@ -387,6 +512,11 @@ 应为 {0}。 + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. “{0}”必须是一个非 null 和非空的字符串。 @@ -752,6 +882,11 @@ 不支持更改文档属性 + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions .NET 编码约定 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf index 939d15173014c..a6d591072ba3b 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf @@ -42,6 +42,16 @@ CodeAction '{0}' 未產生變更的解決方案 "CodeAction" is a specific type, and {0} represents the title shown by the action. + + Comments not allowed + Comments not allowed + + + + Constructors not allowed + Constructors not allowed + + Core EditorConfig Options 核心 EditorConfig 選項 @@ -62,21 +72,86 @@ 文件不支援語法樹 + + Enable JSON editor features + Enable JSON editor features + + + + Error parsing comment + Error parsing comment + + Error reading content of source file '{0}' -- '{1}'. 讀取來源檔案 '{0}' 的內容時發生錯誤 -- '{1}'。 + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Indentation and spacing 縮排和間距 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + + + JSON issue: {0} + JSON issue: {0} + + + + Missing property value + Missing property value + + + + Name expected + Name expected + + + + Nested properties not allowed + Nested properties not allowed + + New line preferences 新行喜好設定 + + Only properties allowed in an object + Only properties allowed in an object + + Only submission project can reference submission projects. 只有提交專案可以參考提交專案。 @@ -92,11 +167,26 @@ 從 {0} 到 {1} 預先定義的轉換。 + + Probable JSON string detected + Probable JSON string detected + + Project does not contain specified reference 專案未包含指定的參考 + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Refactoring Only 僅重構 @@ -122,6 +212,11 @@ 解決方案未包含指定的參考 + + Strings must start with " not ' + Strings must start with " not ' + + Symbol "{0}" is not from source. 符號 "{0}" 非來自來源。 @@ -207,6 +302,11 @@ 將命名空間同步到資料夾結構 + + Syntax error + Syntax error + + The contents of a SourceGeneratedDocument may not be changed. SourceGeneratedDocument 的內容可能無法變更。 @@ -222,11 +322,31 @@ 解決方案已包含指定的參考。 + + Trailing comma not allowed + Trailing comma not allowed + + Unknown 不明 + + Unterminated comment + Unterminated comment + + + + Unterminated string + Unterminated string + + + + Value required + Value required + + Visual Basic files Visual Basic 檔案 @@ -247,6 +367,11 @@ 工作區不是空的。 + + '{0}' expected + '{0}' expected + + {0} is in a different project. {0} 位於不同的專案中。 @@ -387,6 +512,11 @@ 必須是 {0}。 + + '{0}' literal not allowed + '{0}' literal not allowed + + "{0}" must be a non-null and non-empty string. "{0}" 必須是非 null 和非空白的字串。 @@ -752,6 +882,11 @@ 不支援變更文件屬性 + + '{0}' unexpected + '{0}' unexpected + + .NET Coding Conventions .NET 編碼慣例 From 34872c408507d2720bca83526ab9796c701023be Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 21 Jan 2022 18:07:08 -0800 Subject: [PATCH 025/110] WIP --- .../EmbeddedLanguages/Json/JsonLexer.cs | 28 ++--- .../EmbeddedLanguages/Json/JsonOptions.cs | 105 +++++++++++------- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 19 ++-- .../Json/JsonParser.StrictSyntaxChecker.cs | 6 +- .../EmbeddedLanguages/Json/JsonParser.cs | 41 +++---- .../Common/EmbeddedSyntaxToken.cs | 4 +- 6 files changed, 106 insertions(+), 97 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index cce55d7153eeb..115c3600ba41a 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -29,7 +29,7 @@ public JsonLexer(VirtualCharSequence text) : this() public VirtualChar CurrentChar => Position < Text.Length ? Text[Position] - : new VirtualChar((char)0, span: default); + : VirtualChar.Create((char)0, span: default); public VirtualCharSequence GetCharsToCurrentPosition(int start) => this.Text.GetSubSequence(TextSpan.FromBounds(start, Position)); @@ -58,10 +58,10 @@ public JsonToken ScanNextToken() return token; } - private bool IsSpecial(char ch) + private static bool IsSpecial(VirtualChar ch) { // Standard tokens. - switch (ch) + switch (ch.Value) { case '{': case '}': @@ -96,7 +96,7 @@ private bool IsSpecial(char ch) private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic? diagnostic) ScanNextTokenWorker() { Debug.Assert(Position < Text.Length); - switch (this.CurrentChar) + switch (this.CurrentChar.Value) { case '{': return ScanSingleCharToken(JsonKind.OpenBraceToken); case '}': return ScanSingleCharToken(JsonKind.CloseBraceToken); @@ -131,28 +131,27 @@ private bool IsSpecial(char ch) private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic?) ScanString() { var start = Position; - var openChar = this.CurrentChar.Char; + var openChar = this.CurrentChar; Position++; EmbeddedDiagnostic? diagnostic = null; while (Position < Text.Length) { - var currentCh = this.CurrentChar.Char; + var currentCh = this.CurrentChar; Position++; - switch (currentCh) + switch (currentCh.Value) { case '"': case '\'': if (currentCh == openChar) - { return (GetCharsToCurrentPosition(start), JsonKind.StringToken, diagnostic); - } + continue; case '\\': var escapeDiag = ScanEscape(start, Position - 1); - diagnostic = diagnostic ?? escapeDiag; + diagnostic ??= escapeDiag; continue; } } @@ -176,7 +175,7 @@ private bool IsSpecial(char ch) } var currentCh = this.CurrentChar; - switch (currentCh) + switch (currentCh.Value) { case 'b': case 't': @@ -204,7 +203,7 @@ private bool IsSpecial(char ch) private EmbeddedDiagnostic? ScanUnicodeChars(int escapeStart, int unicodeCharStart) { var invalid = false; - for (int i = 0; this.Position < Text.Length && i < 4; i++) + for (var i = 0; this.Position < Text.Length && i < 4; i++) { var ch = this.CurrentChar; Position++; @@ -221,7 +220,7 @@ private bool IsSpecial(char ch) return null; } - private static bool IsHexDigit(char c) + private static bool IsHexDigit(VirtualChar c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || @@ -232,11 +231,8 @@ private static bool IsHexDigit(char c) { var start = Position; - var firstChar = this.CurrentChar; while (Position < Text.Length && !IsSpecial(this.CurrentChar)) - { Position++; - } return (GetCharsToCurrentPosition(start), JsonKind.TextToken, null); } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs index 540bdd9281134..c46b954aa75b1 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs @@ -5,56 +5,79 @@ using System; using System.Collections.Immutable; using System.Composition; +using System.Runtime.Serialization; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json { - internal class JsonOptions + [DataContract] + internal readonly record struct JsonOptions( + [property: DataMember(Order = 0)] bool ColorizeJsonPatterns, + [property: DataMember(Order = 1)] bool ReportInvalidJsonPatterns, + [property: DataMember(Order = 2)] bool HighlightRelatedJsonComponentsUnderCursor, + [property: DataMember(Order = 3)] bool DetectAndOfferEditorFeaturesForProbableJsonStrings) { - public static PerLanguageOption ColorizeJsonPatterns = - new PerLanguageOption( - nameof(JsonOptions), - nameof(ColorizeJsonPatterns), - defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ColorizeJsonPatterns")); - - public static PerLanguageOption ReportInvalidJsonPatterns = - new PerLanguageOption( - nameof(JsonOptions), - nameof(ReportInvalidJsonPatterns), - defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")); - - public static PerLanguageOption HighlightRelatedJsonComponentsUnderCursor = - new PerLanguageOption( - nameof(JsonOptions), - nameof(HighlightRelatedJsonComponentsUnderCursor), - defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")); - - public static PerLanguageOption DetectAndOfferEditorFeaturesForProbableJsonStrings = - new PerLanguageOption( - nameof(JsonOptions), - nameof(DetectAndOfferEditorFeaturesForProbableJsonStrings), - defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DetectAndOfferEditorFeaturesForProbableJsonStrings")); - } - - [ExportOptionProvider, Shared] - internal class JsonOptionsProvider : IOptionProvider - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public JsonOptionsProvider() + [ExportSolutionOptionProvider, Shared] + internal sealed class Metadata : IOptionProvider { + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public Metadata() + { + } + + public ImmutableArray Options { get; } = ImmutableArray.Create( + ColorizeJsonPatterns, + ReportInvalidJsonPatterns, + HighlightRelatedJsonComponentsUnderCursor, + DetectAndOfferEditorFeaturesForProbableJsonStrings); + + public static PerLanguageOption ColorizeJsonPatterns = + new PerLanguageOption( + nameof(JsonOptions), + nameof(ColorizeJsonPatterns), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ColorizeJsonPatterns")); + + public static PerLanguageOption ReportInvalidJsonPatterns = + new PerLanguageOption( + nameof(JsonOptions), + nameof(ReportInvalidJsonPatterns), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")); + + public static PerLanguageOption HighlightRelatedJsonComponentsUnderCursor = + new PerLanguageOption( + nameof(JsonOptions), + nameof(HighlightRelatedJsonComponentsUnderCursor), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")); + + public static PerLanguageOption DetectAndOfferEditorFeaturesForProbableJsonStrings = + new PerLanguageOption( + nameof(JsonOptions), + nameof(DetectAndOfferEditorFeaturesForProbableJsonStrings), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DetectAndOfferEditorFeaturesForProbableJsonStrings")); } - public ImmutableArray Options { get; } = ImmutableArray.Create( - JsonOptions.ColorizeJsonPatterns, - JsonOptions.ReportInvalidJsonPatterns, - JsonOptions.HighlightRelatedJsonComponentsUnderCursor, - JsonOptions.DetectAndOfferEditorFeaturesForProbableJsonStrings); + public static readonly JsonOptions Default + = new( + ColorizeJsonPatterns: Metadata.ColorizeJsonPatterns.DefaultValue, + ReportInvalidJsonPatterns: Metadata.ReportInvalidJsonPatterns.DefaultValue, + HighlightRelatedJsonComponentsUnderCursor: Metadata.HighlightRelatedJsonComponentsUnderCursor.DefaultValue, + DetectAndOfferEditorFeaturesForProbableJsonStrings: Metadata.DetectAndOfferEditorFeaturesForProbableJsonStrings.DefaultValue); + + public static JsonOptions From(Project project) + => From(project.Solution.Options, project.Language); + + public static JsonOptions From(OptionSet options, string language) + => new( + ColorizeJsonPatterns: options.GetOption(Metadata.ColorizeJsonPatterns, language), + ReportInvalidJsonPatterns: options.GetOption(Metadata.ReportInvalidJsonPatterns, language), + HighlightRelatedJsonComponentsUnderCursor: options.GetOption(Metadata.HighlightRelatedJsonComponentsUnderCursor, language), + DetectAndOfferEditorFeaturesForProbableJsonStrings: options.GetOption(Metadata.DetectAndOfferEditorFeaturesForProbableJsonStrings, language)); } } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index bd550ba2e02e2..8684a55441671 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -76,7 +76,7 @@ private static class JsonNetSyntaxChecker // https://github.com/JamesNK/Newtonsoft.Json/blob/993215529562866719689206e27e413013d4439c/Src/Newtonsoft.Json/JsonTextReader.cs#L1926 // So as to match Newtonsoft.Json's behavior around number parsing. var chars = numberToken.VirtualChars; - var firstChar = chars[0].Char; + var firstChar = chars[0]; var singleDigit = char.IsDigit(firstChar) && chars.Length == 1; if (singleDigit) @@ -165,17 +165,14 @@ private static bool IsValidConstructorName(JsonToken nameToken) // a comma. for (int i = 0, n = node.ChildCount - 1; i < n; i++) { - var child = node.ChildAt(i).Node; - if (child.Kind != JsonKind.CommaValue) + var child = node.ChildAt(i); + var nextChild = node.ChildAt(i + 1); + if (child.Kind != JsonKind.CommaValue && + nextChild.Kind != JsonKind.CommaValue) { - var next = node.ChildAt(i + 1).Node; - - if (next.Kind != JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_expected, ','), - GetFirstToken(next).GetSpan()); - } + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_expected, ','), + GetFirstToken(nextChild).GetSpan()); } } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 1f4352b6ccb19..19f40e0c793eb 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -75,7 +75,7 @@ private static class StrictSyntaxChecker { foreach (var ch in trivia.VirtualChars) { - switch (ch.Char) + switch (ch.Value) { case ' ': case '\t': @@ -272,7 +272,7 @@ Numeric values that cannot be represented in the grammar below (such private static EmbeddedDiagnostic? CheckString(JsonToken literalToken) { var chars = literalToken.VirtualChars; - if (chars[0].Char == '\'') + if (chars[0] == '\'') { return new EmbeddedDiagnostic( WorkspacesResources.Strings_must_start_with_double_quote_not_single_quote, @@ -281,7 +281,7 @@ Numeric values that cannot be represented in the grammar below (such for (int i = 1, n = chars.Length - 1; i < n; i++) { - if (chars[i].Char < ' ') + if (chars[i] < ' ') { return new EmbeddedDiagnostic( WorkspacesResources.Illegal_string_character, diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 10d0ffde9f086..56dddcc588858 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -163,7 +163,7 @@ private JsonTree ParseTree(bool strict) // the top level can't have more than one actual value. var firstToken = GetFirstToken(arraySequence.ChildAt(1).Node); return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_unexpected, firstToken.VirtualChars[0].Char), + string.Format(WorkspacesResources._0_unexpected, firstToken.VirtualChars[0]), firstToken.GetSpan()); } @@ -182,12 +182,9 @@ private JsonTree ParseTree(bool strict) return null; } - private static JsonToken GetFirstToken(JsonNode node) + private static JsonToken GetFirstToken(JsonNodeOrToken nodeOrToken) { - var child = node.ChildAt(0); - return child.IsNode - ? GetFirstToken(child.Node) - : child.Token; + return nodeOrToken.IsNode ? GetFirstToken(nodeOrToken.Node.ChildAt(0)) : nodeOrToken.Token; } private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonNode node) @@ -370,7 +367,7 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) // Look for constructors (a json.net extension). We'll report them as an error // in strict model. - if (Matches(token, "new")) + if (JsonParser.Matches(token, "new")) { return ParseConstructor(token); } @@ -378,17 +375,17 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) // Check for certain literal values. Some of these (like NaN) are json.net only. // We'll check for these later in the strict-mode pass. Debug.Assert(token.VirtualChars.Length > 0); - if (TryMatch(token, "NaN", JsonKind.NaNLiteralToken, out var newKind) || - TryMatch(token, "true", JsonKind.TrueLiteralToken, out newKind) || - TryMatch(token, "null", JsonKind.NullLiteralToken, out newKind) || - TryMatch(token, "false", JsonKind.FalseLiteralToken, out newKind) || - TryMatch(token, "Infinity", JsonKind.InfinityLiteralToken, out newKind) || - TryMatch(token, "undefined", JsonKind.UndefinedLiteralToken, out newKind)) + if (JsonParser.TryMatch(token, "NaN", JsonKind.NaNLiteralToken, out var newKind) || + JsonParser.TryMatch(token, "true", JsonKind.TrueLiteralToken, out newKind) || + JsonParser.TryMatch(token, "null", JsonKind.NullLiteralToken, out newKind) || + JsonParser.TryMatch(token, "false", JsonKind.FalseLiteralToken, out newKind) || + JsonParser.TryMatch(token, "Infinity", JsonKind.InfinityLiteralToken, out newKind) || + JsonParser.TryMatch(token, "undefined", JsonKind.UndefinedLiteralToken, out newKind)) { return new JsonLiteralNode(token.With(kind: newKind)); } - if (Matches(token, "-Infinity")) + if (JsonParser.Matches(token, "-Infinity")) { SplitLiteral(token, out var minusToken, out var newLiteralToken); @@ -404,7 +401,7 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) return new JsonTextNode( token.With(kind: JsonKind.TextToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_unexpected, firstChar.Char), + string.Format(WorkspacesResources._0_unexpected, firstChar.ToString()), firstChar.Span))); } @@ -428,9 +425,9 @@ private JsonConstructorNode ParseConstructor(JsonToken token) return result; } - private bool TryMatch(JsonToken token, string val, JsonKind kind, out JsonKind newKind) + private static bool TryMatch(JsonToken token, string val, JsonKind kind, out JsonKind newKind) { - if (Matches(token, val)) + if (JsonParser.Matches(token, val)) { newKind = kind; return true; @@ -440,20 +437,16 @@ private bool TryMatch(JsonToken token, string val, JsonKind kind, out JsonKind n return false; } - private bool Matches(JsonToken token, string val) + private static bool Matches(JsonToken token, string val) { var chars = token.VirtualChars; if (chars.Length != val.Length) - { return false; - } - for (int i = 0; i < val.Length; i++) + for (var i = 0; i < val.Length; i++) { - if (chars[i].Char != val[i]) - { + if (chars[i] != val[i]) return false; - } } return true; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs index 4c93bed8823e3..9d4dc9feb56da 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs @@ -23,14 +23,14 @@ internal struct EmbeddedSyntaxToken where TSyntaxKind : struct /// Returns the value of the token. For example, if the token represents an integer capture, /// then this property would return the actual integer. /// - public readonly object Value; + public readonly object? Value; public EmbeddedSyntaxToken( TSyntaxKind kind, ImmutableArray> leadingTrivia, VirtualCharSequence virtualChars, ImmutableArray> trailingTrivia, - ImmutableArray diagnostics, object value) + ImmutableArray diagnostics, object? value) { Debug.Assert(!leadingTrivia.IsDefault); Debug.Assert(!virtualChars.IsDefault); From 5d6dc079865e0d94576c1b61a632fe10dc226d47 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 22 Jan 2022 10:18:17 -0800 Subject: [PATCH 026/110] GEt building --- .../EmbeddedLanguages/Json/JsonLexer.cs | 13 +--- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 57 +++++++-------- .../Json/JsonParser.StrictSyntaxChecker.cs | 69 +++++++++++-------- .../EmbeddedLanguages/Json/JsonParser.cs | 4 +- .../VirtualChars/VirtualChar.cs | 9 +++ 5 files changed, 85 insertions(+), 67 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 115c3600ba41a..cd4bdbae2f982 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -85,10 +85,8 @@ private static bool IsSpecial(VirtualChar ch) } // more trivia - if (char.IsWhiteSpace(ch)) - { + if (ch.IsWhiteSpace) return true; - } return false; } @@ -248,8 +246,6 @@ private ImmutableArray ScanTrivia(bool leading) { var result = ArrayBuilder.GetInstance(); - var start = Position; - while (Position < Text.Length) { var comment = ScanComment(); @@ -402,16 +398,11 @@ private bool TextAt(int position, string val) private JsonTrivia? ScanWhitespace() { var start = Position; - while (Position < Text.Length && - char.IsWhiteSpace(this.CurrentChar)) - { + while (Position < Text.Length && this.CurrentChar.IsWhiteSpace) Position++; - } if (Position > start) - { return CreateTrivia(JsonKind.WhitespaceTrivia, GetCharsToCurrentPosition(start)); - } return null; } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index 8684a55441671..6e77b112f4976 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -78,11 +78,9 @@ private static class JsonNetSyntaxChecker var chars = numberToken.VirtualChars; var firstChar = chars[0]; - var singleDigit = char.IsDigit(firstChar) && chars.Length == 1; + var singleDigit = firstChar.IsDigit && chars.Length == 1; if (singleDigit) - { return null; - } var nonBase10 = firstChar == '0' && chars.Length > 1 && @@ -121,12 +119,15 @@ private static class JsonNetSyntaxChecker { foreach (var child in node.Sequence) { - var childNode = child.Node; - if (childNode.Kind == JsonKind.Property) + if (child.IsNode) { - return new EmbeddedDiagnostic( - WorkspacesResources.Properties_not_allowed_in_an_array, - ((JsonPropertyNode)childNode).ColonToken.GetSpan()); + var childNode = child.Node; + if (childNode.Kind == JsonKind.Property) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Properties_not_allowed_in_an_array, + ((JsonPropertyNode)childNode).ColonToken.GetSpan()); + } } } @@ -150,10 +151,8 @@ private static bool IsValidConstructorName(JsonToken nameToken) { foreach (var vc in nameToken.VirtualChars) { - if (!char.IsLetterOrDigit(vc.Char)) - { + if (!vc.IsLetterOrDigit) return false; - } } return true; @@ -183,24 +182,28 @@ private static bool IsValidConstructorName(JsonToken nameToken) { for (int i = 0, n = node.Sequence.ChildCount; i < n; i++) { - var child = node.Sequence.ChildAt(i).Node; - - if (i % 2 == 0) + var child = node.Sequence.ChildAt(i); + if (child.IsNode) { - if (child.Kind != JsonKind.Property) + var childNode = child.Node; + + if (i % 2 == 0) { - return new EmbeddedDiagnostic( - WorkspacesResources.Only_properties_allowed_in_an_object, - GetFirstToken(child).GetSpan()); + if (childNode.Kind != JsonKind.Property) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Only_properties_allowed_in_an_object, + GetFirstToken(child).GetSpan()); + } } - } - else - { - if (child.Kind != JsonKind.CommaValue) + else { - return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_expected, ','), - GetFirstToken(child).GetSpan()); + if (childNode.Kind != JsonKind.CommaValue) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_expected, ','), + GetFirstToken(child).GetSpan()); + } } } } @@ -234,8 +237,8 @@ private static bool IsLegalPropertyNameText(JsonToken textToken) return true; } - private static bool IsLegalPropertyNameChar(char ch) - => char.IsLetterOrDigit(ch) || ch == '_' || ch == '$'; + private static bool IsLegalPropertyNameChar(VirtualChar ch) + => ch.IsLetterOrDigit || ch == '_' || ch == '$'; } } } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 19f40e0c793eb..5561238229462 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -113,12 +113,15 @@ private static class StrictSyntaxChecker var sequence = node.Sequence; foreach (var child in sequence) { - var childNode = child.Node; - if (childNode.Kind != JsonKind.Property && childNode.Kind != JsonKind.CommaValue) + if (child.IsNode) { - return new EmbeddedDiagnostic( - WorkspacesResources.Only_properties_allowed_in_an_object, - GetFirstToken(childNode).GetSpan()); + var childNode = child.Node; + if (childNode.Kind != JsonKind.Property && childNode.Kind != JsonKind.CommaValue) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Only_properties_allowed_in_an_object, + GetFirstToken(childNode).GetSpan()); + } } } @@ -129,12 +132,15 @@ private static class StrictSyntaxChecker { foreach (var child in node.Sequence) { - var childNode = child.Node; - if (childNode.Kind == JsonKind.Property) + if (child.IsNode) { - return new EmbeddedDiagnostic( - WorkspacesResources.Properties_not_allowed_in_an_array, - ((JsonPropertyNode)childNode).ColonToken.GetSpan()); + var childNode = child.Node; + if (childNode.Kind == JsonKind.Property) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Properties_not_allowed_in_an_array, + ((JsonPropertyNode)childNode).ColonToken.GetSpan()); + } } } @@ -146,32 +152,41 @@ private static class StrictSyntaxChecker // Ensure that this sequence is actually a separated list. for (int i = 0, n = sequence.ChildCount; i < n; i++) { - var child = sequence.ChildAt(i).Node; - if (i % 2 == 0) + var child = sequence.ChildAt(i); + if (child.IsNode) { - if (child.Kind == JsonKind.CommaValue) + var childNode = child.Node; + if (i % 2 == 0) { - return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_unexpected, ","), - child.GetSpan()); + if (childNode.Kind == JsonKind.CommaValue) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_unexpected, ","), + childNode.GetSpan()); + } } - } - else - { - if (child.Kind != JsonKind.CommaValue) + else { - return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_expected, ","), - GetFirstToken(child).GetSpan()); + if (childNode.Kind != JsonKind.CommaValue) + { + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_expected, ","), + GetFirstToken(child).GetSpan()); + } } } } - if (sequence.ChildCount != 0 && sequence.ChildCount % 2 == 0) + if (sequence.ChildCount != 0 && + sequence.ChildCount % 2 == 0) { - return new EmbeddedDiagnostic( - WorkspacesResources.Trailing_comma_not_allowed, - sequence.ChildAt(sequence.ChildCount - 1).Node.GetSpan()); + var lastChild = sequence.ChildAt(sequence.ChildCount - 1); + if (lastChild.IsNode) + { + return new EmbeddedDiagnostic( + WorkspacesResources.Trailing_comma_not_allowed, + lastChild.Node.GetSpan()); + } } return null; diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 56dddcc588858..bab6a408813dc 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -97,7 +97,7 @@ private JsonToken ConsumeCurrentToken() /// diagnostics. Parsing should always succeed, except in the case of the stack /// overflowing. /// - public static JsonTree TryParse(VirtualCharSequence text, bool strict) + public static JsonTree? TryParse(VirtualCharSequence text, bool strict) { try { @@ -452,7 +452,7 @@ private static bool Matches(JsonToken token, string val) return true; } - private static bool IsDigit(char ch) + private static bool IsDigit(VirtualChar ch) => ch >= '0' && ch <= '9'; private static JsonLiteralNode ParseLiteral(JsonToken textToken, JsonKind kind) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualChar.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualChar.cs index 309250e5b4b65..f9d4cf611c7b8 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualChar.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualChar.cs @@ -87,6 +87,15 @@ private VirtualChar(Rune rune, char surrogateChar, TextSpan span) /// public int Value => SurrogateChar != 0 ? SurrogateChar : Rune.Value; + public bool IsDigit + => SurrogateChar != 0 ? char.IsDigit(SurrogateChar) : Rune.IsDigit(Rune); + + public bool IsLetterOrDigit + => SurrogateChar != 0 ? char.IsLetterOrDigit(SurrogateChar) : Rune.IsLetterOrDigit(Rune); + + public bool IsWhiteSpace + => SurrogateChar != 0 ? char.IsWhiteSpace(SurrogateChar) : Rune.IsWhiteSpace(Rune); + #region equality public static bool operator ==(VirtualChar char1, VirtualChar char2) From 45c9560bfbb2b707873829e94db2af68e2e4a68c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 22 Jan 2022 10:21:58 -0800 Subject: [PATCH 027/110] Simplify --- .../EmbeddedLanguages/Json/JsonNodes.cs | 3 ++ .../Json/JsonParser.JsonNetSyntaxChecks.cs | 35 ++++++++----------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 84d9b2f1d6deb..ca6498c7cc626 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -75,6 +75,9 @@ public JsonSequenceNode(ImmutableArray children) this.Children = children; } + public new JsonValueNode this[int index] + => Children[index]; + internal override JsonNodeOrToken ChildAt(int index) => Children[index]; diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index 6e77b112f4976..ba437ecde6f6b 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -164,8 +164,8 @@ private static bool IsValidConstructorName(JsonToken nameToken) // a comma. for (int i = 0, n = node.ChildCount - 1; i < n; i++) { - var child = node.ChildAt(i); - var nextChild = node.ChildAt(i + 1); + var child = node[i]; + var nextChild = node[i + 1]; if (child.Kind != JsonKind.CommaValue && nextChild.Kind != JsonKind.CommaValue) { @@ -182,28 +182,23 @@ private static bool IsValidConstructorName(JsonToken nameToken) { for (int i = 0, n = node.Sequence.ChildCount; i < n; i++) { - var child = node.Sequence.ChildAt(i); - if (child.IsNode) + var child = node.Sequence[i]; + if (i % 2 == 0) { - var childNode = child.Node; - - if (i % 2 == 0) + if (child.Kind != JsonKind.Property) { - if (childNode.Kind != JsonKind.Property) - { - return new EmbeddedDiagnostic( - WorkspacesResources.Only_properties_allowed_in_an_object, - GetFirstToken(child).GetSpan()); - } + return new EmbeddedDiagnostic( + WorkspacesResources.Only_properties_allowed_in_an_object, + GetFirstToken(child).GetSpan()); } - else + } + else + { + if (child.Kind != JsonKind.CommaValue) { - if (childNode.Kind != JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_expected, ','), - GetFirstToken(child).GetSpan()); - } + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_expected, ','), + GetFirstToken(child).GetSpan()); } } } From e1043721e52b0b50fb12a1ad621196a2a59f5977 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 22 Jan 2022 10:23:18 -0800 Subject: [PATCH 028/110] Simplify --- .../Json/JsonParser.StrictSyntaxChecker.cs | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 5561238229462..b1630f1b4248c 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -152,27 +152,23 @@ private static class StrictSyntaxChecker // Ensure that this sequence is actually a separated list. for (int i = 0, n = sequence.ChildCount; i < n; i++) { - var child = sequence.ChildAt(i); - if (child.IsNode) + var child = sequence[i]; + if (i % 2 == 0) { - var childNode = child.Node; - if (i % 2 == 0) + if (child.Kind == JsonKind.CommaValue) { - if (childNode.Kind == JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_unexpected, ","), - childNode.GetSpan()); - } + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_unexpected, ","), + child.GetSpan()); } - else + } + else + { + if (child.Kind != JsonKind.CommaValue) { - if (childNode.Kind != JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_expected, ","), - GetFirstToken(child).GetSpan()); - } + return new EmbeddedDiagnostic( + string.Format(WorkspacesResources._0_expected, ","), + GetFirstToken(child).GetSpan()); } } } @@ -180,13 +176,10 @@ private static class StrictSyntaxChecker if (sequence.ChildCount != 0 && sequence.ChildCount % 2 == 0) { - var lastChild = sequence.ChildAt(sequence.ChildCount - 1); - if (lastChild.IsNode) - { - return new EmbeddedDiagnostic( - WorkspacesResources.Trailing_comma_not_allowed, - lastChild.Node.GetSpan()); - } + var lastChild = sequence[sequence.ChildCount - 1]; + return new EmbeddedDiagnostic( + WorkspacesResources.Trailing_comma_not_allowed, + lastChild.GetSpan()); } return null; From 976ec330707b9a9f802b5f4d9ea90d88201bfb45 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 22 Jan 2022 10:50:34 -0800 Subject: [PATCH 029/110] WIP --- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 15 ++++++++------- ...odeAnalysis.CSharp.Workspaces.UnitTests.csproj | 12 ------------ .../Common/EmbeddedDiagnostic.cs | 3 +++ .../Common/EmbeddedSyntaxToken.cs | 4 ++-- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index e7427584c8e88..3c4603217ebca 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -9,14 +9,15 @@ using System.Runtime.CompilerServices; using System.Runtime.Serialization.Json; using System.Text; -using System.Web.Script.Serialization; using System.Xml.Linq; +using System.Text.Json; using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; using Microsoft.CodeAnalysis.EmbeddedLanguages.Json; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Newtonsoft.Json.Linq; using Xunit; +using Xunit.Sdk; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { @@ -117,7 +118,7 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) } } - private (SyntaxToken, JsonTree, VirtualCharSequence) JustParseTree( + private (SyntaxToken, JsonTree?, VirtualCharSequence) JustParseTree( string stringText, bool strict, bool conversionFailureOk) { var token = GetStringToken(stringText); @@ -137,7 +138,7 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) return (token, tree, allChars); } - private JsonTree TryParseTree( + private JsonTree? TryParseTree( string stringText, bool strict, bool runTreeCheck, bool conversionFailureOk) { var (token, tree, allChars) = JustParseTree(stringText, strict, conversionFailureOk); @@ -170,8 +171,7 @@ private JsonTree TryParseTree( var serializer1 = new DataContractJsonSerializer(typeof(object)); serializer1.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(token.ValueText))); - var serializer2 = new JavaScriptSerializer(); - serializer2.DeserializeObject(token.ValueText); + JsonDocument.Parse(token.ValueText, new JsonDocumentOptions { AllowTrailingCommas = false, CommentHandling = JsonCommentHandling.Disallow }); } catch (Exception) { @@ -319,8 +319,9 @@ private void TestNST( string stringText, string expected, string looseDiagnostics, string strictDiagnostics, [CallerMemberName]string caller = "") { var (token, tree, allChars) = JustParseTree(stringText, strict: true, conversionFailureOk: false); - - var actualTree = TreeToText(tree).Replace("\"", "\"\""); + Assert.NotNull(tree); + Roslyn.Utilities.Contract.ThrowIfNull(tree); + var actualTree = TreeToText(tree!).Replace("\"", "\"\""); Assert.Equal(expected.Replace("\"", "\"\""), actualTree); var actualDiagnostics = DiagnosticsToText(tree.Diagnostics).Replace("\"", "\"\""); diff --git a/src/Workspaces/CSharpTest/Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests.csproj b/src/Workspaces/CSharpTest/Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests.csproj index 9717fc596e42c..043f4dc6e32e3 100644 --- a/src/Workspaces/CSharpTest/Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests.csproj +++ b/src/Workspaces/CSharpTest/Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests.csproj @@ -28,16 +28,4 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs index 53dccb66840ae..86d6e5074756f 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs @@ -36,6 +36,9 @@ public bool Equals(EmbeddedDiagnostic other) => Message == other.Message && Span.Equals(other.Span); + public override string ToString() + => Message; + public override int GetHashCode() { unchecked diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs index 9d4dc9feb56da..4c93bed8823e3 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs @@ -23,14 +23,14 @@ internal struct EmbeddedSyntaxToken where TSyntaxKind : struct /// Returns the value of the token. For example, if the token represents an integer capture, /// then this property would return the actual integer. /// - public readonly object? Value; + public readonly object Value; public EmbeddedSyntaxToken( TSyntaxKind kind, ImmutableArray> leadingTrivia, VirtualCharSequence virtualChars, ImmutableArray> trailingTrivia, - ImmutableArray diagnostics, object? value) + ImmutableArray diagnostics, object value) { Debug.Assert(!leadingTrivia.IsDefault); Debug.Assert(!virtualChars.IsDefault); From 3199bf900155e85bb04c13b2bf49573cc8b12fe5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 22 Jan 2022 20:41:37 -0800 Subject: [PATCH 030/110] Fix error --- .../Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index e28a0fd91ea8c..1b62a8c55f856 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -145,7 +145,7 @@ private static bool IsSpecial(VirtualChar ch) { case '"': case '\'': - if (currentCh == openChar) + if (currentCh.Value == openChar.Value) return (GetCharsToCurrentPosition(start), JsonKind.StringToken, diagnostic); continue; From d369ae99e597a568421f00c65b3d94073abd8c44 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 22 Jan 2022 20:44:31 -0800 Subject: [PATCH 031/110] Fix test --- .../EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs index 1e7ed7b0eacfb..6d7acbffdca57 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs @@ -4006,10 +4006,10 @@ public void n_string_escaped_emoji_json() ", @" - + ", @" - + "); } From 4f605fbb3e285e8119080170eccd5da100a9df7d Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Sat, 22 Jan 2022 18:48:41 -1000 Subject: [PATCH 032/110] Update src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs --- .../RegularExpressions/CSharpRegexParserTests.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs index 95d83ecb8de0f..ca11699a30eaf 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs @@ -119,11 +119,6 @@ private void TryParseSubTrees( } var tree = RegexParser.TryParse(allChars, options); - if (tree != null) - { - - } - return (token, tree, allChars); } From 9106df1be358765fca64e795d30d01ccf6eeb023 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 23 Jan 2022 11:33:12 -0800 Subject: [PATCH 033/110] Fix --- .../EmbeddedLanguages/Json/JsonParser.cs | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index bab6a408813dc..1e2e4f29df799 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -48,10 +48,10 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// internal partial struct JsonParser { - private static readonly string _closeBracketExpected = string.Format(WorkspacesResources._0_expected, ']'); - private static readonly string _closeBraceExpected = string.Format(WorkspacesResources._0_expected, '}'); - private static readonly string _openParenExpected = string.Format(WorkspacesResources._0_expected, '('); - private static readonly string _closeParenExpected = string.Format(WorkspacesResources._0_expected, ')'); + private static readonly string s_closeBracketExpected = string.Format(WorkspacesResources._0_expected, ']'); + private static readonly string s_closeBraceExpected = string.Format(WorkspacesResources._0_expected, '}'); + private static readonly string s_openParenExpected = string.Format(WorkspacesResources._0_expected, '('); + private static readonly string s_closeParenExpected = string.Format(WorkspacesResources._0_expected, ')'); private JsonLexer _lexer; private JsonToken _currentToken; @@ -277,19 +277,13 @@ private bool ShouldConsumeSequenceElement() } private JsonValueNode ParseValue() - { - switch (_currentToken.Kind) + => _currentToken.Kind switch { - case JsonKind.OpenBraceToken: - return ParseObject(); - case JsonKind.OpenBracketToken: - return ParseArray(); - case JsonKind.CommaToken: - return ParseCommaValue(); - default: - return ParseLiteralOrPropertyOrConstructor(); - } - } + JsonKind.OpenBraceToken => ParseObject(), + JsonKind.OpenBracketToken => ParseArray(), + JsonKind.CommaToken => ParseCommaValue(), + _ => ParseLiteralOrPropertyOrConstructor(), + }; private static void SplitLiteral(JsonToken literalToken, out JsonToken minusToken, out JsonToken newLiteralToken) { @@ -409,7 +403,7 @@ private JsonConstructorNode ParseConstructor(JsonToken token) { var newKeyword = token.With(kind: JsonKind.NewKeyword); var nameToken = ConsumeToken(JsonKind.TextToken, WorkspacesResources.Name_expected); - var openParen = ConsumeToken(JsonKind.OpenParenToken, _openParenExpected); + var openParen = ConsumeToken(JsonKind.OpenParenToken, s_openParenExpected); var savedInConstructor = _inConstructor; _inConstructor = true; @@ -419,7 +413,7 @@ private JsonConstructorNode ParseConstructor(JsonToken token) nameToken, openParen, ParseSequence(), - ConsumeToken(JsonKind.CloseParenToken, _closeParenExpected)); + ConsumeToken(JsonKind.CloseParenToken, s_closeParenExpected)); _inConstructor = savedInConstructor; return result; @@ -455,9 +449,6 @@ private static bool Matches(JsonToken token, string val) private static bool IsDigit(VirtualChar ch) => ch >= '0' && ch <= '9'; - private static JsonLiteralNode ParseLiteral(JsonToken textToken, JsonKind kind) - => new JsonLiteralNode(textToken.With(kind: kind)); - private static JsonValueNode ParseNumber(JsonToken textToken) { var numberToken = textToken.With(kind: JsonKind.NumberToken); @@ -465,7 +456,7 @@ private static JsonValueNode ParseNumber(JsonToken textToken) } private JsonCommaValueNode ParseCommaValue() - => new JsonCommaValueNode(ConsumeCurrentToken()); + => new(ConsumeCurrentToken()); private JsonArrayNode ParseArray() { @@ -475,7 +466,7 @@ private JsonArrayNode ParseArray() var result = new JsonArrayNode( ConsumeCurrentToken(), ParseSequence(), - ConsumeToken(JsonKind.CloseBracketToken, _closeBracketExpected)); + ConsumeToken(JsonKind.CloseBracketToken, s_closeBracketExpected)); _inArray = savedInArray; return result; @@ -489,7 +480,7 @@ private JsonObjectNode ParseObject() var result = new JsonObjectNode( ConsumeCurrentToken(), ParseSequence(), - ConsumeToken(JsonKind.CloseBraceToken, _closeBraceExpected)); + ConsumeToken(JsonKind.CloseBraceToken, s_closeBraceExpected)); _inObject = savedInObject; return result; From 2bcdc661154312e96939d3cbb17509f34906c1fe Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 23 Jan 2022 11:38:37 -0800 Subject: [PATCH 034/110] Cleanup --- .../EmbeddedLanguages/Json/JsonLexer.cs | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index cd4bdbae2f982..adcc2b9a18347 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -94,36 +94,29 @@ private static bool IsSpecial(VirtualChar ch) private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic? diagnostic) ScanNextTokenWorker() { Debug.Assert(Position < Text.Length); - switch (this.CurrentChar.Value) + return this.CurrentChar.Value switch { - case '{': return ScanSingleCharToken(JsonKind.OpenBraceToken); - case '}': return ScanSingleCharToken(JsonKind.CloseBraceToken); - case '[': return ScanSingleCharToken(JsonKind.OpenBracketToken); - case ']': return ScanSingleCharToken(JsonKind.CloseBracketToken); - case '(': return ScanSingleCharToken(JsonKind.OpenParenToken); - case ')': return ScanSingleCharToken(JsonKind.CloseParenToken); - case ',': return ScanSingleCharToken(JsonKind.CommaToken); - case ':': return ScanSingleCharToken(JsonKind.ColonToken); - - case '\'': - case '"': - return ScanString(); - + '{' => ScanSingleCharToken(JsonKind.OpenBraceToken), + '}' => ScanSingleCharToken(JsonKind.CloseBraceToken), + '[' => ScanSingleCharToken(JsonKind.OpenBracketToken), + ']' => ScanSingleCharToken(JsonKind.CloseBracketToken), + '(' => ScanSingleCharToken(JsonKind.OpenParenToken), + ')' => ScanSingleCharToken(JsonKind.CloseParenToken), + ',' => ScanSingleCharToken(JsonKind.CommaToken), + ':' => ScanSingleCharToken(JsonKind.ColonToken), + '\'' or '"' => ScanString(), // It would be tempting to try to scan out numbers here. However, numbers are // actually quite tricky to get right (especially looking one character at a time). // So, instead, we take a page from json.net and just consume out a text sequence. // Later on, we'll analyze that text sequence as a whole to see if it looks like a // number and to also report any issues in line with how json.net and ecmascript // handle json numbers. - //case '-': case '.': //case '0': case '1': case '2': case '3': case '4': //case '5': case '6': case '7': case '8': case '9': // return ScanNumber(); - - default: - return ScanText(); - } + _ => ScanText(), + }; } private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic?) ScanString() @@ -155,7 +148,7 @@ private static bool IsSpecial(VirtualChar ch) } var chars = GetCharsToCurrentPosition(start); - diagnostic = diagnostic ?? new EmbeddedDiagnostic( + diagnostic ??= new EmbeddedDiagnostic( WorkspacesResources.Unterminated_string, GetSpan(chars)); return (chars, JsonKind.StringToken, diagnostic); } From 0d04b9c148112562acc132831ff3a1972599c124 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 23 Jan 2022 11:52:33 -0800 Subject: [PATCH 035/110] Cleanup --- .../EmbeddedLanguages/Json/JsonHelpers.cs | 4 +- .../EmbeddedLanguages/Json/JsonNodes.cs | 123 +++++++----------- 2 files changed, 50 insertions(+), 77 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs index e7bc4a533624f..ca33ec398d459 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs @@ -21,7 +21,7 @@ public static JsonToken CreateToken( public static JsonToken CreateToken(JsonKind kind, ImmutableArray leadingTrivia, VirtualCharSequence virtualChars, ImmutableArray trailingTrivia, ImmutableArray diagnostics) - => new JsonToken(kind, leadingTrivia, virtualChars, trailingTrivia, diagnostics, value: null); + => new(kind, leadingTrivia, virtualChars, trailingTrivia, diagnostics, value: null); public static JsonToken CreateMissingToken(JsonKind kind) => CreateToken(kind, ImmutableArray.Empty, VirtualCharSequence.Empty, ImmutableArray.Empty); @@ -30,6 +30,6 @@ public static JsonTrivia CreateTrivia(JsonKind kind, VirtualCharSequence virtual => CreateTrivia(kind, virtualChars, ImmutableArray.Empty); public static JsonTrivia CreateTrivia(JsonKind kind, VirtualCharSequence virtualChars, ImmutableArray diagnostics) - => new JsonTrivia(kind, virtualChars, diagnostics); + => new(kind, virtualChars, diagnostics); } } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index ca6498c7cc626..df8f3d08d9b71 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -34,15 +34,12 @@ public JsonCompilationUnit(JsonSequenceNode sequence, JsonToken endOfFileToken) internal override int ChildCount => 2; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return Sequence; - case 1: return EndOfFileToken; - } - - throw new InvalidOperationException(); - } + 0 => Sequence, + 1 => EndOfFileToken, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -103,14 +100,11 @@ public JsonTextNode(JsonToken textToken) internal override int ChildCount => 1; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return TextToken; - } - - throw new InvalidOperationException(); - } + 0 => TextToken, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -140,16 +134,13 @@ public JsonObjectNode( internal override int ChildCount => 3; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return OpenBraceToken; - case 1: return Sequence; - case 2: return CloseBraceToken; - } - - throw new InvalidOperationException(); - } + 0 => OpenBraceToken, + 1 => Sequence, + 2 => CloseBraceToken, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -179,16 +170,13 @@ public JsonArrayNode( internal override int ChildCount => 3; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return OpenBracketToken; - case 1: return Sequence; - case 2: return CloseBracketToken; - } - - throw new InvalidOperationException(); - } + 0 => OpenBracketToken, + 1 => Sequence, + 2 => CloseBracketToken, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -209,15 +197,12 @@ public JsonNegativeLiteralNode(JsonToken minusToken, JsonToken literalToken) internal override int ChildCount => 2; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return MinusToken; - case 1: return LiteralToken; - } - - throw new InvalidOperationException(); - } + 0 => MinusToken, + 1 => LiteralToken, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -236,14 +221,11 @@ public JsonLiteralNode(JsonToken literalToken) internal override int ChildCount => 1; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return LiteralToken; - } - - throw new InvalidOperationException(); - } + 0 => LiteralToken, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -263,14 +245,11 @@ public JsonCommaValueNode(JsonToken commaToken) internal override int ChildCount => 1; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return CommaToken; - } - - throw new InvalidOperationException(); - } + 0 => CommaToken, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -296,16 +275,13 @@ public JsonPropertyNode(JsonToken nameToken, JsonToken colonToken, JsonValueNode internal override int ChildCount => 3; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return NameToken; - case 1: return ColonToken; - case 2: return Value; - } - - throw new InvalidOperationException(); - } + 0 => NameToken, + 1 => ColonToken, + 2 => Value, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -333,18 +309,15 @@ public JsonConstructorNode( internal override int ChildCount => 5; internal override JsonNodeOrToken ChildAt(int index) - { - switch (index) + => index switch { - case 0: return NewKeyword; - case 1: return NameToken; - case 2: return OpenParenToken; - case 3: return Sequence; - case 4: return CloseParenToken; - } - - throw new InvalidOperationException(); - } + 0 => NewKeyword, + 1 => NameToken, + 2 => OpenParenToken, + 3 => Sequence, + 4 => CloseParenToken, + _ => throw new InvalidOperationException(), + }; public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); From 4103dd4d0ba0a7a3f8df5bd211f6ff88db2ad836 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 23 Jan 2022 12:03:59 -0800 Subject: [PATCH 036/110] Move to an immutable array for sequences instead of a special node --- .../Json/IJsonNodeVisitor.cs | 1 - .../EmbeddedLanguages/Json/JsonHelpers.cs | 2 +- .../EmbeddedLanguages/Json/JsonKind.cs | 1 - .../EmbeddedLanguages/Json/JsonNodes.cs | 124 ++++++++---------- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 23 ++-- .../Json/JsonParser.StrictSyntaxChecker.cs | 34 ++--- .../EmbeddedLanguages/Json/JsonParser.cs | 24 ++-- .../Common/EmbeddedSyntaxToken.cs | 4 +- 8 files changed, 91 insertions(+), 122 deletions(-) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs index 6cb2875c6ae9b..2388a42ff74fa 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs @@ -7,7 +7,6 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json internal interface IJsonNodeVisitor { void Visit(JsonCompilationUnit node); - void Visit(JsonSequenceNode node); void Visit(JsonArrayNode node); void Visit(JsonObjectNode node); void Visit(JsonPropertyNode node); diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs index ca33ec398d459..6c26c449191e0 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs @@ -21,7 +21,7 @@ public static JsonToken CreateToken( public static JsonToken CreateToken(JsonKind kind, ImmutableArray leadingTrivia, VirtualCharSequence virtualChars, ImmutableArray trailingTrivia, ImmutableArray diagnostics) - => new(kind, leadingTrivia, virtualChars, trailingTrivia, diagnostics, value: null); + => new(kind, leadingTrivia, virtualChars, trailingTrivia, diagnostics, value: null!); public static JsonToken CreateMissingToken(JsonKind kind) => CreateToken(kind, ImmutableArray.Empty, VirtualCharSequence.Empty, ImmutableArray.Empty); diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs index 08c41c0cbf60c..9ca93d890d82c 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs @@ -7,7 +7,6 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json internal enum JsonKind { None = 0, - Sequence, CompilationUnit, Text, Object, diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index df8f3d08d9b71..62d2de5295550 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -15,10 +15,9 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json internal sealed class JsonCompilationUnit : JsonNode { - public JsonCompilationUnit(JsonSequenceNode sequence, JsonToken endOfFileToken) + public JsonCompilationUnit(ImmutableArray sequence, JsonToken endOfFileToken) : base(JsonKind.CompilationUnit) { - Debug.Assert(sequence != null); Debug.Assert(endOfFileToken.Kind == JsonKind.EndOfFile); Sequence = sequence; EndOfFileToken = endOfFileToken; @@ -28,18 +27,18 @@ public JsonCompilationUnit(JsonSequenceNode sequence, JsonToken endOfFileToken) /// For error recovery purposes, we support a sequence of nodes at the top level (even /// though only a single node is actually allowed). /// - public JsonSequenceNode Sequence { get; } + public ImmutableArray Sequence { get; } public JsonToken EndOfFileToken { get; } - internal override int ChildCount => 2; + internal override int ChildCount => Sequence.Length + 1; internal override JsonNodeOrToken ChildAt(int index) - => index switch - { - 0 => Sequence, - 1 => EndOfFileToken, - _ => throw new InvalidOperationException(), - }; + { + if (index == Sequence.Length) + return EndOfFileToken; + + return Sequence[index]; + } public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -56,32 +55,6 @@ protected JsonValueNode(JsonKind kind) } } - /// - /// Represents a possibly-empty sequence of json expressions. - /// - internal sealed class JsonSequenceNode : JsonNode - { - public ImmutableArray Children { get; } - - internal override int ChildCount => Children.Length; - - public JsonSequenceNode(ImmutableArray children) - : base(JsonKind.Sequence) - { - Debug.Assert(children.All(v => v != null)); - this.Children = children; - } - - public new JsonValueNode this[int index] - => Children[index]; - - internal override JsonNodeOrToken ChildAt(int index) - => Children[index]; - - public override void Accept(IJsonNodeVisitor visitor) - => visitor.Visit(this); - } - /// /// Represents a chunk of text that we did not understand as anything special. i.e. it wasn't a /// keyword, number, or literal. @@ -114,7 +87,7 @@ internal sealed class JsonObjectNode : JsonValueNode { public JsonObjectNode( JsonToken openBraceToken, - JsonSequenceNode sequence, + ImmutableArray sequence, JsonToken closeBraceToken) : base(JsonKind.Object) { @@ -128,19 +101,21 @@ public JsonObjectNode( } public JsonToken OpenBraceToken { get; } - public JsonSequenceNode Sequence { get; } + public ImmutableArray Sequence { get; } public JsonToken CloseBraceToken { get; } - internal override int ChildCount => 3; + internal override int ChildCount => 2 + Sequence.Length; internal override JsonNodeOrToken ChildAt(int index) - => index switch - { - 0 => OpenBraceToken, - 1 => Sequence, - 2 => CloseBraceToken, - _ => throw new InvalidOperationException(), - }; + { + if (index == 0) + return OpenBraceToken; + + if (index == Sequence.Length + 1) + return CloseBraceToken; + + return Sequence[index - 1]; + } public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -150,12 +125,11 @@ internal sealed class JsonArrayNode : JsonValueNode { public JsonArrayNode( JsonToken openBracketToken, - JsonSequenceNode sequence, + ImmutableArray sequence, JsonToken closeBracketToken) : base(JsonKind.Array) { Debug.Assert(openBracketToken.Kind == JsonKind.OpenBracketToken); - Debug.Assert(sequence != null); Debug.Assert(closeBracketToken.Kind == JsonKind.CloseBracketToken); OpenBracketToken = openBracketToken; @@ -164,19 +138,21 @@ public JsonArrayNode( } public JsonToken OpenBracketToken { get; } - public JsonSequenceNode Sequence { get; } + public ImmutableArray Sequence { get; } public JsonToken CloseBracketToken { get; } - internal override int ChildCount => 3; + internal override int ChildCount => 2 + Sequence.Length; internal override JsonNodeOrToken ChildAt(int index) - => index switch - { - 0 => OpenBracketToken, - 1 => Sequence, - 2 => CloseBracketToken, - _ => throw new InvalidOperationException(), - }; + { + if (index == 0) + return OpenBracketToken; + + if (index == Sequence.Length + 1) + return CloseBracketToken; + + return Sequence[index - 1]; + } public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); @@ -290,7 +266,11 @@ public override void Accept(IJsonNodeVisitor visitor) internal sealed class JsonConstructorNode : JsonValueNode { public JsonConstructorNode( - JsonToken newKeyword, JsonToken nameToken, JsonToken openParenToken, JsonSequenceNode sequence, JsonToken closeParenToken) + JsonToken newKeyword, + JsonToken nameToken, + JsonToken openParenToken, + ImmutableArray sequence, + JsonToken closeParenToken) : base(JsonKind.Constructor) { NewKeyword = newKeyword; @@ -303,21 +283,27 @@ public JsonConstructorNode( public JsonToken NewKeyword { get; } public JsonToken NameToken { get; } public JsonToken OpenParenToken { get; } - public JsonSequenceNode Sequence { get; } + public ImmutableArray Sequence { get; } public JsonToken CloseParenToken { get; } - internal override int ChildCount => 5; + internal override int ChildCount => Sequence.Length + 4; internal override JsonNodeOrToken ChildAt(int index) - => index switch - { - 0 => NewKeyword, - 1 => NameToken, - 2 => OpenParenToken, - 3 => Sequence, - 4 => CloseParenToken, - _ => throw new InvalidOperationException(), - }; + { + if (index == 0) + return NewKeyword; + + if (index == 1) + return NameToken; + + if (index == 2) + return OpenParenToken; + + if (index == Sequence.Length + 3) + return CloseParenToken; + + return Sequence[index]; + } public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index ba437ecde6f6b..fa9e0c497c40d 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; @@ -119,15 +120,11 @@ private static class JsonNetSyntaxChecker { foreach (var child in node.Sequence) { - if (child.IsNode) + if (child.Kind == JsonKind.Property) { - var childNode = child.Node; - if (childNode.Kind == JsonKind.Property) - { - return new EmbeddedDiagnostic( - WorkspacesResources.Properties_not_allowed_in_an_array, - ((JsonPropertyNode)childNode).ColonToken.GetSpan()); - } + return new EmbeddedDiagnostic( + WorkspacesResources.Properties_not_allowed_in_an_array, + ((JsonPropertyNode)child).ColonToken.GetSpan()); } } @@ -158,14 +155,14 @@ private static bool IsValidConstructorName(JsonToken nameToken) return true; } - private static EmbeddedDiagnostic? CheckCommasBetweenSequenceElements(JsonSequenceNode node) + private static EmbeddedDiagnostic? CheckCommasBetweenSequenceElements(ImmutableArray sequence) { // Json.net allows sequences of commas. But after every non-comma value, you need // a comma. - for (int i = 0, n = node.ChildCount - 1; i < n; i++) + for (int i = 0, n = sequence.Length - 1; i < n; i++) { - var child = node[i]; - var nextChild = node[i + 1]; + var child = sequence[i]; + var nextChild = sequence[i + 1]; if (child.Kind != JsonKind.CommaValue && nextChild.Kind != JsonKind.CommaValue) { @@ -180,7 +177,7 @@ private static bool IsValidConstructorName(JsonToken nameToken) private static EmbeddedDiagnostic? CheckObject(JsonObjectNode node) { - for (int i = 0, n = node.Sequence.ChildCount; i < n; i++) + for (int i = 0, n = node.Sequence.Length; i < n; i++) { var child = node.Sequence[i]; if (i % 2 == 0) diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index b1630f1b4248c..867cfb8f10d67 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -113,15 +113,11 @@ private static class StrictSyntaxChecker var sequence = node.Sequence; foreach (var child in sequence) { - if (child.IsNode) + if (child.Kind != JsonKind.Property && child.Kind != JsonKind.CommaValue) { - var childNode = child.Node; - if (childNode.Kind != JsonKind.Property && childNode.Kind != JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - WorkspacesResources.Only_properties_allowed_in_an_object, - GetFirstToken(childNode).GetSpan()); - } + return new EmbeddedDiagnostic( + WorkspacesResources.Only_properties_allowed_in_an_object, + GetFirstToken(child).GetSpan()); } } @@ -132,25 +128,21 @@ private static class StrictSyntaxChecker { foreach (var child in node.Sequence) { - if (child.IsNode) + if (child.Kind == JsonKind.Property) { - var childNode = child.Node; - if (childNode.Kind == JsonKind.Property) - { - return new EmbeddedDiagnostic( - WorkspacesResources.Properties_not_allowed_in_an_array, - ((JsonPropertyNode)childNode).ColonToken.GetSpan()); - } + return new EmbeddedDiagnostic( + WorkspacesResources.Properties_not_allowed_in_an_array, + ((JsonPropertyNode)child).ColonToken.GetSpan()); } } return CheckProperSeparation(node.Sequence) ?? CheckChildren(node); } - private static EmbeddedDiagnostic? CheckProperSeparation(JsonSequenceNode sequence) + private static EmbeddedDiagnostic? CheckProperSeparation(ImmutableArray sequence) { // Ensure that this sequence is actually a separated list. - for (int i = 0, n = sequence.ChildCount; i < n; i++) + for (int i = 0, n = sequence.Length; i < n; i++) { var child = sequence[i]; if (i % 2 == 0) @@ -173,10 +165,10 @@ private static class StrictSyntaxChecker } } - if (sequence.ChildCount != 0 && - sequence.ChildCount % 2 == 0) + if (sequence.Length != 0 && + sequence.Length % 2 == 0) { - var lastChild = sequence[sequence.ChildCount - 1]; + var lastChild = sequence[^1]; return new EmbeddedDiagnostic( WorkspacesResources.Trailing_comma_not_allowed, lastChild.GetSpan()); diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 1e2e4f29df799..cd5c5318c5f6a 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -148,7 +148,7 @@ private JsonTree ParseTree(bool strict) VirtualCharSequence text, JsonCompilationUnit compilationUnit) { var arraySequence = compilationUnit.Sequence; - if (arraySequence.ChildCount == 0) + if (arraySequence.IsEmpty) { // json is not allowed to be just whitespace. if (text.Length > 0 && @@ -158,10 +158,10 @@ private JsonTree ParseTree(bool strict) return new EmbeddedDiagnostic(WorkspacesResources.Syntax_error, GetSpan(text)); } } - else if (arraySequence.ChildCount >= 2) + else if (arraySequence.Length >= 2) { // the top level can't have more than one actual value. - var firstToken = GetFirstToken(arraySequence.ChildAt(1).Node); + var firstToken = GetFirstToken(arraySequence[1]); return new EmbeddedDiagnostic( string.Format(WorkspacesResources._0_unexpected, firstToken.VirtualChars[0]), firstToken.GetSpan()); @@ -170,9 +170,9 @@ private JsonTree ParseTree(bool strict) foreach (var child in compilationUnit.Sequence) { // Commas should never show up in the top level sequence. - if (child.IsNode && child.Node.Kind == JsonKind.CommaValue) + if (child.Kind == JsonKind.CommaValue) { - var emptyValue = (JsonCommaValueNode)child.Node; + var emptyValue = (JsonCommaValueNode)child; return new EmbeddedDiagnostic( string.Format(WorkspacesResources._0_unexpected, ','), emptyValue.CommaToken.GetSpan()); @@ -217,15 +217,13 @@ private static JsonToken GetFirstToken(JsonNodeOrToken nodeOrToken) { var diagnostic = trivia.Diagnostics.FirstOrNull(); if (diagnostic != null) - { return diagnostic; - } } return null; } - private JsonSequenceNode ParseSequence() + private ImmutableArray ParseSequence() { try { @@ -239,16 +237,14 @@ private JsonSequenceNode ParseSequence() } } - private JsonSequenceNode ParseSequenceWorker() + private ImmutableArray ParseSequenceWorker() { - var list = ArrayBuilder.GetInstance(); + using var _ = ArrayBuilder.GetInstance(out var result); while (ShouldConsumeSequenceElement()) - { - list.Add(ParseValue()); - } + result.Add(ParseValue()); - return new JsonSequenceNode(list.ToImmutableAndFree()); + return result.ToImmutable(); } private bool ShouldConsumeSequenceElement() diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs index 9d4dc9feb56da..4c93bed8823e3 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs @@ -23,14 +23,14 @@ internal struct EmbeddedSyntaxToken where TSyntaxKind : struct /// Returns the value of the token. For example, if the token represents an integer capture, /// then this property would return the actual integer. /// - public readonly object? Value; + public readonly object Value; public EmbeddedSyntaxToken( TSyntaxKind kind, ImmutableArray> leadingTrivia, VirtualCharSequence virtualChars, ImmutableArray> trailingTrivia, - ImmutableArray diagnostics, object? value) + ImmutableArray diagnostics, object value) { Debug.Assert(!leadingTrivia.IsDefault); Debug.Assert(!virtualChars.IsDefault); From 16e6394cf600bf82de047fac05dbc1c67462cd49 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 23 Jan 2022 12:38:47 -0800 Subject: [PATCH 037/110] Sequence fallout --- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 78 ++++++++++++++++++- .../EmbeddedLanguages/Json/JsonNodes.cs | 2 +- 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 3c4603217ebca..1e99159f311f0 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -209,15 +209,70 @@ private string DiagnosticsToText(ImmutableArray diagnostics) private XElement NodeToElement(JsonNode node) { + if (node is JsonArrayNode arrayNode) + return ArrayNodeToElement(arrayNode); + + if (node is JsonCompilationUnit compilationUnit) + return CompilationUnitToElement(compilationUnit); + + if (node is JsonObjectNode objectNode) + return ObjectNodeToElement(objectNode); + + if (node is JsonConstructorNode constructorNode) + return ConstructorNodeToElement(constructorNode); + var element = new XElement(node.Kind.ToString()); foreach (var child in node) - { element.Add(child.IsNode ? NodeToElement(child.Node) : TokenToElement(child.Token)); - } return element; } + private XElement ConstructorNodeToElement(JsonConstructorNode node) + { + var element = new XElement(node.Kind.ToString()); + element.Add(TokenToElement(node.NewKeyword)); + element.Add(TokenToElement(node.NameToken)); + element.Add(TokenToElement(node.OpenParenToken)); + element.Add(CreateSequenceNode(node.Sequence)); + element.Add(TokenToElement(node.CloseParenToken)); + return element; + } + + private XElement ObjectNodeToElement(JsonObjectNode node) + { + var element = new XElement(node.Kind.ToString()); + element.Add(TokenToElement(node.OpenBraceToken)); + element.Add(CreateSequenceNode(node.Sequence)); + element.Add(TokenToElement(node.CloseBraceToken)); + return element; + } + + private XElement CompilationUnitToElement(JsonCompilationUnit node) + { + var element = new XElement(node.Kind.ToString()); + element.Add(CreateSequenceNode(node.Sequence)); + element.Add(TokenToElement(node.EndOfFileToken)); + return element; + } + + private XElement ArrayNodeToElement(JsonArrayNode node) + { + var element = new XElement(node.Kind.ToString()); + element.Add(TokenToElement(node.OpenBracketToken)); + element.Add(CreateSequenceNode(node.Sequence)); + element.Add(TokenToElement(node.CloseBracketToken)); + return element; + } + + private XElement CreateSequenceNode(ImmutableArray sequence) + { + var element = new XElement("Sequence"); + foreach (var child in sequence) + element.Add(NodeToElement(child)); + return element; + } + private XElement TokenToElement(JsonToken token) { var element = new XElement(token.Kind.ToString()); @@ -352,6 +407,25 @@ private void TestNST( } } + private string RemoveSequenceNode(string expected) + { + var element = XElement.Parse(expected); + var result = RemoveSequenceNode(element); + return result.ToString()!; + } + + private object RemoveSequenceNode(XNode node) + { + if (node is not XElement element) + return node; + + var children = element.Nodes().Select(RemoveSequenceNode); + + if (element.Name == "Sequence") + return children; + return new XElement(element.Name, children); + } + [Fact] public void TestDeepRecursion() { diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 62d2de5295550..305c54a60b872 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -302,7 +302,7 @@ internal override JsonNodeOrToken ChildAt(int index) if (index == Sequence.Length + 3) return CloseParenToken; - return Sequence[index]; + return Sequence[index - 3]; } public override void Accept(IJsonNodeVisitor visitor) From 8dedd9a978cf4f248aa9dc8a6faccb6f89ce63b4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Jan 2022 15:03:30 -0800 Subject: [PATCH 038/110] Move to features layer --- .../CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs | 2 +- .../Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs | 0 .../Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs | 0 .../Core/Portable/EmbeddedLanguages/Json/JsonKind.cs | 0 .../Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 0 .../Core/Portable/EmbeddedLanguages/Json/JsonNode.cs | 0 .../Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 0 .../Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs | 0 .../EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs | 0 .../EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs | 0 .../Core/Portable/EmbeddedLanguages/Json/JsonParser.cs | 0 .../Core/Portable/EmbeddedLanguages/Json/JsonTree.cs | 0 12 files changed, 1 insertion(+), 1 deletion(-) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs (100%) rename src/{Workspaces => Features}/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs (100%) diff --git a/src/Compilers/CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs b/src/Compilers/CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs index 4d16b3464faa1..c7a943518a24f 100644 --- a/src/Compilers/CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs +++ b/src/Compilers/CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs @@ -146,7 +146,7 @@ private static InterpolationSyntax ParseInterpolation( interpolation.HasColon ? interpolation.ColonRange.Start : interpolation.CloseBraceRange.Start)]; using var tempLexer = new Lexer(SourceText.From(expressionText), options, allowPreprocessorDirectives: false, interpolationFollowedByColon: interpolation.HasColon); - + er // First grab any trivia right after the {, it will be trailing trivia for the { token. var openTokenTrailingTrivia = tempLexer.LexSyntaxTrailingTrivia().Node; var openTokenText = text[interpolation.OpenBraceRange]; diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/IJsonNodeVisitor.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNode.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs similarity index 100% rename from src/Workspaces/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/JsonTree.cs From 34322a649c86c2462bffd2c7154da3ed4b4c89e1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Jan 2022 15:04:15 -0800 Subject: [PATCH 039/110] Revert --- .../CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compilers/CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs b/src/Compilers/CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs index c7a943518a24f..4d16b3464faa1 100644 --- a/src/Compilers/CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs +++ b/src/Compilers/CSharp/Portable/Parser/LanguageParser_InterpolatedString.cs @@ -146,7 +146,7 @@ private static InterpolationSyntax ParseInterpolation( interpolation.HasColon ? interpolation.ColonRange.Start : interpolation.CloseBraceRange.Start)]; using var tempLexer = new Lexer(SourceText.From(expressionText), options, allowPreprocessorDirectives: false, interpolationFollowedByColon: interpolation.HasColon); - er + // First grab any trivia right after the {, it will be trailing trivia for the { token. var openTokenTrailingTrivia = tempLexer.LexSyntaxTrailingTrivia().Node; var openTokenText = text[interpolation.OpenBraceRange]; From f707df3a8a16ff2e3bcfcdc7ee471435db498d03 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Jan 2022 15:13:47 -0800 Subject: [PATCH 040/110] Move diagnostics --- .../EmbeddedLanguages/Json/JsonLexer.cs | 14 +- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 16 +-- .../Json/JsonParser.StrictSyntaxChecker.cs | 32 ++--- .../EmbeddedLanguages/Json/JsonParser.cs | 22 +-- .../Core/Portable/FeaturesResources.resx | 82 +++++++++++ .../Portable/xlf/FeaturesResources.cs.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.de.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.es.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.fr.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.it.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ja.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ko.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.pl.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.pt-BR.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ru.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.tr.xlf | 135 ++++++++++++++++++ .../xlf/FeaturesResources.zh-Hans.xlf | 135 ++++++++++++++++++ .../xlf/FeaturesResources.zh-Hant.xlf | 135 ++++++++++++++++++ .../FallbackEmbeddedLanguage.cs | 2 - .../Core/Portable/WorkspacesResources.resx | 81 ----------- .../Portable/xlf/WorkspacesResources.cs.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.de.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.es.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.fr.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.it.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.ja.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.ko.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.pl.xlf | 135 ------------------ .../xlf/WorkspacesResources.pt-BR.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.ru.xlf | 135 ------------------ .../Portable/xlf/WorkspacesResources.tr.xlf | 135 ------------------ .../xlf/WorkspacesResources.zh-Hans.xlf | 135 ------------------ .../xlf/WorkspacesResources.zh-Hant.xlf | 135 ------------------ 33 files changed, 1879 insertions(+), 1880 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index adcc2b9a18347..a2d67b8cbb137 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -149,7 +149,7 @@ private static bool IsSpecial(VirtualChar ch) var chars = GetCharsToCurrentPosition(start); diagnostic ??= new EmbeddedDiagnostic( - WorkspacesResources.Unterminated_string, GetSpan(chars)); + FeaturesResources.Unterminated_string, GetSpan(chars)); return (chars, JsonKind.StringToken, diagnostic); } @@ -162,7 +162,7 @@ private static bool IsSpecial(VirtualChar ch) if (this.Position == Text.Length) { var chars = GetCharsToCurrentPosition(stringStart); - return new EmbeddedDiagnostic(WorkspacesResources.Unterminated_string, GetSpan(chars)); + return new EmbeddedDiagnostic(FeaturesResources.Unterminated_string, GetSpan(chars)); } var currentCh = this.CurrentChar; @@ -187,7 +187,7 @@ private static bool IsSpecial(VirtualChar ch) default: Position++; var chars = GetCharsToCurrentPosition(escapeStart); - return new EmbeddedDiagnostic(WorkspacesResources.Invalid_escape_sequence, GetSpan(chars)); + return new EmbeddedDiagnostic(FeaturesResources.Invalid_escape_sequence, GetSpan(chars)); } } @@ -205,7 +205,7 @@ private static bool IsSpecial(VirtualChar ch) if (invalid || (Position - unicodeCharStart != 4)) { var chars = GetCharsToCurrentPosition(escapeStart); - return new EmbeddedDiagnostic(WorkspacesResources.Invalid_escape_sequence, GetSpan(chars)); + return new EmbeddedDiagnostic(FeaturesResources.Invalid_escape_sequence, GetSpan(chars)); } return null; @@ -311,7 +311,7 @@ private ImmutableArray ScanTrivia(bool leading) var chars = GetCharsToCurrentPosition(start); return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars, ImmutableArray.Create(new EmbeddedDiagnostic( - WorkspacesResources.Error_parsing_comment, + FeaturesResources.Error_parsing_comment, GetSpan(chars)))); } @@ -336,7 +336,7 @@ this.CurrentChar is var ch && // Note: json.net reports an error if the file ends with "//", so we just // preserve that behavior. var diagnostics = ImmutableArray.Create(new EmbeddedDiagnostic( - WorkspacesResources.Unterminated_comment, + FeaturesResources.Unterminated_comment, GetSpan(chars))); return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars, diagnostics); } @@ -364,7 +364,7 @@ private JsonTrivia ScanMultiLineComment() Debug.Assert(Position == Text.Length); return CreateTrivia(JsonKind.MultiLineCommentTrivia, GetCharsToCurrentPosition(start), ImmutableArray.Create(new EmbeddedDiagnostic( - WorkspacesResources.Unterminated_comment, + FeaturesResources.Unterminated_comment, GetTextSpan(start, Position)))); } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index fa9e0c497c40d..25c4811f42ef4 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -100,7 +100,7 @@ private static class JsonNetSyntaxChecker catch (Exception) { return new EmbeddedDiagnostic( - WorkspacesResources.Invalid_number, + FeaturesResources.Invalid_number, GetSpan(chars)); } } @@ -109,7 +109,7 @@ private static class JsonNetSyntaxChecker CultureInfo.InvariantCulture, out _)) { return new EmbeddedDiagnostic( - WorkspacesResources.Invalid_number, + FeaturesResources.Invalid_number, GetSpan(chars)); } @@ -123,7 +123,7 @@ private static class JsonNetSyntaxChecker if (child.Kind == JsonKind.Property) { return new EmbeddedDiagnostic( - WorkspacesResources.Properties_not_allowed_in_an_array, + FeaturesResources.Properties_not_allowed_in_an_array, ((JsonPropertyNode)child).ColonToken.GetSpan()); } } @@ -137,7 +137,7 @@ private static class JsonNetSyntaxChecker if (!IsValidConstructorName(node.NameToken)) { return new EmbeddedDiagnostic( - WorkspacesResources.Invalid_constructor_name, + FeaturesResources.Invalid_constructor_name, node.NameToken.GetSpan()); } @@ -167,7 +167,7 @@ private static bool IsValidConstructorName(JsonToken nameToken) nextChild.Kind != JsonKind.CommaValue) { return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_expected, ','), + string.Format(FeaturesResources._0_expected, ','), GetFirstToken(nextChild).GetSpan()); } } @@ -185,7 +185,7 @@ private static bool IsValidConstructorName(JsonToken nameToken) if (child.Kind != JsonKind.Property) { return new EmbeddedDiagnostic( - WorkspacesResources.Only_properties_allowed_in_an_object, + FeaturesResources.Only_properties_allowed_in_an_object, GetFirstToken(child).GetSpan()); } } @@ -194,7 +194,7 @@ private static bool IsValidConstructorName(JsonToken nameToken) if (child.Kind != JsonKind.CommaValue) { return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_expected, ','), + string.Format(FeaturesResources._0_expected, ','), GetFirstToken(child).GetSpan()); } } @@ -209,7 +209,7 @@ private static bool IsValidConstructorName(JsonToken nameToken) !IsLegalPropertyNameText(node.NameToken)) { return new EmbeddedDiagnostic( - WorkspacesResources.Invalid_property_name, + FeaturesResources.Invalid_property_name, node.NameToken.GetSpan()); } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 867cfb8f10d67..d88d1f6588581 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -62,7 +62,7 @@ private static class StrictSyntaxChecker case JsonKind.SingleLineCommentTrivia: // Strict mode doesn't allow comments at all. return new EmbeddedDiagnostic( - WorkspacesResources.Comments_not_allowed, + FeaturesResources.Comments_not_allowed, GetSpan(trivia.VirtualChars)); case JsonKind.WhitespaceTrivia: return CheckWhitespace(trivia); @@ -85,7 +85,7 @@ private static class StrictSyntaxChecker // Strict mode only allows spaces and horizontal tabs. Everything else // is illegal. return new EmbeddedDiagnostic( - WorkspacesResources.Illegal_whitespace_character, + FeaturesResources.Illegal_whitespace_character, ch.Span); } } @@ -116,7 +116,7 @@ private static class StrictSyntaxChecker if (child.Kind != JsonKind.Property && child.Kind != JsonKind.CommaValue) { return new EmbeddedDiagnostic( - WorkspacesResources.Only_properties_allowed_in_an_object, + FeaturesResources.Only_properties_allowed_in_an_object, GetFirstToken(child).GetSpan()); } } @@ -131,7 +131,7 @@ private static class StrictSyntaxChecker if (child.Kind == JsonKind.Property) { return new EmbeddedDiagnostic( - WorkspacesResources.Properties_not_allowed_in_an_array, + FeaturesResources.Properties_not_allowed_in_an_array, ((JsonPropertyNode)child).ColonToken.GetSpan()); } } @@ -150,7 +150,7 @@ private static class StrictSyntaxChecker if (child.Kind == JsonKind.CommaValue) { return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_unexpected, ","), + string.Format(FeaturesResources._0_unexpected, ","), child.GetSpan()); } } @@ -159,7 +159,7 @@ private static class StrictSyntaxChecker if (child.Kind != JsonKind.CommaValue) { return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_expected, ","), + string.Format(FeaturesResources._0_expected, ","), GetFirstToken(child).GetSpan()); } } @@ -170,7 +170,7 @@ private static class StrictSyntaxChecker { var lastChild = sequence[^1]; return new EmbeddedDiagnostic( - WorkspacesResources.Trailing_comma_not_allowed, + FeaturesResources.Trailing_comma_not_allowed, lastChild.GetSpan()); } @@ -182,14 +182,14 @@ private static class StrictSyntaxChecker if (node.NameToken.Kind != JsonKind.StringToken) { return new EmbeddedDiagnostic( - WorkspacesResources.Property_name_must_be_a_string, + FeaturesResources.Property_name_must_be_a_string, node.NameToken.GetSpan()); } if (node.Value.Kind == JsonKind.CommaValue) { return new EmbeddedDiagnostic( - WorkspacesResources.Value_required, + FeaturesResources.Value_required, new TextSpan(node.ColonToken.VirtualChars[0].Span.End, 0)); } @@ -262,7 +262,7 @@ Numeric values that cannot be represented in the grammar below (such if (!s_validNumberRegex.IsMatch(literalText)) { return new EmbeddedDiagnostic( - WorkspacesResources.Invalid_number, + FeaturesResources.Invalid_number, literalToken.GetSpan()); } @@ -275,7 +275,7 @@ Numeric values that cannot be represented in the grammar below (such if (chars[0] == '\'') { return new EmbeddedDiagnostic( - WorkspacesResources.Strings_must_start_with_double_quote_not_single_quote, + FeaturesResources.Strings_must_start_with_double_quote_not_single_quote, chars[0].Span); } @@ -284,7 +284,7 @@ Numeric values that cannot be represented in the grammar below (such if (chars[i] < ' ') { return new EmbeddedDiagnostic( - WorkspacesResources.Illegal_string_character, + FeaturesResources.Illegal_string_character, chars[i].Span); } } @@ -297,7 +297,7 @@ Numeric values that cannot be represented in the grammar below (such if (chars[i + 1] == '\'') { return new EmbeddedDiagnostic( - WorkspacesResources.Invalid_escape_sequence, + FeaturesResources.Invalid_escape_sequence, TextSpan.FromBounds(chars[i].Span.Start, chars[i + 1].Span.End)); } @@ -316,21 +316,21 @@ Numeric values that cannot be represented in the grammar below (such private static EmbeddedDiagnostic? InvalidLiteral(JsonToken literalToken) { return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_literal_not_allowed, literalToken.VirtualChars.CreateString()), + string.Format(FeaturesResources._0_literal_not_allowed, literalToken.VirtualChars.CreateString()), literalToken.GetSpan()); } private static EmbeddedDiagnostic? CheckNegativeLiteral(JsonNegativeLiteralNode node) { return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_literal_not_allowed, "-Infinity"), + string.Format(FeaturesResources._0_literal_not_allowed, "-Infinity"), node.GetSpan()); } private static EmbeddedDiagnostic? CheckConstructor(JsonConstructorNode node) { return new EmbeddedDiagnostic( - WorkspacesResources.Constructors_not_allowed, + FeaturesResources.Constructors_not_allowed, node.NewKeyword.GetSpan()); } } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index cd5c5318c5f6a..18fa3d048bfef 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -48,10 +48,10 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// internal partial struct JsonParser { - private static readonly string s_closeBracketExpected = string.Format(WorkspacesResources._0_expected, ']'); - private static readonly string s_closeBraceExpected = string.Format(WorkspacesResources._0_expected, '}'); - private static readonly string s_openParenExpected = string.Format(WorkspacesResources._0_expected, '('); - private static readonly string s_closeParenExpected = string.Format(WorkspacesResources._0_expected, ')'); + private static readonly string s_closeBracketExpected = string.Format(FeaturesResources._0_expected, ']'); + private static readonly string s_closeBraceExpected = string.Format(FeaturesResources._0_expected, '}'); + private static readonly string s_openParenExpected = string.Format(FeaturesResources._0_expected, '('); + private static readonly string s_closeParenExpected = string.Format(FeaturesResources._0_expected, ')'); private JsonLexer _lexer; private JsonToken _currentToken; @@ -155,7 +155,7 @@ private JsonTree ParseTree(bool strict) compilationUnit.EndOfFileToken.LeadingTrivia.All( t => t.Kind == JsonKind.WhitespaceTrivia || t.Kind == JsonKind.EndOfLineTrivia)) { - return new EmbeddedDiagnostic(WorkspacesResources.Syntax_error, GetSpan(text)); + return new EmbeddedDiagnostic(FeaturesResources.Syntax_error, GetSpan(text)); } } else if (arraySequence.Length >= 2) @@ -163,7 +163,7 @@ private JsonTree ParseTree(bool strict) // the top level can't have more than one actual value. var firstToken = GetFirstToken(arraySequence[1]); return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_unexpected, firstToken.VirtualChars[0]), + string.Format(FeaturesResources._0_unexpected, firstToken.VirtualChars[0]), firstToken.GetSpan()); } @@ -174,7 +174,7 @@ private JsonTree ParseTree(bool strict) { var emptyValue = (JsonCommaValueNode)child; return new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_unexpected, ','), + string.Format(FeaturesResources._0_unexpected, ','), emptyValue.CommaToken.GetSpan()); } } @@ -316,7 +316,7 @@ private JsonPropertyNode ParseProperty(JsonToken stringLiteralOrText) return new JsonPropertyNode( stringLiteralOrText, colonToken, new JsonCommaValueNode(CreateMissingToken(JsonKind.CommaToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( - WorkspacesResources.Missing_property_value, + FeaturesResources.Missing_property_value, GetTokenStartPositionSpan(_currentToken))))); } @@ -328,7 +328,7 @@ private JsonPropertyNode ParseProperty(JsonToken stringLiteralOrText) value = new JsonPropertyNode( nestedProperty.NameToken, nestedProperty.ColonToken.AddDiagnosticIfNone(new EmbeddedDiagnostic( - WorkspacesResources.Nested_properties_not_allowed, + FeaturesResources.Nested_properties_not_allowed, nestedProperty.ColonToken.GetSpan())), nestedProperty.Value); } @@ -391,14 +391,14 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) return new JsonTextNode( token.With(kind: JsonKind.TextToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( - string.Format(WorkspacesResources._0_unexpected, firstChar.ToString()), + string.Format(FeaturesResources._0_unexpected, firstChar.ToString()), firstChar.Span))); } private JsonConstructorNode ParseConstructor(JsonToken token) { var newKeyword = token.With(kind: JsonKind.NewKeyword); - var nameToken = ConsumeToken(JsonKind.TextToken, WorkspacesResources.Name_expected); + var nameToken = ConsumeToken(JsonKind.TextToken, FeaturesResources.Name_expected); var openParen = ConsumeToken(JsonKind.OpenParenToken, s_openParenExpected); var savedInConstructor = _inConstructor; diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index 03929436c8985..6156aec4ffab2 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -3022,4 +3022,86 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Symbol found in assembly path '{0}' + + + Invalid number + + + Unterminated comment + + + Unterminated string + + + '{0}' expected + + + '{0}' unexpected + + + Invalid escape sequence + + + Error parsing comment + + + Syntax error + + + Invalid property name + + + Missing property value + + + Nested properties not allowed + + + Name expected + + + Invalid constructor name + + + Comments not allowed + + + Constructors not allowed + + + Illegal string character + + + Illegal whitespace character + + + Only properties allowed in an object + + + Properties not allowed in an array + + + Property name must be a string + + + Strings must start with " not ' + + + Trailing comma not allowed + + + Value required + + + '{0}' literal not allowed + + + JSON issue: {0} + + + Probable JSON string detected + + + Enable JSON editor features + \ No newline at end of file diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 7c1b1f08579e3..a32264bf45770 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -405,6 +405,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Změna viditelnosti {0} vyžaduje restartování aplikace. + + Comments not allowed + Comments not allowed + + Configure {0} code style Nakonfigurovat styl kódu {0} @@ -425,6 +430,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Nakonfigurujte závažnost pro všechny analyzátory. + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Převést na LINQ @@ -545,6 +555,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Změny provedené v projektu {0} vyžadují restartování aplikace: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Při čtení souboru {0} došlo k chybě: {1} @@ -560,6 +575,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Při vytváření instance CodeFixProvider {0} došlo k chybě. + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Chyba při čtení PDB: {0} @@ -730,6 +750,16 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Znak \ na konci vzorku je neplatný. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Neplatné {x,y} s x > y @@ -870,16 +900,41 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Zavést proměnnou dotazu + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Neplatný název skupiny: Názvy skupin musí začínat znakem slova. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Neplatný výběr + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Nastavit třídu jako abstract @@ -955,6 +1010,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Chybí řídicí znak This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Úprava {0} se statickou proměnnou vyžaduje restartování aplikace. @@ -1070,11 +1130,21 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Přesunutí {0} vyžaduje restartování aplikace. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Přechází se na symbol {0} z {1}. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Vnořený kvantifikátor {0} @@ -1105,11 +1175,31 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Nedostatek znaků ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operátory + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Odkaz na vlastnost se nedá aktualizovat. @@ -2385,6 +2475,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Stream musí podporovat operace read a seek. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Potlačit {0} @@ -2400,6 +2495,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv V cestě sestavení {0} byl nalezen symbol. + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Uvolněte nespravované prostředky (nespravované objekty) a přepište finalizační metodu. @@ -2445,6 +2545,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Příliš mnoho znaků ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typy: @@ -2485,11 +2590,21 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Nedokončená sada [] This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Neukončený komentář (?#...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Zrušit zalomení všech argumentů @@ -2650,6 +2765,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Hodnota: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Upozornění: Změna oboru názvů může vést k vytvoření neplatného kódu a změnit význam kódu. @@ -2735,6 +2855,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Ve vloženém souboru PDB se našel {0}. @@ -2780,11 +2905,21 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv {0} tady není null. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. {0} tady může být null. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Desetimiliontiny sekundy diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index f37fa60af4881..658489431f942 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -405,6 +405,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Ändern der Sichtbarkeit von {0} erfordert einen Neustart der Anwendung. + + Comments not allowed + Comments not allowed + + Configure {0} code style Codeformat "{0}" konfigurieren @@ -425,6 +430,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Schweregrad für alle Analysetools konfigurieren + + Constructors not allowed + Constructors not allowed + + Convert to LINQ In LINQ konvertieren @@ -545,6 +555,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Änderungen, die im Projekt "{0}" vorgenommen wurden, erfordern einen Neustart der Anwendung: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Fehler beim Lesen der Datei "{0}": {1} @@ -560,6 +575,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Fehler beim Erstellen der CodeFixProvider-Instanz "{0}". + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Fehler beim Lesen von PDB-Dateien: „{0}“ @@ -730,6 +750,16 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Nicht zulässiges \-Zeichen am Ende des Musters. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Illegaler {x,y}-Wert mit x > y. @@ -870,16 +900,41 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Abfragevariable bereitstellen + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Ungültiger Gruppenname: Gruppennamen müssen mit einem Wortzeichen beginnen. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Ungültige Auswahl. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Klasse als "abstract" festlegen @@ -955,6 +1010,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Fehlendes Steuerzeichen This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Das Ändern von {0}, welche eine statische Variable enthält erfordert einen Neustart der Anwendung. @@ -1070,11 +1130,21 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Verschieben von {0} erfordert einen Neustart der Anwendung. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Die Navigation von „{1}“ zum Symbol „{0}“ wird durchgeführt. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Geschachtelter Quantifizierer {0}. @@ -1105,11 +1175,31 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Zu wenige )-Zeichen This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatoren + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Der Eigenschaftenverweis kann nicht aktualisiert werden. @@ -2385,6 +2475,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Stream muss Lese- und Suchvorgänge unterstützen. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} unterdrücken @@ -2400,6 +2495,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Das Symbol wurde unter dem Assemblypfad „{0}“ gefunden + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Nicht verwaltete Ressourcen (nicht verwaltete Objekte) freigeben und Finalizer überschreiben @@ -2445,6 +2545,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Zu viele )-Zeichen. This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typen: @@ -2485,11 +2590,21 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Nicht abgeschlossener []-Satz This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Nicht abgeschlossener (?#...)-Kommentar. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Umbruch für alle Argumente aufheben @@ -2650,6 +2765,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Wert: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Warnung: Durch die Änderung des Namespaces kann der Code ungültig werden oder seine Bedeutung verändern. @@ -2735,6 +2855,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. „{0}“ wurde in einer eingebetteten PDB-Datei gefunden. @@ -2780,11 +2905,21 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg "{0}" ist hier nicht NULL. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. "{0}" darf hier NULL sein. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10.000.000stel einer Sekunde diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 1b3a2701ef342..4c787aee6f2bd 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -405,6 +405,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para cambiar la visibilidad de {0} es necesario reiniciar la aplicación. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurar el estilo de código de {0} @@ -425,6 +430,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Configurar la gravedad de todos los analizadores + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Convertir a LINQ @@ -545,6 +555,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Los cambios realizados en el proyecto "{0}" requieren reiniciar la aplicación: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Error al leer el archivo "{0}": {1} @@ -560,6 +575,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Error al crear la instancia de CodeFixProvider "{0}" + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Error al leer PDB: '{0}' @@ -730,6 +750,16 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa \ no válido al final del modelo This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Ilegales {x, y} con x > y @@ -870,16 +900,41 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Introducir la variable de consulta + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nombre de grupo no válido: nombres de grupo deben comenzar con un carácter de palabra This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Selección no válida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Convertir la clase en "abstract" @@ -955,6 +1010,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Falta de carácter de control This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Para modificar {0}que contiene una variable estática, es necesario reiniciar la aplicación. @@ -1070,11 +1130,21 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para mover {0} es necesario reiniciar la aplicación. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navegando al símbolo '{0}' desde '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Cuantificador anidado {0} @@ -1105,11 +1175,31 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa No hay suficientes ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operadores + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated No se puede actualizar la referencia de propiedad @@ -2385,6 +2475,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us La secuencia debe admitir las operaciones de lectura y búsqueda. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Suprimir {0} @@ -2400,6 +2495,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Símbolo encontrado en la ruta de acceso del ensamblado '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: liberar los recursos no administrados (objetos no administrados) y reemplazar el finalizador @@ -2445,6 +2545,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Demasiados ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipos: @@ -2485,11 +2590,21 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Conjunto [] sin terminar This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Comentario (?#...) sin terminar This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Desajustar todos los argumentos @@ -2650,6 +2765,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Valor: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Advertencia: si cambia Cambiar el espacio de nombres puede producir código inválido y cambiar el significado del código. @@ -2735,6 +2855,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' encontrados en PDB incrustado. @@ -2780,11 +2905,21 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us "{0}" no es NULL aquí. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. "{0}" puede ser NULL aquí. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second La diezmillonésima parte de un segundo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index 461c9bb1d6429..788fedb7a1343 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -405,6 +405,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai La modification de la visibilité de {0} requiert le redémarrage de l’application. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurer le style de code {0} @@ -425,6 +430,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Configurer la gravité pour tous les analyseurs + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Convertir en LINQ @@ -545,6 +555,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Les modifications apportées au projet « {0} » nécessitent le redémarrage de l’application : {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Erreur durant la lecture du fichier '{0}' : {1} @@ -560,6 +575,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Erreur lors de la création de l'instance de CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Erreur de lecture de la base de données PDB : '{0}' @@ -730,6 +750,16 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Caractère \ non autorisé à la fin du modèle This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} non autorisé avec x > y @@ -870,16 +900,41 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Introduire la variable de requête + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nom de groupe non valide : les noms de groupe doivent commencer par un caractère alphabétique This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Sélection incorrecte. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Rendre la classe 'abstract' @@ -955,6 +1010,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Caractère de contrôle manquant This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. La modification de {0} qui contient une variable statique requiert le redémarrage de l’application. @@ -1070,11 +1130,21 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Le déplacement de {0} requiert le redémarrage de l’application. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navigation vers le symbole '{0}' à partir de '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificateur imbriqué {0} @@ -1105,11 +1175,31 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Pas assez de )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Opérateurs + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated La référence de propriété ne peut pas être mise à jour @@ -2385,6 +2475,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Le flux doit prendre en charge les opérations de lecture et de recherche. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Supprimer {0} @@ -2400,6 +2495,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Symbole trouvé dans le chemin d’accès de l’assembly '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: libérer les ressources non managées (objets non managés) et substituer le finaliseur @@ -2445,6 +2545,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Trop de )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Types : @@ -2485,11 +2590,21 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Ensemble [] inachevé This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Commentaire (?#...) non terminé This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Désenvelopper tous les arguments @@ -2650,6 +2765,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Valeur : + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Avertissement : Le changement d’espace de noms peut produire du code non valide et changer la signification du code. @@ -2735,6 +2855,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' trouvé dans le fichier PDB incorporé. @@ -2780,11 +2905,21 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée '{0}' n'a pas une valeur null ici. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' a peut-être une valeur null ici. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10 000 000es de seconde diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index 37be60cf20496..4db62ec67acb6 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -405,6 +405,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si modifica la visibilità di {0}, è necessario riavviare l'applicazione. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configura lo stile del codice di {0} @@ -425,6 +430,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Configura la gravità per tutti gli analizzatori + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Converti in LINQ @@ -545,6 +555,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Le modifiche apportate nel progetto '{0}' richiedono il riavvio dell'applicazione: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Si è verificato un errore durante la lettura del file '{0}': {1} @@ -560,6 +575,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Si è verificato un errore durante la creazione dell'istanza di CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Errore durante la lettura del PDB: '{0}' @@ -730,6 +750,16 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Carattere \ non valido alla fine del criterio This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} non valido con x > y @@ -870,16 +900,41 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Introduci la variabile di query + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nome di gruppo non valido: i nomi di gruppo devono iniziare con un carattere alfanumerico This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Selezione non valida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Rendi la classe 'abstract' @@ -955,6 +1010,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Carattere di controllo mancante This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Se si modifica {0} che contiene una variabile statica, è necessario riavviare l'applicazione. @@ -1070,11 +1130,21 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si sposta {0}, è necessario riavviare l'applicazione. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Passaggio al simbolo '{0}' da '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificatore nidificato {0} @@ -1105,11 +1175,31 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Parentesi chiuse insufficienti This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatori + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Non è possibile aggiornare il riferimento alla proprietà @@ -2385,6 +2475,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Il flusso deve supportare operazioni di lettura e ricerca. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Elimina {0} @@ -2400,6 +2495,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Simbolo trovato nel percorso assembly '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: liberare risorse non gestite (oggetti non gestiti) ed eseguire l'override del finalizzatore @@ -2445,6 +2545,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Troppe parentesi di chiusura This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipi: @@ -2485,11 +2590,21 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Set di [] senza terminazione This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Commento (?#...) senza terminazione This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Annulla il ritorno a capo per tutti gli argomenti @@ -2650,6 +2765,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Valore: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Avviso: la modifica dello spazio dei nomi può comportare la creazione di codice non valido e modificare il significato del codice. @@ -2735,6 +2855,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' trovati nel PDB incorporato. @@ -2780,11 +2905,21 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' '{0}' non è Null in questo punto. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' può essere Null in questo punto. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Decimilionesimi di secondo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index ca2c7e0fc26b5..91c1c253846ba 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} の可視性を変更するには、アプリケーションを再起動する必要があります。 + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} コード スタイルの構成 @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma すべてのアナライザーの重要度を構成します + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ に変換 @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma プロジェクト '{0}' で加えられた変更にはアプリケーションの再起動が必要です: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} ファイル {0}' の読み取り中にエラーが発生しました: {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma CodeFixProvider '{0}' のインスタンスの作成でエラーが発生しました + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB: '{0}' の読み込み中にエラーが発生した @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 無効\末尾のパターン This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} で x > y は無効です @@ -870,16 +900,41 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma クエリ変数を導入します + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 無効なグループ名: グループ名は単語文字で始める必要があります This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. 選択が無効です。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' クラスを 'abstract' にしてください @@ -955,6 +1010,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma コントロール文字がありません This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 静的な変数を含む {0} を変更するには、アプリケーションを再起動する必要があります。 @@ -1070,11 +1130,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} を移動するには、アプリケーションを再起動する必要があります。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. "{1}" からシンボル '{0}' に移動しています。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 入れ子になった量指定子 {0} @@ -1105,11 +1175,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ) が足りません This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 演算子 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated プロパティ参照を更新できません @@ -2385,6 +2475,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ストリームは、読み取りとシーク操作をサポートする必要があります。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} の非表示 @@ -2400,6 +2495,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of アセンブリ パス '{0}' にシンボルが見つかりました + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: アンマネージド リソース (アンマネージド オブジェクト) を解放し、ファイナライザーをオーバーライドします @@ -2445,6 +2545,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ) が多すぎます This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 型: @@ -2485,11 +2590,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 未終了の [] セットです This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 未終了の (?#...) コメントです This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments すべての引数の折り返しを解除 @@ -2650,6 +2765,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 値: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 名前空間を変更すると無効なコードが生成され、コードの意味が変更される可能性があります。 @@ -2735,6 +2855,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 埋め込み PDB に '{0}' が見つかりました。 @@ -2780,11 +2905,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ここでは、'{0}' は null ではありません。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. ここでは、'{0}' は null である可能性があります。 + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10,000,000 分の 1 秒単位 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index da2341fce4044..74a9b51611e80 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} 표시 유형을 변경하려면 애플리케이션을 다시 시작해야 합니다. + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} 코드 스타일 구성 @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 모든 분석기에 대해 심각도 구성 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ로 변환 @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ' {0}' 프로젝트에서 변경한 내용을 적용하려면 응용 프로그램 ‘{1}’을(를) 다시 시작 해야 합니다. + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} '{0}' 파일을 읽는 동안 오류가 발생했습니다. {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma CodeFixProvider '{0}' 인스턴스를 만드는 동안 오류가 발생했습니다. + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB를 읽는 동안 오류 발생: '{0}' @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 패턴 끝에 \를 사용할 수 없습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x > y인 잘못된 {x,y}입니다. @@ -870,16 +900,41 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 쿼리 변수 지정 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 잘못된 그룹 이름: 그룹 이름은 단어 문자로 시작해야 합니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. 잘못된 선택 항목입니다. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 'abstract' 클래스 만들기 @@ -955,6 +1010,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 제어 문자가 없습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 정적 변수를 포함하는 {0}을(를) 수정하려면 애플리케이션을 다시 시작해야 합니다. @@ -1070,11 +1130,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0}을(를) 이동하려면 애플리케이션을 다시 시작해야 합니다. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. '{1}'에서 기호 '{0}'(으)로 이동하는 중입니다. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 중첩 수량자 {0}입니다. @@ -1105,11 +1175,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 부족 )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 연산자 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 속성 참조를 업데이트할 수 없습니다. @@ -2385,6 +2475,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 스트림은 읽기 및 찾기 작업을 지원해야 합니다. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0}을(를) 표시하지 않음 @@ -2400,6 +2495,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 어셈블리 경로 '{0}'에서 기호를 찾음 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 비관리형 리소스(비관리형 개체)를 해제하고 종료자를 재정의합니다. @@ -2445,6 +2545,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of )가 너무 많습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 형식: @@ -2485,11 +2590,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 종결되지 않은 [] 집합 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 종격되지 않은 (?#...) 주석 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 모든 인수 래핑 해제 @@ -2650,6 +2765,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 값: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 경고: 네임스페이스를 변경하면 잘못된 코드가 발생하고 코드 의미가 변경될 수 있습니다. @@ -2735,6 +2855,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 포함된 PDB에서 '{0}'을(를) 찾았습니다. @@ -2780,11 +2905,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}'은(는) 여기에서 null이 아닙니다. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}'은(는) 여기에서 null일 수 있습니다. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10,000,000분의 1초 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index ca0c8d5f25aa4..825908ffeb13e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -405,6 +405,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zmiana widoczności elementu {0} wymaga ponownego uruchomienia aplikacji. + + Comments not allowed + Comments not allowed + + Configure {0} code style Konfiguruj styl kodu {0} @@ -425,6 +430,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Konfiguruj ważność wszystkich analizatorów + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Konwertuj na składnię LINQ @@ -545,6 +555,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zmiany wprowadzone w projekcie „{0}” wymagają ponownego uruchomienia aplikacji: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Błąd podczas odczytywania pliku „{0}”: {1} @@ -560,6 +575,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Błąd podczas tworzenia wystąpienia elementu CodeFixProvider „{0}” + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Błąd podczas odczytywania pliku PDB: „{0}” @@ -730,6 +750,16 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Niedozwolony znak \ na końcu wzorca This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Niedozwolone wyrażenie {x,y} z wartością x > y @@ -870,16 +900,41 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Wprowadź zmienną zapytania + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nieprawidłowa nazwa grupy: nazwy grup muszą rozpoczynać się od znaku wyrazu This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Nieprawidłowe zaznaczenie. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Ustaw specyfikator „abstract” dla klasy @@ -955,6 +1010,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Brak znaku kontrolnego This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Modyfikacja elementu {0}, który zawiera zmienną statyczną, wymaga ponownego uruchomienia aplikacji. @@ -1070,11 +1130,21 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Przeniesienie elementu {0} wymaga ponownego uruchomienia aplikacji. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Trwa przechodzenie do symbolu „{0}” z „{1}”. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Zagnieżdżony kwantyfikator {0} @@ -1105,11 +1175,31 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zbyt mało znaków ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatory + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Nie można zaktualizować referencji właściwości @@ -2385,6 +2475,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Strumień musi obsługiwać operacje odczytu i wyszukiwania. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Pomiń element {0} @@ -2400,6 +2495,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Znaleziono symbol w ścieżce zestawu „{0}” + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Zwolnić niezarządzane zasoby (niezarządzane obiekty) i przesłonić finalizator @@ -2445,6 +2545,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Zbyt wiele znaków ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typy: @@ -2485,11 +2590,21 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Niezakończony zestaw [] This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Niezakończony komentarz (?#...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Odwijaj wszystkie argumenty @@ -2650,6 +2765,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Wartość: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Ostrzeżenie: Zmiana przestrzeni nazw może skutkować nieprawidłowym kodem i zmianą jego znaczenia. @@ -2735,6 +2855,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Znaleziono „{0}” w osadzonym pliku PDB. @@ -2780,11 +2905,21 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Element „{0}” nie ma wartości null w tym miejscu. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. Element „{0}” może mieć wartość null w tym miejscu. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 1/10 000 000 sekundy diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index a1ddedb268287..4295e716775ba 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -405,6 +405,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Para alterar a visibilidade de {0}, é necessário reiniciar o aplicativo. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurar estilo de código de {0} @@ -425,6 +430,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Configurar gravidade para todos os analisadores + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Converter para LINQ @@ -545,6 +555,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess As alterações feitas no projeto '{0}' requerem a reinicialização do aplicativo: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Erro ao ler o arquivo '{0}': {1} @@ -560,6 +575,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Erro ao criar instância de CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Erro ao ler PDB: '{0}' @@ -730,6 +750,16 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess \ ilegal no final do padrão This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} ilegal com x> y @@ -870,16 +900,41 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Introduzir a variável de consulta + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nome de grupo inválido: nomes de grupos devem começar com um caractere de palavra This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Seleção inválida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Tornar a classe 'abstract' @@ -955,6 +1010,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Caractere de controle ausente This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. A modificação de {0}, que contém uma variável estática, requer o reinício do aplicativo. @@ -1070,11 +1130,21 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Mover {0} requer reiniciar o aplicativo. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navegando para o símbolo '{0}' de '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificador aninhado {0} @@ -1105,11 +1175,31 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Não há )'s suficientes This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operadores + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated A referência de propriedade não pode ser atualizada @@ -2385,6 +2475,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas O fluxo deve fornecer suporte a operações de leitura e busca. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Suprimir {0} @@ -2400,6 +2495,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Símbolo encontrado no caminho de montagem '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: free unmanaged resources (unmanaged objects) and override finalizer @@ -2445,6 +2545,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Muitos )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipos: @@ -2485,11 +2590,21 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Conjunto [] não finalizado This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Comentário (?#...) não finalizado This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Desencapsular todos os argumentos @@ -2650,6 +2765,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Valor: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Aviso: a alteração do namespace pode produzir código inválido e mudar o significado do código. @@ -2735,6 +2855,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' encontrado no PDB integrado. @@ -2780,11 +2905,21 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas '{0}' não é nulo aqui. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' pode ser nulo aqui. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Dez milionésimos de um segundo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 056492df1c31b..88ff0c5a18438 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для изменения видимости {0} требуется перезапустить приложение. + + Comments not allowed + Comments not allowed + + Configure {0} code style Настройка стиля кода {0} @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Настройка серьезности для всех анализаторов + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Преобразовать в LINQ @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma После внесения изменений в проект "{0}" необходимо перезапустить приложение: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Ошибка при чтении файла "{0}": {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Ошибка при создании экземпляра CodeFixProvider "{0}". + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Ошибка чтения PDB-файла: "{0}" @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Недопустимый символ "\" в конце шаблона This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Неправильное использование {x,y} в x > y @@ -870,16 +900,41 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Добавить переменную запроса + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Недопустимое имя группы: имя группы должно начинаться с буквы This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Недопустимое выделение. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Сделать класс абстрактным @@ -955,6 +1010,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Отсутствует управляющий символ This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Для изменения {0}, где содержится статическая переменная, требуется перезапустить приложение. @@ -1070,11 +1130,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для перемещения {0} требуется перезапустить приложение. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Переход к символу "{0}" от "{1}". + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Вложенный квантификатор {0} @@ -1105,11 +1175,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Отсутствуют закрывающие круглые скобки This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Операторы + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Не удается обновить ссылку на свойство @@ -2385,6 +2475,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Поток должен поддерживать операции чтения и поиска. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Скрыть {0} @@ -2400,6 +2495,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Найден символ в пути сборки "{0}" + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: освободить неуправляемые ресурсы (неуправляемые объекты) и переопределить метод завершения @@ -2445,6 +2545,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Слишком много закрывающих круглых скобок This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Типы: @@ -2485,11 +2590,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Набор [] без признака завершения This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Незавершенный комментарий (? #...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Развернуть все аргументы @@ -2650,6 +2765,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Значение: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Предупреждение: изменение пространства имен может привести к появлению недопустимого кода и к изменению значения кода. @@ -2735,6 +2855,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Найдено "{0}" во внедренном PDB-файле. @@ -2780,11 +2905,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Здесь "{0}" имеет значение, отличное от NULL. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. Здесь "{0}" может иметь значение NULL. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10 000 000-е доли секунды diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index 9b6b513ed3e45..356ed11e363c4 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -405,6 +405,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesinin görünürlüğünün değiştirilmesi, uygulamanın yeniden başlatılmasını gerektirir. + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} kod stilini yapılandır @@ -425,6 +430,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Tüm çözümleyiciler için önem derecesini yapılandır + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ to dönüştürme @@ -545,6 +555,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be '{0}' projesinde yapılan değişiklikler uygulamanın yeniden başlatılmasını gerektiriyor: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} '{0}' dosyası okunurken hata: {1} @@ -560,6 +575,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be '{0}' CodeFixProvider örneği oluşturulurken hata oluştu + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB okuma hatası: “{0}” @@ -730,6 +750,16 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Yasadışı \ model sonunda This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Yasadışı {x, y} x > y @@ -870,16 +900,41 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Sorgu değişkeni ekle + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Geçersiz grup adı: grup adları bir sözcük karakteri ile başlamalıdır This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. Geçersiz seçim. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Sınıfı 'abstract' yap @@ -955,6 +1010,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Eksik denetim karakteri This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Statik bir değişken içeren {0} öğesinin değiştirilmesi, uygulamanın yeniden başlatılmasını gerektirir. @@ -1070,11 +1130,21 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesinin taşınması uygulamanın yeniden başlatılmasını gerektirir. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. “{1}“den "{0}" sembolüne gidiliyor. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} İç içe geçmiş niceleyici {0} @@ -1105,11 +1175,31 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Değil yeterli)'ın This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatörler + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Özellik başvurusu güncelleştirilemiyor @@ -2385,6 +2475,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Akış okuma ve arama işlemlerini desteklemelidir. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} eylemini bastır @@ -2400,6 +2495,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri “{0}” derleme yolunda sembol bulundu + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: yönetilmeyen kaynakları (yönetilmeyen nesneleri) serbest bırakın ve sonlandırıcıyı geçersiz kılın @@ -2445,6 +2545,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Çok fazla)'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Türler: @@ -2485,11 +2590,21 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Sonlandırılmamış [] kümesi This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Sonlandırılmamış (?... #) yorum This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Tüm bağımsız değişkenlerin sarmalamasını kaldır @@ -2650,6 +2765,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Değer: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Uyarı: Ad alanının değiştirilmesi geçersiz kod oluşturabilir ve kodun anlamını değiştirebilir. @@ -2735,6 +2855,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. “{0}”, gömülü PDB'de bulundu. @@ -2780,11 +2905,21 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri '{0}' burada null değil. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' burada null olabilir. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Saniyenin 10.000.000'da biri diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index 7ee893d23e7bb..99c3602d13787 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 更改 {0} 的可见性要求重启应用程序。 + + Comments not allowed + Comments not allowed + + Configure {0} code style 配置 {0} 代码样式 @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 为所有分析器配置严重性 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ 转换为 LINQ @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在项目“{0}”中所做的更改要求重新启动应用程序: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} 读取文件“{0}”时出错: {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 创建 CodeFixProvider“{0}”的实例时出错 + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' 读取 PDB 时出错:“{0}” @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 模式末尾的 \ 非法 This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x > y 的 {x,y} 无效 @@ -870,16 +900,41 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 引入查询变量 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 组名无效: 组名必须以单词字符开头 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. 无效的选择。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 将类设置为 "abstract" @@ -955,6 +1010,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 缺少控制字符 This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 修改包含静态变量的 {0} 需要重启应用程序。 @@ -1070,11 +1130,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 移动 {0} 要求重启应用程序。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. 从“{1}”导航到符号“{0}”。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 嵌套限定符 {0} @@ -1105,11 +1175,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ")" 不足 This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 运算符 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 无法更新属性引用 @@ -2385,6 +2475,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 流必须支持读取和搜寻操作。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} 抑制 {0} @@ -2400,6 +2495,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 在程序集路径 "{0}" 中找到符号 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 释放未托管的资源(未托管的对象)并重写终结器 @@ -2445,6 +2545,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ")" 太多 This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 类型: @@ -2485,11 +2590,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of [] 集未关闭 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment (?#...) 注释未关闭 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 展开所有参数 @@ -2650,6 +2765,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 值: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 更改命名空间可能会产生无效的代码并更改代码的含义。 @@ -2735,6 +2855,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 在嵌入的 PDB 中找到“{0}”。 @@ -2780,11 +2905,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of “{0}”在此处不为 null。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. “{0}”可能在此处为 null。 + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 千万分之一秒 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index f35e8c169d6da..b274b02d4d3a3 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 變更 {0} 的可見度需要重新啟動應用程式。 + + Comments not allowed + Comments not allowed + + Configure {0} code style 設定 {0} 程式碼樣式 @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 設定所有分析器的嚴重性 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ 轉換至 LINQ @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在專案 '{0}' 中所做的變更需要重新啟動應用程式: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} 讀取檔案 '{0}' 時發生錯誤: {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 建立 CodeFixProvider '{0}' 的執行個體時發生錯誤 + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' 讀取 PDB 時發生錯誤: '{0}' @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 模式結尾使用 \ 不符合格式規定 This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x 大於 y 的 {x,y} 不符合格式 @@ -870,16 +900,41 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 引進查詢變數 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 群組名稱無效: 群組名稱必須以文字字元開頭 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid selection. 無效的選取範圍。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 將類別設為 'abstract' @@ -955,6 +1010,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 缺少控制字元 This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 修改包含靜態變數的 {0} 需要重新啟動應用程式。 @@ -1070,11 +1130,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 移動 {0} 需要重新啟動應用程式。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. 正在從 '{1}' 瀏覽至符號 '{0}'。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 巢狀數量詞 {0} @@ -1105,11 +1175,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ) 不夠 This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 運算子 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 無法更新屬性參考 @@ -2385,6 +2475,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 資料流必須支援讀取及搜尋作業。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} 隱藏 {0} @@ -2400,6 +2495,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 在組件路徑 '{0}' 中找到符號 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 釋出非受控資源 (非受控物件) 並覆寫完成項 @@ -2445,6 +2545,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 太多 ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 類型: @@ -2485,11 +2590,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 未結束的 [] 組合 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 未結束的 (?#...) 註解 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 將所有引數取消換行 @@ -2650,6 +2765,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 值: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 變更命名空間可能會產生無效的程式碼及變更程式碼意義。 @@ -2735,6 +2855,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 在內嵌 PDB 中找到 '{0}'。 @@ -2780,11 +2905,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}' 在此不是 null。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' 在此可能為 null。 + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 1/10,000,000 秒 diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/LanguageServices/FallbackEmbeddedLanguage.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/LanguageServices/FallbackEmbeddedLanguage.cs index e8dff92dcb733..8491c62997135 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/LanguageServices/FallbackEmbeddedLanguage.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/LanguageServices/FallbackEmbeddedLanguage.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; -using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Classification.Classifiers; namespace Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices diff --git a/src/Workspaces/Core/Portable/WorkspacesResources.resx b/src/Workspaces/Core/Portable/WorkspacesResources.resx index 31120b3369eb0..06deb5218f886 100644 --- a/src/Workspaces/Core/Portable/WorkspacesResources.resx +++ b/src/Workspaces/Core/Portable/WorkspacesResources.resx @@ -502,87 +502,6 @@ Changing document properties is not supported - - Invalid number - - - Unterminated comment - - - Unterminated string - - - '{0}' expected - - - '{0}' unexpected - - - Invalid escape sequence - - - Error parsing comment - - - Syntax error - - - Invalid property name - - - Missing property value - - - Nested properties not allowed - - - Name expected - - - Invalid constructor name - - - Comments not allowed - - - Constructors not allowed - - - Illegal string character - - - Illegal whitespace character - - - Only properties allowed in an object - - - Properties not allowed in an array - - - Property name must be a string - - - Strings must start with " not ' - - - Trailing comma not allowed - - - Value required - - - '{0}' literal not allowed - - - JSON issue: {0} - - - Probable JSON string detected - - - Enable JSON editor features - Variables captured: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf index 615ec835a8820..778c4b26985b7 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf @@ -42,16 +42,6 @@ Příkaz CodeAction {0} nevytvořil změněné řešení. "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Základní možnosti pro EditorConfig @@ -72,86 +62,21 @@ Dokument nepodporuje stromy syntaxe. - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. Při čtení obsahu zdrojového souboru {0} došlo k chybě -- {1} - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Odsazení a mezery - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Předvolby nových řádků - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Na projekty odeslání se může odkazovat jen projekt odeslání. @@ -167,26 +92,11 @@ Předdefinovaný převod z {0} na {1} - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference Projekt neobsahuje zadaný odkaz. - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Pouze refaktoring @@ -212,11 +122,6 @@ Řešení neobsahuje zadaný odkaz. - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. Symbol {0} nepochází ze zdroje. @@ -302,11 +207,6 @@ Synchronizovat obor názvů se strukturou složek - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. Obsah dokumentu SourceGeneratedDocument nesmí být změněn. @@ -322,31 +222,11 @@ Řešení už zadaný odkaz obsahuje. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Neznámý - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Soubory jazyka Visual Basic @@ -367,11 +247,6 @@ Pracovní prostor není platný. - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} se nachází v jiném projektu. @@ -512,11 +387,6 @@ Očekávalo se {0}. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. {0} musí být neprázdný řetězec, který nemá hodnotu null. @@ -882,11 +752,6 @@ Změna vlastností dokumentu není podporovaná. - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions Konvence kódování v .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf index a466c50245afc..3b33ebc674923 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf @@ -42,16 +42,6 @@ Durch CodeAction "{0}" wurde keine geänderte Lösung erstellt. "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Wichtige EditorConfig-Optionen @@ -72,86 +62,21 @@ Das Dokument unterstützt keine Syntaxstrukturen. - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. Fehler beim Lesen des Inhalts der Quelldatei "{0}": "{1}". - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Einzüge und Abstände - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Einstellungen für neue Zeilen - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Nur ein Übermittlungsprojekt kann auf Übermittlungsprojekte verweisen. @@ -167,26 +92,11 @@ Vordefinierte Konvertierung von "{0}" in "{1}". - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference Der angegebene Verweis ist im Projekt nicht enthalten. - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Nur Refactoring @@ -212,11 +122,6 @@ Der angegebene Verweis ist nicht in der Projektmappe enthalten. - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. Symbol "{0}" ist nicht aus Quelle. @@ -302,11 +207,6 @@ Namespace mit Ordnerstruktur synchronisieren - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. Der Inhalt eines SourceGeneratedDocument kann nicht geändert werden. @@ -322,31 +222,11 @@ Der angegebene Verweis ist bereits in der Projektmappe enthalten. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Unbekannt - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Visual Basic-Dateien @@ -367,11 +247,6 @@ Arbeitsbereich ist nicht leer. - - '{0}' expected - '{0}' expected - - {0} is in a different project. "{0}" befindet sich in einem anderen Projekt. @@ -512,11 +387,6 @@ Erwartet wird {0}. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" muss eine Zeichenfolge sein, die nicht null und nicht leer ist. @@ -882,11 +752,6 @@ Das Ändern der Dokumenteigenschaften wird nicht unterstützt. - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions .NET-Codierungskonventionen diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf index d6cceebc3db50..28f0516522f55 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf @@ -42,16 +42,6 @@ El tipo CodeAction "{0}" no generó una solución modificada "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Opciones principales de EditorConfig @@ -72,86 +62,21 @@ El documento no admite árboles de sintaxis - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. Error al leer el contenido del archivo de origen "{0}"--"{1}". - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Sangría y espaciado - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Nuevas preferencias de línea - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Solo un proyecto de envío puede hacer referencia a proyectos de envío. @@ -167,26 +92,11 @@ Conversión predefinida de {0} a {1} - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference El proyecto no contiene la referencia especificada. - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Solo refactorización @@ -212,11 +122,6 @@ La solución no contiene la referencia especificada - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. El símbolo "{0}" no procede del código fuente. @@ -302,11 +207,6 @@ Sincronizar espacio de nombres con estructura de carpetas - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. No se puede cambiar el contenido de un elemento SourceGeneratedDocument. @@ -322,31 +222,11 @@ La solución ya contiene la referencia especificada. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Desconocido - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Archivos de Visual Basic @@ -367,11 +247,6 @@ El área de trabajo no está vacía. - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} está en un proyecto distinto. @@ -512,11 +387,6 @@ Se esperaba {0}. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" debe ser una cadena que no sea Null ni esté vacía. @@ -882,11 +752,6 @@ No se admite el cambio de propiedades de documentos - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions Convenciones de codificación .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf index f6a189ada6a10..b28c49f5e07d0 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf @@ -42,16 +42,6 @@ Le CodeAction '{0}' n'a pas produit de solution contenant des changements "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Options EditorConfig principales @@ -72,86 +62,21 @@ Le document ne prend pas en charge les arborescences de syntaxe - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. Erreur durant la lecture du contenu du fichier source '{0}' -- '{1}'. - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Indentation et espacement - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Préférences de nouvelle ligne - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Seul un projet de soumission peut référencer des projets de soumission. @@ -167,26 +92,11 @@ Conversion prédéfinie de {0} en {1}. - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference Le projet ne contient pas la référence spécifiée - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Refactorisation uniquement @@ -212,11 +122,6 @@ La solution ne contient pas la référence spécifiée - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. Le symbole "{0}" ne provient pas de la source. @@ -302,11 +207,6 @@ Synchroniser l'espace de noms avec la structure de dossier - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. Le contenu de SourceGeneratedDocument ne doit pas être changé. @@ -322,31 +222,11 @@ La solution contient déjà la référence spécifiée. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Inconnue - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Fichiers Visual Basic @@ -367,11 +247,6 @@ L'espace de travail n'est pas vide. - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} est dans un autre projet. @@ -512,11 +387,6 @@ {0} attendu. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" doit être une chaîne non null et non vide. @@ -882,11 +752,6 @@ Le changement des propriétés du document n'est pas pris en charge - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions Conventions de codage .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf index f60273f1ba836..833722dc62843 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf @@ -42,16 +42,6 @@ L'elemento CodeAction '{0}' non ha generato una soluzione modificata "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Opzioni EditorConfig di base @@ -72,86 +62,21 @@ Il documento non supporta alberi di sintassi - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. Si è verificato un errore durante la lettura del contenuto del file di origine '{0}' - '{1}'. - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Rientro e spaziatura - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Preferenze per nuova riga - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Solo il progetto di invio può fare riferimento a progetti di invio. @@ -167,26 +92,11 @@ Conversione predefinita da {0} a {1}. - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference Il progetto non contiene il riferimento specificato - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Solo refactoring @@ -212,11 +122,6 @@ La soluzione non contiene il riferimento specificato - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. Il simbolo "{0}" non proviene dall'origine. @@ -302,11 +207,6 @@ Sincronizza lo spazio dei nomi con la struttura di cartelle - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. Non è possibile modificare il contenuto di un elemento SourceGeneratedDocument. @@ -322,31 +222,11 @@ La soluzione contiene già il riferimento specificato. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Unbekannt - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files File Visual Basic @@ -367,11 +247,6 @@ L'area di lavoro non è vuota. - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} si trova in un progetto diverso. @@ -512,11 +387,6 @@ È previsto '{0}'. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" deve essere una stringa non Null e non vuota. @@ -882,11 +752,6 @@ La modifica delle proprietà del documento non è supportata - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions Convenzioni di scrittura codice .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf index 960c56cd001c3..055f08def46cc 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf @@ -42,16 +42,6 @@ CodeAction '{0}' は変更されたソリューションを生成しませんでした "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options コア EditorConfig オプション @@ -72,86 +62,21 @@ ドキュメントでは構文ツリーがサポートされません - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. ソース ファイル '{0}' のコンテンツの読み取りでエラーが発生しました -- '{1}'。 - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing インデントと間隔 - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences 改行設定 - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. 送信プロジェクトを参照できるのは、送信プロジェクトのみです。 @@ -167,26 +92,11 @@ {0} から {1} への定義済みの変換 - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference 指定された参照がプロジェクトに含まれていません - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only リファクタリングのみ @@ -212,11 +122,6 @@ 指定された参照がソリューションに含まれていません - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. シンボル "{0}" は、ソースからではありません。 @@ -302,11 +207,6 @@ 名前空間とフォルダー構造の同期 - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. SourceGeneratedDocument のコンテンツが変更されない可能性があります。 @@ -322,31 +222,11 @@ このソリューションには、指定された参照が既に含まれています。 - - Trailing comma not allowed - Trailing comma not allowed - - Unknown 不明 - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Visual Basic ファイル @@ -367,11 +247,6 @@ ワークスペースが空ではありません。 - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} は別のプロジェクトに含まれています。 @@ -512,11 +387,6 @@ {0} が必要です。 - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" は、Null 以外の空でない文字列にする必要があります。 @@ -882,11 +752,6 @@ ドキュメントのプロパティの変更はサポートされていません - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions .NET コーディング規則 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf index 5bc3991cbfe41..27fe20e964e11 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf @@ -42,16 +42,6 @@ CodeAction '{0}'이(가) 변경된 솔루션을 생성하지 않았습니다. "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options 코어 EditorConfig 옵션 @@ -72,86 +62,21 @@ 문서가 구문 트리를 지원하지 않음 - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. 소스 파일 '{0}'의 콘텐츠를 읽는 동안 오류가 발생했습니다. -- '{1}'. - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing 들여쓰기 및 간격 - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences 새 줄 기본 설정 - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. 제출 프로젝트만 제출 프로젝트를 참조할 수 있습니다. @@ -167,26 +92,11 @@ {0}에서 {1}(으)로의 미리 정의된 변환입니다. - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference 지정된 참조가 프로젝트에 포함되어 있지 않습니다. - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only 리팩터링만 @@ -212,11 +122,6 @@ 지정된 참조가 솔루션에 포함되어 있지 않습니다. - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. "{0}" 기호가 소스에 없습니다. @@ -302,11 +207,6 @@ 네임스페이스를 폴더 구조로 동기화 - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. SourceGeneratedDocument의 콘텐츠는 변경할 수 없습니다. @@ -322,31 +222,11 @@ 지정된 참조가 이미 솔루션에 포함되어 있습니다. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown 알 수 없음 - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Visual Basic 파일 @@ -367,11 +247,6 @@ 작업 영역이 비어 있지 않습니다. - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0}이(가) 다른 프로젝트에 있습니다. @@ -512,11 +387,6 @@ {0}이(가) 필요합니다. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}"은(는) null이 아니거나 비어 있지 않은 문자열이어야 합니다. @@ -882,11 +752,6 @@ 문서 속성 변경은 지원되지 않습니다. - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions .NET 코딩 규칙 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf index 81cedf168c5ef..bf6c1799e126d 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf @@ -42,16 +42,6 @@ Element CodeAction „{0}” nie utworzył zmienionego rozwiązania "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Podstawowe opcje EditorConfig @@ -72,86 +62,21 @@ Dokument nie obsługuje drzew składni - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. Błąd podczas odczytywania zawartości pliku źródłowego „{0}”--„{1}”. - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Wcięcia i odstępy - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Preferencje nowego wiersza - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Tylko przesyłany projekt może odwoływać się do przesyłanych projektów. @@ -167,26 +92,11 @@ Wstępnie zdefiniowana konwersja z {0} na {1}. - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference Projekt nie zawiera określonego odwołania - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Tylko refaktoryzacja @@ -212,11 +122,6 @@ Rozwiązanie nie zawiera określonego odwołania - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. Symbol „{0}” nie pochodzi ze źródła. @@ -302,11 +207,6 @@ Synchronizuj przestrzeń nazw ze strukturą folderów - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. Nie można zmienić zawartości elementu SourceGeneratedDocument. @@ -322,31 +222,11 @@ Rozwiązanie już zawiera określone odwołanie. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Nieznany - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Pliki języka Visual Basic @@ -367,11 +247,6 @@ Obszar roboczy nie jest pusty. - - '{0}' expected - '{0}' expected - - {0} is in a different project. Element {0} znajduje się w innym projekcie. @@ -512,11 +387,6 @@ Oczekiwano elementu {0}. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. Element „{0}” musi być ciągiem, który nie ma wartości null i nie jest pusty. @@ -882,11 +752,6 @@ Zmiana właściwości dokumentów nie jest obsługiwana - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions Konwencje kodowania .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf index 206e46a8d0f07..4079e600970ba 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf @@ -42,16 +42,6 @@ A CodeAction '{0}' não produziu uma solução alterada "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Opções Principais do EditorConfig @@ -72,86 +62,21 @@ O documento não dá suporte a árvores de sintaxe - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. Erro ao ler o conteúdo do arquivo de origem '{0}' – '{1}'. - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Recuo e espaçamento - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Preferências de nova linha - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Somente o projeto de envio pode fazer referência a projetos de envio. @@ -167,26 +92,11 @@ Conversão predefinida de {0} em {1}. - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference O projeto não contém a referência especificada - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Somente Refatoração @@ -212,11 +122,6 @@ A solução não contém a referência especificada - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. Símbolo "{0}" não é da fonte. @@ -302,11 +207,6 @@ Sincronizar namespace com a estrutura de pasta - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. O conteúdo de um SourceGeneratedDocument não pode ser alterado. @@ -322,31 +222,11 @@ A solução já contém a referência especificada. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Desconhecido - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Arquivos do Visual Basic @@ -367,11 +247,6 @@ Workspace não está vazio. - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} está em um projeto diferente. @@ -512,11 +387,6 @@ Esperado {0}. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" deve ser uma cadeia de caracteres não nula e não vazia. @@ -882,11 +752,6 @@ Não há suporte para alterar as propriedades do documento - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions Convenções de codificação .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf index 6cda3edb0d828..f84d7e5a5fce0 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf @@ -42,16 +42,6 @@ Действие кода "{0}" не сформировало измененное решение. "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Основные параметры EditorConfig @@ -72,86 +62,21 @@ Документ не поддерживает синтаксические деревья. - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. Ошибка при чтении содержимого исходного файла "{0}" — "{1}". - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Отступы и интервалы - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Предпочтения для новых строк - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Только проект отправки может ссылаться на другие проекты отправки. @@ -167,26 +92,11 @@ Предварительно определенное преобразование из {0} в {1}. - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference Проект не содержит указанную ссылку. - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Только рефакторинг @@ -212,11 +122,6 @@ Решение не содержит указанную ссылку. - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. Символ "{0}" не из источника. @@ -302,11 +207,6 @@ Синхронизировать пространство имен со структурой папок - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. Содержимое SourceGeneratedDocument не может быть изменено. @@ -322,31 +222,11 @@ Решение уже содержит указанную ссылку. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Unbekannt - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Файлы Visual Basic @@ -367,11 +247,6 @@ Рабочая область не пуста. - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} находится в другом проекте. @@ -512,11 +387,6 @@ Требуется {0}. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" не должен равняться Null и пустой строке. @@ -882,11 +752,6 @@ Изменение свойств документа не поддерживается - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions Рекомендации по написанию кода .NET diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf index 27108f4e9c325..134a34cbdb11b 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf @@ -42,16 +42,6 @@ '{0}' CodeAction, değiştirilmiş çözüm üretmedi "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Çekirdek EditorConfig seçenekleri @@ -72,86 +62,21 @@ Belge, söz dizimi ağaçlarını desteklemiyor - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. '{0}' kaynak dosyasının içeriği okunurken hata oluştu -- '{1}'. - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing Girinti ve aralığı - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences Yeni satır tercihleri - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. Gönderim projelerine yalnızca gönderim projesi başvurabilir. @@ -167,26 +92,11 @@ {0} öğesinden {1} öğesine dönüştürme önceden tanımlandı. - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference Proje belirtilen başvuruyu içermiyor - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only Sadece Yeniden Düzenlenme @@ -212,11 +122,6 @@ Çözüm belirtilen başvuruyu içermiyor - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. "{0}" sembolü kaynağa ait değil. @@ -302,11 +207,6 @@ Ad alanını klasör yapısına eşitle - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. SourceGeneratedDocument'ın içeriği değiştirilemez. @@ -322,31 +222,11 @@ Çözüm belirtilen başvuruyu zaten içeriyor. - - Trailing comma not allowed - Trailing comma not allowed - - Unknown Bilinmiyor - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Visual Basic dosyaları @@ -367,11 +247,6 @@ Çalışma alanı boş değil. - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0}, farklı bir projede. @@ -512,11 +387,6 @@ {0} bekleniyor. - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" null olmayan ve boş olmayan bir dize olmalıdır. @@ -882,11 +752,6 @@ Belge özelliklerinin değiştirilmesi desteklenmiyor - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions .NET kodlama kuralları diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf index 6cc5fd8bbb0ef..d7f065176dd1f 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf @@ -42,16 +42,6 @@ CodeAction "{0}" 未生成更改的解决方案 "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options Core EditorConfig 选项 @@ -72,86 +62,21 @@ 文档不支持语法树 - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. 读取源文件“{0}”中的内容时出错 -“{1}”。 - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing 缩进和间距 - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences 新行首选项 - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. 只有提交项目才能引用提交项目。 @@ -167,26 +92,11 @@ 从 {0} 到 {1} 的预定义转换。 - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference 项目不包含指定的引用 - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only 仅重构 @@ -212,11 +122,6 @@ 解决方案不包含指定的引用 - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. 符号“{0}”不是来自源。 @@ -302,11 +207,6 @@ 将命名空间同步到文件夹结构 - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. 不能更改 SourceGeneratedDocument 的内容。 @@ -322,31 +222,11 @@ 解决方案已包含指定的引用。 - - Trailing comma not allowed - Trailing comma not allowed - - Unknown 未知 - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files visual basic 文件 @@ -367,11 +247,6 @@ 工作区不为空。 - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} 位于不同的项目中。 @@ -512,11 +387,6 @@ 应为 {0}。 - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. “{0}”必须是一个非 null 和非空的字符串。 @@ -882,11 +752,6 @@ 不支持更改文档属性 - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions .NET 编码约定 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf index a6d591072ba3b..939d15173014c 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf @@ -42,16 +42,6 @@ CodeAction '{0}' 未產生變更的解決方案 "CodeAction" is a specific type, and {0} represents the title shown by the action. - - Comments not allowed - Comments not allowed - - - - Constructors not allowed - Constructors not allowed - - Core EditorConfig Options 核心 EditorConfig 選項 @@ -72,86 +62,21 @@ 文件不支援語法樹 - - Enable JSON editor features - Enable JSON editor features - - - - Error parsing comment - Error parsing comment - - Error reading content of source file '{0}' -- '{1}'. 讀取來源檔案 '{0}' 的內容時發生錯誤 -- '{1}'。 - - Illegal string character - Illegal string character - - - - Illegal whitespace character - Illegal whitespace character - - Indentation and spacing 縮排和間距 - - Invalid constructor name - Invalid constructor name - - - - Invalid escape sequence - Invalid escape sequence - - - - Invalid number - Invalid number - - - - Invalid property name - Invalid property name - - - - JSON issue: {0} - JSON issue: {0} - - - - Missing property value - Missing property value - - - - Name expected - Name expected - - - - Nested properties not allowed - Nested properties not allowed - - New line preferences 新行喜好設定 - - Only properties allowed in an object - Only properties allowed in an object - - Only submission project can reference submission projects. 只有提交專案可以參考提交專案。 @@ -167,26 +92,11 @@ 從 {0} 到 {1} 預先定義的轉換。 - - Probable JSON string detected - Probable JSON string detected - - Project does not contain specified reference 專案未包含指定的參考 - - Properties not allowed in an array - Properties not allowed in an array - - - - Property name must be a string - Property name must be a string - - Refactoring Only 僅重構 @@ -212,11 +122,6 @@ 解決方案未包含指定的參考 - - Strings must start with " not ' - Strings must start with " not ' - - Symbol "{0}" is not from source. 符號 "{0}" 非來自來源。 @@ -302,11 +207,6 @@ 將命名空間同步到資料夾結構 - - Syntax error - Syntax error - - The contents of a SourceGeneratedDocument may not be changed. SourceGeneratedDocument 的內容可能無法變更。 @@ -322,31 +222,11 @@ 解決方案已包含指定的參考。 - - Trailing comma not allowed - Trailing comma not allowed - - Unknown 不明 - - Unterminated comment - Unterminated comment - - - - Unterminated string - Unterminated string - - - - Value required - Value required - - Visual Basic files Visual Basic 檔案 @@ -367,11 +247,6 @@ 工作區不是空的。 - - '{0}' expected - '{0}' expected - - {0} is in a different project. {0} 位於不同的專案中。 @@ -512,11 +387,6 @@ 必須是 {0}。 - - '{0}' literal not allowed - '{0}' literal not allowed - - "{0}" must be a non-null and non-empty string. "{0}" 必須是非 null 和非空白的字串。 @@ -882,11 +752,6 @@ 不支援變更文件屬性 - - '{0}' unexpected - '{0}' unexpected - - .NET Coding Conventions .NET 編碼慣例 From b3c381304fa4de8799cf3c870cf004b41426b2f2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Jan 2022 15:30:54 -0800 Subject: [PATCH 041/110] Fixup --- .../Json/CSharpJsonParserTests_BasicTests.cs | 0 .../Json/CSharpJsonParserTests_NstTests.cs | 0 .../CSharpJsonParserTests_TestGeneration.cs | 0 .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 47 +++++++++---------- .../CSharpRegexParserTests.cs | 8 ++-- .../RegularExpressions/RegexParser.cs | 2 +- 6 files changed, 28 insertions(+), 29 deletions(-) rename src/{Workspaces => EditorFeatures}/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs (100%) rename src/{Workspaces => EditorFeatures}/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs (100%) rename src/{Workspaces => EditorFeatures}/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs (100%) rename src/{Workspaces => EditorFeatures}/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs (90%) diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs similarity index 100% rename from src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs rename to src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs similarity index 100% rename from src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs rename to src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs similarity index 100% rename from src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs rename to src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs diff --git a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs similarity index 90% rename from src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs rename to src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 1e99159f311f0..1af80c802d59d 100644 --- a/src/Workspaces/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -9,15 +9,14 @@ using System.Runtime.CompilerServices; using System.Runtime.Serialization.Json; using System.Text; -using System.Xml.Linq; using System.Text.Json; +using System.Xml.Linq; using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; using Microsoft.CodeAnalysis.EmbeddedLanguages.Json; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Newtonsoft.Json.Linq; using Xunit; -using Xunit.Sdk; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { @@ -29,7 +28,7 @@ public partial class CSharpJsonParserTests private readonly IVirtualCharService _service = CSharpVirtualCharService.Instance; private const string _statmentPrefix = "var v = "; - private SyntaxToken GetStringToken(string text) + private static SyntaxToken GetStringToken(string text) { var statement = _statmentPrefix + text; var parsedStatement = SyntaxFactory.ParseStatement(statement); @@ -43,7 +42,7 @@ private void Test(string stringText, string expected, string looseDiagnostics, string strictDiagnostics, bool runLooseTreeCheck = true, bool runLooseSubTreeCheck = true, bool runStrictTreeCheck = true, bool runStrictSubTreeCheck = true, - [CallerMemberName]string name = "") + [CallerMemberName] string _ = "") { if (runLooseSubTreeCheck || runLooseSubTreeCheck) { @@ -108,7 +107,7 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) TryParseTree(current, strict, runTreeCheck, conversionFailureOk: true); } - for (int start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++) + for (var start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++) { TryParseTree( stringText.Substring(0, start) + @@ -121,7 +120,7 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) private (SyntaxToken, JsonTree?, VirtualCharSequence) JustParseTree( string stringText, bool strict, bool conversionFailureOk) { - var token = GetStringToken(stringText); + var token = CSharpJsonParserTests.GetStringToken(stringText); if (token.ValueText == "") { return default; @@ -186,13 +185,13 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) return tree; } - private string TreeToText(JsonTree tree) + private static string TreeToText(JsonTree tree) { return new XElement("Tree", NodeToElement(tree.Root)).ToString(); } - private string DiagnosticsToText(ImmutableArray diagnostics) + private static string DiagnosticsToText(ImmutableArray diagnostics) { if (diagnostics.IsEmpty) { @@ -207,7 +206,7 @@ private string DiagnosticsToText(ImmutableArray diagnostics) new XAttribute("Length", d.Span.Length)))).ToString(); } - private XElement NodeToElement(JsonNode node) + private static XElement NodeToElement(JsonNode node) { if (node is JsonArrayNode arrayNode) return ArrayNodeToElement(arrayNode); @@ -228,7 +227,7 @@ private XElement NodeToElement(JsonNode node) return element; } - private XElement ConstructorNodeToElement(JsonConstructorNode node) + private static XElement ConstructorNodeToElement(JsonConstructorNode node) { var element = new XElement(node.Kind.ToString()); element.Add(TokenToElement(node.NewKeyword)); @@ -239,7 +238,7 @@ private XElement ConstructorNodeToElement(JsonConstructorNode node) return element; } - private XElement ObjectNodeToElement(JsonObjectNode node) + private static XElement ObjectNodeToElement(JsonObjectNode node) { var element = new XElement(node.Kind.ToString()); element.Add(TokenToElement(node.OpenBraceToken)); @@ -248,7 +247,7 @@ private XElement ObjectNodeToElement(JsonObjectNode node) return element; } - private XElement CompilationUnitToElement(JsonCompilationUnit node) + private static XElement CompilationUnitToElement(JsonCompilationUnit node) { var element = new XElement(node.Kind.ToString()); element.Add(CreateSequenceNode(node.Sequence)); @@ -256,7 +255,7 @@ private XElement CompilationUnitToElement(JsonCompilationUnit node) return element; } - private XElement ArrayNodeToElement(JsonArrayNode node) + private static XElement ArrayNodeToElement(JsonArrayNode node) { var element = new XElement(node.Kind.ToString()); element.Add(TokenToElement(node.OpenBracketToken)); @@ -265,7 +264,7 @@ private XElement ArrayNodeToElement(JsonArrayNode node) return element; } - private XElement CreateSequenceNode(ImmutableArray sequence) + private static XElement CreateSequenceNode(ImmutableArray sequence) { var element = new XElement("Sequence"); foreach (var child in sequence) @@ -273,7 +272,7 @@ private XElement CreateSequenceNode(ImmutableArray sequence) return element; } - private XElement TokenToElement(JsonToken token) + private static XElement TokenToElement(JsonToken token) { var element = new XElement(token.Kind.ToString()); @@ -300,12 +299,12 @@ private XElement TokenToElement(JsonToken token) return element; } - private XElement TriviaToElement(JsonTrivia trivia) - => new XElement( + private static XElement TriviaToElement(JsonTrivia trivia) + => new( trivia.Kind.ToString(), trivia.VirtualChars.CreateString().Replace("\f", "\\f")); - private void CheckInvariants(JsonTree tree, VirtualCharSequence allChars) + private static void CheckInvariants(JsonTree tree, VirtualCharSequence allChars) { var root = tree.Root; var position = 0; @@ -313,7 +312,7 @@ private void CheckInvariants(JsonTree tree, VirtualCharSequence allChars) Assert.Equal(allChars.Length, position); } - private void CheckInvariants(JsonNode node, ref int position, VirtualCharSequence allChars) + private static void CheckInvariants(JsonNode node, ref int position, VirtualCharSequence allChars) { foreach (var child in node) { @@ -328,14 +327,14 @@ private void CheckInvariants(JsonNode node, ref int position, VirtualCharSequenc } } - private void CheckInvariants(JsonToken token, ref int position, VirtualCharSequence allChars) + private static void CheckInvariants(JsonToken token, ref int position, VirtualCharSequence allChars) { CheckInvariants(token.LeadingTrivia, ref position, allChars); CheckCharacters(token.VirtualChars, ref position, allChars); CheckInvariants(token.TrailingTrivia, ref position, allChars); } - private void CheckInvariants(ImmutableArray leadingTrivia, ref int position, VirtualCharSequence allChars) + private static void CheckInvariants(ImmutableArray leadingTrivia, ref int position, VirtualCharSequence allChars) { foreach (var trivia in leadingTrivia) { @@ -343,7 +342,7 @@ private void CheckInvariants(ImmutableArray leadingTrivia, ref int p } } - private void CheckInvariants(JsonTrivia trivia, ref int position, VirtualCharSequence allChars) + private static void CheckInvariants(JsonTrivia trivia, ref int position, VirtualCharSequence allChars) { switch (trivia.Kind) { @@ -371,9 +370,9 @@ private static void CheckCharacters(VirtualCharSequence virtualChars, ref int po } private void TestNST( - string stringText, string expected, string looseDiagnostics, string strictDiagnostics, [CallerMemberName]string caller = "") + string stringText, string expected, string _, string strictDiagnostics, [CallerMemberName] string caller = "") { - var (token, tree, allChars) = JustParseTree(stringText, strict: true, conversionFailureOk: false); + var (_, tree, allChars) = JustParseTree(stringText, strict: true, conversionFailureOk: false); Assert.NotNull(tree); Roslyn.Utilities.Contract.ThrowIfNull(tree); var actualTree = TreeToText(tree!).Replace("\"", "\"\""); diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs index ca11699a30eaf..4deb99b31c0b7 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs @@ -226,7 +226,7 @@ private static XElement CreateDiagnosticsElement(SourceText text, RegexTree tree private static XAttribute GetTextAttribute(SourceText text, TextSpan span) => new("Text", text.ToString(span)); - private XElement NodeToElement(RegexNode node) + private static XElement NodeToElement(RegexNode node) { if (node is RegexAlternationNode alternationNode) return AlternationToElement(alternationNode, alternationNode.SequenceList.NodesAndTokens.Length); @@ -238,7 +238,7 @@ private XElement NodeToElement(RegexNode node) return element; } - private XElement AlternationToElement(RegexAlternationNode alternationNode, int end) + private static XElement AlternationToElement(RegexAlternationNode alternationNode, int end) { // to keep tests in sync with how we used to structure alternations, we specially handle this node. // First, if the node only has a single element, then just print that element as that's what would @@ -280,7 +280,7 @@ private static XElement TriviaToElement(RegexTrivia trivia) trivia.Kind.ToString(), trivia.VirtualChars.CreateString()); - private void CheckInvariants(RegexTree tree, VirtualCharSequence allChars) + private static void CheckInvariants(RegexTree tree, VirtualCharSequence allChars) { var root = tree.Root; var position = 0; @@ -288,7 +288,7 @@ private void CheckInvariants(RegexTree tree, VirtualCharSequence allChars) Assert.Equal(allChars.Length, position); } - private void CheckInvariants(RegexNode node, ref int position, VirtualCharSequence allChars) + private static void CheckInvariants(RegexNode node, ref int position, VirtualCharSequence allChars) { foreach (var child in node) { diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs index 3675de6b5e925..5cdb192796e59 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs @@ -1438,7 +1438,7 @@ private static int HexValue(VirtualChar ch) throw new InvalidOperationException(); } - private bool HasProblem(RegexNodeOrToken component) + private static bool HasProblem(RegexNodeOrToken component) { if (component.IsNode) { From 8f44c3f6179f6841e8e59df49bae9e8bcd6d2a67 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Jan 2022 16:34:47 -0800 Subject: [PATCH 042/110] Use PerLanguageOption2 --- .../Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs index c46b954aa75b1..b9884218139df 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs @@ -34,28 +34,28 @@ public Metadata() HighlightRelatedJsonComponentsUnderCursor, DetectAndOfferEditorFeaturesForProbableJsonStrings); - public static PerLanguageOption ColorizeJsonPatterns = + public static PerLanguageOption2 ColorizeJsonPatterns = new PerLanguageOption( nameof(JsonOptions), nameof(ColorizeJsonPatterns), defaultValue: true, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ColorizeJsonPatterns")); - public static PerLanguageOption ReportInvalidJsonPatterns = + public static PerLanguageOption2 ReportInvalidJsonPatterns = new PerLanguageOption( nameof(JsonOptions), nameof(ReportInvalidJsonPatterns), defaultValue: true, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")); - public static PerLanguageOption HighlightRelatedJsonComponentsUnderCursor = + public static PerLanguageOption2 HighlightRelatedJsonComponentsUnderCursor = new PerLanguageOption( nameof(JsonOptions), nameof(HighlightRelatedJsonComponentsUnderCursor), defaultValue: true, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")); - public static PerLanguageOption DetectAndOfferEditorFeaturesForProbableJsonStrings = + public static PerLanguageOption2 DetectAndOfferEditorFeaturesForProbableJsonStrings = new PerLanguageOption( nameof(JsonOptions), nameof(DetectAndOfferEditorFeaturesForProbableJsonStrings), From 81695687606f67d9c3e0d2bfe9b5666a33b491b2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 10:09:47 -0800 Subject: [PATCH 043/110] Fix --- .../EmbeddedLanguages/Json/JsonOptions.cs | 112 +++++++----------- 1 file changed, 44 insertions(+), 68 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs index b9884218139df..b588159744a98 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs @@ -5,79 +5,55 @@ using System; using System.Collections.Immutable; using System.Composition; -using System.Runtime.Serialization; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; -namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json -{ - [DataContract] - internal readonly record struct JsonOptions( - [property: DataMember(Order = 0)] bool ColorizeJsonPatterns, - [property: DataMember(Order = 1)] bool ReportInvalidJsonPatterns, - [property: DataMember(Order = 2)] bool HighlightRelatedJsonComponentsUnderCursor, - [property: DataMember(Order = 3)] bool DetectAndOfferEditorFeaturesForProbableJsonStrings) - { - [ExportSolutionOptionProvider, Shared] - internal sealed class Metadata : IOptionProvider - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public Metadata() - { - } - - public ImmutableArray Options { get; } = ImmutableArray.Create( - ColorizeJsonPatterns, - ReportInvalidJsonPatterns, - HighlightRelatedJsonComponentsUnderCursor, - DetectAndOfferEditorFeaturesForProbableJsonStrings); - - public static PerLanguageOption2 ColorizeJsonPatterns = - new PerLanguageOption( - nameof(JsonOptions), - nameof(ColorizeJsonPatterns), - defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ColorizeJsonPatterns")); - - public static PerLanguageOption2 ReportInvalidJsonPatterns = - new PerLanguageOption( - nameof(JsonOptions), - nameof(ReportInvalidJsonPatterns), - defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")); - - public static PerLanguageOption2 HighlightRelatedJsonComponentsUnderCursor = - new PerLanguageOption( - nameof(JsonOptions), - nameof(HighlightRelatedJsonComponentsUnderCursor), - defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")); - - public static PerLanguageOption2 DetectAndOfferEditorFeaturesForProbableJsonStrings = - new PerLanguageOption( - nameof(JsonOptions), - nameof(DetectAndOfferEditorFeaturesForProbableJsonStrings), - defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DetectAndOfferEditorFeaturesForProbableJsonStrings")); - } +namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json; - public static readonly JsonOptions Default - = new( - ColorizeJsonPatterns: Metadata.ColorizeJsonPatterns.DefaultValue, - ReportInvalidJsonPatterns: Metadata.ReportInvalidJsonPatterns.DefaultValue, - HighlightRelatedJsonComponentsUnderCursor: Metadata.HighlightRelatedJsonComponentsUnderCursor.DefaultValue, - DetectAndOfferEditorFeaturesForProbableJsonStrings: Metadata.DetectAndOfferEditorFeaturesForProbableJsonStrings.DefaultValue); - - public static JsonOptions From(Project project) - => From(project.Solution.Options, project.Language); +internal class JsonOptions +{ + public static PerLanguageOption2 ColorizeJsonPatterns = + new( + nameof(JsonOptions), + nameof(ColorizeJsonPatterns), + defaultValue: true, + storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ColorizeJsonPatterns")); + + public static PerLanguageOption2 ReportInvalidJsonPatterns = + new( + nameof(JsonOptions), + nameof(ReportInvalidJsonPatterns), + defaultValue: true, + storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")); + + public static PerLanguageOption2 HighlightRelatedJsonComponentsUnderCursor = + new( + nameof(JsonOptions), + nameof(HighlightRelatedJsonComponentsUnderCursor), + defaultValue: true, + storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")); + + public static PerLanguageOption2 DetectAndOfferEditorFeaturesForProbableJsonStrings = + new( + nameof(JsonOptions), + nameof(DetectAndOfferEditorFeaturesForProbableJsonStrings), + defaultValue: true, + storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DetectAndOfferEditorFeaturesForProbableJsonStrings")); +} - public static JsonOptions From(OptionSet options, string language) - => new( - ColorizeJsonPatterns: options.GetOption(Metadata.ColorizeJsonPatterns, language), - ReportInvalidJsonPatterns: options.GetOption(Metadata.ReportInvalidJsonPatterns, language), - HighlightRelatedJsonComponentsUnderCursor: options.GetOption(Metadata.HighlightRelatedJsonComponentsUnderCursor, language), - DetectAndOfferEditorFeaturesForProbableJsonStrings: options.GetOption(Metadata.DetectAndOfferEditorFeaturesForProbableJsonStrings, language)); +[ExportSolutionOptionProvider, Shared] +internal class JsonOptionsProvider : IOptionProvider +{ + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public JsonOptionsProvider() + { } + + public ImmutableArray Options { get; } = ImmutableArray.Create( + JsonOptions.ColorizeJsonPatterns, + JsonOptions.ReportInvalidJsonPatterns, + JsonOptions.HighlightRelatedJsonComponentsUnderCursor, + JsonOptions.DetectAndOfferEditorFeaturesForProbableJsonStrings); } From fc35e277ca374a4e54e84a5c4cc55af684924901 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:26:53 -0800 Subject: [PATCH 044/110] Add comments --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs index 9ca93d890d82c..e034a039f4885 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonKind.cs @@ -7,11 +7,14 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json internal enum JsonKind { None = 0, + + // Nodes CompilationUnit, Text, Object, Array, Literal, + // Used to represent `-Infinity` which is supported by Json.Net NegativeLiteral, Property, Constructor, From fb38e29949c906beddda4b987295110e25a439a7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:30:46 -0800 Subject: [PATCH 045/110] Make lexer noncopyable --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index a2d67b8cbb137..858a31c358284 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -8,6 +8,7 @@ using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json { @@ -17,6 +18,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json using JsonToken = EmbeddedSyntaxToken; using JsonTrivia = EmbeddedSyntaxTrivia; + [NonCopyable] internal struct JsonLexer { public readonly VirtualCharSequence Text; From 73c9de51b66a5f7026b48b02a7a84cd34127e6fd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:34:50 -0800 Subject: [PATCH 046/110] Assert if we're out of bounds --- .../Portable/EmbeddedLanguages/Json/JsonLexer.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 4ad8645ac9637..b66b5e27889e3 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -29,9 +29,17 @@ public JsonLexer(VirtualCharSequence text) : this() Text = text; } - public VirtualChar CurrentChar => Position < Text.Length - ? Text[Position] - : VirtualChar.Create((char)0, span: default); + public VirtualChar CurrentChar + { + get + { + if (Position < Text.Length) + return Text[Position]; + + Debug.Fail("Indexed past the end of the content"); + return default; + } + } public VirtualCharSequence GetCharsToCurrentPosition(int start) => GetSubSequence(start, Position); From f06c22ea6a194283757ff77128b84edd23f62252 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:37:15 -0800 Subject: [PATCH 047/110] Inline method --- .../EmbeddedLanguages/Json/JsonLexer.cs | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index b66b5e27889e3..a2ddede5c4803 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -71,39 +71,6 @@ public JsonToken ScanNextToken() return token; } - private static bool IsSpecial(VirtualChar ch) - { - // Standard tokens. - switch (ch.Value) - { - case '{': - case '}': - case '[': - case ']': - case '(': - case ')': - case ',': - case ':': - case '\'': - case '"': - return true; - - case ' ': - case '\t': - case '/': - case '\r': - case '\n': - // trivia cases - return true; - } - - // more trivia - if (ch.IsWhiteSpace) - return true; - - return false; - } - private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic? diagnostic) ScanNextTokenWorker() { Debug.Assert(Position < Text.Length); @@ -235,10 +202,43 @@ private static bool IsHexDigit(VirtualChar c) { var start = Position; - while (Position < Text.Length && !IsSpecial(this.CurrentChar)) + while (Position < Text.Length && !IsNotPartOfText(this.CurrentChar)) Position++; return (GetCharsToCurrentPosition(start), JsonKind.TextToken, null); + + static bool IsNotPartOfText(VirtualChar ch) + { + // Standard tokens. + switch (ch.Value) + { + case '{': + case '}': + case '[': + case ']': + case '(': + case ')': + case ',': + case ':': + case '\'': + case '"': + return true; + + case ' ': + case '\t': + case '/': + case '\r': + case '\n': + // trivia cases + return true; + } + + // more trivia + if (ch.IsWhiteSpace) + return true; + + return false; + } } private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic?) ScanSingleCharToken(JsonKind kind) From de724bba321cdc81f866e9eb40eea8819f519dd8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:39:00 -0800 Subject: [PATCH 048/110] Simplify --- .../Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index a2ddede5c4803..0c8d3cd4e8e80 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -192,11 +192,9 @@ public JsonToken ScanNextToken() } private static bool IsHexDigit(VirtualChar c) - { - return (c >= '0' && c <= '9') || - (c >= 'A' && c <= 'F') || - (c >= 'a' && c <= 'f'); - } + => c.Value is (>= '0' and <= '9') or + (>= 'A' and <= 'F') or + (>= 'a' and <= 'f'); private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic?) ScanText() { From bcbb9c5b9ef0547b7e7c0c2ccdcdd934453a5593 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:40:15 -0800 Subject: [PATCH 049/110] Delete old code --- .../Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 0c8d3cd4e8e80..d172f97469401 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -91,10 +91,6 @@ public JsonToken ScanNextToken() // Later on, we'll analyze that text sequence as a whole to see if it looks like a // number and to also report any issues in line with how json.net and ecmascript // handle json numbers. - //case '-': case '.': - //case '0': case '1': case '2': case '3': case '4': - //case '5': case '6': case '7': case '8': case '9': - // return ScanNumber(); _ => ScanText(), }; } From 450f113f9ea43b65343e1d57b5eaa8d476d82a96 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:42:21 -0800 Subject: [PATCH 050/110] Rename --- .../Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index d172f97469401..7e0d8e6ae9776 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -117,7 +117,7 @@ public JsonToken ScanNextToken() continue; case '\\': - var escapeDiag = ScanEscape(start, Position - 1); + var escapeDiag = AdvanceToEndOfEscape(start, Position - 1); diagnostic ??= escapeDiag; continue; } @@ -130,10 +130,10 @@ public JsonToken ScanNextToken() } /// - /// does not actually lex out an escape token. Instead, it just - /// moves the position forward and returns a diagnostic if this was not a valid escape. + /// does not actually lex out an escape token. Instead, it just moves the + /// position forward and returns a diagnostic if this was not a valid escape. /// - private EmbeddedDiagnostic? ScanEscape(int stringStart, int escapeStart) + private EmbeddedDiagnostic? AdvanceToEndOfEscape(int stringStart, int escapeStart) { if (this.Position == Text.Length) { From aabb865779c7f682753b024d265502e92a03935b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:45:14 -0800 Subject: [PATCH 051/110] Add asserts --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 7e0d8e6ae9776..bde266f4add50 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -327,6 +327,7 @@ private ImmutableArray ScanTrivia(bool leading) private JsonTrivia ScanSingleLineComment() { + Debug.Assert(IsAt("//")); var start = Position; Position += 2; @@ -353,6 +354,7 @@ this.CurrentChar is var ch && private JsonTrivia ScanMultiLineComment() { + Debug.Assert(IsAt("/*")); var start = Position; Position += 2; From 9d5edc73d22569d38d0bb4198826e287ad6dd0f9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:46:22 -0800 Subject: [PATCH 052/110] Simplify --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index bde266f4add50..74b5635148899 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -332,8 +332,7 @@ private JsonTrivia ScanSingleLineComment() Position += 2; while (Position < Text.Length && - this.CurrentChar is var ch && - ch != '\r' && ch != '\n') + this.CurrentChar.Value is not '\r' and not '\n') { Position++; } From 38bc56778173d378deecfa9174a13a5f6e491133 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:49:35 -0800 Subject: [PATCH 053/110] Add assert --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 305c54a60b872..bb3b4c5cfb85e 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -163,6 +163,7 @@ internal sealed class JsonNegativeLiteralNode : JsonValueNode public JsonNegativeLiteralNode(JsonToken minusToken, JsonToken literalToken) : base(JsonKind.NegativeLiteral) { + Debug.Assert(minusToken.Kind == JsonKind.MinusToken); MinusToken = minusToken; LiteralToken = literalToken; } From eb0d913858ffffb9873e3600bd35f310aa0ff734 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:52:40 -0800 Subject: [PATCH 054/110] Add comment --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index bb3b4c5cfb85e..0adc81071b9bc 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -208,6 +208,9 @@ public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); } + /// + /// See the note in for why commas are stored as values for convenience. + /// internal sealed class JsonCommaValueNode : JsonValueNode { public JsonCommaValueNode(JsonToken commaToken) From 116a967a87cb2296cf949253f51fcfd905ae301c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:54:23 -0800 Subject: [PATCH 055/110] Add comment --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 0adc81071b9bc..4205112cfd206 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -240,6 +240,8 @@ internal sealed class JsonPropertyNode : JsonValueNode public JsonPropertyNode(JsonToken nameToken, JsonToken colonToken, JsonValueNode value) : base(JsonKind.Property) { + // Note: the name is allowed by json.net to just be a text token, not a string. e.g. `goo: 0` as opposed to + // `"goo": 0`. Strict json does not allow this. Debug.Assert(nameToken.Kind == JsonKind.StringToken || nameToken.Kind == JsonKind.TextToken); Debug.Assert(colonToken.Kind == JsonKind.ColonToken); Debug.Assert(value != null); From 3011a5910e5111db3b01abc087eb9d2d922a4ec7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:55:13 -0800 Subject: [PATCH 056/110] Add comment --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 4205112cfd206..6935906e88fa0 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -269,6 +269,9 @@ public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); } + /// + /// Json.net construction. It allows things like new Date(1, 2, 3). This is not allowed in strict mode. + /// internal sealed class JsonConstructorNode : JsonValueNode { public JsonConstructorNode( From 226540aff89f024d12cc451d698e3549fe0945bf Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 25 Jan 2022 18:56:55 -0800 Subject: [PATCH 057/110] Update src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs Co-authored-by: Jason Malinowski --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 62d2de5295550..305c54a60b872 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -302,7 +302,7 @@ internal override JsonNodeOrToken ChildAt(int index) if (index == Sequence.Length + 3) return CloseParenToken; - return Sequence[index]; + return Sequence[index - 3]; } public override void Accept(IJsonNodeVisitor visitor) From 44f9d610a954f7a3ef92ed93286c5e921f0636f4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:06:14 -0800 Subject: [PATCH 058/110] Add tesT --- .../Json/CSharpJsonParserTests_BasicTests.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index b50b4cc3ee20f..3e5db98e52ad6 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -5260,6 +5260,37 @@ public void TestNumber28() ", @" +"); + } + + [Fact] + public void TestIncompleteProperty() + { + Test(@"""{ 'a': }""", @" + + + + { + + + 'a' + : + + } + + + + + + + + +", + @" + +", + @" + "); } } From df12d83a4e9d0a82f8e95ca7f917c09497d46dbd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:08:27 -0800 Subject: [PATCH 059/110] Make a remark --- .../EmbeddedLanguages/Json/JsonParser.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 18fa3d048bfef..e0744a758febd 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -26,26 +26,29 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// cref="JsonTree"/> out of it. Parsing will always succeed (except in the case of a /// stack-overflow) and will consume the entire sequence of chars. General roslyn syntax /// principles are held to (i.e. immutable, fully representative, etc.). - /// + /// /// The parser always parses out the same tree regardless of input. *However*, depending on the /// flags passed to it, it may return a different set of *diagnostics*. Specifically, the /// parser supports json.net parsing and strict RFC8259 (https://tools.ietf.org/html/rfc8259). /// As such, the parser supports a superset of both, but then does a pass at the end to produce /// appropriate diagnostics. - /// + /// + /// + /// /// Note: the json structure we parse out is actually very simple. It's effectively all lists /// of values. We just treat almost everything as a 'value'. For - /// example, a (i.e. ```"x" = 0```) is a 'value'. As such, it - /// can show up in arrays (i.e. ```["x" = 0, "y" = 1]```). This is not legal, but it greatly + /// example, a (i.e. "x" = 0) is a 'value'. As such, it + /// can show up in arrays (i.e. ["x" = 0, "y" = 1]). This is not legal, but it greatly /// simplifies parsing. Effectively, we just have recursive list parsing, where we accept any /// sort of value in any sort of context. A later pass will then report errors for the wrong /// sorts of values showing up in incorrect contexts. - /// - /// Note: We also treat commas (```,```) as being a 'value' on its own. This simplifies parsing + /// + /// Note: We also treat commas (,) as being a 'value' on its own. This simplifies parsing /// by allowing us to not have to represent Lists and SeparatedLists. It also helps model - /// things that are supported in json.net (like ```[1,,2]```). Our post-parsing pass will + /// things that are supported in json.net (like [1,,2]). Our post-parsing pass will /// then ensure that these comma-values only show up in the right contexts. - /// + /// + /// internal partial struct JsonParser { private static readonly string s_closeBracketExpected = string.Format(FeaturesResources._0_expected, ']'); From e875456ef67ae9cd802dd3d75f2fe6372f3b9da3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:09:58 -0800 Subject: [PATCH 060/110] Simplify code --- .../EmbeddedLanguages/Json/JsonParser.cs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index e0744a758febd..ab5fc85cbbc85 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -150,8 +150,8 @@ private JsonTree ParseTree(bool strict) private static EmbeddedDiagnostic? CheckTopLevel( VirtualCharSequence text, JsonCompilationUnit compilationUnit) { - var arraySequence = compilationUnit.Sequence; - if (arraySequence.IsEmpty) + var sequence = compilationUnit.Sequence; + if (sequence.IsEmpty) { // json is not allowed to be just whitespace. if (text.Length > 0 && @@ -161,25 +161,24 @@ private JsonTree ParseTree(bool strict) return new EmbeddedDiagnostic(FeaturesResources.Syntax_error, GetSpan(text)); } } - else if (arraySequence.Length >= 2) + else if (sequence.Length >= 2) { // the top level can't have more than one actual value. - var firstToken = GetFirstToken(arraySequence[1]); + var firstToken = GetFirstToken(sequence[1]); return new EmbeddedDiagnostic( string.Format(FeaturesResources._0_unexpected, firstToken.VirtualChars[0]), firstToken.GetSpan()); } - foreach (var child in compilationUnit.Sequence) + var child = compilationUnit.Sequence.Single(); + + // Commas should never show up in the top level sequence. + if (child.Kind == JsonKind.CommaValue) { - // Commas should never show up in the top level sequence. - if (child.Kind == JsonKind.CommaValue) - { - var emptyValue = (JsonCommaValueNode)child; - return new EmbeddedDiagnostic( - string.Format(FeaturesResources._0_unexpected, ','), - emptyValue.CommaToken.GetSpan()); - } + var emptyValue = (JsonCommaValueNode)child; + return new EmbeddedDiagnostic( + string.Format(FeaturesResources._0_unexpected, ','), + emptyValue.CommaToken.GetSpan()); } return null; From 22f6dcaff0b86bb3542a2e8bb6c7f0cbf0803a27 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:15:06 -0800 Subject: [PATCH 061/110] Simplify --- .../Core/Portable/EmbeddedLanguages/Json/JsonParser.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index ab5fc85cbbc85..5705e050fdecd 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -156,10 +156,12 @@ private JsonTree ParseTree(bool strict) // json is not allowed to be just whitespace. if (text.Length > 0 && compilationUnit.EndOfFileToken.LeadingTrivia.All( - t => t.Kind == JsonKind.WhitespaceTrivia || t.Kind == JsonKind.EndOfLineTrivia)) + t => t.Kind is JsonKind.WhitespaceTrivia or JsonKind.EndOfLineTrivia)) { return new EmbeddedDiagnostic(FeaturesResources.Syntax_error, GetSpan(text)); } + + return null; } else if (sequence.Length >= 2) { @@ -170,7 +172,7 @@ private JsonTree ParseTree(bool strict) firstToken.GetSpan()); } - var child = compilationUnit.Sequence.Single(); + var child = sequence.Single(); // Commas should never show up in the top level sequence. if (child.Kind == JsonKind.CommaValue) From 51a53a93a41ee1716afcc12968371905186090a7 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 25 Jan 2022 19:22:20 -0800 Subject: [PATCH 062/110] Update src/Features/Core/Portable/FeaturesResources.resx Co-authored-by: Joey Robichaud --- src/Features/Core/Portable/FeaturesResources.resx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index 6156aec4ffab2..2451a35f95db8 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -3022,7 +3022,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Symbol found in assembly path '{0}' - Invalid number From 681b9d48462e18c040677aa9be758cc54d0b6141 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:23:07 -0800 Subject: [PATCH 063/110] Add test --- .../Json/CSharpJsonParserTests_BasicTests.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 3e5db98e52ad6..8970ffcbb2956 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -5291,6 +5291,43 @@ public void TestIncompleteProperty() ", @" +"); + } + + [Fact] + public void TestPropertyWithCommaFollowedByComma() + { + Test(@"""{ 'a': , , }""", @" + + + + { + + + 'a' + : + + + + + + , + + + , + + + } + + + + +", + @" + +", + @" + "); } } From 658d59776f305eb1637158acf723d81febf52ad8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:34:50 -0800 Subject: [PATCH 064/110] Assert if we're out of bounds --- .../Portable/EmbeddedLanguages/Json/JsonLexer.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 858a31c358284..c7b5bc2ae94ec 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -29,9 +29,17 @@ public JsonLexer(VirtualCharSequence text) : this() Text = text; } - public VirtualChar CurrentChar => Position < Text.Length - ? Text[Position] - : VirtualChar.Create((char)0, span: default); + public VirtualChar CurrentChar + { + get + { + if (Position < Text.Length) + return Text[Position]; + + Debug.Fail("Indexed past the end of the content"); + return default; + } + } public VirtualCharSequence GetCharsToCurrentPosition(int start) => this.Text.GetSubSequence(TextSpan.FromBounds(start, Position)); From 64172fcb9e4dc24c6d6efbdef3d30640229f0ae0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:37:15 -0800 Subject: [PATCH 065/110] Inline method --- .../EmbeddedLanguages/Json/JsonLexer.cs | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index c7b5bc2ae94ec..53fdf296ff728 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -68,39 +68,6 @@ public JsonToken ScanNextToken() return token; } - private static bool IsSpecial(VirtualChar ch) - { - // Standard tokens. - switch (ch.Value) - { - case '{': - case '}': - case '[': - case ']': - case '(': - case ')': - case ',': - case ':': - case '\'': - case '"': - return true; - - case ' ': - case '\t': - case '/': - case '\r': - case '\n': - // trivia cases - return true; - } - - // more trivia - if (ch.IsWhiteSpace) - return true; - - return false; - } - private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic? diagnostic) ScanNextTokenWorker() { Debug.Assert(Position < Text.Length); @@ -232,10 +199,43 @@ private static bool IsHexDigit(VirtualChar c) { var start = Position; - while (Position < Text.Length && !IsSpecial(this.CurrentChar)) + while (Position < Text.Length && !IsNotPartOfText(this.CurrentChar)) Position++; return (GetCharsToCurrentPosition(start), JsonKind.TextToken, null); + + static bool IsNotPartOfText(VirtualChar ch) + { + // Standard tokens. + switch (ch.Value) + { + case '{': + case '}': + case '[': + case ']': + case '(': + case ')': + case ',': + case ':': + case '\'': + case '"': + return true; + + case ' ': + case '\t': + case '/': + case '\r': + case '\n': + // trivia cases + return true; + } + + // more trivia + if (ch.IsWhiteSpace) + return true; + + return false; + } } private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic?) ScanSingleCharToken(JsonKind kind) From 404d539b801a341f375840f7a0a1eb1eb8535a66 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:39:00 -0800 Subject: [PATCH 066/110] Simplify --- .../Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 53fdf296ff728..7f72489a8d602 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -189,11 +189,9 @@ public JsonToken ScanNextToken() } private static bool IsHexDigit(VirtualChar c) - { - return (c >= '0' && c <= '9') || - (c >= 'A' && c <= 'F') || - (c >= 'a' && c <= 'f'); - } + => c.Value is (>= '0' and <= '9') or + (>= 'A' and <= 'F') or + (>= 'a' and <= 'f'); private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic?) ScanText() { From 698e6573886955a3e9cd6962ba168eca7e54fe2b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:40:15 -0800 Subject: [PATCH 067/110] Delete old code --- .../Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 7f72489a8d602..1f3076b0b19c5 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -88,10 +88,6 @@ public JsonToken ScanNextToken() // Later on, we'll analyze that text sequence as a whole to see if it looks like a // number and to also report any issues in line with how json.net and ecmascript // handle json numbers. - //case '-': case '.': - //case '0': case '1': case '2': case '3': case '4': - //case '5': case '6': case '7': case '8': case '9': - // return ScanNumber(); _ => ScanText(), }; } From fc034d0ea4c2c38b3656742989633a0d0d356567 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:42:21 -0800 Subject: [PATCH 068/110] Rename --- .../Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 1f3076b0b19c5..8f05a93337cb6 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -114,7 +114,7 @@ public JsonToken ScanNextToken() continue; case '\\': - var escapeDiag = ScanEscape(start, Position - 1); + var escapeDiag = AdvanceToEndOfEscape(start, Position - 1); diagnostic ??= escapeDiag; continue; } @@ -127,10 +127,10 @@ public JsonToken ScanNextToken() } /// - /// does not actually lex out an escape token. Instead, it just - /// moves the position forward and returns a diagnostic if this was not a valid escape. + /// does not actually lex out an escape token. Instead, it just moves the + /// position forward and returns a diagnostic if this was not a valid escape. /// - private EmbeddedDiagnostic? ScanEscape(int stringStart, int escapeStart) + private EmbeddedDiagnostic? AdvanceToEndOfEscape(int stringStart, int escapeStart) { if (this.Position == Text.Length) { From 082a250a54d2f1f2027e35359be5f99d123016c1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:45:14 -0800 Subject: [PATCH 069/110] Add asserts --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 8f05a93337cb6..e9eda36e74985 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -324,6 +324,7 @@ private ImmutableArray ScanTrivia(bool leading) private JsonTrivia ScanSingleLineComment() { + Debug.Assert(IsAt("//")); var start = Position; Position += 2; @@ -350,6 +351,7 @@ this.CurrentChar is var ch && private JsonTrivia ScanMultiLineComment() { + Debug.Assert(IsAt("/*")); var start = Position; Position += 2; From 642408c2c49c9dc671e642bde114c0f045c91afe Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:46:22 -0800 Subject: [PATCH 070/110] Simplify --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index e9eda36e74985..4fd7a77dd3f3d 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -329,8 +329,7 @@ private JsonTrivia ScanSingleLineComment() Position += 2; while (Position < Text.Length && - this.CurrentChar is var ch && - ch != '\r' && ch != '\n') + this.CurrentChar.Value is not '\r' and not '\n') { Position++; } From 2c623c952989d09498eff38e7bd1d8c979814588 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:49:35 -0800 Subject: [PATCH 071/110] Add assert --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 62d2de5295550..4a940cf927773 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -163,6 +163,7 @@ internal sealed class JsonNegativeLiteralNode : JsonValueNode public JsonNegativeLiteralNode(JsonToken minusToken, JsonToken literalToken) : base(JsonKind.NegativeLiteral) { + Debug.Assert(minusToken.Kind == JsonKind.MinusToken); MinusToken = minusToken; LiteralToken = literalToken; } From 03bc820e54ce6e49f9aa18cdb817f2fa99342cef Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:52:40 -0800 Subject: [PATCH 072/110] Add comment --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 4a940cf927773..5afced2078ac5 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -208,6 +208,9 @@ public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); } + /// + /// See the note in for why commas are stored as values for convenience. + /// internal sealed class JsonCommaValueNode : JsonValueNode { public JsonCommaValueNode(JsonToken commaToken) From efac73fc21b306ed961397516d371b5be34e7228 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:54:23 -0800 Subject: [PATCH 073/110] Add comment --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 5afced2078ac5..d9f65d53608d7 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -240,6 +240,8 @@ internal sealed class JsonPropertyNode : JsonValueNode public JsonPropertyNode(JsonToken nameToken, JsonToken colonToken, JsonValueNode value) : base(JsonKind.Property) { + // Note: the name is allowed by json.net to just be a text token, not a string. e.g. `goo: 0` as opposed to + // `"goo": 0`. Strict json does not allow this. Debug.Assert(nameToken.Kind == JsonKind.StringToken || nameToken.Kind == JsonKind.TextToken); Debug.Assert(colonToken.Kind == JsonKind.ColonToken); Debug.Assert(value != null); From 30e6175e20f989f82334c8b4c3506d877fcc35dd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 18:55:13 -0800 Subject: [PATCH 074/110] Add comment --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index d9f65d53608d7..6b379ff40a97f 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -269,6 +269,9 @@ public override void Accept(IJsonNodeVisitor visitor) => visitor.Visit(this); } + /// + /// Json.net construction. It allows things like new Date(1, 2, 3). This is not allowed in strict mode. + /// internal sealed class JsonConstructorNode : JsonValueNode { public JsonConstructorNode( From ff21e3e3b8cf1351edca2f20b5963242544e3b38 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:08:27 -0800 Subject: [PATCH 075/110] Make a remark --- .../EmbeddedLanguages/Json/JsonParser.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 18fa3d048bfef..e0744a758febd 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -26,26 +26,29 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// cref="JsonTree"/> out of it. Parsing will always succeed (except in the case of a /// stack-overflow) and will consume the entire sequence of chars. General roslyn syntax /// principles are held to (i.e. immutable, fully representative, etc.). - /// + /// /// The parser always parses out the same tree regardless of input. *However*, depending on the /// flags passed to it, it may return a different set of *diagnostics*. Specifically, the /// parser supports json.net parsing and strict RFC8259 (https://tools.ietf.org/html/rfc8259). /// As such, the parser supports a superset of both, but then does a pass at the end to produce /// appropriate diagnostics. - /// + /// + /// + /// /// Note: the json structure we parse out is actually very simple. It's effectively all lists /// of values. We just treat almost everything as a 'value'. For - /// example, a (i.e. ```"x" = 0```) is a 'value'. As such, it - /// can show up in arrays (i.e. ```["x" = 0, "y" = 1]```). This is not legal, but it greatly + /// example, a (i.e. "x" = 0) is a 'value'. As such, it + /// can show up in arrays (i.e. ["x" = 0, "y" = 1]). This is not legal, but it greatly /// simplifies parsing. Effectively, we just have recursive list parsing, where we accept any /// sort of value in any sort of context. A later pass will then report errors for the wrong /// sorts of values showing up in incorrect contexts. - /// - /// Note: We also treat commas (```,```) as being a 'value' on its own. This simplifies parsing + /// + /// Note: We also treat commas (,) as being a 'value' on its own. This simplifies parsing /// by allowing us to not have to represent Lists and SeparatedLists. It also helps model - /// things that are supported in json.net (like ```[1,,2]```). Our post-parsing pass will + /// things that are supported in json.net (like [1,,2]). Our post-parsing pass will /// then ensure that these comma-values only show up in the right contexts. - /// + /// + /// internal partial struct JsonParser { private static readonly string s_closeBracketExpected = string.Format(FeaturesResources._0_expected, ']'); From 55f5e61f6d282a455b887e8abf07fd706f6325df Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:09:58 -0800 Subject: [PATCH 076/110] Simplify code --- .../EmbeddedLanguages/Json/JsonParser.cs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index e0744a758febd..ab5fc85cbbc85 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -150,8 +150,8 @@ private JsonTree ParseTree(bool strict) private static EmbeddedDiagnostic? CheckTopLevel( VirtualCharSequence text, JsonCompilationUnit compilationUnit) { - var arraySequence = compilationUnit.Sequence; - if (arraySequence.IsEmpty) + var sequence = compilationUnit.Sequence; + if (sequence.IsEmpty) { // json is not allowed to be just whitespace. if (text.Length > 0 && @@ -161,25 +161,24 @@ private JsonTree ParseTree(bool strict) return new EmbeddedDiagnostic(FeaturesResources.Syntax_error, GetSpan(text)); } } - else if (arraySequence.Length >= 2) + else if (sequence.Length >= 2) { // the top level can't have more than one actual value. - var firstToken = GetFirstToken(arraySequence[1]); + var firstToken = GetFirstToken(sequence[1]); return new EmbeddedDiagnostic( string.Format(FeaturesResources._0_unexpected, firstToken.VirtualChars[0]), firstToken.GetSpan()); } - foreach (var child in compilationUnit.Sequence) + var child = compilationUnit.Sequence.Single(); + + // Commas should never show up in the top level sequence. + if (child.Kind == JsonKind.CommaValue) { - // Commas should never show up in the top level sequence. - if (child.Kind == JsonKind.CommaValue) - { - var emptyValue = (JsonCommaValueNode)child; - return new EmbeddedDiagnostic( - string.Format(FeaturesResources._0_unexpected, ','), - emptyValue.CommaToken.GetSpan()); - } + var emptyValue = (JsonCommaValueNode)child; + return new EmbeddedDiagnostic( + string.Format(FeaturesResources._0_unexpected, ','), + emptyValue.CommaToken.GetSpan()); } return null; From 9d246c2e68552e820750f6b60cf168e7d8ea6c8f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:15:06 -0800 Subject: [PATCH 077/110] Simplify --- .../Core/Portable/EmbeddedLanguages/Json/JsonParser.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index ab5fc85cbbc85..5705e050fdecd 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -156,10 +156,12 @@ private JsonTree ParseTree(bool strict) // json is not allowed to be just whitespace. if (text.Length > 0 && compilationUnit.EndOfFileToken.LeadingTrivia.All( - t => t.Kind == JsonKind.WhitespaceTrivia || t.Kind == JsonKind.EndOfLineTrivia)) + t => t.Kind is JsonKind.WhitespaceTrivia or JsonKind.EndOfLineTrivia)) { return new EmbeddedDiagnostic(FeaturesResources.Syntax_error, GetSpan(text)); } + + return null; } else if (sequence.Length >= 2) { @@ -170,7 +172,7 @@ private JsonTree ParseTree(bool strict) firstToken.GetSpan()); } - var child = compilationUnit.Sequence.Single(); + var child = sequence.Single(); // Commas should never show up in the top level sequence. if (child.Kind == JsonKind.CommaValue) From 74395aedb6fbb7e0f4ac6571131f1db88f96ebcb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Jan 2022 19:31:46 -0800 Subject: [PATCH 078/110] Simplify --- .../EmbeddedLanguages/Json/JsonLexer.cs | 2 +- .../EmbeddedLanguages/Json/JsonParser.cs | 32 ++++++++----------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 74b5635148899..effb795cecf26 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -244,7 +244,7 @@ static bool IsNotPartOfText(VirtualChar ch) private ImmutableArray ScanTrivia(bool leading) { - var result = ArrayBuilder.GetInstance(); + using var _ = ArrayBuilder.GetInstance(out var result); while (Position < Text.Length) { diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 5705e050fdecd..b68d8e70c6148 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -120,28 +120,24 @@ private JsonTree ParseTree(bool strict) var root = new JsonCompilationUnit(arraySequence, _currentToken); - // We only report a single diagnostic when parsing out json. This helps prevent lots of - // cascading errors from being reported. First, we see if there are any diagnostics - // directly in tokens in the tree. If not, we then check for any incorrect tree - // structure (that would be incorrect for both json.net or strict-mode). If we don't - // run into any problems, we'll then perform specific json.net or strict-mode checks. + // We only report a single diagnostic when parsing out json. This helps prevent lots of cascading errors + // from being reported. First, we see if there are any diagnostics directly in tokens in the tree. If not, + // we then check for any incorrect tree structure (that would be incorrect for both json.net or + // strict-mode). If we don't run into any problems, we'll then perform specific json.net or strict-mode + // checks. var diagnostic = GetFirstDiagnostic(root) ?? CheckTopLevel(_lexer.Text, root); - if (diagnostic == null) - { - // We didn't have any diagnostics in the tree so far. Do the json.net/strict checks - // depending on how we were invoked. - diagnostic = strict - ? StrictSyntaxChecker.CheckSyntax(root) - : JsonNetSyntaxChecker.CheckSyntax(root); - } + // If we didn't have any diagnostics in the tree so far. Do the json.net/strict checks depending on how we + // were invoked. - var diagnostics = diagnostic == null - ? ImmutableArray.Empty - : ImmutableArray.Create(diagnostic.Value); + diagnostic ??= strict + ? StrictSyntaxChecker.CheckSyntax(root) + : JsonNetSyntaxChecker.CheckSyntax(root); - return new JsonTree( - _lexer.Text, root, diagnostics); + return new JsonTree(_lexer.Text, root, + diagnostic == null + ? ImmutableArray.Empty + : ImmutableArray.Create(diagnostic.Value)); } /// From 8c6dc5beb1b3c52aed4abff4f09547b87ac2f0a1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 06:40:46 -0800 Subject: [PATCH 079/110] Simplify --- .../Core/Portable/EmbeddedLanguages/Json/JsonParser.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index b68d8e70c6148..c999d51a7978a 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -183,9 +183,7 @@ private JsonTree ParseTree(bool strict) } private static JsonToken GetFirstToken(JsonNodeOrToken nodeOrToken) - { - return nodeOrToken.IsNode ? GetFirstToken(nodeOrToken.Node.ChildAt(0)) : nodeOrToken.Token; - } + => nodeOrToken.IsNode ? GetFirstToken(nodeOrToken.Node.ChildAt(0)) : nodeOrToken.Token; private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonNode node) { @@ -193,20 +191,16 @@ private static JsonToken GetFirstToken(JsonNodeOrToken nodeOrToken) { var diagnostic = GetFirstDiagnostic(child); if (diagnostic != null) - { return diagnostic; - } } return null; } private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonNodeOrToken child) - { - return child.IsNode + => child.IsNode ? GetFirstDiagnostic(child.Node) : GetFirstDiagnostic(child.Token); - } private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonToken token) => GetFirstDiagnostic(token.LeadingTrivia) ?? token.Diagnostics.FirstOrNull() ?? GetFirstDiagnostic(token.TrailingTrivia); From 9454d988d21148c6c845e1ed01a8bd9742b4d714 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 06:53:56 -0800 Subject: [PATCH 080/110] Simplify --- .../EmbeddedLanguages/Json/JsonLexer.cs | 19 +-- .../EmbeddedLanguages/Json/JsonParser.cs | 126 ++++++------------ 2 files changed, 46 insertions(+), 99 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 4fd7a77dd3f3d..124dc36aad707 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -60,12 +60,9 @@ public JsonToken ScanNextToken() var trailingTrivia = ScanTrivia(leading: false); var token = CreateToken(kind, leadingTrivia, chars, trailingTrivia); - if (diagnostic != null) - { - token = token.AddDiagnosticIfNone(diagnostic.Value); - } - - return token; + return diagnostic == null + ? token + : token.AddDiagnosticIfNone(diagnostic.Value); } private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic? diagnostic) ScanNextTokenWorker() @@ -354,11 +351,8 @@ private JsonTrivia ScanMultiLineComment() var start = Position; Position += 2; - while (Position < Text.Length && - !IsAt("*/")) - { + while (Position < Text.Length && !IsAt("*/")) Position++; - } if (IsAt("*/")) { @@ -383,11 +377,8 @@ private bool TextAt(int position, string val) { for (var i = 0; i < val.Length; i++) { - if (position + i >= Text.Length || - Text[position + i] != val[i]) - { + if (position + i >= Text.Length || Text[position + i] != val[i]) return false; - } } return true; diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 5705e050fdecd..45302dfc16ed0 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -49,6 +49,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// then ensure that these comma-values only show up in the right contexts. /// /// + [NonCopyable] internal partial struct JsonParser { private static readonly string s_closeBracketExpected = string.Format(FeaturesResources._0_expected, ']'); @@ -120,28 +121,22 @@ private JsonTree ParseTree(bool strict) var root = new JsonCompilationUnit(arraySequence, _currentToken); - // We only report a single diagnostic when parsing out json. This helps prevent lots of - // cascading errors from being reported. First, we see if there are any diagnostics - // directly in tokens in the tree. If not, we then check for any incorrect tree - // structure (that would be incorrect for both json.net or strict-mode). If we don't - // run into any problems, we'll then perform specific json.net or strict-mode checks. + // We only report a single diagnostic when parsing out json. This helps prevent lots of cascading errors + // from being reported. First, we see if there are any diagnostics directly in tokens in the tree. If not, + // we then check for any incorrect tree structure (that would be incorrect for both json.net or + // strict-mode). If we don't run into any problems, we'll then perform specific json.net or strict-mode + // checks. var diagnostic = GetFirstDiagnostic(root) ?? CheckTopLevel(_lexer.Text, root); - if (diagnostic == null) - { - // We didn't have any diagnostics in the tree so far. Do the json.net/strict checks - // depending on how we were invoked. - diagnostic = strict - ? StrictSyntaxChecker.CheckSyntax(root) - : JsonNetSyntaxChecker.CheckSyntax(root); - } + // If we didn't have any diagnostics in the tree so far, then do the json.net/strict checks depending on how we + // were invoked. + diagnostic ??= strict + ? StrictSyntaxChecker.CheckSyntax(root) + : JsonNetSyntaxChecker.CheckSyntax(root); - var diagnostics = diagnostic == null + return new JsonTree(_lexer.Text, root, diagnostic == null ? ImmutableArray.Empty - : ImmutableArray.Create(diagnostic.Value); - - return new JsonTree( - _lexer.Text, root, diagnostics); + : ImmutableArray.Create(diagnostic.Value)); } /// @@ -187,9 +182,7 @@ private JsonTree ParseTree(bool strict) } private static JsonToken GetFirstToken(JsonNodeOrToken nodeOrToken) - { - return nodeOrToken.IsNode ? GetFirstToken(nodeOrToken.Node.ChildAt(0)) : nodeOrToken.Token; - } + => nodeOrToken.IsNode ? GetFirstToken(nodeOrToken.Node.ChildAt(0)) : nodeOrToken.Token; private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonNode node) { @@ -197,20 +190,16 @@ private static JsonToken GetFirstToken(JsonNodeOrToken nodeOrToken) { var diagnostic = GetFirstDiagnostic(child); if (diagnostic != null) - { return diagnostic; - } } return null; } private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonNodeOrToken child) - { - return child.IsNode + => child.IsNode ? GetFirstDiagnostic(child.Node) : GetFirstDiagnostic(child.Token); - } private static EmbeddedDiagnostic? GetFirstDiagnostic(JsonToken token) => GetFirstDiagnostic(token.LeadingTrivia) ?? token.Diagnostics.FirstOrNull() ?? GetFirstDiagnostic(token.TrailingTrivia); @@ -254,24 +243,16 @@ private ImmutableArray ParseSequenceWorker() private bool ShouldConsumeSequenceElement() { if (_currentToken.Kind == JsonKind.EndOfFile) - { return false; - } if (_currentToken.Kind == JsonKind.CloseBraceToken) - { return !_inObject; - } if (_currentToken.Kind == JsonKind.CloseBracketToken) - { return !_inArray; - } if (_currentToken.Kind == JsonKind.CloseParenToken) - { return !_inConstructor; - } return true; } @@ -303,12 +284,13 @@ private JsonPropertyNode ParseProperty(JsonToken stringLiteralOrText) { Debug.Assert(_currentToken.Kind == JsonKind.ColonToken); if (stringLiteralOrText.Kind != JsonKind.StringToken) - { stringLiteralOrText = stringLiteralOrText.With(kind: JsonKind.TextToken); - } var colonToken = ConsumeCurrentToken(); - // Newtonsoft allows "{ a: , }" as a legal property. + + // Newtonsoft allows "{ a: , }" as a legal property. In that case, synthesize a missing value and allow the + // comma to be parsed as the next value in the sequence. The strict pass will error if it sees this missing + // comma-value as the value of a property. if (_currentToken.Kind == JsonKind.CommaToken) { return new JsonPropertyNode( @@ -337,49 +319,41 @@ private JsonPropertyNode ParseProperty(JsonToken stringLiteralOrText) nestedProperty.Value); } - return new JsonPropertyNode( - stringLiteralOrText, colonToken, value); + return new JsonPropertyNode(stringLiteralOrText, colonToken, value); } private JsonValueNode ParseLiteralOrPropertyOrConstructor() { var textToken = ConsumeCurrentToken(); - if (_currentToken.Kind != JsonKind.ColonToken) - { - return ParseLiteralOrTextOrConstructor(textToken); - } - - return ParseProperty(textToken); + return _currentToken.Kind == JsonKind.ColonToken + ? ParseProperty(textToken) + : ParseLiteralOrTextOrConstructor(textToken); } private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) { if (token.Kind == JsonKind.StringToken) - { return new JsonLiteralNode(token); - } // Look for constructors (a json.net extension). We'll report them as an error // in strict model. - if (JsonParser.Matches(token, "new")) - { + if (Matches(token, "new")) return ParseConstructor(token); - } // Check for certain literal values. Some of these (like NaN) are json.net only. // We'll check for these later in the strict-mode pass. Debug.Assert(token.VirtualChars.Length > 0); - if (JsonParser.TryMatch(token, "NaN", JsonKind.NaNLiteralToken, out var newKind) || - JsonParser.TryMatch(token, "true", JsonKind.TrueLiteralToken, out newKind) || - JsonParser.TryMatch(token, "null", JsonKind.NullLiteralToken, out newKind) || - JsonParser.TryMatch(token, "false", JsonKind.FalseLiteralToken, out newKind) || - JsonParser.TryMatch(token, "Infinity", JsonKind.InfinityLiteralToken, out newKind) || - JsonParser.TryMatch(token, "undefined", JsonKind.UndefinedLiteralToken, out newKind)) + if (TryMatch(token, "NaN", JsonKind.NaNLiteralToken, out var newKind) || + TryMatch(token, "true", JsonKind.TrueLiteralToken, out newKind) || + TryMatch(token, "null", JsonKind.NullLiteralToken, out newKind) || + TryMatch(token, "false", JsonKind.FalseLiteralToken, out newKind) || + TryMatch(token, "Infinity", JsonKind.InfinityLiteralToken, out newKind) || + TryMatch(token, "undefined", JsonKind.UndefinedLiteralToken, out newKind)) { return new JsonLiteralNode(token.With(kind: newKind)); } - if (JsonParser.Matches(token, "-Infinity")) + if (Matches(token, "-Infinity")) { SplitLiteral(token, out var minusToken, out var newLiteralToken); @@ -389,9 +363,7 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) var firstChar = token.VirtualChars[0]; if (firstChar == '-' || firstChar == '.' || IsDigit(firstChar)) - { return ParseNumber(token); - } return new JsonTextNode( token.With(kind: JsonKind.TextToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( @@ -401,17 +373,13 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) private JsonConstructorNode ParseConstructor(JsonToken token) { - var newKeyword = token.With(kind: JsonKind.NewKeyword); - var nameToken = ConsumeToken(JsonKind.TextToken, FeaturesResources.Name_expected); - var openParen = ConsumeToken(JsonKind.OpenParenToken, s_openParenExpected); - var savedInConstructor = _inConstructor; _inConstructor = true; var result = new JsonConstructorNode( - newKeyword, - nameToken, - openParen, + token.With(kind: JsonKind.NewKeyword), + ConsumeToken(JsonKind.TextToken, FeaturesResources.Name_expected), + ConsumeToken(JsonKind.OpenParenToken, s_openParenExpected), ParseSequence(), ConsumeToken(JsonKind.CloseParenToken, s_closeParenExpected)); @@ -421,7 +389,7 @@ private JsonConstructorNode ParseConstructor(JsonToken token) private static bool TryMatch(JsonToken token, string val, JsonKind kind, out JsonKind newKind) { - if (JsonParser.Matches(token, val)) + if (Matches(token, val)) { newKind = kind; return true; @@ -447,13 +415,10 @@ private static bool Matches(JsonToken token, string val) } private static bool IsDigit(VirtualChar ch) - => ch >= '0' && ch <= '9'; + => ch.Value is >= '0' and <= '9'; private static JsonValueNode ParseNumber(JsonToken textToken) - { - var numberToken = textToken.With(kind: JsonKind.NumberToken); - return new JsonLiteralNode(numberToken); - } + => new(textToken.With(kind: JsonKind.NumberToken)); private JsonCommaValueNode ParseCommaValue() => new(ConsumeCurrentToken()); @@ -487,23 +452,14 @@ private JsonObjectNode ParseObject() } private JsonToken ConsumeToken(JsonKind kind, string error) - { - if (_currentToken.Kind == kind) - { - return ConsumeCurrentToken(); - } - else - { - return CreateMissingToken(kind).AddDiagnosticIfNone( + => _currentToken.Kind == kind + ? ConsumeCurrentToken() + : CreateMissingToken(kind).AddDiagnosticIfNone( new EmbeddedDiagnostic(error, GetTokenStartPositionSpan(_currentToken))); - } - } private TextSpan GetTokenStartPositionSpan(JsonToken token) - { - return token.Kind == JsonKind.EndOfFile + => token.Kind == JsonKind.EndOfFile ? new TextSpan(_lexer.Text.Last().Span.End, 0) : new TextSpan(token.VirtualChars[0].Span.Start, 0); - } } } From a9e44ead59366003657cbaa1414bccf87cc6fb5d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 06:56:04 -0800 Subject: [PATCH 081/110] Add asserts --- .../Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 6935906e88fa0..248727bb05f29 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Immutable; using System.Diagnostics; -using System.Linq; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json @@ -18,6 +17,7 @@ internal sealed class JsonCompilationUnit : JsonNode public JsonCompilationUnit(ImmutableArray sequence, JsonToken endOfFileToken) : base(JsonKind.CompilationUnit) { + Debug.Assert(sequence != null); Debug.Assert(endOfFileToken.Kind == JsonKind.EndOfFile); Sequence = sequence; EndOfFileToken = endOfFileToken; @@ -130,6 +130,7 @@ public JsonArrayNode( : base(JsonKind.Array) { Debug.Assert(openBracketToken.Kind == JsonKind.OpenBracketToken); + Debug.Assert(sequence != null); Debug.Assert(closeBracketToken.Kind == JsonKind.CloseBracketToken); OpenBracketToken = openBracketToken; @@ -282,6 +283,11 @@ public JsonConstructorNode( JsonToken closeParenToken) : base(JsonKind.Constructor) { + Debug.Assert(newKeyword.Kind == JsonKind.NewKeyword); + Debug.Assert(nameToken.Kind == JsonKind.TextToken); + Debug.Assert(openParenToken.Kind == JsonKind.OpenParenToken); + Debug.Assert(sequence != null); + Debug.Assert(closeParenToken.Kind == JsonKind.CloseParenToken); NewKeyword = newKeyword; NameToken = nameToken; OpenParenToken = openParenToken; From fe3cd4291218552e52f5d90d8b09a15d02f3cc21 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 06:56:52 -0800 Subject: [PATCH 082/110] Fix --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 45302dfc16ed0..af0ed9ef83fe5 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -417,7 +417,7 @@ private static bool Matches(JsonToken token, string val) private static bool IsDigit(VirtualChar ch) => ch.Value is >= '0' and <= '9'; - private static JsonValueNode ParseNumber(JsonToken textToken) + private static JsonLiteralNode ParseNumber(JsonToken textToken) => new(textToken.With(kind: JsonKind.NumberToken)); private JsonCommaValueNode ParseCommaValue() From 86e9df625ecd5130d4accc49cbbc7f7959479ab4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 07:01:31 -0800 Subject: [PATCH 083/110] Fix --- src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 124dc36aad707..64a487148687b 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -274,7 +274,7 @@ private ImmutableArray ScanTrivia(bool leading) break; } - return result.ToImmutableAndFree(); + return result.ToImmutable(); } private JsonTrivia? ScanEndOfLine() From 1e867a82e2d5ce61e6c8b0ffe8db17dc58f5e1a5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 07:11:25 -0800 Subject: [PATCH 084/110] Add tests --- .../Json/CSharpJsonParserTests_BasicTests.cs | 34 +++++++++++++------ .../EmbeddedLanguages/Json/JsonParser.cs | 7 ++++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index a3eba834dd64e..02bcd80ee7f9d 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -736,8 +736,6 @@ public void TestInfinity1() [Fact] public void TestNegativeInfinity1() { - // DataContractJsonSerializer accepts NaN and Infinity when those are not part of - // the spec. So we don't run those checks. Test(@"""-Infinity""", @" @@ -752,14 +750,12 @@ public void TestNegativeInfinity1() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] public void TestNegativeInfinity2() { - // DataContractJsonSerializer accepts NaN and Infinity when those are not part of - // the spec. So we don't run those checks. Test(@"""- Infinity""", @" @@ -778,7 +774,7 @@ public void TestNegativeInfinity2() ", @" -", runStrictTreeCheck: false); +"); } [Fact] @@ -4660,7 +4656,6 @@ public void TestSimpleNumber3() [Fact] public void TestSimpleNumber4() { - // DataContractJsonSerializer does not follow the spec for numbers properly. Test(@"@""-.0""", @" @@ -4674,7 +4669,7 @@ public void TestSimpleNumber4() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] @@ -5334,9 +5329,26 @@ public void TestPropertyWithCommaFollowedByComma() [Fact] public void TestTopLevelProperty() { - Test(@"""'a': 0""", @"", - @"", - @""); + Test(@"""'a': 0""", @" + + + + 'a' + : + + 0 + + + + + +", + @" + +", + @" + +"); } } } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 8c0028c36a297..497197a8f1824 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -178,6 +178,13 @@ private JsonTree ParseTree(bool strict) string.Format(FeaturesResources._0_unexpected, ','), emptyValue.CommaToken.GetSpan()); } + else if (child.Kind == JsonKind.Property) + { + var propertyValue = (JsonPropertyNode)child; + return new EmbeddedDiagnostic( + string.Format(FeaturesResources._0_unexpected, ':'), + propertyValue.ColonToken.GetSpan()); + } return null; } From 76b40e688a26243f02d46d61390069c38864f474 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 07:13:06 -0800 Subject: [PATCH 085/110] Add tests --- .../EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 02bcd80ee7f9d..cfedf6fa13409 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -4751,7 +4751,6 @@ public void TestNumber2() [Fact] public void TestNumber3() { - // DataContractJsonSerializer does not follow the spec for numbers properly. Test(@"@""00""", @" @@ -4765,7 +4764,7 @@ public void TestNumber3() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] From ff57ed2bb6d52db67b980b8b16b3bc0d9f90c226 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 07:14:23 -0800 Subject: [PATCH 086/110] Just use new .net json parser --- .../CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 1af80c802d59d..89b6c87bac63a 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -4,11 +4,8 @@ using System; using System.Collections.Immutable; -using System.IO; using System.Linq; using System.Runtime.CompilerServices; -using System.Runtime.Serialization.Json; -using System.Text; using System.Text.Json; using System.Xml.Linq; using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; @@ -167,9 +164,6 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) { try { - var serializer1 = new DataContractJsonSerializer(typeof(object)); - serializer1.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(token.ValueText))); - JsonDocument.Parse(token.ValueText, new JsonDocumentOptions { AllowTrailingCommas = false, CommentHandling = JsonCommentHandling.Disallow }); } catch (Exception) From 8a097e1147d0d49f77d56937327273481535dfc3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 07:17:05 -0800 Subject: [PATCH 087/110] Just use new .net json parser --- .../Json/CSharpJsonParserTests_BasicTests.cs | 23 ++++++------------- .../Json/CSharpJsonParserTests_NstTests.cs | 2 +- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 2 +- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index cfedf6fa13409..9c978ea9f6a8d 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -153,7 +153,7 @@ public void TestFormFeed3() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] @@ -649,8 +649,6 @@ public void TestUndefinedLiteral1() [Fact] public void TestNaNLiteral1() { - // DataContractJsonSerializer accepts NaN and Infinity when those are not part of - // the spec. So we don't run those checks. Test(@"""NaN""", @" @@ -664,14 +662,12 @@ public void TestNaNLiteral1() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] public void TestNaNLiteral2() { - // DataContractJsonSerializer accepts NaN and Infinity when those are not part of - // the spec. So we don't run those checks. Test(@""" NaN """, @" @@ -688,7 +684,7 @@ public void TestNaNLiteral2() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] @@ -715,8 +711,6 @@ public void TestNaNLiteral3() [Fact] public void TestInfinity1() { - // DataContractJsonSerializer accepts NaN and Infinity when those are not part of - // the spec. So we don't run those checks. Test(@"""Infinity""", @" @@ -730,7 +724,7 @@ public void TestInfinity1() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] @@ -4770,7 +4764,6 @@ public void TestNumber3() [Fact] public void TestNumber4() { - // DataContractJsonSerializer does not follow the spec for numbers properly. Test(@"@""-00""", @" @@ -4784,13 +4777,12 @@ public void TestNumber4() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] public void TestNumber5() { - // DataContractJsonSerializer does not follow the spec for numbers properly. Test(@"@""0.""", @" @@ -4804,13 +4796,12 @@ public void TestNumber5() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] public void TestNumber6() { - // DataContractJsonSerializer does not follow the spec for numbers properly. Test(@"@""-0.""", @" @@ -4824,7 +4815,7 @@ public void TestNumber6() @"", @" -", runStrictTreeCheck: false); +"); } [Fact] diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs index 6d7acbffdca57..ac559941904b2 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { - public partial class CSharpJsonParserTests + public partial class CSharpJsonParserNstTests : CSharpJsonParserTests { [Fact] public void i_number_double_huge_neg_exp_json() diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 89b6c87bac63a..585d8bac34609 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -363,7 +363,7 @@ private static void CheckCharacters(VirtualCharSequence virtualChars, ref int po position += virtualChars.Length; } - private void TestNST( + protected void TestNST( string stringText, string expected, string _, string strictDiagnostics, [CallerMemberName] string caller = "") { var (_, tree, allChars) = JustParseTree(stringText, strict: true, conversionFailureOk: false); From 40007267533eeb9e25127718d4478e673bd9284d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 07:33:39 -0800 Subject: [PATCH 088/110] Simplify tests --- .../Json/CSharpJsonParserTests_BasicTests.cs | 4 +- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 88 +++++++------------ 2 files changed, 36 insertions(+), 56 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 9c978ea9f6a8d..46b406a405861 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { - public partial class CSharpJsonParserTests + public partial class CSharpJsonParserBasicTests : CSharpJsonParserTests { [Fact] public void TestOneSpace() @@ -3591,7 +3591,7 @@ public void TestObjectLiteralComments() @"", @" -", runLooseTreeCheck: false); +", runLooseSubTreeCheck: false); } [Fact] diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 585d8bac34609..4b4caaedb39cc 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -35,41 +35,33 @@ private static SyntaxToken GetStringToken(string text) return token; } - private void Test(string stringText, + protected void Test(string stringText, string expected, string looseDiagnostics, string strictDiagnostics, - bool runLooseTreeCheck = true, bool runLooseSubTreeCheck = true, - bool runStrictTreeCheck = true, bool runStrictSubTreeCheck = true, + bool runLooseSubTreeCheck = true, + bool runStrictSubTreeCheck = true, [CallerMemberName] string _ = "") { - if (runLooseSubTreeCheck || runLooseSubTreeCheck) - { - Test(stringText, strict: false, expected, looseDiagnostics, runLooseTreeCheck, runLooseSubTreeCheck); - } + if (runLooseSubTreeCheck) + Test(stringText, strict: false, expected, looseDiagnostics, runLooseSubTreeCheck); - if (runStrictTreeCheck || runStrictSubTreeCheck) - { - Test(stringText, strict: true, expected, strictDiagnostics, runStrictTreeCheck, runStrictSubTreeCheck); - } + if (runStrictSubTreeCheck) + Test(stringText, strict: true, expected, strictDiagnostics, runStrictSubTreeCheck); } private void Test( string stringText, bool strict, string expectedTree, string expectedDiagnostics, - bool runTreeCheck, bool runSubTreeChecks) + bool runSubTreeChecks) { - var tree = TryParseTree(stringText, strict, runTreeCheck, conversionFailureOk: false); + var tree = TryParseTree(stringText, strict, conversionFailureOk: false); if (tree == null) - { return; - } // Tests are allowed to not run the subtree tests. This is because some // subtrees can cause the native regex parser to exhibit very bad behavior // (like not ever actually finishing compiling). if (runSubTreeChecks) - { - TryParseSubTrees(stringText, strict, runTreeCheck); - } + TryParseSubTrees(stringText, strict); var actualTree = TreeToText(tree).Replace("\"", "\"\""); Assert.Equal(expectedTree.Replace("\"", "\"\""), actualTree); @@ -78,14 +70,14 @@ private void Test( Assert.Equal(expectedDiagnostics.Replace("\"", "\"\""), actualDiagnostics); } - private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) + private void TryParseSubTrees(string stringText, bool strict) { // Trim the input from the right and make sure tree invariants hold var current = stringText; while (current != "@\"\"" && current != "\"\"") { current = current.Substring(0, current.Length - 2) + "\""; - TryParseTree(current, strict, runTreeCheck, conversionFailureOk: true); + TryParseTree(current, strict, conversionFailureOk: true); } // Trim the input from the left and make sure tree invariants hold @@ -101,7 +93,7 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) current = "\"" + current.Substring(2); } - TryParseTree(current, strict, runTreeCheck, conversionFailureOk: true); + TryParseTree(current, strict, conversionFailureOk: true); } for (var start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++) @@ -109,8 +101,7 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) TryParseTree( stringText.Substring(0, start) + stringText.Substring(start + 1, stringText.Length - (start + 1)), - strict, runTreeCheck, - conversionFailureOk: true); + strict, conversionFailureOk: true); } } @@ -135,7 +126,7 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) } private JsonTree? TryParseTree( - string stringText, bool strict, bool runTreeCheck, bool conversionFailureOk) + string stringText, bool strict, bool conversionFailureOk) { var (token, tree, allChars) = JustParseTree(stringText, strict, conversionFailureOk); if (tree == null) @@ -146,36 +137,32 @@ private void TryParseSubTrees(string stringText, bool strict, bool runTreeCheck) CheckInvariants(tree, allChars); - if (runTreeCheck) + if (!strict) { - if (!strict) + try { - try - { - JToken.Parse(token.ValueText); - } - catch (Exception) - { - Assert.NotEmpty(tree.Diagnostics); - return tree; - } + JToken.Parse(token.ValueText); } - else + catch (Exception) { - try - { - JsonDocument.Parse(token.ValueText, new JsonDocumentOptions { AllowTrailingCommas = false, CommentHandling = JsonCommentHandling.Disallow }); - } - catch (Exception) - { - Assert.NotEmpty(tree.Diagnostics); - return tree; - } + Assert.NotEmpty(tree.Diagnostics); + return tree; + } + } + else + { + try + { + JsonDocument.Parse(token.ValueText, new JsonDocumentOptions { AllowTrailingCommas = false, CommentHandling = JsonCommentHandling.Disallow }); + } + catch (Exception) + { + Assert.NotEmpty(tree.Diagnostics); + return tree; } - - Assert.Empty(tree.Diagnostics); } + Assert.Empty(tree.Diagnostics); return tree; } @@ -400,13 +387,6 @@ protected void TestNST( } } - private string RemoveSequenceNode(string expected) - { - var element = XElement.Parse(expected); - var result = RemoveSequenceNode(element); - return result.ToString()!; - } - private object RemoveSequenceNode(XNode node) { if (node is not XElement element) From 02798df95ebfb98bfdeeb95b2b3c56caeb9d7600 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 08:02:39 -0800 Subject: [PATCH 089/110] Add test --- .../Json/CSharpJsonParserTests_BasicTests.cs | 23 +++++ .../Json/CSharpJsonParserTests_NstTests.cs | 38 ++++++++ .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 86 +++---------------- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 21 ++--- .../Json/JsonParser.StrictSyntaxChecker.cs | 2 +- 5 files changed, 84 insertions(+), 86 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 46b406a405861..840ff0eb96c86 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -5338,6 +5338,29 @@ public void TestTopLevelProperty() ", @" +"); + } + + [Fact] + public void TestTopLevelConstructor() + { + Test(@"""new Date()""", @" + + + + new + Date + ( + + ) + + + + +", + @"", + @" + "); } } diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs index ac559941904b2..f1041f67e877d 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs @@ -3,12 +3,50 @@ // See the LICENSE file in the project root for more information. // tests from: https://github.com/nst/JSONTestSuite +using System.Runtime.CompilerServices; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { public partial class CSharpJsonParserNstTests : CSharpJsonParserTests { + private void TestNST( + string stringText, string expected, string _, string strictDiagnostics, [CallerMemberName] string caller = "") + { + var (_, tree, allChars) = JustParseTree(stringText, strict: true, conversionFailureOk: false); + Assert.NotNull(tree); + Roslyn.Utilities.Contract.ThrowIfNull(tree); + var actualTree = TreeToText(tree!).Replace("\"", "\"\""); + Assert.Equal(expected.Replace("\"", "\"\""), actualTree); + + var actualDiagnostics = DiagnosticsToText(tree.Diagnostics).Replace("\"", "\"\""); + Assert.Equal(strictDiagnostics.Replace("\"", "\"\""), actualDiagnostics); + + CheckInvariants(tree, allChars); + + if (caller.StartsWith("y_")) + { + // y_ tests must produce no diagnostics. + Assert.Empty(strictDiagnostics); + } + else if (caller.StartsWith("i_")) + { + // We don't want to have diagnostics for i_ tests even though we're allowed to. + // That's because we want our parser to be permissive when possible so we don't + // error on json that is legal under some other parser. + Assert.Empty(strictDiagnostics); + } + else if (caller.StartsWith("n_")) + { + // n_ tests must always produce diagnostics. + Assert.NotEmpty(strictDiagnostics); + } + else + { + Assert.False(true, "Unexpected test name."); + } + } + [Fact] public void i_number_double_huge_neg_exp_json() { diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 4b4caaedb39cc..997609fe648f9 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -23,11 +23,11 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json public partial class CSharpJsonParserTests { private readonly IVirtualCharService _service = CSharpVirtualCharService.Instance; - private const string _statmentPrefix = "var v = "; + private const string StatementPrefix = "var v = "; private static SyntaxToken GetStringToken(string text) { - var statement = _statmentPrefix + text; + var statement = StatementPrefix + text; var parsedStatement = SyntaxFactory.ParseStatement(statement); var token = parsedStatement.DescendantTokens().ToArray()[3]; Assert.True(token.Kind() == SyntaxKind.StringLiteralToken); @@ -76,7 +76,7 @@ private void TryParseSubTrees(string stringText, bool strict) var current = stringText; while (current != "@\"\"" && current != "\"\"") { - current = current.Substring(0, current.Length - 2) + "\""; + current = current[0..^2] + "\""; TryParseTree(current, strict, conversionFailureOk: true); } @@ -84,14 +84,9 @@ private void TryParseSubTrees(string stringText, bool strict) current = stringText; while (current != "@\"\"" && current != "\"\"") { - if (current[0] == '@') - { - current = "@\"" + current.Substring(3); - } - else - { - current = "\"" + current.Substring(2); - } + current = current[0] == '@' + ? "@\"" + current[3..] + : "\"" + current[2..]; TryParseTree(current, strict, conversionFailureOk: true); } @@ -99,20 +94,18 @@ private void TryParseSubTrees(string stringText, bool strict) for (var start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++) { TryParseTree( - stringText.Substring(0, start) + - stringText.Substring(start + 1, stringText.Length - (start + 1)), + stringText[..start] + + stringText[(start + 1)..], strict, conversionFailureOk: true); } } - private (SyntaxToken, JsonTree?, VirtualCharSequence) JustParseTree( + private protected (SyntaxToken, JsonTree?, VirtualCharSequence) JustParseTree( string stringText, bool strict, bool conversionFailureOk) { var token = CSharpJsonParserTests.GetStringToken(stringText); if (token.ValueText == "") - { return default; - } var allChars = _service.TryConvertToVirtualChars(token); if (allChars.IsDefault) @@ -166,18 +159,14 @@ private void TryParseSubTrees(string stringText, bool strict) return tree; } - private static string TreeToText(JsonTree tree) - { - return new XElement("Tree", + private protected static string TreeToText(JsonTree tree) + => new XElement("Tree", NodeToElement(tree.Root)).ToString(); - } - private static string DiagnosticsToText(ImmutableArray diagnostics) + private protected static string DiagnosticsToText(ImmutableArray diagnostics) { if (diagnostics.IsEmpty) - { return ""; - } return new XElement("Diagnostics", diagnostics.Select(d => @@ -258,24 +247,16 @@ private static XElement TokenToElement(JsonToken token) var element = new XElement(token.Kind.ToString()); if (token.Value != null) - { element.Add(new XAttribute("value", token.Value)); - } if (token.LeadingTrivia.Length > 0) - { element.Add(new XElement("Trivia", token.LeadingTrivia.Select(t => TriviaToElement(t)))); - } if (token.VirtualChars.Length > 0) - { element.Add(token.VirtualChars.CreateString()); - } if (token.TrailingTrivia.Length > 0) - { element.Add(new XElement("Trivia", token.TrailingTrivia.Select(t => TriviaToElement(t)))); - } return element; } @@ -285,7 +266,7 @@ private static XElement TriviaToElement(JsonTrivia trivia) trivia.Kind.ToString(), trivia.VirtualChars.CreateString().Replace("\f", "\\f")); - private static void CheckInvariants(JsonTree tree, VirtualCharSequence allChars) + private protected static void CheckInvariants(JsonTree tree, VirtualCharSequence allChars) { var root = tree.Root; var position = 0; @@ -318,9 +299,7 @@ private static void CheckInvariants(JsonToken token, ref int position, VirtualCh private static void CheckInvariants(ImmutableArray leadingTrivia, ref int position, VirtualCharSequence allChars) { foreach (var trivia in leadingTrivia) - { CheckInvariants(trivia, ref position, allChars); - } } private static void CheckInvariants(JsonTrivia trivia, ref int position, VirtualCharSequence allChars) @@ -343,50 +322,11 @@ private static void CheckInvariants(JsonTrivia trivia, ref int position, Virtual private static void CheckCharacters(VirtualCharSequence virtualChars, ref int position, VirtualCharSequence allChars) { for (var i = 0; i < virtualChars.Length; i++) - { Assert.Equal(allChars[position + i], virtualChars[i]); - } position += virtualChars.Length; } - protected void TestNST( - string stringText, string expected, string _, string strictDiagnostics, [CallerMemberName] string caller = "") - { - var (_, tree, allChars) = JustParseTree(stringText, strict: true, conversionFailureOk: false); - Assert.NotNull(tree); - Roslyn.Utilities.Contract.ThrowIfNull(tree); - var actualTree = TreeToText(tree!).Replace("\"", "\"\""); - Assert.Equal(expected.Replace("\"", "\"\""), actualTree); - - var actualDiagnostics = DiagnosticsToText(tree.Diagnostics).Replace("\"", "\"\""); - Assert.Equal(strictDiagnostics.Replace("\"", "\"\""), actualDiagnostics); - - CheckInvariants(tree, allChars); - - if (caller.StartsWith("y_")) - { - // y_ tests must produce no diagnostics. - Assert.Empty(strictDiagnostics); - } - else if (caller.StartsWith("i_")) - { - // We don't want to have diagnostics for i_ tests even though we're allowed to. - // That's because we want our parser to be permissive when possible so we don't - // error on json that is legal under some other parser. - Assert.Empty(strictDiagnostics); - } - else if (caller.StartsWith("n_")) - { - // n_ tests must always produce diagnostics. - Assert.NotEmpty(strictDiagnostics); - } - else - { - Assert.False(true, "Unexpected test name."); - } - } - private object RemoveSequenceNode(XNode node) { if (node is not XElement element) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index 25c4811f42ef4..5f96608daac58 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -37,19 +37,16 @@ private static class JsonNetSyntaxChecker } public static EmbeddedDiagnostic? CheckSyntax(JsonNode node) - { - switch (node.Kind) + => node.Kind switch { - case JsonKind.Array: return CheckArray((JsonArrayNode)node); - case JsonKind.Object: return CheckObject((JsonObjectNode)node); - case JsonKind.Constructor: return CheckConstructor((JsonConstructorNode)node); - case JsonKind.Property: return CheckProperty((JsonPropertyNode)node); - case JsonKind.Literal: return CheckLiteral((JsonLiteralNode)node); - case JsonKind.NegativeLiteral: return CheckNegativeLiteral((JsonNegativeLiteralNode)node); - } - - return CheckChildren(node); - } + JsonKind.Array => CheckArray((JsonArrayNode)node), + JsonKind.Object => CheckObject((JsonObjectNode)node), + JsonKind.Constructor => CheckConstructor((JsonConstructorNode)node), + JsonKind.Property => CheckProperty((JsonPropertyNode)node), + JsonKind.Literal => CheckLiteral((JsonLiteralNode)node), + JsonKind.NegativeLiteral => CheckNegativeLiteral((JsonNegativeLiteralNode)node), + _ => CheckChildren(node), + }; private static EmbeddedDiagnostic? CheckLiteral(JsonLiteralNode node) { diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index d88d1f6588581..7834cc1a23724 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -247,7 +247,7 @@ Numeric values that cannot be represented in the grammar below (such */ private static readonly Regex s_validNumberRegex = - new Regex( + new( @"^ -? # [ minus ] (0|([1-9][0-9]*)) # int From 2e3e83da97acdfc4c910f3c5649fc92bd87d37ca Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 08:09:06 -0800 Subject: [PATCH 090/110] Add test --- .../Json/CSharpJsonParserTests_BasicTests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 840ff0eb96c86..819ea36d65476 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -5361,6 +5361,27 @@ public void TestTopLevelConstructor() @"", @" +"); + } + + [Fact] + public void TestTopLevelText() + { + Test(@"""Date""", @" + + + + Date + + + + +", + @" + +", + @" + "); } } From 64cee0bd63854ffa39e3b6cca0a969cb1a4d88c9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 08:13:45 -0800 Subject: [PATCH 091/110] Simplify --- .../Portable/EmbeddedLanguages/Json/JsonLexer.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 1c5fa69362cac..0066e985fd087 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -29,17 +29,7 @@ public JsonLexer(VirtualCharSequence text) : this() Text = text; } - public VirtualChar CurrentChar - { - get - { - if (Position < Text.Length) - return Text[Position]; - - Debug.Fail("Indexed past the end of the content"); - return default; - } - } + public VirtualChar CurrentChar => Text[Position]; public VirtualCharSequence GetCharsToCurrentPosition(int start) => GetSubSequence(start, Position); From cdf9299b7027f06e58c806016014043fd2031870 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 08:22:05 -0800 Subject: [PATCH 092/110] Simplify --- .../EmbeddedLanguages/Json/JsonHelpers.cs | 3 + .../EmbeddedLanguages/Json/JsonLexer.cs | 88 +++++-------------- 2 files changed, 24 insertions(+), 67 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs index 6c26c449191e0..ad7472c3f7cd2 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonHelpers.cs @@ -29,6 +29,9 @@ public static JsonToken CreateMissingToken(JsonKind kind) public static JsonTrivia CreateTrivia(JsonKind kind, VirtualCharSequence virtualChars) => CreateTrivia(kind, virtualChars, ImmutableArray.Empty); + public static JsonTrivia CreateTrivia(JsonKind kind, VirtualCharSequence virtualChars, EmbeddedDiagnostic diagnostic) + => CreateTrivia(kind, virtualChars, ImmutableArray.Create(diagnostic)); + public static JsonTrivia CreateTrivia(JsonKind kind, VirtualCharSequence virtualChars, ImmutableArray diagnostics) => new(kind, virtualChars, diagnostics); } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs index 0066e985fd087..cc2787f3c408d 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonLexer.cs @@ -104,7 +104,7 @@ public JsonToken ScanNextToken() continue; case '\\': - var escapeDiag = AdvanceToEndOfEscape(start, Position - 1); + var escapeDiag = AdvanceToEndOfEscape(start, escapeStart: Position - 1); diagnostic ??= escapeDiag; continue; } @@ -129,29 +129,14 @@ public JsonToken ScanNextToken() } var currentCh = this.CurrentChar; - switch (currentCh.Value) + Position++; + + return currentCh.Value switch { - case 'b': - case 't': - case 'n': - case 'f': - case 'r': - case '\\': - case '"': - case '\'': - case '/': - Position++; - return null; - - case 'u': - Position++; - return ScanUnicodeChars(escapeStart, Position); - - default: - Position++; - var chars = GetCharsToCurrentPosition(escapeStart); - return new EmbeddedDiagnostic(FeaturesResources.Invalid_escape_sequence, GetSpan(chars)); - } + 'b' or 't' or 'n' or 'f' or 'r' or '\\' or '"' or '\'' or '/' => null, + 'u' => ScanUnicodeChars(escapeStart, Position), + _ => new EmbeddedDiagnostic(FeaturesResources.Invalid_escape_sequence, GetSpan(GetCharsToCurrentPosition(escapeStart))), + }; } private EmbeddedDiagnostic? ScanUnicodeChars(int escapeStart, int unicodeCharStart) @@ -189,37 +174,15 @@ private static bool IsHexDigit(VirtualChar c) return (GetCharsToCurrentPosition(start), JsonKind.TextToken, null); static bool IsNotPartOfText(VirtualChar ch) - { - // Standard tokens. - switch (ch.Value) + => ch.Value switch { - case '{': - case '}': - case '[': - case ']': - case '(': - case ')': - case ',': - case ':': - case '\'': - case '"': - return true; - - case ' ': - case '\t': - case '/': - case '\r': - case '\n': - // trivia cases - return true; - } - - // more trivia - if (ch.IsWhiteSpace) - return true; - - return false; - } + // Standard tokens. + '{' or '}' or '[' or ']' or '(' or ')' or ',' or ':' or '\'' or '"' => true, + // trivia cases + ' ' or '\t' or '/' or '\r' or '\n' => true, + // more trivia + _ => ch.IsWhiteSpace, + }; } private (VirtualCharSequence, JsonKind, EmbeddedDiagnostic?) ScanSingleCharToken(JsonKind kind) @@ -304,9 +267,7 @@ private ImmutableArray ScanTrivia(bool leading) var chars = GetCharsToCurrentPosition(start); return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars, - ImmutableArray.Create(new EmbeddedDiagnostic( - FeaturesResources.Error_parsing_comment, - GetSpan(chars)))); + new EmbeddedDiagnostic(FeaturesResources.Error_parsing_comment, GetSpan(chars))); } return null; @@ -318,21 +279,16 @@ private JsonTrivia ScanSingleLineComment() var start = Position; Position += 2; - while (Position < Text.Length && - this.CurrentChar.Value is not '\r' and not '\n') - { + while (Position < Text.Length && this.CurrentChar.Value is not '\r' and not '\n') Position++; - } var chars = GetCharsToCurrentPosition(start); if (Position == start + 2) { // Note: json.net reports an error if the file ends with "//", so we just // preserve that behavior. - var diagnostics = ImmutableArray.Create(new EmbeddedDiagnostic( - FeaturesResources.Unterminated_comment, - GetSpan(chars))); - return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars, diagnostics); + return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars, + new EmbeddedDiagnostic(FeaturesResources.Unterminated_comment, GetSpan(chars))); } return CreateTrivia(JsonKind.SingleLineCommentTrivia, chars); @@ -355,9 +311,7 @@ private JsonTrivia ScanMultiLineComment() Debug.Assert(Position == Text.Length); return CreateTrivia(JsonKind.MultiLineCommentTrivia, GetCharsToCurrentPosition(start), - ImmutableArray.Create(new EmbeddedDiagnostic( - FeaturesResources.Unterminated_comment, - GetTextSpan(start, Position)))); + new EmbeddedDiagnostic(FeaturesResources.Unterminated_comment, GetTextSpan(start, Position))); } private TextSpan GetTextSpan(int startInclusive, int endExclusive) From 0f932e980cc4a02024b30ce1c19861d41ec29a42 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 08:24:37 -0800 Subject: [PATCH 093/110] Add comment --- .../Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index 248727bb05f29..ed15d429abd55 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -56,8 +56,8 @@ protected JsonValueNode(JsonKind kind) } /// - /// Represents a chunk of text that we did not understand as anything special. i.e. it wasn't a - /// keyword, number, or literal. + /// Represents a chunk of text that we did not understand as anything special. i.e. it wasn't a keyword, number, or + /// literal. One common case of this is an unquoted property name (which json.net accepts). /// internal sealed class JsonTextNode : JsonValueNode { From 396c55a454e46806f352770584a912c2ab1dd92f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 08:33:11 -0800 Subject: [PATCH 094/110] Share code --- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 39 +++------------- .../Json/JsonParser.StrictSyntaxChecker.cs | 14 +----- .../EmbeddedLanguages/Json/JsonParser.cs | 44 ++++++++++++++++++- 3 files changed, 51 insertions(+), 46 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index 5f96608daac58..0beabc8665bfd 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -27,9 +27,7 @@ private static class JsonNetSyntaxChecker { var diagnostic = CheckSyntax(child.Node); if (diagnostic != null) - { return diagnostic; - } } } @@ -49,24 +47,14 @@ private static class JsonNetSyntaxChecker }; private static EmbeddedDiagnostic? CheckLiteral(JsonLiteralNode node) - { - if (node.LiteralToken.Kind == JsonKind.NumberToken) - { - return CheckNumber(node.LiteralToken); - } - - return CheckChildren(node); - } + => node.LiteralToken.Kind == JsonKind.NumberToken + ? CheckNumber(node.LiteralToken) + : CheckChildren(node); private static EmbeddedDiagnostic? CheckNegativeLiteral(JsonNegativeLiteralNode node) - { - if (node.LiteralToken.Kind == JsonKind.NumberToken) - { - return CheckNumber(node.LiteralToken); - } - - return CheckChildren(node); - } + => node.LiteralToken.Kind == JsonKind.NumberToken + ? CheckNumber(node.LiteralToken) + : CheckChildren(node); private static EmbeddedDiagnostic? CheckNumber(JsonToken numberToken) { @@ -114,20 +102,7 @@ private static class JsonNetSyntaxChecker } private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) - { - foreach (var child in node.Sequence) - { - if (child.Kind == JsonKind.Property) - { - return new EmbeddedDiagnostic( - FeaturesResources.Properties_not_allowed_in_an_array, - ((JsonPropertyNode)child).ColonToken.GetSpan()); - } - } - - var diagnostic = CheckCommasBetweenSequenceElements(node.Sequence); - return diagnostic ?? CheckChildren(node); - } + => CheckCommasBetweenSequenceElements(node.Sequence) ?? CheckChildren(node); private static EmbeddedDiagnostic? CheckConstructor(JsonConstructorNode node) { diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 7834cc1a23724..c3f138c419e02 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -125,19 +125,7 @@ private static class StrictSyntaxChecker } private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) - { - foreach (var child in node.Sequence) - { - if (child.Kind == JsonKind.Property) - { - return new EmbeddedDiagnostic( - FeaturesResources.Properties_not_allowed_in_an_array, - ((JsonPropertyNode)child).ColonToken.GetSpan()); - } - } - - return CheckProperSeparation(node.Sequence) ?? CheckChildren(node); - } + => CheckProperSeparation(node.Sequence) ?? CheckChildren(node); private static EmbeddedDiagnostic? CheckProperSeparation(ImmutableArray sequence) { diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 497197a8f1824..e757e50b03c8d 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -186,8 +186,50 @@ private JsonTree ParseTree(bool strict) propertyValue.ColonToken.GetSpan()); } - return null; + return CheckSyntax(child); + } + } + + private static EmbeddedDiagnostic? CheckChildren(JsonNode node) + { + foreach (var child in node) + { + if (child.IsNode) + { + var diagnostic = CheckSyntax(child.Node); + if (diagnostic != null) + return diagnostic; + } } + + return null; + } + + public static EmbeddedDiagnostic? CheckSyntax(JsonNode node) + => node.Kind switch + { + JsonKind.Array => CheckArray((JsonArrayNode)node), + //JsonKind.Object => CheckObject((JsonObjectNode)node), + //JsonKind.Constructor => CheckConstructor((JsonConstructorNode)node), + //JsonKind.Property => CheckProperty((JsonPropertyNode)node), + //JsonKind.Literal => CheckLiteral((JsonLiteralNode)node), + //JsonKind.NegativeLiteral => CheckNegativeLiteral((JsonNegativeLiteralNode)node), + _ => CheckChildren(node), + }; + + private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) + { + foreach (var child in node.Sequence) + { + if (child.Kind == JsonKind.Property) + { + return new EmbeddedDiagnostic( + FeaturesResources.Properties_not_allowed_in_an_array, + ((JsonPropertyNode)child).ColonToken.GetSpan()); + } + } + + return CheckChildren(node); } private static JsonToken GetFirstToken(JsonNodeOrToken nodeOrToken) From 27bd3adefffdc31f7f82ca45161f7df4becd3425 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 08:43:47 -0800 Subject: [PATCH 095/110] Simplify --- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 83 ++++---- .../Json/JsonParser.StrictSyntaxChecker.cs | 187 ++++++------------ .../EmbeddedLanguages/Json/JsonParser.cs | 61 +++--- 3 files changed, 119 insertions(+), 212 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index 0beabc8665bfd..da8dfb1a1f2d0 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -19,23 +19,9 @@ internal partial struct JsonParser { private static class JsonNetSyntaxChecker { - private static EmbeddedDiagnostic? CheckChildren(JsonNode node) - { - foreach (var child in node) - { - if (child.IsNode) - { - var diagnostic = CheckSyntax(child.Node); - if (diagnostic != null) - return diagnostic; - } - } - - return null; - } - public static EmbeddedDiagnostic? CheckSyntax(JsonNode node) - => node.Kind switch + { + var diagnostic = node.Kind switch { JsonKind.Array => CheckArray((JsonArrayNode)node), JsonKind.Object => CheckObject((JsonObjectNode)node), @@ -43,18 +29,36 @@ private static class JsonNetSyntaxChecker JsonKind.Property => CheckProperty((JsonPropertyNode)node), JsonKind.Literal => CheckLiteral((JsonLiteralNode)node), JsonKind.NegativeLiteral => CheckNegativeLiteral((JsonNegativeLiteralNode)node), - _ => CheckChildren(node), + _ => null, }; + return diagnostic ?? CheckChildren(node); + + static EmbeddedDiagnostic? CheckChildren(JsonNode node) + { + foreach (var child in node) + { + if (child.IsNode) + { + var diagnostic = CheckSyntax(child.Node); + if (diagnostic != null) + return diagnostic; + } + } + + return null; + } + } + private static EmbeddedDiagnostic? CheckLiteral(JsonLiteralNode node) => node.LiteralToken.Kind == JsonKind.NumberToken ? CheckNumber(node.LiteralToken) - : CheckChildren(node); + : null; private static EmbeddedDiagnostic? CheckNegativeLiteral(JsonNegativeLiteralNode node) => node.LiteralToken.Kind == JsonKind.NumberToken ? CheckNumber(node.LiteralToken) - : CheckChildren(node); + : null; private static EmbeddedDiagnostic? CheckNumber(JsonToken numberToken) { @@ -84,37 +88,26 @@ private static class JsonNetSyntaxChecker } catch (Exception) { - return new EmbeddedDiagnostic( - FeaturesResources.Invalid_number, - GetSpan(chars)); + return new EmbeddedDiagnostic(FeaturesResources.Invalid_number, GetSpan(chars)); } } else if (!double.TryParse( literalText, NumberStyles.Float, CultureInfo.InvariantCulture, out _)) { - return new EmbeddedDiagnostic( - FeaturesResources.Invalid_number, - GetSpan(chars)); + return new EmbeddedDiagnostic(FeaturesResources.Invalid_number, GetSpan(chars)); } return null; } private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) - => CheckCommasBetweenSequenceElements(node.Sequence) ?? CheckChildren(node); + => CheckCommasBetweenSequenceElements(node.Sequence); private static EmbeddedDiagnostic? CheckConstructor(JsonConstructorNode node) - { - if (!IsValidConstructorName(node.NameToken)) - { - return new EmbeddedDiagnostic( - FeaturesResources.Invalid_constructor_name, - node.NameToken.GetSpan()); - } - - return CheckCommasBetweenSequenceElements(node.Sequence) ?? CheckChildren(node); - } + => !IsValidConstructorName(node.NameToken) + ? new EmbeddedDiagnostic(FeaturesResources.Invalid_constructor_name, node.NameToken.GetSpan()) + : CheckCommasBetweenSequenceElements(node.Sequence); private static bool IsValidConstructorName(JsonToken nameToken) { @@ -172,30 +165,20 @@ private static bool IsValidConstructorName(JsonToken nameToken) } } - return CheckChildren(node); + return null; } private static EmbeddedDiagnostic? CheckProperty(JsonPropertyNode node) - { - if (node.NameToken.Kind != JsonKind.StringToken && - !IsLegalPropertyNameText(node.NameToken)) - { - return new EmbeddedDiagnostic( - FeaturesResources.Invalid_property_name, - node.NameToken.GetSpan()); - } - - return CheckChildren(node); - } + => node.NameToken.Kind != JsonKind.StringToken && !IsLegalPropertyNameText(node.NameToken) + ? new EmbeddedDiagnostic(FeaturesResources.Invalid_property_name, node.NameToken.GetSpan()) + : null; private static bool IsLegalPropertyNameText(JsonToken textToken) { foreach (var ch in textToken.VirtualChars) { if (!IsLegalPropertyNameChar(ch)) - { return false; - } } return true; diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index c3f138c419e02..c97878afaddf6 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -5,7 +5,6 @@ using System.Collections.Immutable; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; -using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json @@ -23,18 +22,32 @@ internal partial struct JsonParser /// private static class StrictSyntaxChecker { - private static EmbeddedDiagnostic? CheckChildren(JsonNode node) + public static EmbeddedDiagnostic? CheckSyntax(JsonNode node) { - foreach (var child in node) + var diagnostic = node.Kind switch { - var diagnostic = child.IsNode ? CheckSyntax(child.Node) : CheckToken(child.Token); - if (diagnostic != null) + JsonKind.Constructor => CheckConstructor((JsonConstructorNode)node), + JsonKind.Literal => CheckLiteral((JsonLiteralNode)node), + JsonKind.NegativeLiteral => CheckNegativeLiteral((JsonNegativeLiteralNode)node), + JsonKind.Property => CheckProperty((JsonPropertyNode)node), + JsonKind.Array => CheckArray((JsonArrayNode)node), + JsonKind.Object => CheckObject((JsonObjectNode)node), + _ => null, + }; + + return diagnostic ?? CheckChildren(node); + + static EmbeddedDiagnostic? CheckChildren(JsonNode node) + { + foreach (var child in node) { - return diagnostic; + var diagnostic = child.IsNode ? CheckSyntax(child.Node) : CheckToken(child.Token); + if (diagnostic != null) + return diagnostic; } - } - return null; + return null; + } } private static EmbeddedDiagnostic? CheckToken(JsonToken token) @@ -46,30 +59,21 @@ private static class StrictSyntaxChecker { var diagnostic = CheckTrivia(trivia); if (diagnostic != null) - { return diagnostic; - } } return null; } private static EmbeddedDiagnostic? CheckTrivia(JsonTrivia trivia) - { - switch (trivia.Kind) + => trivia.Kind switch { - case JsonKind.MultiLineCommentTrivia: - case JsonKind.SingleLineCommentTrivia: - // Strict mode doesn't allow comments at all. - return new EmbeddedDiagnostic( - FeaturesResources.Comments_not_allowed, - GetSpan(trivia.VirtualChars)); - case JsonKind.WhitespaceTrivia: - return CheckWhitespace(trivia); - } - - return null; - } + // Strict mode doesn't allow comments at all. + JsonKind.MultiLineCommentTrivia or JsonKind.SingleLineCommentTrivia + => new EmbeddedDiagnostic(FeaturesResources.Comments_not_allowed, GetSpan(trivia.VirtualChars)), + JsonKind.WhitespaceTrivia => CheckWhitespace(trivia), + _ => null, + }; private static EmbeddedDiagnostic? CheckWhitespace(JsonTrivia trivia) { @@ -84,48 +88,27 @@ private static class StrictSyntaxChecker default: // Strict mode only allows spaces and horizontal tabs. Everything else // is illegal. - return new EmbeddedDiagnostic( - FeaturesResources.Illegal_whitespace_character, - ch.Span); + return new EmbeddedDiagnostic(FeaturesResources.Illegal_whitespace_character, ch.Span); } } return null; } - public static EmbeddedDiagnostic? CheckSyntax(JsonNode node) - { - switch (node.Kind) - { - case JsonKind.Constructor: return CheckConstructor((JsonConstructorNode)node); - case JsonKind.Literal: return CheckLiteral((JsonLiteralNode)node); - case JsonKind.NegativeLiteral: return CheckNegativeLiteral((JsonNegativeLiteralNode)node); - case JsonKind.Property: return CheckProperty((JsonPropertyNode)node); - case JsonKind.Array: return CheckArray((JsonArrayNode)node); - case JsonKind.Object: return CheckObject((JsonObjectNode)node); - } - - return CheckChildren(node); - } - private static EmbeddedDiagnostic? CheckObject(JsonObjectNode node) { var sequence = node.Sequence; foreach (var child in sequence) { if (child.Kind != JsonKind.Property && child.Kind != JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - FeaturesResources.Only_properties_allowed_in_an_object, - GetFirstToken(child).GetSpan()); - } + return new EmbeddedDiagnostic(FeaturesResources.Only_properties_allowed_in_an_object, GetFirstToken(child).GetSpan()); } - return CheckProperSeparation(sequence) ?? CheckChildren(node); + return CheckProperSeparation(sequence); } private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) - => CheckProperSeparation(node.Sequence) ?? CheckChildren(node); + => CheckProperSeparation(node.Sequence); private static EmbeddedDiagnostic? CheckProperSeparation(ImmutableArray sequence) { @@ -136,31 +119,17 @@ private static class StrictSyntaxChecker if (i % 2 == 0) { if (child.Kind == JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - string.Format(FeaturesResources._0_unexpected, ","), - child.GetSpan()); - } + return new EmbeddedDiagnostic(string.Format(FeaturesResources._0_unexpected, ","), child.GetSpan()); } else { if (child.Kind != JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - string.Format(FeaturesResources._0_expected, ","), - GetFirstToken(child).GetSpan()); - } + return new EmbeddedDiagnostic(string.Format(FeaturesResources._0_expected, ","), GetFirstToken(child).GetSpan()); } } - if (sequence.Length != 0 && - sequence.Length % 2 == 0) - { - var lastChild = sequence[^1]; - return new EmbeddedDiagnostic( - FeaturesResources.Trailing_comma_not_allowed, - lastChild.GetSpan()); - } + if (sequence.Length != 0 && sequence.Length % 2 == 0) + return new EmbeddedDiagnostic(FeaturesResources.Trailing_comma_not_allowed, sequence[^1].GetSpan()); return null; } @@ -168,39 +137,24 @@ private static class StrictSyntaxChecker private static EmbeddedDiagnostic? CheckProperty(JsonPropertyNode node) { if (node.NameToken.Kind != JsonKind.StringToken) - { - return new EmbeddedDiagnostic( - FeaturesResources.Property_name_must_be_a_string, - node.NameToken.GetSpan()); - } + return new EmbeddedDiagnostic(FeaturesResources.Property_name_must_be_a_string, node.NameToken.GetSpan()); if (node.Value.Kind == JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - FeaturesResources.Value_required, - new TextSpan(node.ColonToken.VirtualChars[0].Span.End, 0)); - } + return new EmbeddedDiagnostic(FeaturesResources.Value_required, new TextSpan(node.ColonToken.VirtualChars[0].Span.End, 0)); - return CheckString(node.NameToken) ?? CheckChildren(node); + return CheckString(node.NameToken); } private static EmbeddedDiagnostic? CheckLiteral(JsonLiteralNode node) - { - switch (node.LiteralToken.Kind) + => node.LiteralToken.Kind switch { - case JsonKind.NaNLiteralToken: - case JsonKind.InfinityLiteralToken: - case JsonKind.UndefinedLiteralToken: - // These are all json.net extensions. Disallow them all. - return InvalidLiteral(node.LiteralToken); - case JsonKind.NumberToken: - return CheckNumber(node.LiteralToken); - case JsonKind.StringToken: - return CheckString(node.LiteralToken); - } - - return CheckChildren(node); - } + // These are all json.net extensions. Disallow them all. + JsonKind.NaNLiteralToken or JsonKind.InfinityLiteralToken or JsonKind.UndefinedLiteralToken + => InvalidLiteral(node.LiteralToken), + JsonKind.NumberToken => CheckNumber(node.LiteralToken), + JsonKind.StringToken => CheckString(node.LiteralToken), + _ => null, + }; /* From: https://tools.ietf.org/html/rfc8259 @@ -247,34 +201,21 @@ Numeric values that cannot be represented in the grammar below (such private static EmbeddedDiagnostic? CheckNumber(JsonToken literalToken) { var literalText = literalToken.VirtualChars.CreateString(); - if (!s_validNumberRegex.IsMatch(literalText)) - { - return new EmbeddedDiagnostic( - FeaturesResources.Invalid_number, - literalToken.GetSpan()); - } - - return CheckToken(literalToken); + return !s_validNumberRegex.IsMatch(literalText) + ? new EmbeddedDiagnostic(FeaturesResources.Invalid_number, literalToken.GetSpan()) + : CheckToken(literalToken); } private static EmbeddedDiagnostic? CheckString(JsonToken literalToken) { var chars = literalToken.VirtualChars; if (chars[0] == '\'') - { - return new EmbeddedDiagnostic( - FeaturesResources.Strings_must_start_with_double_quote_not_single_quote, - chars[0].Span); - } + return new EmbeddedDiagnostic(FeaturesResources.Strings_must_start_with_double_quote_not_single_quote, chars[0].Span); for (int i = 1, n = chars.Length - 1; i < n; i++) { if (chars[i] < ' ') - { - return new EmbeddedDiagnostic( - FeaturesResources.Illegal_string_character, - chars[i].Span); - } + return new EmbeddedDiagnostic(FeaturesResources.Illegal_string_character, chars[i].Span); } // Lexer allows \' as that's ok in json.net. Check and block that here. @@ -283,11 +224,7 @@ Numeric values that cannot be represented in the grammar below (such if (chars[i] == '\\') { if (chars[i + 1] == '\'') - { - return new EmbeddedDiagnostic( - FeaturesResources.Invalid_escape_sequence, - TextSpan.FromBounds(chars[i].Span.Start, chars[i + 1].Span.End)); - } + return new EmbeddedDiagnostic(FeaturesResources.Invalid_escape_sequence, TextSpan.FromBounds(chars[i].Span.Start, chars[i + 1].Span.End)); // Legal escape. just jump forward past it. Note, this works for simple // escape and unicode \uXXXX escapes. @@ -302,25 +239,13 @@ Numeric values that cannot be represented in the grammar below (such } private static EmbeddedDiagnostic? InvalidLiteral(JsonToken literalToken) - { - return new EmbeddedDiagnostic( - string.Format(FeaturesResources._0_literal_not_allowed, literalToken.VirtualChars.CreateString()), - literalToken.GetSpan()); - } + => new EmbeddedDiagnostic(string.Format(FeaturesResources._0_literal_not_allowed, literalToken.VirtualChars.CreateString()), literalToken.GetSpan()); private static EmbeddedDiagnostic? CheckNegativeLiteral(JsonNegativeLiteralNode node) - { - return new EmbeddedDiagnostic( - string.Format(FeaturesResources._0_literal_not_allowed, "-Infinity"), - node.GetSpan()); - } + => new EmbeddedDiagnostic(string.Format(FeaturesResources._0_literal_not_allowed, "-Infinity"), node.GetSpan()); private static EmbeddedDiagnostic? CheckConstructor(JsonConstructorNode node) - { - return new EmbeddedDiagnostic( - FeaturesResources.Constructors_not_allowed, - node.NewKeyword.GetSpan()); - } + => new EmbeddedDiagnostic(FeaturesResources.Constructors_not_allowed, node.NewKeyword.GetSpan()); } } } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index e757e50b03c8d..106565242276e 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -188,48 +188,47 @@ private JsonTree ParseTree(bool strict) return CheckSyntax(child); } - } - private static EmbeddedDiagnostic? CheckChildren(JsonNode node) - { - foreach (var child in node) + static EmbeddedDiagnostic? CheckSyntax(JsonNode node) { - if (child.IsNode) + var diagnostic = node.Kind switch { - var diagnostic = CheckSyntax(child.Node); - if (diagnostic != null) - return diagnostic; - } - } + JsonKind.Array => CheckArray((JsonArrayNode)node), + _ => null, + }; - return null; - } + return diagnostic ?? CheckChildren(node); + } - public static EmbeddedDiagnostic? CheckSyntax(JsonNode node) - => node.Kind switch + static EmbeddedDiagnostic? CheckChildren(JsonNode node) { - JsonKind.Array => CheckArray((JsonArrayNode)node), - //JsonKind.Object => CheckObject((JsonObjectNode)node), - //JsonKind.Constructor => CheckConstructor((JsonConstructorNode)node), - //JsonKind.Property => CheckProperty((JsonPropertyNode)node), - //JsonKind.Literal => CheckLiteral((JsonLiteralNode)node), - //JsonKind.NegativeLiteral => CheckNegativeLiteral((JsonNegativeLiteralNode)node), - _ => CheckChildren(node), - }; + foreach (var child in node) + { + if (child.IsNode) + { + var diagnostic = CheckSyntax(child.Node); + if (diagnostic != null) + return diagnostic; + } + } - private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) - { - foreach (var child in node.Sequence) + return null; + } + + static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) { - if (child.Kind == JsonKind.Property) + foreach (var child in node.Sequence) { - return new EmbeddedDiagnostic( - FeaturesResources.Properties_not_allowed_in_an_array, - ((JsonPropertyNode)child).ColonToken.GetSpan()); + if (child.Kind == JsonKind.Property) + { + return new EmbeddedDiagnostic( + FeaturesResources.Properties_not_allowed_in_an_array, + ((JsonPropertyNode)child).ColonToken.GetSpan()); + } } - } - return CheckChildren(node); + return CheckChildren(node); + } } private static JsonToken GetFirstToken(JsonNodeOrToken nodeOrToken) From 4a07c55087b8bff4bd0096746dae04240eabc432 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 08:45:18 -0800 Subject: [PATCH 096/110] Simplify --- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 21 ++++--------------- .../Json/JsonParser.StrictSyntaxChecker.cs | 11 +++++----- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index da8dfb1a1f2d0..04df9353df551 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -128,13 +128,8 @@ private static bool IsValidConstructorName(JsonToken nameToken) { var child = sequence[i]; var nextChild = sequence[i + 1]; - if (child.Kind != JsonKind.CommaValue && - nextChild.Kind != JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - string.Format(FeaturesResources._0_expected, ','), - GetFirstToken(nextChild).GetSpan()); - } + if (child.Kind != JsonKind.CommaValue && nextChild.Kind != JsonKind.CommaValue) + return new EmbeddedDiagnostic(string.Format(FeaturesResources._0_expected, ','), GetFirstToken(nextChild).GetSpan()); } return null; @@ -148,20 +143,12 @@ private static bool IsValidConstructorName(JsonToken nameToken) if (i % 2 == 0) { if (child.Kind != JsonKind.Property) - { - return new EmbeddedDiagnostic( - FeaturesResources.Only_properties_allowed_in_an_object, - GetFirstToken(child).GetSpan()); - } + return new EmbeddedDiagnostic(FeaturesResources.Only_properties_allowed_in_an_object, GetFirstToken(child).GetSpan()); } else { if (child.Kind != JsonKind.CommaValue) - { - return new EmbeddedDiagnostic( - string.Format(FeaturesResources._0_expected, ','), - GetFirstToken(child).GetSpan()); - } + return new EmbeddedDiagnostic(string.Format(FeaturesResources._0_expected, ','), GetFirstToken(child).GetSpan()); } } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index c97878afaddf6..8490bb920eacd 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -97,14 +97,13 @@ JsonKind.MultiLineCommentTrivia or JsonKind.SingleLineCommentTrivia private static EmbeddedDiagnostic? CheckObject(JsonObjectNode node) { - var sequence = node.Sequence; - foreach (var child in sequence) + foreach (var child in node.Sequence) { if (child.Kind != JsonKind.Property && child.Kind != JsonKind.CommaValue) return new EmbeddedDiagnostic(FeaturesResources.Only_properties_allowed_in_an_object, GetFirstToken(child).GetSpan()); } - return CheckProperSeparation(sequence); + return CheckProperSeparation(node.Sequence); } private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) @@ -239,13 +238,13 @@ Numeric values that cannot be represented in the grammar below (such } private static EmbeddedDiagnostic? InvalidLiteral(JsonToken literalToken) - => new EmbeddedDiagnostic(string.Format(FeaturesResources._0_literal_not_allowed, literalToken.VirtualChars.CreateString()), literalToken.GetSpan()); + => new(string.Format(FeaturesResources._0_literal_not_allowed, literalToken.VirtualChars.CreateString()), literalToken.GetSpan()); private static EmbeddedDiagnostic? CheckNegativeLiteral(JsonNegativeLiteralNode node) - => new EmbeddedDiagnostic(string.Format(FeaturesResources._0_literal_not_allowed, "-Infinity"), node.GetSpan()); + => new(string.Format(FeaturesResources._0_literal_not_allowed, "-Infinity"), node.GetSpan()); private static EmbeddedDiagnostic? CheckConstructor(JsonConstructorNode node) - => new EmbeddedDiagnostic(FeaturesResources.Constructors_not_allowed, node.NewKeyword.GetSpan()); + => new(FeaturesResources.Constructors_not_allowed, node.NewKeyword.GetSpan()); } } } From 4f1085c96d36fbf34a1df590167bf99bf8741748 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 11:36:57 -0800 Subject: [PATCH 097/110] Make static --- .../RegularExpressions/CSharpRegexParserTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs index 4deb99b31c0b7..3076ab7447f5b 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs @@ -127,7 +127,7 @@ private void TryParseSubTrees( bool conversionFailureOk, bool allowIndexOutOfRange, bool allowNullReference, - bool allowOutOfMemeory, + bool allowOutOfMemory, bool allowDiagnosticsMismatch = false) { var (token, tree, allChars) = JustParseTree(stringText, options, conversionFailureOk); @@ -157,7 +157,7 @@ private void TryParseSubTrees( // bug with .NET regex parser. can happen with patterns like: (?(?S)) return treeAndText; } - catch (OutOfMemoryException) when (allowOutOfMemeory) + catch (OutOfMemoryException) when (allowOutOfMemory) { // bug with .NET regex parser. can happen with patterns like: a{2147483647,} return treeAndText; @@ -196,7 +196,7 @@ private void TryParseSubTrees( return treeAndText; } - private string TreeToText(SourceText text, RegexTree tree) + private static string TreeToText(SourceText text, RegexTree tree) { var element = new XElement("Tree", NodeToElement(tree.Root)); From 965b3740ea0e052177e96e6370fe438122a50dff Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 26 Jan 2022 16:32:37 -0800 Subject: [PATCH 098/110] WIP --- .../Json/CSharpJsonParserTests_BasicTests.cs | 10 +-- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 16 +++- .../EmbeddedLanguages/Json/JsonNodes.cs | 12 +-- .../Json/JsonParser.JsonNetSyntaxChecks.cs | 15 +--- .../Json/JsonParser.StrictSyntaxChecker.cs | 7 +- .../EmbeddedLanguages/Json/JsonParser.cs | 73 +++++++++++++++++-- 6 files changed, 98 insertions(+), 35 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 819ea36d65476..674cae0321a10 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -1741,9 +1741,11 @@ public void TestArrayPropertyName() ] + : + 0 @@ -1754,12 +1756,8 @@ public void TestArrayPropertyName() ", - @" - -", - @" - -"); + @"", + @""); } [Fact] diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 997609fe648f9..e0af450e4795b 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -19,6 +19,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { using JsonToken = EmbeddedSyntaxToken; using JsonTrivia = EmbeddedSyntaxTrivia; + using JsonSeparatedList = EmbeddedSeparatedSyntaxNodeList; public partial class CSharpJsonParserTests { @@ -192,11 +193,16 @@ private static XElement NodeToElement(JsonNode node) var element = new XElement(node.Kind.ToString()); foreach (var child in node) - element.Add(child.IsNode ? NodeToElement(child.Node) : TokenToElement(child.Token)); + element.Add(NodeOrTokenToElement(child)); return element; } + private static XElement NodeOrTokenToElement(EmbeddedSyntaxNodeOrToken child) + { + return child.IsNode ? NodeToElement(child.Node) : TokenToElement(child.Token); + } + private static XElement ConstructorNodeToElement(JsonConstructorNode node) { var element = new XElement(node.Kind.ToString()); @@ -242,6 +248,14 @@ private static XElement CreateSequenceNode(ImmutableArray sequenc return element; } + private static XElement CreateSequenceNode(JsonSeparatedList sequence) + { + var element = new XElement("Sequence"); + foreach (var child in sequence.NodesAndTokens) + element.Add(NodeOrTokenToElement(child)); + return element; + } + private static XElement TokenToElement(JsonToken token) { var element = new XElement(token.Kind.ToString()); diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs index ed15d429abd55..65eb2bed7f3a6 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonNodes.cs @@ -11,6 +11,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json { using JsonNodeOrToken = EmbeddedSyntaxNodeOrToken; using JsonToken = EmbeddedSyntaxToken; + using JsonSeparatedList = EmbeddedSeparatedSyntaxNodeList; internal sealed class JsonCompilationUnit : JsonNode { @@ -87,12 +88,11 @@ internal sealed class JsonObjectNode : JsonValueNode { public JsonObjectNode( JsonToken openBraceToken, - ImmutableArray sequence, + JsonSeparatedList sequence, JsonToken closeBraceToken) : base(JsonKind.Object) { Debug.Assert(openBraceToken.Kind == JsonKind.OpenBraceToken); - Debug.Assert(sequence != null); Debug.Assert(closeBraceToken.Kind == JsonKind.CloseBraceToken); OpenBraceToken = openBraceToken; @@ -101,20 +101,20 @@ public JsonObjectNode( } public JsonToken OpenBraceToken { get; } - public ImmutableArray Sequence { get; } + public JsonSeparatedList Sequence { get; } public JsonToken CloseBraceToken { get; } - internal override int ChildCount => 2 + Sequence.Length; + internal override int ChildCount => 2 + Sequence.NodesAndTokens.Length; internal override JsonNodeOrToken ChildAt(int index) { if (index == 0) return OpenBraceToken; - if (index == Sequence.Length + 1) + if (index == Sequence.NodesAndTokens.Length + 1) return CloseBraceToken; - return Sequence[index - 1]; + return Sequence.NodesAndTokens[index - 1]; } public override void Accept(IJsonNodeVisitor visitor) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs index 04df9353df551..b8e7f558cf3b3 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.JsonNetSyntaxChecks.cs @@ -137,19 +137,10 @@ private static bool IsValidConstructorName(JsonToken nameToken) private static EmbeddedDiagnostic? CheckObject(JsonObjectNode node) { - for (int i = 0, n = node.Sequence.Length; i < n; i++) + foreach (var child in node.Sequence) { - var child = node.Sequence[i]; - if (i % 2 == 0) - { - if (child.Kind != JsonKind.Property) - return new EmbeddedDiagnostic(FeaturesResources.Only_properties_allowed_in_an_object, GetFirstToken(child).GetSpan()); - } - else - { - if (child.Kind != JsonKind.CommaValue) - return new EmbeddedDiagnostic(string.Format(FeaturesResources._0_expected, ','), GetFirstToken(child).GetSpan()); - } + if (child.Kind != JsonKind.Property) + return new EmbeddedDiagnostic(FeaturesResources.Only_properties_allowed_in_an_object, GetFirstToken(child).GetSpan()); } return null; diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs index 8490bb920eacd..145c77a810622 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.StrictSyntaxChecker.cs @@ -99,11 +99,14 @@ JsonKind.MultiLineCommentTrivia or JsonKind.SingleLineCommentTrivia { foreach (var child in node.Sequence) { - if (child.Kind != JsonKind.Property && child.Kind != JsonKind.CommaValue) + if (child.Kind != JsonKind.Property) return new EmbeddedDiagnostic(FeaturesResources.Only_properties_allowed_in_an_object, GetFirstToken(child).GetSpan()); } - return CheckProperSeparation(node.Sequence); + if (node.Sequence.NodesAndTokens.Length != 0 && node.Sequence.NodesAndTokens.Length % 2 == 0) + return new EmbeddedDiagnostic(FeaturesResources.Trailing_comma_not_allowed, node.Sequence.NodesAndTokens[^1].Token.GetSpan()); + + return null; } private static EmbeddedDiagnostic? CheckArray(JsonArrayNode node) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 106565242276e..b1931636c8651 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -20,6 +20,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json using JsonNodeOrToken = EmbeddedSyntaxNodeOrToken; using JsonToken = EmbeddedSyntaxToken; using JsonTrivia = EmbeddedSyntaxTrivia; + using JsonSeparatedList = EmbeddedSeparatedSyntaxNodeList; /// /// Parser used for reading in a sequence of s, and producing a .Empty : ImmutableArray.Create(diagnostic.Value)); + + static EmbeddedDiagnostic? Earliest(EmbeddedDiagnostic? d1, EmbeddedDiagnostic? d2) + { + if (d1 == null) + return d2; + + if (d2 == null) + return d1; + + return d1.Value.Span.Start <= d2.Value.Span.Start ? d1 : d2; + } } /// @@ -290,6 +306,41 @@ private ImmutableArray ParseSequenceWorker() return result.ToImmutable(); } + private JsonSeparatedList ParseCommaSeparatedSequence() + { + try + { + _recursionDepth++; + StackGuard.EnsureSufficientExecutionStack(_recursionDepth); + return ParseCommaSeparatedSequenceWorker(); + } + finally + { + _recursionDepth--; + } + } + + private JsonSeparatedList ParseCommaSeparatedSequenceWorker() + { + using var _ = ArrayBuilder.GetInstance(out var result); + var allProperties = true; + while (ShouldConsumeSequenceElement()) + { + var value = ParseValue(); + allProperties = allProperties && value.Kind == JsonKind.Property; + result.Add(value); + + // Try to consume a comma. If we don't see one, consume an empty one as a placeholder. Create a + // diagnostic message depending on if we've seen only properties before this point. If not, don't give + // a message about a missing comma. Instead, we'll give a specific message that we didn't get a + // property when we expected one. + if (ShouldConsumeSequenceElement()) + result.Add(ConsumeToken(JsonKind.CommaToken, allProperties ? s_commaExpected : null)); + } + + return new JsonSeparatedList(result.ToImmutable()); + } + private bool ShouldConsumeSequenceElement() { if (_currentToken.Kind == JsonKind.EndOfFile) @@ -494,18 +545,24 @@ private JsonObjectNode ParseObject() var result = new JsonObjectNode( ConsumeCurrentToken(), - ParseSequence(), + ParseCommaSeparatedSequence(), ConsumeToken(JsonKind.CloseBraceToken, s_closeBraceExpected)); _inObject = savedInObject; return result; } - private JsonToken ConsumeToken(JsonKind kind, string error) - => _currentToken.Kind == kind - ? ConsumeCurrentToken() - : CreateMissingToken(kind).AddDiagnosticIfNone( - new EmbeddedDiagnostic(error, GetTokenStartPositionSpan(_currentToken))); + private JsonToken ConsumeToken(JsonKind kind, string? error) + { + if (_currentToken.Kind == kind) + return ConsumeCurrentToken(); + + var result = CreateMissingToken(kind); + if (error == null) + return result; + + return result.AddDiagnosticIfNone(new EmbeddedDiagnostic(error, GetTokenStartPositionSpan(_currentToken))); + } private TextSpan GetTokenStartPositionSpan(JsonToken token) => token.Kind == JsonKind.EndOfFile From 91e95572d1cd8b1bb14296204cf8f31d6b0f7d68 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 10:57:46 -0800 Subject: [PATCH 099/110] Update testS --- .../Json/CSharpJsonParserTests_BasicTests.cs | 195 ++++++------------ .../Json/CSharpJsonParserTests_NstTests.cs | 121 +++++------ 2 files changed, 116 insertions(+), 200 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 674cae0321a10..765ca28d7cf4e 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -764,10 +764,10 @@ public void TestNegativeInfinity2() ", @" - + ", @" - + "); } @@ -863,7 +863,7 @@ public void TestIncompleteUnicode1() ", @" - + "); } @@ -884,7 +884,7 @@ public void TestIncompleteEscape() ", @" - + "); } @@ -1035,9 +1035,7 @@ public void TestMultiObject1() 1 - - , - + , 'second' : @@ -1045,9 +1043,7 @@ public void TestMultiObject1() 2 - - , - + , 'third' : @@ -1084,9 +1080,7 @@ public void TestMultiObject2() 1 - - , - + , ""second"" : @@ -1094,9 +1088,7 @@ public void TestMultiObject2() 2 - - , - + , ""third"" : @@ -1152,12 +1144,11 @@ public void TestMissingColon() 0 - - , - + , 'b' + 0 @@ -1212,10 +1203,8 @@ public void TestNestedPropertyMissingColon() ""A person"" - - , + , - @@ -1226,10 +1215,8 @@ public void TestNestedPropertyMissingColon() ""object"" - - , + , - @@ -1250,6 +1237,7 @@ public void TestNestedPropertyMissingColon() ""name"" + { @@ -1263,10 +1251,8 @@ public void TestNestedPropertyMissingColon() } - - , + , - @@ -1287,10 +1273,8 @@ public void TestNestedPropertyMissingColon() ""array"" - - , + , - @@ -1359,12 +1343,11 @@ public void TestMissingColon2() 0 - - , - + , ""b"" + 0 @@ -1503,7 +1486,7 @@ public void TestAdditionalContentWhitespaceText() ", @" - + "); } @@ -1756,8 +1739,12 @@ public void TestArrayPropertyName() ", - @"", - @""); + @" + +", + @" + +"); } [Fact] @@ -1888,6 +1875,7 @@ public void TestNameWithSpace() a + b : @@ -2096,9 +2084,11 @@ public void TestStrangeIllegalPropName() 0 + ( + 0 : @@ -2114,10 +2104,10 @@ public void TestStrangeIllegalPropName() ", @" - + ", @" - + "); } @@ -2168,9 +2158,7 @@ public void TestObjectWithEmptyPropValue1() - - , - + , } @@ -2200,9 +2188,7 @@ public void TestObjectWithEmptyPropValue2() - - , - + , } @@ -2243,7 +2229,7 @@ public void TestObjectWithEmptyPropValue3() ", @" - + "); } @@ -2305,7 +2291,7 @@ public void TestObjectWithEmptyPropValue5() ", @" - + "); } @@ -2336,7 +2322,7 @@ public void TestObjectWithEmptyPropValue6() ", @" - + "); } @@ -2371,7 +2357,7 @@ public void TestNestedProp1() ", @" - + "); } @@ -2594,9 +2580,7 @@ public void TestMultiLine1() 'bc' - - , - + , 'd' : @@ -2642,9 +2626,7 @@ public void TestMultiLine2() ""bc"" - - , - + , ""d"" : @@ -2700,10 +2682,8 @@ public void TestNestedObject() 'A person' - - , + , - @@ -2714,10 +2694,8 @@ public void TestNestedObject() 'object' - - , + , - @@ -2752,10 +2730,8 @@ public void TestNestedObject() } - - , + , - @@ -2776,10 +2752,8 @@ public void TestNestedObject() 'array' - - , + , - @@ -2866,10 +2840,8 @@ public void TestNestedObject1() ""A person"" - - , + , - @@ -2880,10 +2852,8 @@ public void TestNestedObject1() ""object"" - - , + , - @@ -2918,10 +2888,8 @@ public void TestNestedObject1() } - - , + , - @@ -2942,10 +2910,8 @@ public void TestNestedObject1() ""array"" - - , + , - @@ -3010,9 +2976,7 @@ public void TestLiterals1() '' - - , - + , B : @@ -3020,9 +2984,7 @@ public void TestLiterals1() 1 - - , - + , C : @@ -3030,9 +2992,7 @@ public void TestLiterals1() - - , - + , D : @@ -3040,9 +3000,7 @@ public void TestLiterals1() 1.23 - - , - + , E : @@ -3050,9 +3008,7 @@ public void TestLiterals1() 3.45 - - , - + , F : @@ -3089,9 +3045,7 @@ public void TestLiterals2() """" - - , - + , ""B"" : @@ -3099,9 +3053,7 @@ public void TestLiterals2() 1 - - , - + , ""D"" : @@ -3109,9 +3061,7 @@ public void TestLiterals2() 1.23 - - , - + , ""E"" : @@ -3119,9 +3069,7 @@ public void TestLiterals2() 3.45 - - , - + , ""F"" : @@ -3495,10 +3443,8 @@ public void TestObjectLiteralComments() 'Apple' /*comment*/ - - , /*comment*/ + , /*comment*/ - @@ -3509,10 +3455,8 @@ public void TestObjectLiteralComments() '1' - - , + , - @@ -3523,10 +3467,8 @@ public void TestObjectLiteralComments() 3.99 - - , + , - @@ -3997,7 +3939,7 @@ public void TestConstructor1() ", @" - + "); } @@ -4022,7 +3964,7 @@ public void TestConstructor2() ", @" - + "); } @@ -4047,7 +3989,7 @@ public void TestConstructor3() ", @" - + "); } @@ -4400,12 +4342,11 @@ public void TestMultipleCommasInObject() 0 + , , - - , - + 1 : @@ -4424,7 +4365,7 @@ public void TestMultipleCommasInObject() ", @" - + "); } @@ -5273,7 +5214,7 @@ public void TestIncompleteProperty() ", @" - + "); } @@ -5293,9 +5234,7 @@ public void TestPropertyWithCommaFollowedByComma() - - , - + , , @@ -5310,7 +5249,7 @@ public void TestPropertyWithCommaFollowedByComma() ", @" - + "); } @@ -5335,7 +5274,7 @@ public void TestTopLevelProperty() ", @" - + "); } diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs index f1041f67e877d..3714cf984ab3c 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_NstTests.cs @@ -1203,10 +1203,10 @@ public void n_array_items_separated_by_semicolon_json() ", @" - + ", @" - + "); } @@ -1329,10 +1329,10 @@ public void n_array_newlines_unclosed_json() ", @" - + ", @" - + "); } @@ -1472,10 +1472,10 @@ public void n_array_unclosed_trailing_comma_json() ", @" - + ", @" - + "); } @@ -2996,10 +2996,10 @@ public void n_object_bracket_key_json() ", @" - + ", @" - + "); } @@ -3015,9 +3015,7 @@ public void n_object_comma_instead_of_colon_json() ""x"" - - , - + , null @@ -3052,6 +3050,7 @@ public void n_object_double_colon_json() : + ""b"" @@ -3086,6 +3085,7 @@ public void n_object_garbage_at_end_json() ""a"" + 123 @@ -3100,7 +3100,7 @@ public void n_object_garbage_at_end_json() ", @" - + "); } @@ -3149,9 +3149,7 @@ public void n_object_lone_continuation_byte_in_key_and_trailing_comma_json() ""0"" - - , - + , } @@ -3177,6 +3175,7 @@ public void n_object_missing_colon_json() ""a"" + b @@ -3188,10 +3187,10 @@ public void n_object_missing_colon_json() ", @" - + ", @" - + "); } @@ -3207,6 +3206,7 @@ public void n_object_missing_key_json() : + ""b"" @@ -3237,6 +3237,7 @@ public void n_object_missing_semicolon_json() ""a"" + ""b"" @@ -3306,10 +3307,10 @@ public void n_object_no_colon_json() ", @" - + ", @" - + "); } @@ -3387,9 +3388,7 @@ public void n_object_repeated_null_null_json() null - - , - + , null : @@ -3426,21 +3425,15 @@ public void n_object_several_trailing_commas_json() 0 + , , + , , - - , - - - , - - - , - + , } @@ -3452,7 +3445,7 @@ public void n_object_several_trailing_commas_json() ", @" - + "); } @@ -3501,9 +3494,7 @@ public void n_object_trailing_comma_json() 0 - - , - + , } @@ -3573,7 +3564,7 @@ public void n_object_trailing_comment_open_json() ", @" - + "); } @@ -3655,12 +3646,11 @@ public void n_object_two_commas_in_a_row_json() ""b"" + , , - - , - + ""c"" : @@ -3679,7 +3669,7 @@ public void n_object_two_commas_in_a_row_json() ", @" - + "); } @@ -3759,9 +3749,7 @@ public void n_object_with_single_string_json() ""bar"" - - , - + , ""a"" @@ -4765,9 +4753,7 @@ public void n_structure_comma_instead_of_closing_brace_json() true - - , - + , @@ -4776,10 +4762,10 @@ public void n_structure_comma_instead_of_closing_brace_json() ", @" - + ", @" - + "); } @@ -5069,10 +5055,10 @@ public void n_structure_open_array_comma_json() ", @" - + ", @" - + "); } @@ -5229,10 +5215,10 @@ public void n_structure_open_object_comma_json() ", @" - + ", @" - + "); } @@ -5258,10 +5244,10 @@ public void n_structure_open_object_open_array_json() ", @" - + ", @" - + "); } @@ -5312,10 +5298,10 @@ public void n_structure_open_object_string_with_apostrophes_json() ", @" - + ", @" - + "); } @@ -6470,9 +6456,7 @@ public void y_object_json() ""sdf"" - - , - + , ""dfg"" : @@ -6534,9 +6518,7 @@ public void y_object_duplicated_key_json() ""b"" - - , - + , ""a"" : @@ -6571,9 +6553,7 @@ public void y_object_duplicated_key_and_value_json() ""b"" - - , - + , ""a"" : @@ -6681,9 +6661,7 @@ public void y_object_extreme_numbers_json() -1.0e+28 - - , - + , ""max"" : @@ -6705,7 +6683,8 @@ public void y_object_extreme_numbers_json() [Fact] public void y_object_long_strings_json() { - TestNST(@"@""{""""x"""":[{""""id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}], """"id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}""", @" + TestNST(@"@""{""""x"""":[{""""id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}], """"id"""": """"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""""}""", + @" @@ -6734,9 +6713,7 @@ public void y_object_long_strings_json() ] - - , - + , ""id"" : From 92f69f027208d55093072e2337462c6b6f41f3f4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 14:17:26 -0800 Subject: [PATCH 100/110] Remove options --- .../EmbeddedLanguages/Json/JsonOptions.cs | 59 ------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs deleted file mode 100644 index b588159744a98..0000000000000 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonOptions.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Immutable; -using System.Composition; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Options.Providers; - -namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json; - -internal class JsonOptions -{ - public static PerLanguageOption2 ColorizeJsonPatterns = - new( - nameof(JsonOptions), - nameof(ColorizeJsonPatterns), - defaultValue: true, - storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ColorizeJsonPatterns")); - - public static PerLanguageOption2 ReportInvalidJsonPatterns = - new( - nameof(JsonOptions), - nameof(ReportInvalidJsonPatterns), - defaultValue: true, - storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")); - - public static PerLanguageOption2 HighlightRelatedJsonComponentsUnderCursor = - new( - nameof(JsonOptions), - nameof(HighlightRelatedJsonComponentsUnderCursor), - defaultValue: true, - storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")); - - public static PerLanguageOption2 DetectAndOfferEditorFeaturesForProbableJsonStrings = - new( - nameof(JsonOptions), - nameof(DetectAndOfferEditorFeaturesForProbableJsonStrings), - defaultValue: true, - storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DetectAndOfferEditorFeaturesForProbableJsonStrings")); -} - -[ExportSolutionOptionProvider, Shared] -internal class JsonOptionsProvider : IOptionProvider -{ - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public JsonOptionsProvider() - { - } - - public ImmutableArray Options { get; } = ImmutableArray.Create( - JsonOptions.ColorizeJsonPatterns, - JsonOptions.ReportInvalidJsonPatterns, - JsonOptions.HighlightRelatedJsonComponentsUnderCursor, - JsonOptions.DetectAndOfferEditorFeaturesForProbableJsonStrings); -} From 636fce4efb941904112c10056ed6d3caf73715bb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 15:35:55 -0800 Subject: [PATCH 101/110] Delete test generator --- .../CSharpJsonParserTests_TestGeneration.cs | 172 ------------------ 1 file changed, 172 deletions(-) delete mode 100644 src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs deleted file mode 100644 index 9b19f917d611b..0000000000000 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_TestGeneration.cs +++ /dev/null @@ -1,172 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#if false -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using Microsoft.CodeAnalysis.EmbeddedLanguages.Json; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json -{ - public class Fixture : IDisposable - { - public void Dispose() - { -#if false - var other = new Dictionary(); - - var tree = SyntaxFactory.ParseSyntaxTree( - File.ReadAllText(@"C:\GitHub\roslyn-internal\Open\src\Workspaces\CSharpTest\Json\CSharpJsonParserTests_BasicTests.cs")); - - var methodNames = tree.GetRoot().DescendantNodes().OfType().Select(m => m.Identifier.ValueText); - var nameToIndex = new Dictionary(); - - var index = 0; - foreach (var name in methodNames) - { - nameToIndex[name] = index; - index++; - } - -#if true - var tests = - CSharpJsonParserTests.nameToTest.Where(kvp => !kvp.Key.StartsWith("NegativeTest") && !kvp.Key.StartsWith("Reference")) - .OrderBy(kvp => nameToIndex[kvp.Key]) - .Select(kvp => kvp.Value); -#elif false - var tests = - CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("NegativeTest")) - .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) - .Select(kvp => kvp.Value); -#else - var tests = - CSharpRegexParserTests.nameToTest.Where(kvp => kvp.Key.StartsWith("Reference")) - .OrderBy(kvp => kvp.Key, LogicalStringComparer.Instance) - .Select(kvp => kvp.Value); -#endif -#endif - var tests = - CSharpJsonParserTests.nameToTest.Where( - kvp => kvp.Key.StartsWith("i_") || - kvp.Key.StartsWith("n_") || - kvp.Key.StartsWith("y_")).Select(kvp => kvp.Value); - var val = string.Join("\r\n", tests); - } - } - - [CollectionDefinition(nameof(MyCollection))] - public class MyCollection : ICollectionFixture - { - } - - [Collection(nameof(MyCollection))] - public partial class CSharpJsonParserTests - { - private readonly Fixture _fixture; - - public CSharpJsonParserTests(Fixture fixture) - { - _fixture = fixture; - } - - public static Dictionary nameToTest = new Dictionary(); - - [Fact] - private void GenerateTestSuiteTests() - { - Process(@"C:\GitHub\JSONTestSuite\test_parsing"); - Process(@"C:\GitHub\JSONTestSuite\test_transform"); - } - - private void Process(string path) - { - foreach (var entry in Directory.EnumerateFiles(path, "*.json")) - { - try - { - var contents = "@\"" + File.ReadAllText(entry).Replace("\"", "\"\"") + "\""; - if (contents.Contains((char)0)) - { - continue; - } - - var fileName = Massage(new FileInfo(entry).Name); - - var test = GenerateTests(contents, true, true, fileName); - nameToTest.Add(fileName, test); - } - catch (ArgumentException) - { - } - } - } - - private static readonly Regex _regex = new Regex("[^0-9a-zA-Z_]"); - private string Massage(string name) - { - return _regex.Replace(name, "_"); - } - - //private void Test(string stringText, string expected, bool runJsonNetCheck = true, bool runJsonNetSubTreeTests = true, [CallerMemberName]string name = "") - //{ - // var test = GenerateTests(stringText, runJsonNetCheck, runJsonNetSubTreeTests, name); - // nameToTest.Add(name, test); - //} - - private string GenerateTests(string val, bool runJsonNetCheck, bool runJsonNetSubTreeTests, string testName) - { - var builder = new StringBuilder(); - builder.AppendLine("[Fact]"); - builder.AppendLine("public void " + testName + "()"); - builder.AppendLine("{"); - builder.Append(@" TestNST("); - - var escaped = val.Replace("\"", "\"\""); - var quoted = "" + '@' + '"' + escaped + '"'; - builder.Append(quoted); - - var token = GetStringToken(val); - var allChars = _service.TryConvertToVirtualChars(token); - var looseTree = JsonParser.TryParse(allChars, strict: false); - if (looseTree == null) - { - throw new ArgumentException(); - } - - builder.Append(", " + '@' + '"'); - builder.Append(TreeToText(looseTree).Replace("\"", "\"\"")); - - builder.AppendLine("" + '"' + ','); - builder.Append("" + '@' + '"'); - builder.Append(DiagnosticsToText(looseTree.Diagnostics).Replace("\"", "\"\"")); - builder.AppendLine("" + '"' + ','); - - var strictTree = JsonParser.TryParse(allChars, strict: true); - builder.Append("" + '@' + '"'); - builder.Append(DiagnosticsToText(strictTree.Diagnostics).Replace("\"", "\"\"")); - builder.Append('"'); - - if (!runJsonNetCheck) - { - builder.Append(", runLooseTreeCheck: false"); - } - - if (!runJsonNetSubTreeTests) - { - builder.Append(", runLooseSubTreeCheck: false"); - } - - builder.AppendLine(");"); - builder.AppendLine("}"); - - return builder.ToString(); - } - } -} -#endif From 6d6cb00f3a84d5e47cc7e7a710fe47063be2dbc5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 15:51:05 -0800 Subject: [PATCH 102/110] Add tests --- .../Json/CSharpJsonParserTests_BasicTests.cs | 541 ++++++++++++++++++ .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 6 +- 2 files changed, 543 insertions(+), 4 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 765ca28d7cf4e..5591af06da5e2 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -5319,6 +5319,547 @@ public void TestTopLevelText() ", @" +"); + } + + [Fact] + public void TestNestedArrays1() + { + Test(@"""[1, [2, [3, [4]]]]""", @" + + + + [ + + + 1 + + + , + + + [ + + + 2 + + + , + + + [ + + + 3 + + + , + + + [ + + + 4 + + + ] + + + ] + + + ] + + + ] + + + + +", + @"", + @""); + } + + [Fact] + public void TestNestedArraysTrailingCommas1() + { + Test(@"""[1, [2, [3, [4,],],],]""", @" + + + + [ + + + 1 + + + , + + + [ + + + 2 + + + , + + + [ + + + 3 + + + , + + + [ + + + 4 + + + , + + + ] + + + , + + + ] + + + , + + + ] + + + , + + + ] + + + + +", + @"", + @" + +"); + } + + [Fact] + public void TestBogusNesting1() + { + Test(@"""[1, [2, [3, [4}}}}""", @" + + + + [ + + + 1 + + + , + + + [ + + + 2 + + + , + + + [ + + + 3 + + + , + + + [ + + + 4 + + + } + + + } + + + } + + + } + + + + + + + + + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void TestBogusNesting2() + { + Test(@"""[1, [2, [3, [4}]}]""", @" + + + + [ + + + 1 + + + , + + + [ + + + 2 + + + , + + + [ + + + 3 + + + , + + + [ + + + 4 + + + } + + + ] + + + } + + + ] + + + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void TestBogusNesting3() + { + Test(@"""{1, {2, {3, {4]]]]""", @" + + + + { + + + 1 + + , + + { + + + 2 + + , + + { + + + 3 + + , + + { + + + 4 + + + + ] + + + + ] + + + + ] + + + + ] + + + + + + + + + + + + + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void TestBogusNesting4() + { + Test(@"""[1, {2, [3, {4]]]]""", @" + + + + [ + + + 1 + + + , + + + { + + + 2 + + , + + [ + + + 3 + + + , + + + { + + + 4 + + + + + + ] + + + + + + ] + + + ] + + + ] + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void TestBogusNesting5() + { + Test(@"""[1, {2, [3, {4]}]}""", @" + + + + [ + + + 1 + + + , + + + { + + + 2 + + , + + [ + + + 3 + + + , + + + { + + + 4 + + + + + + ] + + + } + + + ] + + + } + + + + +", + @" + +", + @" + +"); + } + + [Fact] + public void TestBogusNesting6() + { + Test(@"""[1, {2, [3, {4}]}]""", @" + + + + [ + + + 1 + + + , + + + { + + + 2 + + , + + [ + + + 3 + + + , + + + { + + + 4 + + + } + + + ] + + + } + + + ] + + + + +", + @" + +", + @" + "); } } diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index e0af450e4795b..aabfe0d237c6a 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Immutable; using System.Linq; -using System.Runtime.CompilerServices; using System.Text.Json; using System.Xml.Linq; using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; @@ -17,9 +16,9 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { + using JsonSeparatedList = EmbeddedSeparatedSyntaxNodeList; using JsonToken = EmbeddedSyntaxToken; using JsonTrivia = EmbeddedSyntaxTrivia; - using JsonSeparatedList = EmbeddedSeparatedSyntaxNodeList; public partial class CSharpJsonParserTests { @@ -39,8 +38,7 @@ private static SyntaxToken GetStringToken(string text) protected void Test(string stringText, string expected, string looseDiagnostics, string strictDiagnostics, bool runLooseSubTreeCheck = true, - bool runStrictSubTreeCheck = true, - [CallerMemberName] string _ = "") + bool runStrictSubTreeCheck = true) { if (runLooseSubTreeCheck) Test(stringText, strict: false, expected, looseDiagnostics, runLooseSubTreeCheck); From 889dd42c8cb727073085e01012488a34a5e3e21d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 15:52:44 -0800 Subject: [PATCH 103/110] Run all --- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index aabfe0d237c6a..14b2cd05a60b4 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -35,16 +35,16 @@ private static SyntaxToken GetStringToken(string text) return token; } - protected void Test(string stringText, - string expected, string looseDiagnostics, string strictDiagnostics, + protected void Test( + string stringText, + string expected, + string looseDiagnostics, + string strictDiagnostics, bool runLooseSubTreeCheck = true, bool runStrictSubTreeCheck = true) { - if (runLooseSubTreeCheck) - Test(stringText, strict: false, expected, looseDiagnostics, runLooseSubTreeCheck); - - if (runStrictSubTreeCheck) - Test(stringText, strict: true, expected, strictDiagnostics, runStrictSubTreeCheck); + Test(stringText, strict: false, expected, looseDiagnostics, runLooseSubTreeCheck); + Test(stringText, strict: true, expected, strictDiagnostics, runStrictSubTreeCheck); } private void Test( From ccae4f60630f04474c80bdf27efecb9f6dcbb270 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 16:02:48 -0800 Subject: [PATCH 104/110] Simplify test code --- .../Json/CSharpJsonParserTests_BasicTests.cs | 16 ++++++++-------- .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 5 ++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 5591af06da5e2..4319e9b54d231 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -3672,7 +3672,7 @@ public void TestInvalidNumber() ", @" -", runStrictSubTreeCheck: false); +"); } [Fact] @@ -4547,7 +4547,7 @@ public void TestSimpleNumber1() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] @@ -4564,7 +4564,7 @@ public void TestSimpleNumber2() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] @@ -4813,7 +4813,7 @@ public void TestNumber9() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] @@ -4830,7 +4830,7 @@ public void TestNumber10() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] @@ -4847,7 +4847,7 @@ public void TestNumber11() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] @@ -4864,7 +4864,7 @@ public void TestNumber12() ", @"", - @"", runStrictSubTreeCheck: false); + @""); } [Fact] @@ -4995,7 +4995,7 @@ public void TestNumber19() ", @" -", runStrictSubTreeCheck: false); +"); } [Fact] diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 14b2cd05a60b4..32edd22c0ec00 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -40,11 +40,10 @@ protected void Test( string expected, string looseDiagnostics, string strictDiagnostics, - bool runLooseSubTreeCheck = true, - bool runStrictSubTreeCheck = true) + bool runLooseSubTreeCheck = true) { Test(stringText, strict: false, expected, looseDiagnostics, runLooseSubTreeCheck); - Test(stringText, strict: true, expected, strictDiagnostics, runStrictSubTreeCheck); + Test(stringText, strict: true, expected, strictDiagnostics, runSubTreeChecks: true); } private void Test( From 54bf451f3f9b3978e1804ddf8150a2d5534e61cd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 16:05:16 -0800 Subject: [PATCH 105/110] Fix comment --- .../Portable/EmbeddedLanguages/Json/JsonParser.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index b1931636c8651..33eaafbdd3773 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -123,16 +123,13 @@ private JsonTree ParseTree(bool strict) var root = new JsonCompilationUnit(arraySequence, _currentToken); - // We only report a single diagnostic when parsing out json. This helps prevent lots of cascading errors - // from being reported. First, we see if there are any diagnostics directly in tokens in the tree. If not, - // we then check for any incorrect tree structure (that would be incorrect for both json.net or - // strict-mode). If we don't run into any problems, we'll then perform specific json.net or strict-mode - // checks. + // There are three forms of diagnostics we can detect. The first were generated directly when parsing and + // relate to unknown tokens encountered or tokens that were needed but not found. The second relates to a + // set of grammar check rules that apply to both strict and non-strict json. The last is the specific + // strict/loose checks we perform. We look for all three forms, but only report the first issue we found. + // We want to avoid reporting a ton of cascaded errors. var diagnostic1 = GetFirstDiagnostic(root); var diagnostic2 = CheckTopLevel(_lexer.Text, root); - - // If we didn't have any diagnostics in the tree so far, then do the json.net/strict checks depending on how we - // were invoked. var diagnostic3 = strict ? StrictSyntaxChecker.CheckSyntax(root) : JsonNetSyntaxChecker.CheckSyntax(root); From 1cd13735406d67298ced4f2177f85136b0089acc Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 16:16:25 -0800 Subject: [PATCH 106/110] Explicitly test empty string case. --- .../Json/CSharpJsonParserTests_BasicTests.cs | 8 ++++++++ .../EmbeddedLanguages/Json/CSharpJsonTests.cs | 11 ++++++++--- .../Portable/EmbeddedLanguages/Json/JsonParser.cs | 6 ++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index 4319e9b54d231..c6e69ca07b549 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -8,6 +8,14 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EmbeddedLanguages.Json { public partial class CSharpJsonParserBasicTests : CSharpJsonParserTests { + [Fact] + public void TestEmpty() + { + Test(@"""""", expected: null, + @"", + @"", runLooseSubTreeCheck: false); + } + [Fact] public void TestOneSpace() { diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs index 32edd22c0ec00..2a7748eeec5b7 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonTests.cs @@ -37,7 +37,7 @@ private static SyntaxToken GetStringToken(string text) protected void Test( string stringText, - string expected, + string? expected, string looseDiagnostics, string strictDiagnostics, bool runLooseSubTreeCheck = true) @@ -48,12 +48,17 @@ protected void Test( private void Test( string stringText, bool strict, - string expectedTree, string expectedDiagnostics, + string? expectedTree, string expectedDiagnostics, bool runSubTreeChecks) { var tree = TryParseTree(stringText, strict, conversionFailureOk: false); if (tree == null) + { + Assert.Null(expectedTree); return; + } + + Assert.NotNull(expectedTree); // Tests are allowed to not run the subtree tests. This is because some // subtrees can cause the native regex parser to exhibit very bad behavior @@ -62,7 +67,7 @@ private void Test( TryParseSubTrees(stringText, strict); var actualTree = TreeToText(tree).Replace("\"", "\"\""); - Assert.Equal(expectedTree.Replace("\"", "\"\""), actualTree); + Assert.Equal(expectedTree!.Replace("\"", "\"\""), actualTree); var actualDiagnostics = DiagnosticsToText(tree.Diagnostics).Replace("\"", "\"\""); Assert.Equal(expectedDiagnostics.Replace("\"", "\"\""), actualDiagnostics); diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index 33eaafbdd3773..bf93e6048893c 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -107,6 +107,9 @@ private JsonToken ConsumeCurrentToken() { try { + if (text.Length == 0) + return null; + return new JsonParser(text).ParseTree(strict); } catch (InsufficientExecutionStackException) @@ -162,6 +165,9 @@ private JsonTree ParseTree(bool strict) if (sequence.IsEmpty) { // json is not allowed to be just whitespace. + // + // Note: we always have at least some content (either real nodes in the tree) or trivia on the EOF token + // as we only parse when we have a non-empty sequence of virtual chars to begin with. if (text.Length > 0 && compilationUnit.EndOfFileToken.LeadingTrivia.All( t => t.Kind is JsonKind.WhitespaceTrivia or JsonKind.EndOfLineTrivia)) From cc8ccf5689e1a15e927aa5af27e2e1eda6d84114 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 16:18:30 -0800 Subject: [PATCH 107/110] Convert to switch expression --- .../EmbeddedLanguages/Json/JsonParser.cs | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index bf93e6048893c..dd8187d1855c6 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -345,21 +345,14 @@ private JsonSeparatedList ParseCommaSeparatedSequenceWorker() } private bool ShouldConsumeSequenceElement() - { - if (_currentToken.Kind == JsonKind.EndOfFile) - return false; - - if (_currentToken.Kind == JsonKind.CloseBraceToken) - return !_inObject; - - if (_currentToken.Kind == JsonKind.CloseBracketToken) - return !_inArray; - - if (_currentToken.Kind == JsonKind.CloseParenToken) - return !_inConstructor; - - return true; - } + => _currentToken.Kind switch + { + JsonKind.EndOfFile => false, + JsonKind.CloseBraceToken => !_inObject, + JsonKind.CloseBracketToken => !_inArray, + JsonKind.CloseParenToken => !_inConstructor, + _ => true + }; private JsonValueNode ParseValue() => _currentToken.Kind switch From 1a4386fd1bcdf6af42ba8f38d9c4f0cce9cac38d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 16:28:31 -0800 Subject: [PATCH 108/110] Inline --- .../Json/CSharpJsonParserTests_BasicTests.cs | 60 +++++++++++++++++++ .../EmbeddedLanguages/Json/JsonParser.cs | 9 ++- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs index c6e69ca07b549..6c04ad9ed97fe 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/Json/CSharpJsonParserTests_BasicTests.cs @@ -5868,6 +5868,66 @@ public void TestBogusNesting6() ", @" +"); + } + + [Fact] + public void TestIntegerPropertyName() + { + Test(@"""{ 0: true }""", expected: @" + + + + { + + + 0 + : + + true + + + + } + + + + +", + @"", + @" + +"); + } + + [Fact] + public void TestColonPropertyName() + { + Test(@"""{ :: true }""", expected: @" + + + + { + + + : + : + + true + + + + } + + + + +", + @" + +", + @" + "); } } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index dd8187d1855c6..cd6aca24aa504 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -380,6 +380,8 @@ private static void SplitLiteral(JsonToken literalToken, out JsonToken minusToke private JsonPropertyNode ParseProperty(JsonToken stringLiteralOrText) { Debug.Assert(_currentToken.Kind == JsonKind.ColonToken); + + // Kind could be anything else we might have parsed as a value (for example, an integer/boolean literal). if (stringLiteralOrText.Kind != JsonKind.StringToken) stringLiteralOrText = stringLiteralOrText.With(kind: JsonKind.TextToken); @@ -441,8 +443,8 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) // We'll check for these later in the strict-mode pass. Debug.Assert(token.VirtualChars.Length > 0); if (TryMatch(token, "NaN", JsonKind.NaNLiteralToken, out var newKind) || - TryMatch(token, "true", JsonKind.TrueLiteralToken, out newKind) || TryMatch(token, "null", JsonKind.NullLiteralToken, out newKind) || + TryMatch(token, "true", JsonKind.TrueLiteralToken, out newKind) || TryMatch(token, "false", JsonKind.FalseLiteralToken, out newKind) || TryMatch(token, "Infinity", JsonKind.InfinityLiteralToken, out newKind) || TryMatch(token, "undefined", JsonKind.UndefinedLiteralToken, out newKind)) @@ -460,7 +462,7 @@ private JsonValueNode ParseLiteralOrTextOrConstructor(JsonToken token) var firstChar = token.VirtualChars[0]; if (firstChar == '-' || firstChar == '.' || IsDigit(firstChar)) - return ParseNumber(token); + return new JsonLiteralNode(token.With(kind: JsonKind.NumberToken)); return new JsonTextNode( token.With(kind: JsonKind.TextToken).AddDiagnosticIfNone(new EmbeddedDiagnostic( @@ -514,9 +516,6 @@ private static bool Matches(JsonToken token, string val) private static bool IsDigit(VirtualChar ch) => ch.Value is >= '0' and <= '9'; - private static JsonLiteralNode ParseNumber(JsonToken textToken) - => new(textToken.With(kind: JsonKind.NumberToken)); - private JsonCommaValueNode ParseCommaValue() => new(ConsumeCurrentToken()); From e6d7e28ccec502b5637ff0edbd9c05e7a074632a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 16:32:12 -0800 Subject: [PATCH 109/110] Strings --- .../Portable/xlf/FeaturesResources.cs.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.de.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.es.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.fr.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.it.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ja.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ko.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.pl.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.pt-BR.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ru.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.tr.xlf | 135 ++++++++++++++++++ .../xlf/FeaturesResources.zh-Hans.xlf | 135 ++++++++++++++++++ .../xlf/FeaturesResources.zh-Hant.xlf | 135 ++++++++++++++++++ 13 files changed, 1755 insertions(+) diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 126168f83a6cc..3d68aa2e707df 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -410,6 +410,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Změna viditelnosti {0} vyžaduje restartování aplikace. + + Comments not allowed + Comments not allowed + + Configure {0} code style Nakonfigurovat styl kódu {0} @@ -430,6 +435,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Nakonfigurujte závažnost pro všechny analyzátory. + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Převést na LINQ @@ -550,6 +560,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Změny provedené v projektu {0} vyžadují restartování aplikace: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Při čtení souboru {0} došlo k chybě: {1} @@ -565,6 +580,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Při vytváření instance CodeFixProvider {0} došlo k chybě. + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Chyba při čtení PDB: {0} @@ -735,6 +755,16 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Znak \ na konci vzorku je neplatný. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Neplatné {x,y} s x > y @@ -875,11 +905,31 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Zavést proměnnou dotazu + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Neplatný název skupiny: Názvy skupin musí začínat znakem slova. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Neplatný výběr + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Nastavit třídu jako abstract @@ -965,6 +1020,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Chybí řídicí znak This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Úprava {0} se statickou proměnnou vyžaduje restartování aplikace. @@ -1080,11 +1140,21 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Přesunutí {0} vyžaduje restartování aplikace. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Přechází se na symbol {0} z {1}. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Vnořený kvantifikátor {0} @@ -1115,11 +1185,31 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Nedostatek znaků ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operátory + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Odkaz na vlastnost se nedá aktualizovat. @@ -2395,6 +2485,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Stream musí podporovat operace read a seek. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Potlačit {0} @@ -2410,6 +2505,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv V cestě sestavení {0} byl nalezen symbol. + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Uvolněte nespravované prostředky (nespravované objekty) a přepište finalizační metodu. @@ -2460,6 +2560,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Příliš mnoho znaků ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typy: @@ -2500,11 +2605,21 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Nedokončená sada [] This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Neukončený komentář (?#...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Zrušit zalomení všech argumentů @@ -2665,6 +2780,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Hodnota: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Upozornění: Změna oboru názvů může vést k vytvoření neplatného kódu a změnit význam kódu. @@ -2750,6 +2870,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Ve vloženém souboru PDB se našel {0}. @@ -2800,6 +2925,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv {0} tady není null. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. {0} tady může být null. @@ -2810,6 +2940,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Desetimiliontiny sekundy diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index 763e85b2e3bb0..439b3881e2433 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -410,6 +410,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Ändern der Sichtbarkeit von {0} erfordert einen Neustart der Anwendung. + + Comments not allowed + Comments not allowed + + Configure {0} code style Codeformat "{0}" konfigurieren @@ -430,6 +435,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Schweregrad für alle Analysetools konfigurieren + + Constructors not allowed + Constructors not allowed + + Convert to LINQ In LINQ konvertieren @@ -550,6 +560,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Änderungen, die im Projekt "{0}" vorgenommen wurden, erfordern einen Neustart der Anwendung: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Fehler beim Lesen der Datei "{0}": {1} @@ -565,6 +580,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Fehler beim Erstellen der CodeFixProvider-Instanz "{0}". + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Fehler beim Lesen von PDB-Dateien: „{0}“ @@ -735,6 +755,16 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Nicht zulässiges \-Zeichen am Ende des Musters. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Illegaler {x,y}-Wert mit x > y. @@ -875,11 +905,31 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Abfragevariable bereitstellen + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Ungültiger Gruppenname: Gruppennamen müssen mit einem Wortzeichen beginnen. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Ungültige Auswahl. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Klasse als "abstract" festlegen @@ -965,6 +1020,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Fehlendes Steuerzeichen This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Das Ändern von {0}, welche eine statische Variable enthält erfordert einen Neustart der Anwendung. @@ -1080,11 +1140,21 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Verschieben von {0} erfordert einen Neustart der Anwendung. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Die Navigation von „{1}“ zum Symbol „{0}“ wird durchgeführt. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Geschachtelter Quantifizierer {0}. @@ -1115,11 +1185,31 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Zu wenige )-Zeichen This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatoren + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Der Eigenschaftenverweis kann nicht aktualisiert werden. @@ -2395,6 +2485,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Stream muss Lese- und Suchvorgänge unterstützen. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} unterdrücken @@ -2410,6 +2505,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Das Symbol wurde unter dem Assemblypfad „{0}“ gefunden + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Nicht verwaltete Ressourcen (nicht verwaltete Objekte) freigeben und Finalizer überschreiben @@ -2460,6 +2560,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Zu viele )-Zeichen. This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typen: @@ -2500,11 +2605,21 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Nicht abgeschlossener []-Satz This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Nicht abgeschlossener (?#...)-Kommentar. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Umbruch für alle Argumente aufheben @@ -2665,6 +2780,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Wert: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Warnung: Durch die Änderung des Namespaces kann der Code ungültig werden oder seine Bedeutung verändern. @@ -2750,6 +2870,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. „{0}“ wurde in einer eingebetteten PDB-Datei gefunden. @@ -2800,6 +2925,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg "{0}" ist hier nicht NULL. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. "{0}" darf hier NULL sein. @@ -2810,6 +2940,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10.000.000stel einer Sekunde diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 2abf8ac42d9a4..9e2340799fb43 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -410,6 +410,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para cambiar la visibilidad de {0} es necesario reiniciar la aplicación. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurar el estilo de código de {0} @@ -430,6 +435,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Configurar la gravedad de todos los analizadores + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Convertir a LINQ @@ -550,6 +560,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Los cambios realizados en el proyecto "{0}" requieren reiniciar la aplicación: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Error al leer el archivo "{0}": {1} @@ -565,6 +580,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Error al crear la instancia de CodeFixProvider "{0}" + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Error al leer PDB: '{0}' @@ -735,6 +755,16 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa \ no válido al final del modelo This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Ilegales {x, y} con x > y @@ -875,11 +905,31 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Introducir la variable de consulta + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nombre de grupo no válido: nombres de grupo deben comenzar con un carácter de palabra This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Selección no válida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Convertir la clase en "abstract" @@ -965,6 +1020,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Falta de carácter de control This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Para modificar {0}que contiene una variable estática, es necesario reiniciar la aplicación. @@ -1080,11 +1140,21 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para mover {0} es necesario reiniciar la aplicación. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navegando al símbolo '{0}' desde '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Cuantificador anidado {0} @@ -1115,11 +1185,31 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa No hay suficientes ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operadores + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated No se puede actualizar la referencia de propiedad @@ -2395,6 +2485,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us La secuencia debe admitir las operaciones de lectura y búsqueda. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Suprimir {0} @@ -2410,6 +2505,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Símbolo encontrado en la ruta de acceso del ensamblado '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: liberar los recursos no administrados (objetos no administrados) y reemplazar el finalizador @@ -2460,6 +2560,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Demasiados ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipos: @@ -2500,11 +2605,21 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Conjunto [] sin terminar This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Comentario (?#...) sin terminar This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Desajustar todos los argumentos @@ -2665,6 +2780,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Valor: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Advertencia: si cambia Cambiar el espacio de nombres puede producir código inválido y cambiar el significado del código. @@ -2750,6 +2870,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' encontrados en PDB incrustado. @@ -2800,6 +2925,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us "{0}" no es NULL aquí. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. "{0}" puede ser NULL aquí. @@ -2810,6 +2940,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second La diezmillonésima parte de un segundo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index 4443f332e4727..07925a507ad34 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -410,6 +410,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai La modification de la visibilité de {0} requiert le redémarrage de l’application. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurer le style de code {0} @@ -430,6 +435,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Configurer la gravité pour tous les analyseurs + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Convertir en LINQ @@ -550,6 +560,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Les modifications apportées au projet « {0} » nécessitent le redémarrage de l’application : {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Erreur durant la lecture du fichier '{0}' : {1} @@ -565,6 +580,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Erreur lors de la création de l'instance de CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Erreur de lecture de la base de données PDB : '{0}' @@ -735,6 +755,16 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Caractère \ non autorisé à la fin du modèle This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} non autorisé avec x > y @@ -875,11 +905,31 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Introduire la variable de requête + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nom de groupe non valide : les noms de groupe doivent commencer par un caractère alphabétique This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Sélection incorrecte. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Rendre la classe 'abstract' @@ -965,6 +1020,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Caractère de contrôle manquant This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. La modification de {0} qui contient une variable statique requiert le redémarrage de l’application. @@ -1080,11 +1140,21 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Le déplacement de {0} requiert le redémarrage de l’application. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navigation vers le symbole '{0}' à partir de '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificateur imbriqué {0} @@ -1115,11 +1185,31 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Pas assez de )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Opérateurs + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated La référence de propriété ne peut pas être mise à jour @@ -2395,6 +2485,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Le flux doit prendre en charge les opérations de lecture et de recherche. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Supprimer {0} @@ -2410,6 +2505,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Symbole trouvé dans le chemin d’accès de l’assembly '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: libérer les ressources non managées (objets non managés) et substituer le finaliseur @@ -2460,6 +2560,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Trop de )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Types : @@ -2500,11 +2605,21 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Ensemble [] inachevé This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Commentaire (?#...) non terminé This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Désenvelopper tous les arguments @@ -2665,6 +2780,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Valeur : + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Avertissement : Le changement d’espace de noms peut produire du code non valide et changer la signification du code. @@ -2750,6 +2870,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' trouvé dans le fichier PDB incorporé. @@ -2800,6 +2925,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée '{0}' n'a pas une valeur null ici. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' a peut-être une valeur null ici. @@ -2810,6 +2940,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10 000 000es de seconde diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index ebf07fa467879..4ddd70a0ff778 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -410,6 +410,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si modifica la visibilità di {0}, è necessario riavviare l'applicazione. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configura lo stile del codice di {0} @@ -430,6 +435,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Configura la gravità per tutti gli analizzatori + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Converti in LINQ @@ -550,6 +560,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Le modifiche apportate nel progetto '{0}' richiedono il riavvio dell'applicazione: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Si è verificato un errore durante la lettura del file '{0}': {1} @@ -565,6 +580,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Si è verificato un errore durante la creazione dell'istanza di CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Errore durante la lettura del PDB: '{0}' @@ -735,6 +755,16 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Carattere \ non valido alla fine del criterio This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} non valido con x > y @@ -875,11 +905,31 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Introduci la variabile di query + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nome di gruppo non valido: i nomi di gruppo devono iniziare con un carattere alfanumerico This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Selezione non valida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Rendi la classe 'abstract' @@ -965,6 +1020,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Carattere di controllo mancante This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Se si modifica {0} che contiene una variabile statica, è necessario riavviare l'applicazione. @@ -1080,11 +1140,21 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si sposta {0}, è necessario riavviare l'applicazione. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Passaggio al simbolo '{0}' da '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificatore nidificato {0} @@ -1115,11 +1185,31 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Parentesi chiuse insufficienti This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatori + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Non è possibile aggiornare il riferimento alla proprietà @@ -2395,6 +2485,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Il flusso deve supportare operazioni di lettura e ricerca. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Elimina {0} @@ -2410,6 +2505,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Simbolo trovato nel percorso assembly '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: liberare risorse non gestite (oggetti non gestiti) ed eseguire l'override del finalizzatore @@ -2460,6 +2560,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Troppe parentesi di chiusura This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipi: @@ -2500,11 +2605,21 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Set di [] senza terminazione This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Commento (?#...) senza terminazione This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Annulla il ritorno a capo per tutti gli argomenti @@ -2665,6 +2780,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Valore: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Avviso: la modifica dello spazio dei nomi può comportare la creazione di codice non valido e modificare il significato del codice. @@ -2750,6 +2870,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' trovati nel PDB incorporato. @@ -2800,6 +2925,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' '{0}' non è Null in questo punto. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' può essere Null in questo punto. @@ -2810,6 +2940,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Decimilionesimi di secondo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index 3fd88f8a13c09..3105050fc1760 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -410,6 +410,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} の可視性を変更するには、アプリケーションを再起動する必要があります。 + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} コード スタイルの構成 @@ -430,6 +435,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma すべてのアナライザーの重要度を構成します + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ に変換 @@ -550,6 +560,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma プロジェクト '{0}' で加えられた変更にはアプリケーションの再起動が必要です: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} ファイル {0}' の読み取り中にエラーが発生しました: {1} @@ -565,6 +580,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma CodeFixProvider '{0}' のインスタンスの作成でエラーが発生しました + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB: '{0}' の読み込み中にエラーが発生した @@ -735,6 +755,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 無効\末尾のパターン This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} で x > y は無効です @@ -875,11 +905,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma クエリ変数を導入します + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 無効なグループ名: グループ名は単語文字で始める必要があります This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 選択が無効です。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' クラスを 'abstract' にしてください @@ -965,6 +1020,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma コントロール文字がありません This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 静的な変数を含む {0} を変更するには、アプリケーションを再起動する必要があります。 @@ -1080,11 +1140,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} を移動するには、アプリケーションを再起動する必要があります。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. "{1}" からシンボル '{0}' に移動しています。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 入れ子になった量指定子 {0} @@ -1115,11 +1185,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ) が足りません This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 演算子 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated プロパティ参照を更新できません @@ -2395,6 +2485,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ストリームは、読み取りとシーク操作をサポートする必要があります。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} の非表示 @@ -2410,6 +2505,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of アセンブリ パス '{0}' にシンボルが見つかりました + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: アンマネージド リソース (アンマネージド オブジェクト) を解放し、ファイナライザーをオーバーライドします @@ -2460,6 +2560,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ) が多すぎます This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 型: @@ -2500,11 +2605,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 未終了の [] セットです This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 未終了の (?#...) コメントです This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments すべての引数の折り返しを解除 @@ -2665,6 +2780,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 値: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 名前空間を変更すると無効なコードが生成され、コードの意味が変更される可能性があります。 @@ -2750,6 +2870,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 埋め込み PDB に '{0}' が見つかりました。 @@ -2800,6 +2925,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ここでは、'{0}' は null ではありません。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. ここでは、'{0}' は null である可能性があります。 @@ -2810,6 +2940,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10,000,000 分の 1 秒単位 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index 242967ad8e4cb..0cbb798f4c926 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -410,6 +410,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} 표시 유형을 변경하려면 애플리케이션을 다시 시작해야 합니다. + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} 코드 스타일 구성 @@ -430,6 +435,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 모든 분석기에 대해 심각도 구성 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ로 변환 @@ -550,6 +560,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ' {0}' 프로젝트에서 변경한 내용을 적용하려면 응용 프로그램 ‘{1}’을(를) 다시 시작 해야 합니다. + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} '{0}' 파일을 읽는 동안 오류가 발생했습니다. {1} @@ -565,6 +580,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma CodeFixProvider '{0}' 인스턴스를 만드는 동안 오류가 발생했습니다. + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB를 읽는 동안 오류 발생: '{0}' @@ -735,6 +755,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 패턴 끝에 \를 사용할 수 없습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x > y인 잘못된 {x,y}입니다. @@ -875,11 +905,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 쿼리 변수 지정 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 잘못된 그룹 이름: 그룹 이름은 단어 문자로 시작해야 합니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 잘못된 선택 항목입니다. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 'abstract' 클래스 만들기 @@ -965,6 +1020,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 제어 문자가 없습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 정적 변수를 포함하는 {0}을(를) 수정하려면 애플리케이션을 다시 시작해야 합니다. @@ -1080,11 +1140,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0}을(를) 이동하려면 애플리케이션을 다시 시작해야 합니다. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. '{1}'에서 기호 '{0}'(으)로 이동하는 중입니다. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 중첩 수량자 {0}입니다. @@ -1115,11 +1185,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 부족 )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 연산자 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 속성 참조를 업데이트할 수 없습니다. @@ -2395,6 +2485,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 스트림은 읽기 및 찾기 작업을 지원해야 합니다. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0}을(를) 표시하지 않음 @@ -2410,6 +2505,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 어셈블리 경로 '{0}'에서 기호를 찾음 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 비관리형 리소스(비관리형 개체)를 해제하고 종료자를 재정의합니다. @@ -2460,6 +2560,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of )가 너무 많습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 형식: @@ -2500,11 +2605,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 종결되지 않은 [] 집합 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 종격되지 않은 (?#...) 주석 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 모든 인수 래핑 해제 @@ -2665,6 +2780,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 값: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 경고: 네임스페이스를 변경하면 잘못된 코드가 발생하고 코드 의미가 변경될 수 있습니다. @@ -2750,6 +2870,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 포함된 PDB에서 '{0}'을(를) 찾았습니다. @@ -2800,6 +2925,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}'은(는) 여기에서 null이 아닙니다. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}'은(는) 여기에서 null일 수 있습니다. @@ -2810,6 +2940,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10,000,000분의 1초 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index 55d75355ceee5..eb423d9e02855 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -410,6 +410,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zmiana widoczności elementu {0} wymaga ponownego uruchomienia aplikacji. + + Comments not allowed + Comments not allowed + + Configure {0} code style Konfiguruj styl kodu {0} @@ -430,6 +435,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Konfiguruj ważność wszystkich analizatorów + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Konwertuj na składnię LINQ @@ -550,6 +560,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zmiany wprowadzone w projekcie „{0}” wymagają ponownego uruchomienia aplikacji: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Błąd podczas odczytywania pliku „{0}”: {1} @@ -565,6 +580,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Błąd podczas tworzenia wystąpienia elementu CodeFixProvider „{0}” + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Błąd podczas odczytywania pliku PDB: „{0}” @@ -735,6 +755,16 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Niedozwolony znak \ na końcu wzorca This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Niedozwolone wyrażenie {x,y} z wartością x > y @@ -875,11 +905,31 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Wprowadź zmienną zapytania + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nieprawidłowa nazwa grupy: nazwy grup muszą rozpoczynać się od znaku wyrazu This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Nieprawidłowe zaznaczenie. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Ustaw specyfikator „abstract” dla klasy @@ -965,6 +1020,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Brak znaku kontrolnego This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Modyfikacja elementu {0}, który zawiera zmienną statyczną, wymaga ponownego uruchomienia aplikacji. @@ -1080,11 +1140,21 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Przeniesienie elementu {0} wymaga ponownego uruchomienia aplikacji. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Trwa przechodzenie do symbolu „{0}” z „{1}”. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Zagnieżdżony kwantyfikator {0} @@ -1115,11 +1185,31 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zbyt mało znaków ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatory + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Nie można zaktualizować referencji właściwości @@ -2395,6 +2485,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Strumień musi obsługiwać operacje odczytu i wyszukiwania. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Pomiń element {0} @@ -2410,6 +2505,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Znaleziono symbol w ścieżce zestawu „{0}” + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Zwolnić niezarządzane zasoby (niezarządzane obiekty) i przesłonić finalizator @@ -2460,6 +2560,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Zbyt wiele znaków ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typy: @@ -2500,11 +2605,21 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Niezakończony zestaw [] This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Niezakończony komentarz (?#...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Odwijaj wszystkie argumenty @@ -2665,6 +2780,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Wartość: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Ostrzeżenie: Zmiana przestrzeni nazw może skutkować nieprawidłowym kodem i zmianą jego znaczenia. @@ -2750,6 +2870,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Znaleziono „{0}” w osadzonym pliku PDB. @@ -2800,6 +2925,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Element „{0}” nie ma wartości null w tym miejscu. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. Element „{0}” może mieć wartość null w tym miejscu. @@ -2810,6 +2940,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 1/10 000 000 sekundy diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index 469ecda45d97d..e36ac89a75175 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -410,6 +410,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Para alterar a visibilidade de {0}, é necessário reiniciar o aplicativo. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurar estilo de código de {0} @@ -430,6 +435,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Configurar gravidade para todos os analisadores + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Converter para LINQ @@ -550,6 +560,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess As alterações feitas no projeto '{0}' requerem a reinicialização do aplicativo: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Erro ao ler o arquivo '{0}': {1} @@ -565,6 +580,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Erro ao criar instância de CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Erro ao ler PDB: '{0}' @@ -735,6 +755,16 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess \ ilegal no final do padrão This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} ilegal com x> y @@ -875,11 +905,31 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Introduzir a variável de consulta + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nome de grupo inválido: nomes de grupos devem começar com um caractere de palavra This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Seleção inválida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Tornar a classe 'abstract' @@ -965,6 +1020,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Caractere de controle ausente This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. A modificação de {0}, que contém uma variável estática, requer o reinício do aplicativo. @@ -1080,11 +1140,21 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Mover {0} requer reiniciar o aplicativo. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navegando para o símbolo '{0}' de '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificador aninhado {0} @@ -1115,11 +1185,31 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Não há )'s suficientes This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operadores + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated A referência de propriedade não pode ser atualizada @@ -2395,6 +2485,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas O fluxo deve fornecer suporte a operações de leitura e busca. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Suprimir {0} @@ -2410,6 +2505,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Símbolo encontrado no caminho de montagem '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: free unmanaged resources (unmanaged objects) and override finalizer @@ -2460,6 +2560,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Muitos )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipos: @@ -2500,11 +2605,21 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Conjunto [] não finalizado This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Comentário (?#...) não finalizado This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Desencapsular todos os argumentos @@ -2665,6 +2780,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Valor: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Aviso: a alteração do namespace pode produzir código inválido e mudar o significado do código. @@ -2750,6 +2870,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' encontrado no PDB integrado. @@ -2800,6 +2925,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas '{0}' não é nulo aqui. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' pode ser nulo aqui. @@ -2810,6 +2940,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Dez milionésimos de um segundo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index a9fcb8d225d4f..dccdbf6f22126 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -410,6 +410,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для изменения видимости {0} требуется перезапустить приложение. + + Comments not allowed + Comments not allowed + + Configure {0} code style Настройка стиля кода {0} @@ -430,6 +435,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Настройка серьезности для всех анализаторов + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Преобразовать в LINQ @@ -550,6 +560,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma После внесения изменений в проект "{0}" необходимо перезапустить приложение: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Ошибка при чтении файла "{0}": {1} @@ -565,6 +580,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Ошибка при создании экземпляра CodeFixProvider "{0}". + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Ошибка чтения PDB-файла: "{0}" @@ -735,6 +755,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Недопустимый символ "\" в конце шаблона This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Неправильное использование {x,y} в x > y @@ -875,11 +905,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Добавить переменную запроса + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Недопустимое имя группы: имя группы должно начинаться с буквы This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Недопустимое выделение. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Сделать класс абстрактным @@ -965,6 +1020,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Отсутствует управляющий символ This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Для изменения {0}, где содержится статическая переменная, требуется перезапустить приложение. @@ -1080,11 +1140,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для перемещения {0} требуется перезапустить приложение. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Переход к символу "{0}" от "{1}". + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Вложенный квантификатор {0} @@ -1115,11 +1185,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Отсутствуют закрывающие круглые скобки This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Операторы + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Не удается обновить ссылку на свойство @@ -2395,6 +2485,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Поток должен поддерживать операции чтения и поиска. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Скрыть {0} @@ -2410,6 +2505,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Найден символ в пути сборки "{0}" + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: освободить неуправляемые ресурсы (неуправляемые объекты) и переопределить метод завершения @@ -2460,6 +2560,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Слишком много закрывающих круглых скобок This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Типы: @@ -2500,11 +2605,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Набор [] без признака завершения This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Незавершенный комментарий (? #...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Развернуть все аргументы @@ -2665,6 +2780,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Значение: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Предупреждение: изменение пространства имен может привести к появлению недопустимого кода и к изменению значения кода. @@ -2750,6 +2870,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Найдено "{0}" во внедренном PDB-файле. @@ -2800,6 +2925,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Здесь "{0}" имеет значение, отличное от NULL. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. Здесь "{0}" может иметь значение NULL. @@ -2810,6 +2940,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10 000 000-е доли секунды diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index f97b27d4bee8f..e3e506f7b49b0 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -410,6 +410,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesinin görünürlüğünün değiştirilmesi, uygulamanın yeniden başlatılmasını gerektirir. + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} kod stilini yapılandır @@ -430,6 +435,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Tüm çözümleyiciler için önem derecesini yapılandır + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ to dönüştürme @@ -550,6 +560,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be '{0}' projesinde yapılan değişiklikler uygulamanın yeniden başlatılmasını gerektiriyor: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} '{0}' dosyası okunurken hata: {1} @@ -565,6 +580,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be '{0}' CodeFixProvider örneği oluşturulurken hata oluştu + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB okuma hatası: “{0}” @@ -735,6 +755,16 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Yasadışı \ model sonunda This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Yasadışı {x, y} x > y @@ -875,11 +905,31 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Sorgu değişkeni ekle + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Geçersiz grup adı: grup adları bir sözcük karakteri ile başlamalıdır This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Geçersiz seçim. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Sınıfı 'abstract' yap @@ -965,6 +1020,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Eksik denetim karakteri This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Statik bir değişken içeren {0} öğesinin değiştirilmesi, uygulamanın yeniden başlatılmasını gerektirir. @@ -1080,11 +1140,21 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesinin taşınması uygulamanın yeniden başlatılmasını gerektirir. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. “{1}“den "{0}" sembolüne gidiliyor. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} İç içe geçmiş niceleyici {0} @@ -1115,11 +1185,31 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Değil yeterli)'ın This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatörler + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Özellik başvurusu güncelleştirilemiyor @@ -2395,6 +2485,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Akış okuma ve arama işlemlerini desteklemelidir. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} eylemini bastır @@ -2410,6 +2505,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri “{0}” derleme yolunda sembol bulundu + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: yönetilmeyen kaynakları (yönetilmeyen nesneleri) serbest bırakın ve sonlandırıcıyı geçersiz kılın @@ -2460,6 +2560,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Çok fazla)'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Türler: @@ -2500,11 +2605,21 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Sonlandırılmamış [] kümesi This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Sonlandırılmamış (?... #) yorum This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Tüm bağımsız değişkenlerin sarmalamasını kaldır @@ -2665,6 +2780,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Değer: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Uyarı: Ad alanının değiştirilmesi geçersiz kod oluşturabilir ve kodun anlamını değiştirebilir. @@ -2750,6 +2870,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. “{0}”, gömülü PDB'de bulundu. @@ -2800,6 +2925,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri '{0}' burada null değil. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' burada null olabilir. @@ -2810,6 +2940,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Saniyenin 10.000.000'da biri diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index 9ac4339be08cc..e6ff82fb8411e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -410,6 +410,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 更改 {0} 的可见性要求重启应用程序。 + + Comments not allowed + Comments not allowed + + Configure {0} code style 配置 {0} 代码样式 @@ -430,6 +435,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 为所有分析器配置严重性 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ 转换为 LINQ @@ -550,6 +560,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在项目“{0}”中所做的更改要求重新启动应用程序: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} 读取文件“{0}”时出错: {1} @@ -565,6 +580,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 创建 CodeFixProvider“{0}”的实例时出错 + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' 读取 PDB 时出错:“{0}” @@ -735,6 +755,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 模式末尾的 \ 非法 This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x > y 的 {x,y} 无效 @@ -875,11 +905,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 引入查询变量 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 组名无效: 组名必须以单词字符开头 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 无效的选择。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 将类设置为 "abstract" @@ -965,6 +1020,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 缺少控制字符 This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 修改包含静态变量的 {0} 需要重启应用程序。 @@ -1080,11 +1140,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 移动 {0} 要求重启应用程序。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. 从“{1}”导航到符号“{0}”。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 嵌套限定符 {0} @@ -1115,11 +1185,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ")" 不足 This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 运算符 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 无法更新属性引用 @@ -2395,6 +2485,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 流必须支持读取和搜寻操作。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} 抑制 {0} @@ -2410,6 +2505,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 在程序集路径 "{0}" 中找到符号 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 释放未托管的资源(未托管的对象)并重写终结器 @@ -2460,6 +2560,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ")" 太多 This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 类型: @@ -2500,11 +2605,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of [] 集未关闭 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment (?#...) 注释未关闭 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 展开所有参数 @@ -2665,6 +2780,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 值: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 更改命名空间可能会产生无效的代码并更改代码的含义。 @@ -2750,6 +2870,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 在嵌入的 PDB 中找到“{0}”。 @@ -2800,6 +2925,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of “{0}”在此处不为 null。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. “{0}”可能在此处为 null。 @@ -2810,6 +2940,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 千万分之一秒 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index 1293a919e25f5..e36223d5c97c8 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -410,6 +410,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 變更 {0} 的可見度需要重新啟動應用程式。 + + Comments not allowed + Comments not allowed + + Configure {0} code style 設定 {0} 程式碼樣式 @@ -430,6 +435,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 設定所有分析器的嚴重性 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ 轉換至 LINQ @@ -550,6 +560,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在專案 '{0}' 中所做的變更需要重新啟動應用程式: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} 讀取檔案 '{0}' 時發生錯誤: {1} @@ -565,6 +580,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 建立 CodeFixProvider '{0}' 的執行個體時發生錯誤 + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' 讀取 PDB 時發生錯誤: '{0}' @@ -735,6 +755,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 模式結尾使用 \ 不符合格式規定 This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x 大於 y 的 {x,y} 不符合格式 @@ -875,11 +905,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 引進查詢變數 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 群組名稱無效: 群組名稱必須以文字字元開頭 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -890,6 +940,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 無效的選取範圍。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 將類別設為 'abstract' @@ -965,6 +1020,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 缺少控制字元 This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 修改包含靜態變數的 {0} 需要重新啟動應用程式。 @@ -1080,11 +1140,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 移動 {0} 需要重新啟動應用程式。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. 正在從 '{1}' 瀏覽至符號 '{0}'。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 巢狀數量詞 {0} @@ -1115,11 +1185,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ) 不夠 This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 運算子 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 無法更新屬性參考 @@ -2395,6 +2485,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 資料流必須支援讀取及搜尋作業。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} 隱藏 {0} @@ -2410,6 +2505,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 在組件路徑 '{0}' 中找到符號 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 釋出非受控資源 (非受控物件) 並覆寫完成項 @@ -2460,6 +2560,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 太多 ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 類型: @@ -2500,11 +2605,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 未結束的 [] 組合 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 未結束的 (?#...) 註解 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 將所有引數取消換行 @@ -2665,6 +2780,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 值: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 變更命名空間可能會產生無效的程式碼及變更程式碼意義。 @@ -2750,6 +2870,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 在內嵌 PDB 中找到 '{0}'。 @@ -2800,6 +2925,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}' 在此不是 null。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' 在此可能為 null。 @@ -2810,6 +2940,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}' references + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 1/10,000,000 秒 From 5b007f6b4bb75b820e3278df4a4ad46a9ee64395 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Jan 2022 21:40:09 -0800 Subject: [PATCH 110/110] Resources --- .../Portable/xlf/FeaturesResources.cs.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.de.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.es.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.fr.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.it.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ja.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ko.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.pl.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.pt-BR.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.ru.xlf | 135 ++++++++++++++++++ .../Portable/xlf/FeaturesResources.tr.xlf | 135 ++++++++++++++++++ .../xlf/FeaturesResources.zh-Hans.xlf | 135 ++++++++++++++++++ .../xlf/FeaturesResources.zh-Hant.xlf | 135 ++++++++++++++++++ 13 files changed, 1755 insertions(+) diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 55a8b0895f7e0..5506e510763e0 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -405,6 +405,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Změna viditelnosti {0} vyžaduje restartování aplikace. + + Comments not allowed + Comments not allowed + + Configure {0} code style Nakonfigurovat styl kódu {0} @@ -425,6 +430,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Nakonfigurujte závažnost pro všechny analyzátory. + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Převést na LINQ @@ -545,6 +555,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Změny provedené v projektu {0} vyžadují restartování aplikace: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Při čtení souboru {0} došlo k chybě: {1} @@ -560,6 +575,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Při vytváření instance CodeFixProvider {0} došlo k chybě. + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Chyba při čtení PDB: {0} @@ -730,6 +750,16 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Znak \ na konci vzorku je neplatný. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Neplatné {x,y} s x > y @@ -870,11 +900,31 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Zavést proměnnou dotazu + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Neplatný název skupiny: Názvy skupin musí začínat znakem slova. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Neplatný výběr + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Nastavit třídu jako abstract @@ -960,6 +1015,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Chybí řídicí znak This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Úprava {0} se statickou proměnnou vyžaduje restartování aplikace. @@ -1075,11 +1135,21 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Přesunutí {0} vyžaduje restartování aplikace. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Přechází se na symbol {0} z {1}. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Vnořený kvantifikátor {0} @@ -1110,11 +1180,31 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Nedostatek znaků ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operátory + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Odkaz na vlastnost se nedá aktualizovat. @@ -2390,6 +2480,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Stream musí podporovat operace read a seek. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Potlačit {0} @@ -2405,6 +2500,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv V cestě sestavení {0} byl nalezen symbol. + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Uvolněte nespravované prostředky (nespravované objekty) a přepište finalizační metodu. @@ -2450,6 +2550,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Příliš mnoho znaků ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typy: @@ -2490,11 +2595,21 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Nedokončená sada [] This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Neukončený komentář (?#...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Zrušit zalomení všech argumentů @@ -2655,6 +2770,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Hodnota: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Upozornění: Změna oboru názvů může vést k vytvoření neplatného kódu a změnit význam kódu. @@ -2740,6 +2860,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Ve vloženém souboru PDB se našel {0}. @@ -2785,11 +2910,21 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv {0} tady není null. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. {0} tady může být null. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Desetimiliontiny sekundy diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index cd01fe71d85d2..5b37382137222 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -405,6 +405,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Ändern der Sichtbarkeit von {0} erfordert einen Neustart der Anwendung. + + Comments not allowed + Comments not allowed + + Configure {0} code style Codeformat "{0}" konfigurieren @@ -425,6 +430,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Schweregrad für alle Analysetools konfigurieren + + Constructors not allowed + Constructors not allowed + + Convert to LINQ In LINQ konvertieren @@ -545,6 +555,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Änderungen, die im Projekt "{0}" vorgenommen wurden, erfordern einen Neustart der Anwendung: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Fehler beim Lesen der Datei "{0}": {1} @@ -560,6 +575,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Fehler beim Erstellen der CodeFixProvider-Instanz "{0}". + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Fehler beim Lesen von PDB-Dateien: „{0}“ @@ -730,6 +750,16 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Nicht zulässiges \-Zeichen am Ende des Musters. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Illegaler {x,y}-Wert mit x > y. @@ -870,11 +900,31 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Abfragevariable bereitstellen + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Ungültiger Gruppenname: Gruppennamen müssen mit einem Wortzeichen beginnen. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Ungültige Auswahl. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Klasse als "abstract" festlegen @@ -960,6 +1015,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Fehlendes Steuerzeichen This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Das Ändern von {0}, welche eine statische Variable enthält erfordert einen Neustart der Anwendung. @@ -1075,11 +1135,21 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Verschieben von {0} erfordert einen Neustart der Anwendung. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Die Navigation von „{1}“ zum Symbol „{0}“ wird durchgeführt. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Geschachtelter Quantifizierer {0}. @@ -1110,11 +1180,31 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Zu wenige )-Zeichen This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatoren + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Der Eigenschaftenverweis kann nicht aktualisiert werden. @@ -2390,6 +2480,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Stream muss Lese- und Suchvorgänge unterstützen. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} unterdrücken @@ -2405,6 +2500,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Das Symbol wurde unter dem Assemblypfad „{0}“ gefunden + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Nicht verwaltete Ressourcen (nicht verwaltete Objekte) freigeben und Finalizer überschreiben @@ -2450,6 +2550,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Zu viele )-Zeichen. This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typen: @@ -2490,11 +2595,21 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Nicht abgeschlossener []-Satz This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Nicht abgeschlossener (?#...)-Kommentar. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Umbruch für alle Argumente aufheben @@ -2655,6 +2770,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Wert: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Warnung: Durch die Änderung des Namespaces kann der Code ungültig werden oder seine Bedeutung verändern. @@ -2740,6 +2860,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. „{0}“ wurde in einer eingebetteten PDB-Datei gefunden. @@ -2785,11 +2910,21 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg "{0}" ist hier nicht NULL. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. "{0}" darf hier NULL sein. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10.000.000stel einer Sekunde diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index c6f0ea459b91f..b7c18f8e82619 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -405,6 +405,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para cambiar la visibilidad de {0} es necesario reiniciar la aplicación. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurar el estilo de código de {0} @@ -425,6 +430,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Configurar la gravedad de todos los analizadores + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Convertir a LINQ @@ -545,6 +555,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Los cambios realizados en el proyecto "{0}" requieren reiniciar la aplicación: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Error al leer el archivo "{0}": {1} @@ -560,6 +575,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Error al crear la instancia de CodeFixProvider "{0}" + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Error al leer PDB: '{0}' @@ -730,6 +750,16 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa \ no válido al final del modelo This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Ilegales {x, y} con x > y @@ -870,11 +900,31 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Introducir la variable de consulta + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nombre de grupo no válido: nombres de grupo deben comenzar con un carácter de palabra This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Selección no válida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Convertir la clase en "abstract" @@ -960,6 +1015,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Falta de carácter de control This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Para modificar {0}que contiene una variable estática, es necesario reiniciar la aplicación. @@ -1075,11 +1135,21 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para mover {0} es necesario reiniciar la aplicación. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navegando al símbolo '{0}' desde '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Cuantificador anidado {0} @@ -1110,11 +1180,31 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa No hay suficientes ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operadores + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated No se puede actualizar la referencia de propiedad @@ -2390,6 +2480,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us La secuencia debe admitir las operaciones de lectura y búsqueda. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Suprimir {0} @@ -2405,6 +2500,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Símbolo encontrado en la ruta de acceso del ensamblado '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: liberar los recursos no administrados (objetos no administrados) y reemplazar el finalizador @@ -2450,6 +2550,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Demasiados ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipos: @@ -2490,11 +2595,21 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Conjunto [] sin terminar This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Comentario (?#...) sin terminar This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Desajustar todos los argumentos @@ -2655,6 +2770,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Valor: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Advertencia: si cambia Cambiar el espacio de nombres puede producir código inválido y cambiar el significado del código. @@ -2740,6 +2860,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' encontrados en PDB incrustado. @@ -2785,11 +2910,21 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us "{0}" no es NULL aquí. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. "{0}" puede ser NULL aquí. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second La diezmillonésima parte de un segundo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index aada3377fd5e0..e9375da0f7327 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -405,6 +405,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai La modification de la visibilité de {0} requiert le redémarrage de l’application. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurer le style de code {0} @@ -425,6 +430,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Configurer la gravité pour tous les analyseurs + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Convertir en LINQ @@ -545,6 +555,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Les modifications apportées au projet « {0} » nécessitent le redémarrage de l’application : {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Erreur durant la lecture du fichier '{0}' : {1} @@ -560,6 +575,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Erreur lors de la création de l'instance de CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Erreur de lecture de la base de données PDB : '{0}' @@ -730,6 +750,16 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Caractère \ non autorisé à la fin du modèle This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} non autorisé avec x > y @@ -870,11 +900,31 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Introduire la variable de requête + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nom de groupe non valide : les noms de groupe doivent commencer par un caractère alphabétique This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Sélection incorrecte. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Rendre la classe 'abstract' @@ -960,6 +1015,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Caractère de contrôle manquant This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. La modification de {0} qui contient une variable statique requiert le redémarrage de l’application. @@ -1075,11 +1135,21 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Le déplacement de {0} requiert le redémarrage de l’application. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navigation vers le symbole '{0}' à partir de '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificateur imbriqué {0} @@ -1110,11 +1180,31 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Pas assez de )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Opérateurs + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated La référence de propriété ne peut pas être mise à jour @@ -2390,6 +2480,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Le flux doit prendre en charge les opérations de lecture et de recherche. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Supprimer {0} @@ -2405,6 +2500,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Symbole trouvé dans le chemin d’accès de l’assembly '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: libérer les ressources non managées (objets non managés) et substituer le finaliseur @@ -2450,6 +2550,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Trop de )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Types : @@ -2490,11 +2595,21 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Ensemble [] inachevé This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Commentaire (?#...) non terminé This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Désenvelopper tous les arguments @@ -2655,6 +2770,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Valeur : + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Avertissement : Le changement d’espace de noms peut produire du code non valide et changer la signification du code. @@ -2740,6 +2860,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' trouvé dans le fichier PDB incorporé. @@ -2785,11 +2910,21 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée '{0}' n'a pas une valeur null ici. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' a peut-être une valeur null ici. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10 000 000es de seconde diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index bac7efd014b69..1c6d827ba3b9a 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -405,6 +405,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si modifica la visibilità di {0}, è necessario riavviare l'applicazione. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configura lo stile del codice di {0} @@ -425,6 +430,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Configura la gravità per tutti gli analizzatori + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Converti in LINQ @@ -545,6 +555,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Le modifiche apportate nel progetto '{0}' richiedono il riavvio dell'applicazione: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Si è verificato un errore durante la lettura del file '{0}': {1} @@ -560,6 +575,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Si è verificato un errore durante la creazione dell'istanza di CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Errore durante la lettura del PDB: '{0}' @@ -730,6 +750,16 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Carattere \ non valido alla fine del criterio This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} non valido con x > y @@ -870,11 +900,31 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Introduci la variabile di query + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nome di gruppo non valido: i nomi di gruppo devono iniziare con un carattere alfanumerico This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Selezione non valida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Rendi la classe 'abstract' @@ -960,6 +1015,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Carattere di controllo mancante This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Se si modifica {0} che contiene una variabile statica, è necessario riavviare l'applicazione. @@ -1075,11 +1135,21 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si sposta {0}, è necessario riavviare l'applicazione. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Passaggio al simbolo '{0}' da '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificatore nidificato {0} @@ -1110,11 +1180,31 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Parentesi chiuse insufficienti This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatori + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Non è possibile aggiornare il riferimento alla proprietà @@ -2390,6 +2480,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Il flusso deve supportare operazioni di lettura e ricerca. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Elimina {0} @@ -2405,6 +2500,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Simbolo trovato nel percorso assembly '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: liberare risorse non gestite (oggetti non gestiti) ed eseguire l'override del finalizzatore @@ -2450,6 +2550,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Troppe parentesi di chiusura This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipi: @@ -2490,11 +2595,21 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Set di [] senza terminazione This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Commento (?#...) senza terminazione This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Annulla il ritorno a capo per tutti gli argomenti @@ -2655,6 +2770,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Valore: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Avviso: la modifica dello spazio dei nomi può comportare la creazione di codice non valido e modificare il significato del codice. @@ -2740,6 +2860,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' trovati nel PDB incorporato. @@ -2785,11 +2910,21 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' '{0}' non è Null in questo punto. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' può essere Null in questo punto. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Decimilionesimi di secondo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index 203fcee3fd168..bc800f1e4383e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} の可視性を変更するには、アプリケーションを再起動する必要があります。 + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} コード スタイルの構成 @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma すべてのアナライザーの重要度を構成します + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ に変換 @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma プロジェクト '{0}' で加えられた変更にはアプリケーションの再起動が必要です: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} ファイル {0}' の読み取り中にエラーが発生しました: {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma CodeFixProvider '{0}' のインスタンスの作成でエラーが発生しました + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB: '{0}' の読み込み中にエラーが発生した @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 無効\末尾のパターン This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} で x > y は無効です @@ -870,11 +900,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma クエリ変数を導入します + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 無効なグループ名: グループ名は単語文字で始める必要があります This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 選択が無効です。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' クラスを 'abstract' にしてください @@ -960,6 +1015,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma コントロール文字がありません This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 静的な変数を含む {0} を変更するには、アプリケーションを再起動する必要があります。 @@ -1075,11 +1135,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} を移動するには、アプリケーションを再起動する必要があります。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. "{1}" からシンボル '{0}' に移動しています。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 入れ子になった量指定子 {0} @@ -1110,11 +1180,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ) が足りません This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 演算子 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated プロパティ参照を更新できません @@ -2390,6 +2480,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ストリームは、読み取りとシーク操作をサポートする必要があります。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} の非表示 @@ -2405,6 +2500,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of アセンブリ パス '{0}' にシンボルが見つかりました + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: アンマネージド リソース (アンマネージド オブジェクト) を解放し、ファイナライザーをオーバーライドします @@ -2450,6 +2550,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ) が多すぎます This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 型: @@ -2490,11 +2595,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 未終了の [] セットです This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 未終了の (?#...) コメントです This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments すべての引数の折り返しを解除 @@ -2655,6 +2770,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 値: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 名前空間を変更すると無効なコードが生成され、コードの意味が変更される可能性があります。 @@ -2740,6 +2860,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 埋め込み PDB に '{0}' が見つかりました。 @@ -2785,11 +2910,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ここでは、'{0}' は null ではありません。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. ここでは、'{0}' は null である可能性があります。 + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10,000,000 分の 1 秒単位 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index d9a74b94d4521..f96bcaaf78c8d 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} 표시 유형을 변경하려면 애플리케이션을 다시 시작해야 합니다. + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} 코드 스타일 구성 @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 모든 분석기에 대해 심각도 구성 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ로 변환 @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ' {0}' 프로젝트에서 변경한 내용을 적용하려면 응용 프로그램 ‘{1}’을(를) 다시 시작 해야 합니다. + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} '{0}' 파일을 읽는 동안 오류가 발생했습니다. {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma CodeFixProvider '{0}' 인스턴스를 만드는 동안 오류가 발생했습니다. + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB를 읽는 동안 오류 발생: '{0}' @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 패턴 끝에 \를 사용할 수 없습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x > y인 잘못된 {x,y}입니다. @@ -870,11 +900,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 쿼리 변수 지정 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 잘못된 그룹 이름: 그룹 이름은 단어 문자로 시작해야 합니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 잘못된 선택 항목입니다. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 'abstract' 클래스 만들기 @@ -960,6 +1015,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 제어 문자가 없습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 정적 변수를 포함하는 {0}을(를) 수정하려면 애플리케이션을 다시 시작해야 합니다. @@ -1075,11 +1135,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0}을(를) 이동하려면 애플리케이션을 다시 시작해야 합니다. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. '{1}'에서 기호 '{0}'(으)로 이동하는 중입니다. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 중첩 수량자 {0}입니다. @@ -1110,11 +1180,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 부족 )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 연산자 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 속성 참조를 업데이트할 수 없습니다. @@ -2390,6 +2480,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 스트림은 읽기 및 찾기 작업을 지원해야 합니다. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0}을(를) 표시하지 않음 @@ -2405,6 +2500,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 어셈블리 경로 '{0}'에서 기호를 찾음 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 비관리형 리소스(비관리형 개체)를 해제하고 종료자를 재정의합니다. @@ -2450,6 +2550,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of )가 너무 많습니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 형식: @@ -2490,11 +2595,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 종결되지 않은 [] 집합 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 종격되지 않은 (?#...) 주석 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 모든 인수 래핑 해제 @@ -2655,6 +2770,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 값: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 경고: 네임스페이스를 변경하면 잘못된 코드가 발생하고 코드 의미가 변경될 수 있습니다. @@ -2740,6 +2860,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 포함된 PDB에서 '{0}'을(를) 찾았습니다. @@ -2785,11 +2910,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}'은(는) 여기에서 null이 아닙니다. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}'은(는) 여기에서 null일 수 있습니다. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10,000,000분의 1초 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index 8425d82425201..0e3d1f8c5fb72 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -405,6 +405,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zmiana widoczności elementu {0} wymaga ponownego uruchomienia aplikacji. + + Comments not allowed + Comments not allowed + + Configure {0} code style Konfiguruj styl kodu {0} @@ -425,6 +430,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Konfiguruj ważność wszystkich analizatorów + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Konwertuj na składnię LINQ @@ -545,6 +555,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zmiany wprowadzone w projekcie „{0}” wymagają ponownego uruchomienia aplikacji: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Błąd podczas odczytywania pliku „{0}”: {1} @@ -560,6 +575,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Błąd podczas tworzenia wystąpienia elementu CodeFixProvider „{0}” + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Błąd podczas odczytywania pliku PDB: „{0}” @@ -730,6 +750,16 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Niedozwolony znak \ na końcu wzorca This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Niedozwolone wyrażenie {x,y} z wartością x > y @@ -870,11 +900,31 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Wprowadź zmienną zapytania + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nieprawidłowa nazwa grupy: nazwy grup muszą rozpoczynać się od znaku wyrazu This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Nieprawidłowe zaznaczenie. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Ustaw specyfikator „abstract” dla klasy @@ -960,6 +1015,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Brak znaku kontrolnego This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Modyfikacja elementu {0}, który zawiera zmienną statyczną, wymaga ponownego uruchomienia aplikacji. @@ -1075,11 +1135,21 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Przeniesienie elementu {0} wymaga ponownego uruchomienia aplikacji. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Trwa przechodzenie do symbolu „{0}” z „{1}”. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Zagnieżdżony kwantyfikator {0} @@ -1110,11 +1180,31 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zbyt mało znaków ) This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatory + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Nie można zaktualizować referencji właściwości @@ -2390,6 +2480,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Strumień musi obsługiwać operacje odczytu i wyszukiwania. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Pomiń element {0} @@ -2405,6 +2500,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Znaleziono symbol w ścieżce zestawu „{0}” + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: Zwolnić niezarządzane zasoby (niezarządzane obiekty) i przesłonić finalizator @@ -2450,6 +2550,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Zbyt wiele znaków ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Typy: @@ -2490,11 +2595,21 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Niezakończony zestaw [] This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Niezakończony komentarz (?#...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Odwijaj wszystkie argumenty @@ -2655,6 +2770,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Wartość: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Ostrzeżenie: Zmiana przestrzeni nazw może skutkować nieprawidłowym kodem i zmianą jego znaczenia. @@ -2740,6 +2860,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Znaleziono „{0}” w osadzonym pliku PDB. @@ -2785,11 +2910,21 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Element „{0}” nie ma wartości null w tym miejscu. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. Element „{0}” może mieć wartość null w tym miejscu. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 1/10 000 000 sekundy diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index 4aaeccbd29ff7..72d97b9c0c2ec 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -405,6 +405,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Para alterar a visibilidade de {0}, é necessário reiniciar o aplicativo. + + Comments not allowed + Comments not allowed + + Configure {0} code style Configurar estilo de código de {0} @@ -425,6 +430,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Configurar gravidade para todos os analisadores + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Converter para LINQ @@ -545,6 +555,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess As alterações feitas no projeto '{0}' requerem a reinicialização do aplicativo: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Erro ao ler o arquivo '{0}': {1} @@ -560,6 +575,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Erro ao criar instância de CodeFixProvider '{0}' + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Erro ao ler PDB: '{0}' @@ -730,6 +750,16 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess \ ilegal no final do padrão This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y {x,y} ilegal com x> y @@ -870,11 +900,31 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Introduzir a variável de consulta + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Nome de grupo inválido: nomes de grupos devem começar com um caractere de palavra This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Seleção inválida. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Tornar a classe 'abstract' @@ -960,6 +1015,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Caractere de controle ausente This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. A modificação de {0}, que contém uma variável estática, requer o reinício do aplicativo. @@ -1075,11 +1135,21 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Mover {0} requer reiniciar o aplicativo. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Navegando para o símbolo '{0}' de '{1}'. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Quantificador aninhado {0} @@ -1110,11 +1180,31 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Não há )'s suficientes This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operadores + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated A referência de propriedade não pode ser atualizada @@ -2390,6 +2480,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas O fluxo deve fornecer suporte a operações de leitura e busca. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Suprimir {0} @@ -2405,6 +2500,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Símbolo encontrado no caminho de montagem '{0}' + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: free unmanaged resources (unmanaged objects) and override finalizer @@ -2450,6 +2550,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Muitos )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Tipos: @@ -2490,11 +2595,21 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Conjunto [] não finalizado This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Comentário (?#...) não finalizado This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Desencapsular todos os argumentos @@ -2655,6 +2770,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Valor: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Aviso: a alteração do namespace pode produzir código inválido e mudar o significado do código. @@ -2740,6 +2860,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. '{0}' encontrado no PDB integrado. @@ -2785,11 +2910,21 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas '{0}' não é nulo aqui. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' pode ser nulo aqui. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Dez milionésimos de um segundo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 5d2284c2e773e..ea916ba863f84 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для изменения видимости {0} требуется перезапустить приложение. + + Comments not allowed + Comments not allowed + + Configure {0} code style Настройка стиля кода {0} @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Настройка серьезности для всех анализаторов + + Constructors not allowed + Constructors not allowed + + Convert to LINQ Преобразовать в LINQ @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma После внесения изменений в проект "{0}" необходимо перезапустить приложение: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} Ошибка при чтении файла "{0}": {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Ошибка при создании экземпляра CodeFixProvider "{0}". + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' Ошибка чтения PDB-файла: "{0}" @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Недопустимый символ "\" в конце шаблона This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Неправильное использование {x,y} в x > y @@ -870,11 +900,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Добавить переменную запроса + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Недопустимое имя группы: имя группы должно начинаться с буквы This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Недопустимое выделение. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Сделать класс абстрактным @@ -960,6 +1015,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Отсутствует управляющий символ This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Для изменения {0}, где содержится статическая переменная, требуется перезапустить приложение. @@ -1075,11 +1135,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для перемещения {0} требуется перезапустить приложение. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. Переход к символу "{0}" от "{1}". + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} Вложенный квантификатор {0} @@ -1110,11 +1180,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Отсутствуют закрывающие круглые скобки This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Операторы + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Не удается обновить ссылку на свойство @@ -2390,6 +2480,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Поток должен поддерживать операции чтения и поиска. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} Скрыть {0} @@ -2405,6 +2500,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Найден символ в пути сборки "{0}" + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: освободить неуправляемые ресурсы (неуправляемые объекты) и переопределить метод завершения @@ -2450,6 +2550,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Слишком много закрывающих круглых скобок This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Типы: @@ -2490,11 +2595,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Набор [] без признака завершения This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Незавершенный комментарий (? #...) This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Развернуть все аргументы @@ -2655,6 +2770,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Значение: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Предупреждение: изменение пространства имен может привести к появлению недопустимого кода и к изменению значения кода. @@ -2740,6 +2860,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. Найдено "{0}" во внедренном PDB-файле. @@ -2785,11 +2910,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Здесь "{0}" имеет значение, отличное от NULL. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. Здесь "{0}" может иметь значение NULL. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 10 000 000-е доли секунды diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index 0001dbf01e9d2..c15da67b3f15f 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -405,6 +405,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesinin görünürlüğünün değiştirilmesi, uygulamanın yeniden başlatılmasını gerektirir. + + Comments not allowed + Comments not allowed + + Configure {0} code style {0} kod stilini yapılandır @@ -425,6 +430,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Tüm çözümleyiciler için önem derecesini yapılandır + + Constructors not allowed + Constructors not allowed + + Convert to LINQ LINQ to dönüştürme @@ -545,6 +555,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be '{0}' projesinde yapılan değişiklikler uygulamanın yeniden başlatılmasını gerektiriyor: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} '{0}' dosyası okunurken hata: {1} @@ -560,6 +575,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be '{0}' CodeFixProvider örneği oluşturulurken hata oluştu + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' PDB okuma hatası: “{0}” @@ -730,6 +750,16 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Yasadışı \ model sonunda This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y Yasadışı {x, y} x > y @@ -870,11 +900,31 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Sorgu değişkeni ekle + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character Geçersiz grup adı: grup adları bir sözcük karakteri ile başlamalıdır This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Geçersiz seçim. + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' Sınıfı 'abstract' yap @@ -960,6 +1015,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Eksik denetim karakteri This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. Statik bir değişken içeren {0} öğesinin değiştirilmesi, uygulamanın yeniden başlatılmasını gerektirir. @@ -1075,11 +1135,21 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesinin taşınması uygulamanın yeniden başlatılmasını gerektirir. + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. “{1}“den "{0}" sembolüne gidiliyor. + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} İç içe geçmiş niceleyici {0} @@ -1110,11 +1180,31 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Değil yeterli)'ın This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators Operatörler + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated Özellik başvurusu güncelleştirilemiyor @@ -2390,6 +2480,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Akış okuma ve arama işlemlerini desteklemelidir. + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} {0} eylemini bastır @@ -2405,6 +2500,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri “{0}” derleme yolunda sembol bulundu + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: yönetilmeyen kaynakları (yönetilmeyen nesneleri) serbest bırakın ve sonlandırıcıyı geçersiz kılın @@ -2450,6 +2550,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Çok fazla)'s This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: Türler: @@ -2490,11 +2595,21 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Sonlandırılmamış [] kümesi This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment Sonlandırılmamış (?... #) yorum This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments Tüm bağımsız değişkenlerin sarmalamasını kaldır @@ -2655,6 +2770,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Değer: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. Uyarı: Ad alanının değiştirilmesi geçersiz kod oluşturabilir ve kodun anlamını değiştirebilir. @@ -2740,6 +2860,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. “{0}”, gömülü PDB'de bulundu. @@ -2785,11 +2910,21 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri '{0}' burada null değil. + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' burada null olabilir. + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second Saniyenin 10.000.000'da biri diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index 026851c76ca31..0f61a123efd84 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 更改 {0} 的可见性要求重启应用程序。 + + Comments not allowed + Comments not allowed + + Configure {0} code style 配置 {0} 代码样式 @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 为所有分析器配置严重性 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ 转换为 LINQ @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在项目“{0}”中所做的更改要求重新启动应用程序: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} 读取文件“{0}”时出错: {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 创建 CodeFixProvider“{0}”的实例时出错 + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' 读取 PDB 时出错:“{0}” @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 模式末尾的 \ 非法 This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x > y 的 {x,y} 无效 @@ -870,11 +900,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 引入查询变量 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 组名无效: 组名必须以单词字符开头 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 无效的选择。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 将类设置为 "abstract" @@ -960,6 +1015,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 缺少控制字符 This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 修改包含静态变量的 {0} 需要重启应用程序。 @@ -1075,11 +1135,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 移动 {0} 要求重启应用程序。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. 从“{1}”导航到符号“{0}”。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 嵌套限定符 {0} @@ -1110,11 +1180,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ")" 不足 This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 运算符 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 无法更新属性引用 @@ -2390,6 +2480,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 流必须支持读取和搜寻操作。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} 抑制 {0} @@ -2405,6 +2500,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 在程序集路径 "{0}" 中找到符号 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 释放未托管的资源(未托管的对象)并重写终结器 @@ -2450,6 +2550,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ")" 太多 This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 类型: @@ -2490,11 +2595,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of [] 集未关闭 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment (?#...) 注释未关闭 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 展开所有参数 @@ -2655,6 +2770,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 值: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 更改命名空间可能会产生无效的代码并更改代码的含义。 @@ -2740,6 +2860,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 在嵌入的 PDB 中找到“{0}”。 @@ -2785,11 +2910,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of “{0}”在此处不为 null。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. “{0}”可能在此处为 null。 + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 千万分之一秒 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index d45db7573140b..35527dbf65bd1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -405,6 +405,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 變更 {0} 的可見度需要重新啟動應用程式。 + + Comments not allowed + Comments not allowed + + Configure {0} code style 設定 {0} 程式碼樣式 @@ -425,6 +430,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 設定所有分析器的嚴重性 + + Constructors not allowed + Constructors not allowed + + Convert to LINQ 轉換至 LINQ @@ -545,6 +555,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在專案 '{0}' 中所做的變更需要重新啟動應用程式: {1} + + Enable JSON editor features + Enable JSON editor features + + Error while reading file '{0}': {1} 讀取檔案 '{0}' 時發生錯誤: {1} @@ -560,6 +575,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 建立 CodeFixProvider '{0}' 的執行個體時發生錯誤 + + Error parsing comment + Error parsing comment + + Error reading PDB: '{0}' 讀取 PDB 時發生錯誤: '{0}' @@ -730,6 +750,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 模式結尾使用 \ 不符合格式規定 This is an error message shown to the user when they write an invalid Regular Expression. Example: \ + + Illegal string character + Illegal string character + + + + Illegal whitespace character + Illegal whitespace character + + Illegal {x,y} with x > y x 大於 y 的 {x,y} 不符合格式 @@ -870,11 +900,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 引進查詢變數 + + Invalid constructor name + Invalid constructor name + + + + Invalid escape sequence + Invalid escape sequence + + Invalid group name: Group names must begin with a word character 群組名稱無效: 群組名稱必須以文字字元開頭 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<a >a) + + Invalid number + Invalid number + + + + Invalid property name + Invalid property name + + Invalid regex pattern Invalid regex pattern @@ -885,6 +935,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 無效的選取範圍。 + + JSON issue: {0} + JSON issue: {0} + + Make class 'abstract' 將類別設為 'abstract' @@ -960,6 +1015,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 缺少控制字元 This is an error message shown to the user when they write an invalid Regular Expression. Example: \c + + Missing property value + Missing property value + + Modifying {0} which contains a static variable requires restarting the application. 修改包含靜態變數的 {0} 需要重新啟動應用程式。 @@ -1075,11 +1135,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 移動 {0} 需要重新啟動應用程式。 + + Name expected + Name expected + + Navigating to symbol '{0}' from '{1}'. 正在從 '{1}' 瀏覽至符號 '{0}'。 + + Nested properties not allowed + Nested properties not allowed + + Nested quantifier {0} 巢狀數量詞 {0} @@ -1110,11 +1180,31 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ) 不夠 This is an error message shown to the user when they write an invalid Regular Expression. Example: (a + + Only properties allowed in an object + Only properties allowed in an object + + Operators 運算子 + + Probable JSON string detected + Probable JSON string detected + + + + Properties not allowed in an array + Properties not allowed in an array + + + + Property name must be a string + Property name must be a string + + Property reference cannot be updated 無法更新屬性參考 @@ -2390,6 +2480,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 資料流必須支援讀取及搜尋作業。 + + Strings must start with " not ' + Strings must start with " not ' + + Suppress {0} 隱藏 {0} @@ -2405,6 +2500,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 在組件路徑 '{0}' 中找到符號 + + Syntax error + Syntax error + + TODO: free unmanaged resources (unmanaged objects) and override finalizer TODO: 釋出非受控資源 (非受控物件) 並覆寫完成項 @@ -2450,6 +2550,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 太多 ) This is an error message shown to the user when they write an invalid Regular Expression. Example: ) + + Trailing comma not allowed + Trailing comma not allowed + + Types: 類型: @@ -2490,11 +2595,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 未結束的 [] 組合 This is an error message shown to the user when they write an invalid Regular Expression. Example: [ + + Unterminated comment + Unterminated comment + + Unterminated (?#...) comment 未結束的 (?#...) 註解 This is an error message shown to the user when they write an invalid Regular Expression. Example: (?# + + Unterminated string + Unterminated string + + Unwrap all arguments 將所有引數取消換行 @@ -2655,6 +2770,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 值: + + Value required + Value required + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 變更命名空間可能會產生無效的程式碼及變更程式碼意義。 @@ -2740,6 +2860,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of {0} - {1} + + '{0}' expected + '{0}' expected + + '{0}' found in embedded PDB. 在內嵌 PDB 中找到 '{0}'。 @@ -2785,11 +2910,21 @@ Zero-width positive lookbehind assertions are typically used at the beginning of '{0}' 在此不是 null。 + + '{0}' literal not allowed + '{0}' literal not allowed + + '{0}' may be null here. '{0}' 在此可能為 null。 + + '{0}' unexpected + '{0}' unexpected + + 10,000,000ths of a second 1/10,000,000 秒