diff --git a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/Json/CSharpJsonParserTests.cs b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/Json/CSharpJsonParserTests.cs index 2fbc9e7ad2dcd..1d0f3c6a11f16 100644 --- a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/Json/CSharpJsonParserTests.cs +++ b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/Json/CSharpJsonParserTests.cs @@ -92,7 +92,7 @@ private static string RemoveMessagesInNonSupportedLanguage(string value) var diagnosticsElement = XElement.Parse(value); foreach (var diagnosticElement in diagnosticsElement.Elements("Diagnostic")) - diagnosticElement.Attribute("Message").Remove(); + diagnosticElement.Attribute("Message")!.Remove(); return diagnosticsElement.ToString(); } diff --git a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs index c1c61f2e7ece6..1bc6bed5b35e1 100644 --- a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs +++ b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests.cs @@ -40,46 +40,26 @@ private static SyntaxToken GetStringToken(string text) return token; } - private void Test(string stringText, string expected, RegexOptions options, - bool runSubTreeTests = true, - bool allowIndexOutOfRange = false, - bool allowNullReference = false, - bool allowOutOfMemory = false, - bool allowDiagnosticsMismatch = false) + private void Test( + string stringText, string expected, RegexOptions options) { - var (tree, sourceText) = TryParseTree(stringText, options, conversionFailureOk: false, - allowIndexOutOfRange, allowNullReference, allowOutOfMemory, allowDiagnosticsMismatch); + var (tree, sourceText) = 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, - allowIndexOutOfRange, allowNullReference, allowOutOfMemory, allowDiagnosticsMismatch); - } + TryParseSubTrees(stringText, options); - const string DoubleQuoteEscaping = "\"\""; var actual = TreeToText(sourceText, tree) - .Replace("\"", DoubleQuoteEscaping) - .Replace(""", DoubleQuoteEscaping); - AssertEx.Equal(expected.Replace("\"", DoubleQuoteEscaping), actual); + .Replace(""", "\""); + AssertEx.Equal(expected, actual); } - private void TryParseSubTrees( - string stringText, RegexOptions options, - bool allowIndexOutOfRange, - bool allowNullReference, - bool allowOutOfMemory, - bool allowDiagnosticsMismatch) + private void TryParseSubTrees(string stringText, RegexOptions options) { // Trim the input from the right and make sure tree invariants hold var current = stringText; while (current is not "@\"\"" and not "\"\"") { current = current[..^2] + "\""; - TryParseTree(current, options, conversionFailureOk: true, - allowIndexOutOfRange, allowNullReference, allowOutOfMemory, allowDiagnosticsMismatch); + TryParseTree(current, options, conversionFailureOk: true); } // Trim the input from the left and make sure tree invariants hold @@ -95,8 +75,7 @@ private void TryParseSubTrees( current = "\"" + current[2..]; } - TryParseTree(current, options, conversionFailureOk: true, - allowIndexOutOfRange, allowNullReference, allowOutOfMemory, allowDiagnosticsMismatch); + TryParseTree(current, options, conversionFailureOk: true); } for (var start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++) @@ -104,8 +83,8 @@ private void TryParseSubTrees( TryParseTree( stringText[..start] + stringText[(start + 1)..], - options, conversionFailureOk: true, - allowIndexOutOfRange, allowNullReference, allowOutOfMemory, allowDiagnosticsMismatch); + options, + conversionFailureOk: true); } } @@ -125,12 +104,7 @@ private void TryParseSubTrees( } private (RegexTree, SourceText) TryParseTree( - string stringText, RegexOptions options, - bool conversionFailureOk, - bool allowIndexOutOfRange, - bool allowNullReference, - bool allowOutOfMemory, - bool allowDiagnosticsMismatch = false) + string stringText, RegexOptions options, bool conversionFailureOk) { var (token, tree, allChars) = JustParseTree(stringText, options, conversionFailureOk); if (tree == null) @@ -148,42 +122,24 @@ private void TryParseSubTrees( { regex = new Regex(token.ValueText, options); } - catch (IndexOutOfRangeException) when (allowIndexOutOfRange) - { - // bug with .NET regex parser. Can happen with patterns like: (?<-0 - Assert.NotEmpty(tree.Diagnostics); - return treeAndText; - } - catch (NullReferenceException) when (allowNullReference) - { - // bug with .NET regex parser. can happen with patterns like: (?(?S)) - return treeAndText; - } - catch (OutOfMemoryException) when (allowOutOfMemory) - { - // bug with .NET regex parser. can happen with patterns like: a{2147483647,} - return treeAndText; - } catch (ArgumentException ex) { - if (!allowDiagnosticsMismatch) + Assert.NotEmpty(tree.Diagnostics); + + // Ensure the diagnostic we emit is the same as the .NET one. Note: we can only + // do this in en-US as that's the only culture where we control the text exactly + // and can ensure it exactly matches Regex. We depend on localization to do a + // good enough job here for other languages. + if (Thread.CurrentThread.CurrentCulture.Name == "en-US") { - Assert.NotEmpty(tree.Diagnostics); - - // Ensure the diagnostic we emit is the same as the .NET one. Note: we can only - // do this in en-US as that's the only culture where we control the text exactly - // and can ensure it exactly matches Regex. We depend on localization to do a - // good enough job here for other languages. - if (Thread.CurrentThread.CurrentCulture.Name == "en-US") - { - Assert.True(tree.Diagnostics.Any(d => ex.Message.Contains(d.Message))); - } + var result = tree.Diagnostics.Any(d => ex.Message.Contains(d.Message)); + Assert.True(result); } return treeAndText; } - if (!tree.Diagnostics.IsEmpty && !allowDiagnosticsMismatch) + if (!tree.Diagnostics.IsEmpty) { var expectedDiagnostics = CreateDiagnosticsElement(sourceText, tree); Assert.False(true, "Expected diagnostics: \r\n" + expectedDiagnostics.ToString().Replace(@"""", @"""""")); diff --git a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs index 89a9ac84bd145..dece27dde8038 100644 --- a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs +++ b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_BasicTests.cs @@ -506,7 +506,7 @@ public void TestOpenQuestion1() - + @@ -539,7 +539,7 @@ public void TestOpenQuestion2() - + @@ -575,7 +575,7 @@ public void TestOpenQuestion3() - + @@ -612,7 +612,7 @@ public void TestOpenQuestion4() - + @@ -1882,7 +1882,7 @@ public void TestLargeExactRangeNumericQuantifier1() - """, RegexOptions.None, runSubTreeTests: false, allowOutOfMemory: true); + """, RegexOptions.None); } [Fact] @@ -1906,13 +1906,13 @@ public void TestLargeExactRangeNumericQuantifier2() - + - """, RegexOptions.None, runSubTreeTests: false); + """, RegexOptions.None); } [Fact] @@ -1940,7 +1940,7 @@ public void TestLargeOpenRangeNumericQuantifier1() - """, RegexOptions.None, runSubTreeTests: false, allowOutOfMemory: true); + """, RegexOptions.None); } [Fact] @@ -1965,13 +1965,13 @@ public void TestLargeOpenRangeNumericQuantifier2() - + - """, RegexOptions.None, runSubTreeTests: false); + """, RegexOptions.None); } [Fact] @@ -2000,7 +2000,7 @@ public void TestLargeClosedRangeNumericQuantifier1() - """, RegexOptions.None, runSubTreeTests: false); + """, RegexOptions.None); } [Fact] @@ -2026,13 +2026,13 @@ public void TestLargeClosedRangeNumericQuantifier2() - + - """, RegexOptions.None, runSubTreeTests: false); + """, RegexOptions.None); } [Fact] @@ -2479,7 +2479,7 @@ public void TestDanglingNumericQuantifier1() - + @@ -2507,7 +2507,7 @@ public void TestDanglingNumericQuantifier2() - + @@ -2594,7 +2594,7 @@ public void TestAsteriskQuantifierAtStart() - + @@ -2625,7 +2625,7 @@ public void TestAsteriskQuantifierAtStartOfGroup() - + @@ -2682,7 +2682,7 @@ public void TestPlusQuantifierAtStart() - + @@ -2713,7 +2713,7 @@ public void TestPlusQuantifierAtStartOfGroup() - + @@ -2770,7 +2770,7 @@ public void TestQuestionQuantifierAtStart() - + @@ -2801,7 +2801,7 @@ public void TestQuestionQuantifierAtStartOfGroup() - + @@ -2863,7 +2863,7 @@ public void TestNumericQuantifierAtStart() - + @@ -2897,7 +2897,7 @@ public void TestNumericQuantifierAtStartOfGroup() - + @@ -3722,7 +3722,7 @@ public void TestHexEscape1() - + @@ -3752,7 +3752,7 @@ public void TestHexEscape2() - + @@ -3779,7 +3779,7 @@ public void TestHexEscape3() - + @@ -3809,7 +3809,7 @@ public void TestHexEscape4() - + @@ -4016,7 +4016,7 @@ public void TestHexEscape12() - + @@ -4072,7 +4072,7 @@ public void TestUnicodeEscape1() - + @@ -4099,7 +4099,7 @@ public void TestUnicodeEscape2() - + @@ -4126,7 +4126,7 @@ public void TestUnicodeEscape3() - + @@ -4153,7 +4153,7 @@ public void TestUnicodeEscape4() - + @@ -4234,7 +4234,7 @@ public void TestUnicodeEscape7() - + @@ -4264,7 +4264,7 @@ public void TestUnicodeEscape8() - + @@ -4294,7 +4294,7 @@ public void TestUnicodeEscape9() - + @@ -8138,13 +8138,14 @@ public void TestBalancingGrouping1() + - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8178,7 +8179,7 @@ public void TestBalancingGrouping2() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8211,7 +8212,7 @@ public void TestBalancingGrouping3() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8244,7 +8245,7 @@ public void TestBalancingGrouping4() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8274,7 +8275,7 @@ public void TestBalancingGrouping5() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8314,7 +8315,7 @@ public void TestBalancingGrouping6() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8360,7 +8361,7 @@ public void TestBalancingGrouping7() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8400,7 +8401,7 @@ public void TestBalancingGrouping8() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8430,7 +8431,7 @@ public void TestBalancingGrouping9() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8458,6 +8459,7 @@ public void TestBalancingGrouping10() + @@ -8466,7 +8468,7 @@ public void TestBalancingGrouping10() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8502,7 +8504,7 @@ public void TestBalancingGrouping11() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8537,7 +8539,7 @@ public void TestBalancingGrouping12() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8572,7 +8574,7 @@ public void TestBalancingGrouping13() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8604,7 +8606,7 @@ public void TestBalancingGrouping14() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8646,7 +8648,7 @@ public void TestBalancingGrouping15() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8694,7 +8696,7 @@ public void TestBalancingGrouping16() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8736,7 +8738,7 @@ public void TestBalancingGrouping17() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8768,7 +8770,7 @@ public void TestBalancingGrouping18() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8801,7 +8803,7 @@ public void TestBalancingGroupingUndefinedReference1() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8837,7 +8839,7 @@ public void TestBalancingGroupingDefinedReferenceBehind() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8873,7 +8875,7 @@ public void TestBalancingGroupingDefinedReferenceAhead() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8914,7 +8916,7 @@ public void TestBalancingGroupingNamedReferenceBehind() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8955,7 +8957,7 @@ public void TestBalancingGroupingNamedReferenceAhead() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -8995,7 +8997,7 @@ public void TestBalancingGroupingNumberedReferenceBehind() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9035,7 +9037,7 @@ public void TestBalancingGroupingNumberedReferenceAhead() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9098,7 +9100,7 @@ public void TestBalancingGroupingAutoNumberedExists() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9176,7 +9178,7 @@ public void TestBalancingGroupingAutoNumbers() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9259,7 +9261,7 @@ public void TestBalancingGroupingAutoNumbers1() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9342,7 +9344,7 @@ public void TestBalancingGroupingAutoNumbers2() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9430,7 +9432,7 @@ public void TestBalancingGroupingAutoNumbers3() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9508,7 +9510,7 @@ public void TestBalancingGroupingAutoNumbers4() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9585,7 +9587,7 @@ public void TestBalancingGroupingAutoNumbers5_1() - + @@ -9593,7 +9595,7 @@ public void TestBalancingGroupingAutoNumbers5_1() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9676,7 +9678,7 @@ public void TestBalancingGroupingAutoNumbers5() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9759,7 +9761,7 @@ public void TestBalancingGroupingAutoNumbers6() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9840,7 +9842,7 @@ public void TestBalancingGroupingAutoNumbers7_1() - + @@ -9849,7 +9851,7 @@ public void TestBalancingGroupingAutoNumbers7_1() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9937,7 +9939,7 @@ public void TestBalancingGroupingAutoNumbers7() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -9982,7 +9984,7 @@ public void TestReferenceToBalancingGroupCaptureName1() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -10025,7 +10027,7 @@ public void TestReferenceToBalancingGroupCaptureName2() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -10057,7 +10059,7 @@ public void TestReferenceToSameBalancingGroup() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -10117,7 +10119,7 @@ public void TestQuoteBalancingCapture1() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -10149,7 +10151,7 @@ public void TestQuoteBalancingCapture2() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -10188,7 +10190,7 @@ public void TestMismatchedOpenCloseCapture1() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -10227,7 +10229,7 @@ public void TestMismatchedOpenCloseCapture2() - """, RegexOptions.IgnorePatternWhitespace, allowIndexOutOfRange: true); + """, RegexOptions.IgnorePatternWhitespace); } [Fact] @@ -10285,7 +10287,7 @@ public void TestConditionalCapture2() - + @@ -10585,7 +10587,7 @@ public void TestConditionalCapture10() - + @@ -10616,7 +10618,7 @@ public void TestConditionalCapture11() - + @@ -11163,7 +11165,7 @@ public void TestCommentInConditionalGrouping1() - + @@ -11207,7 +11209,7 @@ public void TestCommentInConditionalGrouping2() - + @@ -11251,7 +11253,7 @@ public void TestCommentInConditionalGrouping3() - + @@ -13868,7 +13870,7 @@ public void TestCharacterClassRange7() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -14065,18 +14067,15 @@ public void TestCharacterClassRange13() [ - - - [:x:] - - - - - a - - + + [:x: + ] + + -a] + @@ -14312,8 +14311,8 @@ public void TestCharacterClassRange19() - - + + @@ -14354,8 +14353,8 @@ public void TestCharacterClassRange20() - - + + @@ -15634,7 +15633,7 @@ public void TestCharacterClassRange54() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -15675,7 +15674,7 @@ public void TestCharacterClassRange55() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -15720,7 +15719,7 @@ public void TestCharacterClassRange56() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -15761,7 +15760,7 @@ public void TestCharacterClassRange57() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -15806,7 +15805,7 @@ public void TestCharacterClassRange58() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -15848,7 +15847,7 @@ public void TestCharacterClassRange59() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -15894,7 +15893,7 @@ public void TestCharacterClassRange60() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -15936,7 +15935,7 @@ public void TestCharacterClassRange61() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -15980,7 +15979,7 @@ public void TestCharacterClassRange62() - """, RegexOptions.None, allowDiagnosticsMismatch: true); + """, RegexOptions.None); } [Fact] @@ -19305,5 +19304,33 @@ public void TestCategoryWithUnderscore() """, RegexOptions.None); } + + [Fact] + public void TestMinusAsCharacterClassStart() + { + Test(""" + @"[-[:L:]" + """, """ + + + + + [ + + + -[:L: + + + ] + + + + + + + + + """, RegexOptions.None); + } } } diff --git a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs index b70ccc59d18dc..012f6f412b595 100644 --- a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs +++ b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_DotnetNegativeTests.cs @@ -261,7 +261,7 @@ public void NegativeTest7() - + @@ -927,7 +927,7 @@ public void NegativeTest29() - + @@ -1163,7 +1163,7 @@ public void NegativeTest36() - + @@ -1204,7 +1204,7 @@ public void NegativeTest37() - + @@ -1250,7 +1250,7 @@ public void NegativeTest38() - + @@ -1300,7 +1300,7 @@ public void NegativeTest39() - + @@ -1354,7 +1354,7 @@ public void NegativeTest40() - + @@ -1378,23 +1378,33 @@ public void NegativeTest41() ( ? - + ( - ? - i + + + ? + + + i + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1422,7 +1432,7 @@ public void NegativeTest42() - + @@ -1444,23 +1454,33 @@ public void NegativeTest43() ( ? - + ( - ? - I + + + ? + + + I + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1475,23 +1495,33 @@ public void NegativeTest44() ( ? - + ( - ? - M + + + ? + + + M + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1506,23 +1536,33 @@ public void NegativeTest45() ( ? - + ( - ? - s + + + ? + + + s + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1537,23 +1577,33 @@ public void NegativeTest46() ( ? - + ( - ? - S + + + ? + + + S + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1568,23 +1618,33 @@ public void NegativeTest47() ( ? - + ( - ? - x + + + ? + + + x + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1599,23 +1659,33 @@ public void NegativeTest48() ( ? - + ( - ? - X + + + ? + + + X + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1630,23 +1700,33 @@ public void NegativeTest49() ( ? - + ( - ? - n + + + ? + + + n + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1661,23 +1741,33 @@ public void NegativeTest50() ( ? - + ( - ? - m + + + ? + + + m + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -1736,7 +1826,7 @@ public void NegativeTest52() - + @@ -1775,7 +1865,7 @@ public void NegativeTest53() - + @@ -2105,7 +2195,7 @@ public void NegativeTest62() - + @@ -2143,7 +2233,7 @@ public void NegativeTest63() - + @@ -2281,7 +2371,7 @@ public void NegativeTest66() - + @@ -2322,7 +2412,7 @@ public void NegativeTest67() - + @@ -2358,7 +2448,7 @@ public void NegativeTest68() - + @@ -2379,23 +2469,33 @@ public void NegativeTest69() ( ? - + ( - ? - N + + + ? + + + N + + ) - + ) + + + + - """, RegexOptions.None, allowNullReference: true); + """, RegexOptions.None); } [Fact] @@ -2447,7 +2547,7 @@ public void NegativeTest71() - + @@ -2544,7 +2644,7 @@ public void NegativeTest73() - + @@ -2689,7 +2789,7 @@ public void NegativeTest76() - + @@ -2765,7 +2865,7 @@ public void NegativeTest77() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] @@ -2826,7 +2926,7 @@ public void NegativeTest78() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] @@ -2887,7 +2987,7 @@ public void NegativeTest79() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] @@ -2948,7 +3048,7 @@ public void NegativeTest80() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] @@ -2988,7 +3088,7 @@ public void NegativeTest81() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] @@ -4779,7 +4879,7 @@ public void NegativeTest117() - + @@ -4806,7 +4906,7 @@ public void NegativeTest118() - + @@ -4833,7 +4933,7 @@ public void NegativeTest119() - + @@ -4860,7 +4960,7 @@ public void NegativeTest120() - + @@ -5324,7 +5424,7 @@ public void NegativeTest129() - + @@ -5377,7 +5477,7 @@ public void NegativeTest130() - + @@ -5721,7 +5821,7 @@ public void NegativeTest136() - + @@ -5784,7 +5884,7 @@ public void NegativeTest137() - """, RegexOptions.None, runSubTreeTests: false); + """, RegexOptions.None); } [Fact] diff --git a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_RealWorld.cs b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_RealWorld.cs index 8273ba798f170..f113fa03d36e6 100644 --- a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_RealWorld.cs +++ b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_RealWorld.cs @@ -37,7 +37,7 @@ public void TestRealWorldCases(string pattern, int options) public static IEnumerable GetRealWorldCases() { using var stream = typeof(CSharpRegexParserTests).Assembly.GetManifestResourceStream("Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.EmbeddedLanguages.RegularExpressions.Regex_RealWorldPatterns.json"); - using var streamReader = new StreamReader(stream); + using var streamReader = new StreamReader(stream!); using var textReader = new JsonTextReader(streamReader); foreach (var obj in JArray.Load(textReader)) diff --git a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs index cafb96fef8fe1..2111c17be5cab 100644 --- a/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs +++ b/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/CSharpRegexParserTests_ReferenceTests.cs @@ -1233,7 +1233,7 @@ public void ReferenceTest17() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] @@ -1295,7 +1295,7 @@ public void ReferenceTest18() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] @@ -1698,7 +1698,7 @@ public void ReferenceTest25() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] @@ -1984,7 +1984,7 @@ public void ReferenceTest31() - """, RegexOptions.None, allowIndexOutOfRange: true); + """, RegexOptions.None); } [Fact] diff --git a/src/EditorFeatures/CSharpTest2/Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests.csproj b/src/EditorFeatures/CSharpTest2/Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests.csproj index 11ac577797e61..c071e339d5755 100644 --- a/src/EditorFeatures/CSharpTest2/Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests.csproj +++ b/src/EditorFeatures/CSharpTest2/Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests.csproj @@ -1,10 +1,9 @@  - + - net472 - true + $(NetRoslyn) Library Microsoft.CodeAnalysis.Editor.CSharp.UnitTests @@ -18,27 +17,14 @@ - - - - + - - - - - - + - - - - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs b/src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs index d82b772dd5c41..32ebedb7b43c4 100644 --- a/src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs +++ b/src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs @@ -27,9 +27,9 @@ static KeywordRecommenderTests() { var recommender = Activator.CreateInstance(recommenderType); var field = recommenderType.GetField(nameof(AbstractSyntacticSingleKeywordRecommender.KeywordKind), BindingFlags.Public | BindingFlags.Instance); - var kind = (SyntaxKind)field.GetValue(recommender); + var kind = (SyntaxKind)field!.GetValue(recommender)!; - s_recommenderMap.Add(kind, (AbstractSyntacticSingleKeywordRecommender)recommender); + s_recommenderMap.Add(kind, (AbstractSyntacticSingleKeywordRecommender)recommender!); } catch { @@ -44,7 +44,7 @@ protected KeywordRecommenderTests() var kindName = name[..^"RecommenderTests".Length]; // e.g. ForEachKeywordRecommenderTests -> ForEachKeyword var field = typeof(SyntaxKind).GetField(kindName); - var kind = (SyntaxKind)field.GetValue(null); + var kind = (SyntaxKind)field!.GetValue(null)!; KeywordText = SyntaxFacts.GetText(kind); s_recommenderMap.TryGetValue(kind, out var recommender); diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/IRegexNodeVisitor.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/IRegexNodeVisitor.cs index 148a39f015021..8770faabbacd5 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/IRegexNodeVisitor.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/IRegexNodeVisitor.cs @@ -15,7 +15,6 @@ internal interface IRegexNodeVisitor void Visit(RegexNegatedCharacterClassNode node); void Visit(RegexCharacterClassRangeNode node); void Visit(RegexCharacterClassSubtractionNode node); - void Visit(RegexPosixPropertyNode node); void Visit(RegexWildcardNode node); void Visit(RegexZeroOrMoreQuantifierNode node); void Visit(RegexOneOrMoreQuantifierNode node); diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs index 7f7f28d1c11bf..d3c782e81d10b 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs @@ -304,16 +304,6 @@ public void Visit(RegexAnchorEscapeNode node) public void Visit(RegexTextNode node) => AddClassification(node.TextToken, ClassificationTypeNames.RegexText); - public void Visit(RegexPosixPropertyNode node) - { - // The .NET parser just interprets the [ of the node, and skips the rest. So - // classify the end part as a comment. - Context.AddClassification(ClassificationTypeNames.RegexText, node.TextToken.VirtualChars[0].Span); - Context.AddClassification( - ClassificationTypeNames.RegexComment, - GetSpan(node.TextToken.VirtualChars[1], node.TextToken.VirtualChars.Last())); - } - public void Visit(RegexAlternationNode node) { for (var i = 1; i < node.SequenceList.NodesAndTokens.Length; i += 2) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexKind.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexKind.cs index a63419c321a41..e5d3351caaf87 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexKind.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexKind.cs @@ -19,7 +19,6 @@ internal enum RegexKind NegatedCharacterClass, CharacterClassRange, CharacterClassSubtraction, - PosixProperty, ZeroOrMoreQuantifier, OneOrMoreQuantifier, diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexLexer.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexLexer.cs index 44d2103cebed6..056f1278ffb3b 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexLexer.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexLexer.cs @@ -299,7 +299,7 @@ public static bool IsEscapeCategoryChar(VirtualChar ch) if (error) { token = token.AddDiagnosticIfNone(new EmbeddedDiagnostic( - FeaturesResources.Capture_group_numbers_must_be_less_than_or_equal_to_Int32_MaxValue, + FeaturesResources.Quantifier_and_capture_group_numbers_must_be_less_than_or_equal_to_Int32_MaxValue, token.GetSpan())); } @@ -391,7 +391,7 @@ public RegexToken ScanHexCharacters(int count) if (length != count) { result = result.AddDiagnosticIfNone(new EmbeddedDiagnostic( - FeaturesResources.Insufficient_hexadecimal_digits, + FeaturesResources.Insufficient_or_invalid_hexadecimal_digits, GetTextSpan(beforeSlash, Position))); } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexNodes.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexNodes.cs index 7da5dd2a92426..d5debdeeacfda 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexNodes.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexNodes.cs @@ -238,35 +238,6 @@ public override void Accept(IRegexNodeVisitor visitor) => visitor.Visit(this); } -/// -/// Represents a ```[:...:]``` node in a character class. Note: the .NET regex parser -/// simply treats this as the character ```[``` and ignores the rest of the ```:...:]```. -/// They latter part has no impact on the actual match engine that is produced. -/// -internal sealed class RegexPosixPropertyNode : RegexPrimaryExpressionNode -{ - public RegexPosixPropertyNode(RegexToken textToken) - : base(RegexKind.PosixProperty) - { - Debug.Assert(textToken.Kind == RegexKind.TextToken); - TextToken = textToken; - } - - public RegexToken TextToken { get; } - - internal override int ChildCount => 1; - - internal override RegexNodeOrToken ChildAt(int index) - => index switch - { - 0 => TextToken, - _ => throw new InvalidOperationException(), - }; - - public override void Accept(IRegexNodeVisitor visitor) - => visitor.Visit(this); -} - /// /// Root of all expression nodes. /// @@ -1093,14 +1064,14 @@ internal abstract class RegexConditionalGroupingNode : RegexQuestionGroupingNode { protected RegexConditionalGroupingNode( RegexKind kind, RegexToken openParenToken, RegexToken questionToken, - RegexExpressionNode result, RegexToken closeParenToken) + RegexAlternationNode result, RegexToken closeParenToken) : base(kind, openParenToken, questionToken, closeParenToken) { Debug.Assert(result != null); Result = result; } - public RegexExpressionNode Result { get; } + public RegexAlternationNode Result { get; } } /// @@ -1111,7 +1082,7 @@ internal sealed class RegexConditionalCaptureGroupingNode : RegexConditionalGrou public RegexConditionalCaptureGroupingNode( RegexToken openParenToken, RegexToken questionToken, RegexToken innerOpenParenToken, RegexToken captureToken, RegexToken innerCloseParenToken, - RegexExpressionNode result, RegexToken closeParenToken) + RegexAlternationNode result, RegexToken closeParenToken) : base(RegexKind.ConditionalCaptureGrouping, openParenToken, questionToken, result, closeParenToken) { Debug.Assert(innerOpenParenToken.Kind == RegexKind.OpenParenToken); @@ -1150,9 +1121,11 @@ public override void Accept(IRegexNodeVisitor visitor) internal sealed class RegexConditionalExpressionGroupingNode : RegexConditionalGroupingNode { public RegexConditionalExpressionGroupingNode( - RegexToken openParenToken, RegexToken questionToken, + RegexToken openParenToken, + RegexToken questionToken, RegexGroupingNode grouping, - RegexExpressionNode result, RegexToken closeParenToken) + RegexAlternationNode result, + RegexToken closeParenToken) : base(RegexKind.ConditionalExpressionGrouping, openParenToken, questionToken, result, closeParenToken) { Debug.Assert(grouping != null); diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs index 629da0fe12c81..1e5bb6f880021 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs @@ -577,7 +577,7 @@ private RegexPrimaryExpressionNode ParsePrimaryExpression(RegexExpressionNode? l RegexKind.DollarToken => ParseEndAnchor(), RegexKind.BackslashToken => ParseEscape(_currentToken, allowTriviaAfterEnd: true), RegexKind.OpenBracketToken => ParseCharacterClass(), - RegexKind.OpenParenToken => ParseGrouping(), + RegexKind.OpenParenToken => ParseGrouping(inConditionalExpression: false), RegexKind.CloseParenToken => ParseUnexpectedCloseParenToken(), RegexKind.OpenBraceToken => ParsePossibleUnexpectedNumericQuantifier(lastExpression), RegexKind.AsteriskToken or RegexKind.PlusToken or RegexKind.QuestionToken => ParseUnexpectedQuantifier(lastExpression), @@ -645,7 +645,7 @@ private RegexPrimaryExpressionNode ParseWildcard() return new RegexWildcardNode(ConsumeCurrentToken(allowTrivia: true)); } - private RegexGroupingNode ParseGrouping() + private RegexGroupingNode ParseGrouping(bool inConditionalExpression) { var start = _lexer.Position; @@ -656,7 +656,7 @@ private RegexGroupingNode ParseGrouping() switch (_currentToken.Kind) { case RegexKind.QuestionToken: - return ParseGroupQuestion(openParenToken, _currentToken); + return ParseGroupQuestion(openParenToken, _currentToken, inConditionalExpression); default: // Wasn't (? just parse this as a normal group. @@ -713,12 +713,15 @@ private readonly TextSpan GetTokenStartPositionSpan(RegexToken token) : new TextSpan(token.VirtualChars[0].Span.Start, 0); } - private RegexGroupingNode ParseGroupQuestion(RegexToken openParenToken, RegexToken questionToken) + private RegexGroupingNode ParseGroupQuestion( + RegexToken openParenToken, RegexToken questionToken, bool inConditionalExpression) { - var optionsToken = _lexer.TryScanOptions(); - if (optionsToken != null) + // Corresponds to check at: https://github.com/dotnet/runtime/blob/7790117932dc14aaeb2fc82aff6c0dc6c74ce434/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs#L1003 + if (!inConditionalExpression) { - return ParseOptionsGroupingNode(openParenToken, questionToken, optionsToken.Value); + var optionsToken = _lexer.TryScanOptions(); + if (optionsToken != null) + return ParseOptionsGroupingNode(openParenToken, questionToken, optionsToken.Value); } var afterQuestionPos = _lexer.Position; @@ -803,7 +806,7 @@ private RegexConditionalGroupingNode ParseConditionalGrouping(RegexToken openPar if (!HasCapture((int)capture.Value)) { capture = capture.AddDiagnosticIfNone(new EmbeddedDiagnostic( - FeaturesResources.Reference_to_undefined_group, + string.Format(FeaturesResources.Conditional_alternation_refers_to_an_undefined_group_number_0, capture.VirtualChars.First()), capture.GetSpan())); } } @@ -811,7 +814,7 @@ private RegexConditionalGroupingNode ParseConditionalGrouping(RegexToken openPar { innerCloseParenToken = CreateMissingToken(RegexKind.CloseParenToken); capture = capture.AddDiagnosticIfNone(new EmbeddedDiagnostic( - FeaturesResources.Malformed, + string.Format(FeaturesResources.Conditional_alternation_is_missing_a_closing_parenthesis_after_the_group_number_0, capture.VirtualChars.First()), capture.GetSpan())); MoveBackBeforePreviousScan(); } @@ -916,7 +919,7 @@ private RegexConditionalGroupingNode ParseConditionalExpressionGrouping( // Parse out the grouping that starts with the second open paren in (?( // this will get us to (?(...) - var grouping = ParseGrouping(); + var grouping = ParseGrouping(inConditionalExpression: true); // Now parse out the embedded expression that follows that. this will get us to // (?(...)... @@ -928,7 +931,7 @@ private RegexConditionalGroupingNode ParseConditionalExpressionGrouping( grouping, result, ParseGroupingCloseParen()); } - private RegexExpressionNode ParseConditionalGroupingResult() + private RegexAlternationNode ParseConditionalGroupingResult() { var currentOptions = _options; var result = this.ParseAlternatingSequences(consumeCloseParen: false, isConditional: true); @@ -1036,7 +1039,7 @@ private RegexToken ParseCaptureGroupingCloseToken(ref RegexToken openParenToken, if (_currentToken.Kind == RegexKind.EndOfFile) { - openParenToken = openParenToken.AddDiagnosticIfNone(new EmbeddedDiagnostic( + openParenToken = openParenToken.AddDiagnosticIfMissing(new EmbeddedDiagnostic( FeaturesResources.Unrecognized_grouping_construct, GetSpan(openParenToken, openToken))); } @@ -1370,12 +1373,6 @@ private static bool TryGetRangeComponentValueWorker(RegexNode component, out int ch = GetCharValue(((RegexUnicodeEscapeNode)component).HexText, withBase: 16); return true; - case RegexKind.PosixProperty: - // When the native parser sees [:...:] it treats this as if it just saw '[' and skipped the - // rest. - ch = '['; - return true; - case RegexKind.Text: ch = ((RegexTextNode)component).TextToken.VirtualChars[0].Value; return true; @@ -1538,36 +1535,6 @@ private RegexPrimaryExpressionNode ParseSingleCharacterClassComponent(bool isFir ConsumeCurrentToken(allowTrivia: false)); } - // From the .NET regex code: - // This is code for Posix style properties - [:Ll:] or [:IsTibetan:]. - // It currently doesn't do anything other than skip the whole thing! - if (!afterRangeMinus && _currentToken.Kind == RegexKind.OpenBracketToken && _lexer.IsAt(":")) - { - var beforeBracketPos = _lexer.Position - 1; - // trivia is not allowed anywhere in a character class - ConsumeCurrentToken(allowTrivia: false); - - var captureName = _lexer.TryScanCaptureName(); - if (captureName.HasValue && _lexer.IsAt(":]")) - { - _lexer.Position += 2; - var textChars = _lexer.GetSubPattern(beforeBracketPos, _lexer.Position); - var token = CreateToken(RegexKind.TextToken, [], textChars); - - // trivia is not allowed anywhere in a character class - ConsumeCurrentToken(allowTrivia: false); - return new RegexPosixPropertyNode(token); - } - else - { - // Reset to back where we were. - // trivia is not allowed anywhere in a character class - _lexer.Position = beforeBracketPos; - ConsumeCurrentToken(allowTrivia: false); - Debug.Assert(_currentToken.Kind == RegexKind.OpenBracketToken); - } - } - // trivia is not allowed anywhere in a character class return new RegexTextNode( ConsumeCurrentToken(allowTrivia: false).With(kind: RegexKind.TextToken)); @@ -2046,7 +2013,7 @@ private static void CheckQuantifierExpression(RegexExpressionNode? current, ref current.Kind == RegexKind.SimpleOptionsGrouping) { token = token.AddDiagnosticIfNone(new EmbeddedDiagnostic( - FeaturesResources.Quantifier_x_y_following_nothing, token.GetSpan())); + string.Format(FeaturesResources.Quantifier_0_following_nothing, token.VirtualChars.First()), token.GetSpan())); } else if (current is RegexQuantifierNode or RegexLazyQuantifierNode) { diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index 4b3c92533f5df..d335bd56d7da9 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -1750,8 +1750,8 @@ If the "H" format specifier is used without other custom format specifiers, it's Cannot include class \{0} in character range This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-\w]. {0} is the invalid class (\w here) - - Capture group numbers must be less than or equal to Int32.MaxValue + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} @@ -1770,18 +1770,22 @@ If the "H" format specifier is used without other custom format specifiers, it's Incomplete \p{X} character escape This is an error message shown to the user when they write an invalid Regular Expression. Example: \p{ Cc } - - Insufficient hexadecimal digits + + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x 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) - - malformed + + Conditional alternation is missing a closing parenthesis after the group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Malformed \p{X} character escape This is an error message shown to the user when they write an invalid Regular Expression. Example: \p {Cc} @@ -1795,23 +1799,19 @@ If the "H" format specifier is used without other custom format specifiers, it's This is an error message shown to the user when they write an invalid Regular Expression. Example: \c - Nested quantifier {0} + Nested quantifier '{0}' This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. Not enough )'s This is an error message shown to the user when they write an invalid Regular Expression. Example: (a - - Quantifier {x,y} following nothing + + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * - - reference to undefined group - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} + Reference to undefined group name '{0}' This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 85a7397f6a55c..9834783b76e7e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -350,11 +350,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Nejde navigovat k symbolu pod stříškou. - - Capture group numbers must be less than or equal to Int32.MaxValue - Čísla skupin digitalizace musí být menší nebo rovny hodnotě Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero Počet zachytávání nemůže být nulový @@ -510,6 +505,16 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Komentáře nejsou povolené + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style Nakonfigurovat styl kódu {0} @@ -950,9 +955,9 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Dočasná vložená proměnná - - Insufficient hexadecimal digits - Nedostatek šestnáctkových číslic + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Nastavení metody jako asynchronní vyžaduje restartování aplikace, protože tuto akci modul runtime nepodporuje. - - malformed - chybný formát - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Chybně formátovaná řídicí sekvence znaků \p{X} @@ -1241,8 +1241,8 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn - Nested quantifier {0} - Vnořený kvantifikátor {0} + Nested quantifier '{0}' + Vnořený kvantifikátor {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Vyžádat vybrané členy až do {0} - - Quantifier {x,y} following nothing - Před kvantifikátorem {x,y} není nic uvedeno. + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Dotaz - - reference to undefined group - odkaz na nedefinovanou skupinu - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - Odkaz na nedefinovaný název skupiny {0} + Reference to undefined group name '{0}' + Odkaz na nedefinovaný název skupiny {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Odkaz na nedefinované číslo skupiny {0} + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index 7f204e2265b53..a391220d79418 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -350,11 +350,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Navigieren zu dem Symbol unter dem Caret nicht möglich. - - Capture group numbers must be less than or equal to Int32.MaxValue - Erfassungsgruppennummern müssen kleiner oder gleich Int32.MaxValue sein. - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero Aufzeichnungsnummer darf nicht 0 (null) sein. @@ -510,6 +505,16 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Nicht zulässige Kommentare + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style Codeformat "{0}" konfigurieren @@ -950,9 +955,9 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Inline temporär variabel - - Insufficient hexadecimal digits - Nicht genügend Hexadezimalziffern. + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Festlegen einer Methode als asynchron erfordert einen Neustart der Anwendung, da es von der Laufzeit nicht unterstützt wird. - - malformed - fehlerhaft - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Falsch formatiertes \p{X}-Escapezeichen. @@ -1241,8 +1241,8 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d - Nested quantifier {0} - Geschachtelter Quantifizierer {0}. + Nested quantifier '{0}' + Geschachtelter Quantifizierer {0}. This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Ausgewählte Elemente bis {0} ziehen - - Quantifier {x,y} following nothing - Quantifizierer {x,y} nach nichts. + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Abfrage - - reference to undefined group - Verweis auf nicht definierte Gruppe - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - Verweis auf nicht definierten Gruppennamen {0} + Reference to undefined group name '{0}' + Verweis auf nicht definierten Gruppennamen {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Verweis auf nicht definierte Gruppennummer {0} + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 26d3746dc168b..650833edcb06e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -350,11 +350,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa No se puede navegar al símbolo que hay debajo del símbolo de intercalación. - - Capture group numbers must be less than or equal to Int32.MaxValue - La captura de números de grupo deben ser menor o igual a Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero La captura de número no puede ser cero @@ -510,6 +505,16 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Comentarios no permitidos + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style Configurar el estilo de código de {0} @@ -950,9 +955,9 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Variable temporal en línea - - Insufficient hexadecimal digits - Insuficientes dígitos hexadecimales + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para convertir un método en asincrónico, es necesario reiniciar la aplicación porque no es compatible con el tiempo de ejecución. - - malformed - con formato incorrecto - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Escape de carácter incorrecto \p{X} @@ -1241,8 +1241,8 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa - Nested quantifier {0} - Cuantificador anidado {0} + Nested quantifier '{0}' + Cuantificador anidado {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Subir miembros seleccionados hasta {0} - - Quantifier {x,y} following nothing - Cuantificador {x,y} después de nada + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Consulta - - reference to undefined group - referencia al grupo no definido - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - Referencia a nombre de grupo no definido {0} + Reference to undefined group name '{0}' + Referencia a nombre de grupo no definido {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Referencia al número de grupo indefinido {0} + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index 95e8055573e62..7f293261e1089 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -350,11 +350,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Impossible de naviguer jusqu'au symbole sous le caret. - - Capture group numbers must be less than or equal to Int32.MaxValue - Les nombres de groupe de capture doivent être inférieurs ou égaux à Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero Le nombre de captures ne peut pas être égal à zéro @@ -510,6 +505,16 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Commentaires non autorisés + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style Configurer le style de code {0} @@ -950,9 +955,9 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Variable temporaire inline - - Insufficient hexadecimal digits - Chiffres hexadécimaux insuffisants + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai La création d’une méthode asynchrone nécessite le redémarrage de l’application, car elle n’est pas prise en charge par le runtime. - - malformed - incorrecte - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Caractère d'échappement incorrect \p{X} @@ -1241,8 +1241,8 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai - Nested quantifier {0} - Quantificateur imbriqué {0} + Nested quantifier '{0}' + Quantificateur imbriqué {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Extraire les membres sélectionnés jusqu’à {0} - - Quantifier {x,y} following nothing - Le quantificateur {x,y} ne suit rien + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Requête - - reference to undefined group - référence à un groupe indéfini - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - Référence au nom de groupe indéfini {0} + Reference to undefined group name '{0}' + Référence au nom de groupe indéfini {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Référence à un numéro de groupe indéfini {0} + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index e800c530aeec8..1bbd3b65f2cb1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -350,11 +350,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Non è possibile passare al simbolo sotto il punto di inserimento. - - Capture group numbers must be less than or equal to Int32.MaxValue - I numeri del gruppo Capture devono essere minori o uguali a Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero Il numero di acquisizioni non può essere zero @@ -510,6 +505,16 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Commenti non consentiti + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style Configura lo stile del codice di {0} @@ -950,9 +955,9 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Variabile temporanea inline - - Insufficient hexadecimal digits - Cifre esadecimali insufficienti + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Per rendere un metodo asincrono, è necessario riavviare l'applicazione perché non è supportata dal runtime. - - malformed - non valido - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Sequenza di caratteri di escape \\p{X} non valida @@ -1241,8 +1241,8 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa - Nested quantifier {0} - Quantificatore nidificato {0} + Nested quantifier '{0}' + Quantificatore nidificato {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Pull dei membri selezionati fino a {0} - - Quantifier {x,y} following nothing - Il quantificatore {x,y} non segue alcun elemento + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Query - - reference to undefined group - riferimento a gruppo indefinito - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - Riferimento a nome di gruppo indefinito: {0} + Reference to undefined group name '{0}' + Riferimento a nome di gruppo indefinito: {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Riferimento a numero di gruppo indefinito: {0} + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index a7894ceb4119a..71c1758ed1c58 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -350,11 +350,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma カレットの下のシンボルに移動できません。 - - Capture group numbers must be less than or equal to Int32.MaxValue - キャプチャ グループ番号は Int32.MaxValue 以下でなければなりません - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero キャプチャ番号を 0 にすることはできません @@ -510,6 +505,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma コメントは使用できません + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style {0} コード スタイルの構成 @@ -950,9 +955,9 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma インラインの一時変数 - - Insufficient hexadecimal digits - 16 進数の数字が正しくありません + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ランタイムでサポートされていないため、メソッドを非同期にするには、アプリケーションを再起動する必要があります。 - - malformed - 不正な形式 - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape 間違った形式の \p{X} エスケープ文字です @@ -1241,8 +1241,8 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma - Nested quantifier {0} - 入れ子になった量指定子 {0} + Nested quantifier '{0}' + 入れ子になった量指定子 {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 選択したメンバーを最大 {0} 人選出 - - Quantifier {x,y} following nothing - 量指定子 {x,y} の前に何もありません + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query クエリ - - reference to undefined group - 未定義のグループへの参照 - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - 未定義のグループ名 {0} への参照 + Reference to undefined group name '{0}' + 未定義のグループ名 {0} への参照 This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - 未定義のグループ番号 {0} への参照 + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index 7d7b7f3698995..ecdf5d6fd26a9 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -350,11 +350,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 캐럿에서 기호를 탐색할 수 없습니다. - - Capture group numbers must be less than or equal to Int32.MaxValue - 캡처 그룹 번호는 Int32.MaxValue보다 작거나 같아야 합니다. - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero 캡처 번호는 0일 수 없습니다. @@ -510,6 +505,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 주석이 허용되지 않습니다. + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style {0} 코드 스타일 구성 @@ -950,9 +955,9 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 인라인 임시 변수 - - Insufficient hexadecimal digits - 16진수가 부족합니다. + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 런타임에서 지원하지 않기 때문에 메서드를 비동기화하려면 애플리케이션을 다시 시작해야 합니다. - - malformed - 형식이 잘못되었습니다. - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape 형식이 잘못된 \p{X} 문자 이스케이프 @@ -1241,8 +1241,8 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma - Nested quantifier {0} - 중첩 수량자 {0}입니다. + Nested quantifier '{0}' + 중첩 수량자 {0}입니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 선택한 멤버를 최대 {0}까지 끌어오기 - - Quantifier {x,y} following nothing - 수량자 {x,y} 앞에 아무 것도 없습니다. + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query 쿼리 - - reference to undefined group - 정의되지 않은 그룹에 대한 참조 - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - 정의되지 않은 그룹 이름 {0}에 대한 참조입니다. + Reference to undefined group name '{0}' + 정의되지 않은 그룹 이름 {0}에 대한 참조입니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - 정의되지 않은 그룹 번호 {0}을(를) 참조합니다. + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index 7867a63c08500..e0cfca5c78eab 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -350,11 +350,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Nie można przejść do symbolu pod karetką. - - Capture group numbers must be less than or equal to Int32.MaxValue - Wartość przechwytywania numerów grup musi być mniejsza lub równa wartości Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero Numer przechwytywania nie może być równy zeru @@ -510,6 +505,16 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Komentarze są niedozwolone + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style Konfiguruj styl kodu {0} @@ -950,9 +955,9 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Wstawiona zmienna tymczasowa - - Insufficient hexadecimal digits - Zbyt mało cyfr szesnastkowych + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Ustanawianie metody asynchroniczną wymaga ponownego uruchomienia aplikacji, ponieważ nie jest to obsługiwane przez środowisko uruchomieniowe. - - malformed - źle sformułowane - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Źle sformułowana sekwencja ucieczki znaku \p{X} @@ -1241,8 +1241,8 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k - Nested quantifier {0} - Zagnieżdżony kwantyfikator {0} + Nested quantifier '{0}' + Zagnieżdżony kwantyfikator {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Wyciągnij wybrane elementy składowe w górę do {0} - - Quantifier {x,y} following nothing - Nic nie występuje przed kwantyfikatorem {x,y} + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Zapytanie - - reference to undefined group - odwołanie do niezdefiniowanej grupy - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - Odwołanie do niezdefiniowanej nazwy grupy {0} + Reference to undefined group name '{0}' + Odwołanie do niezdefiniowanej nazwy grupy {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Odwołanie do niezdefiniowanego numeru grupy {0} + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index 1653d6f144cbd..df56fda2243d2 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -350,11 +350,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Não é possível navegar para o símbolo sob o cursor. - - Capture group numbers must be less than or equal to Int32.MaxValue - Os números do grupo de captura devem ser menores ou iguais a Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero O número da captura não pode ser zero @@ -510,6 +505,16 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Comentários não permitidos + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style Configurar estilo de código de {0} @@ -950,9 +955,9 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Variável temporária embutida - - Insufficient hexadecimal digits - Dígitos hexadecimais insuficientes + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Tornar um método assíncrono requer reiniciar o aplicativo porque não há suporte para o tempo de execução. - - malformed - malformado - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Escape de caractere malformado \p{X} @@ -1241,8 +1241,8 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess - Nested quantifier {0} - Quantificador aninhado {0} + Nested quantifier '{0}' + Quantificador aninhado {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Efetuar pull dos membros selecionados para {0} - - Quantifier {x,y} following nothing - Nada precede o quantificador {x,y} + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Consulta - - reference to undefined group - referência a grupo indefinido - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - Referência ao nome do grupo indefinido {0} + Reference to undefined group name '{0}' + Referência ao nome do grupo indefinido {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Referência ao grupo número {0} indefinido + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 649d54ec65dfe..be341769892e1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -350,11 +350,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Не удается перейти к символу, на котором находится курсор. - - Capture group numbers must be less than or equal to Int32.MaxValue - Номера групп записи должны быть меньше или равны Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero Номер записи не может быть равен нулю @@ -510,6 +505,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Комментарии не разрешены + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style Настройка стиля кода {0} @@ -950,9 +955,9 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Встроить временную переменную - - Insufficient hexadecimal digits - Недостаточно шестнадцатеричных цифр + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Чтобы сделать метод асинхронным, требуется перезапустить приложение, так как это не поддерживается средой выполнения. - - malformed - Ошибка в регулярном выражении - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Неправильная escape-последовательность \p{X} @@ -1241,8 +1241,8 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma - Nested quantifier {0} - Вложенный квантификатор {0} + Nested quantifier '{0}' + Вложенный квантификатор {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Вытянуть выбранные элементы до {0} - - Quantifier {x,y} following nothing - Отсутствуют элементы перед квантификатором {x,y} + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Запрос - - reference to undefined group - Ссылка на неопределенную группу - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - Ссылка на неопределенное имя группы {0} + Reference to undefined group name '{0}' + Ссылка на неопределенное имя группы {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Ссылка на неопределенный номер группы {0} + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index 966d58dddc4ee..f35b8034505de 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -350,11 +350,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Giriş işareti altında sembole gidilemiyor. - - Capture group numbers must be less than or equal to Int32.MaxValue - Yakalama grup numaraları Int32.MaxValue eşit veya daha az olmalıdır - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero Yakalama numarası sıfır olamaz @@ -510,6 +505,16 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Açıklamalara izin verilmiyor + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style {0} kod stilini yapılandır @@ -950,9 +955,9 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Satır içi geçici değişken - - Insufficient hexadecimal digits - Yetersiz onaltılık basamak + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Bir metodu zaman uyumsuz yapmak çalışma zamanı tarafından desteklenmediğinden uygulamanın yeniden başlatılmasını gerektirir. - - malformed - Hatalı biçimlendirilmiş - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape Hatalı biçimlendirilmiş \p{X} karakter kaçış @@ -1241,8 +1241,8 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be - Nested quantifier {0} - İç içe geçmiş niceleyici {0} + Nested quantifier '{0}' + İç içe geçmiş niceleyici {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Seçili üyeleri {0} öğesine yukarı çek - - Quantifier {x,y} following nothing - Niceleyici {x,y} hiçbir şeyi takip etmiyor + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query Sorgu - - reference to undefined group - tanımsız grubuna başvuru - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - {0} tanımsız grup adı referansı + Reference to undefined group name '{0}' + {0} tanımsız grup adı referansı This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - Tanımlanmamış grup numarası {0} referansı + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index d8e90bcbe0a66..0e36fce0e293d 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -350,11 +350,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 无法导航到插入点下面的符号。 - - Capture group numbers must be less than or equal to Int32.MaxValue - 捕获组编号必须小于等于 Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero 捕获编号不能为零 @@ -510,6 +505,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 不允许注释 + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style 配置 {0} 代码样式 @@ -950,9 +955,9 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 内联临时变量 - - Insufficient hexadecimal digits - 无效的十六进制数字 + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 使方法异步需要重启应用程序,因为运行时不支持此操作。 - - malformed - 格式错误 - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape \p{X} 字符转义格式错误 @@ -1241,8 +1241,8 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma - Nested quantifier {0} - 嵌套限定符 {0} + Nested quantifier '{0}' + 嵌套限定符 {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 将所选成员向上拉取到 {0} - - Quantifier {x,y} following nothing - 限定符 {x,y} 前没有任何内容 + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query 查询 - - reference to undefined group - 对未定义组的引用 - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - 对未定义的组名 {0} 的引用 + Reference to undefined group name '{0}' + 对未定义的组名 {0} 的引用 This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - 对未定义的组编号 {0} 的引用 + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index b6d645a30c461..bb342ea2e488f 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -350,11 +350,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 無法巡覽至插入號下的符號。 - - Capture group numbers must be less than or equal to Int32.MaxValue - 擷取群組號碼必須小於或等於 Int32.MaxValue - This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} - Capture number cannot be zero 擷取號碼不可為零 @@ -510,6 +505,16 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 不允許的註解 + + Conditional alternation is missing a closing parenthesis after the group number {0} + Conditional alternation is missing a closing parenthesis after the group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 + + + Conditional alternation refers to an undefined group number {0} + Conditional alternation refers to an undefined group number {0} + This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)\1)) + Configure {0} code style 設定 {0} 程式碼樣式 @@ -950,9 +955,9 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 內嵌暫存變數 - - Insufficient hexadecimal digits - 十六進位數位不足 + + Insufficient or invalid hexadecimal digits + Insufficient or invalid hexadecimal digits This is an error message shown to the user when they write an invalid Regular Expression. Example: \x @@ -1050,11 +1055,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 因為執行時間不支援,所以製作非同步方法需要重新開機應用程式。 - - malformed - 語式錯誤 - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(0 - Malformed \p{X} character escape \p{X} 字元逸出語式錯誤 @@ -1241,8 +1241,8 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma - Nested quantifier {0} - 巢狀數量詞 {0} + Nested quantifier '{0}' + 巢狀數量詞 {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: a**. In this case {0} will be '*', the extra unnecessary quantifier. @@ -1340,29 +1340,29 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 將選取的成員最多提取 {0} - - Quantifier {x,y} following nothing - 數量詞 {x,y} 前面沒有任何項目 + + Quantifier '{0}' following nothing + Quantifier '{0}' following nothing This is an error message shown to the user when they write an invalid Regular Expression. Example: * + + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + Quantifier and capture group numbers must be less than or equal to Int32.MaxValue + This is an error message shown to the user when they write an invalid Regular Expression. Example: a{2147483648} + Query 查詢 - - reference to undefined group - 對未定義群組的參考 - This is an error message shown to the user when they write an invalid Regular Expression. Example: (?(1)) - - Reference to undefined group name {0} - 對未定義群組名稱 {0} 的參考 + Reference to undefined group name '{0}' + 對未定義群組名稱 {0} 的參考 This is an error message shown to the user when they write an invalid Regular Expression. Example: \k<a>. Here, {0} will be the name of the undefined group ('a') Reference to undefined group number {0} - 參考未定義的群組號碼 {0} + Reference to undefined group number {0} This is an error message shown to the user when they write an invalid Regular Expression. Example: (?<-1>). Here, {0} will be the number of the undefined group ('1') diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs index c53fd40c306e6..b17f4d4bd1235 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs @@ -17,43 +17,4 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Common; /// for the range of characters for '\\p{0}' (even though the regex engine would only see the \\ /// translated as a virtual char to the single \ character. /// -internal readonly struct EmbeddedDiagnostic : IEquatable -{ - public readonly string Message; - public readonly TextSpan Span; - - public EmbeddedDiagnostic(string message, TextSpan span) - { - RoslynDebug.AssertNotNull(message); - Message = message; - Span = span; - } - - public override bool Equals(object? obj) - => obj is EmbeddedDiagnostic diagnostic && Equals(diagnostic); - - public bool Equals(EmbeddedDiagnostic other) - => Message == other.Message && - Span.Equals(other.Span); - - public override string ToString() - => Message; - - public override int GetHashCode() - { - unchecked - { - var hashCode = -954867195; - hashCode = hashCode * -1521134295 + base.GetHashCode(); - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Message); - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Span); - return hashCode; - } - } - - public static bool operator ==(EmbeddedDiagnostic diagnostic1, EmbeddedDiagnostic diagnostic2) - => diagnostic1.Equals(diagnostic2); - - public static bool operator !=(EmbeddedDiagnostic diagnostic1, EmbeddedDiagnostic diagnostic2) - => !(diagnostic1 == diagnostic2); -} +internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs index 2150fd617a93c..0d5f809823480 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs @@ -50,6 +50,9 @@ public EmbeddedSyntaxToken( public EmbeddedSyntaxToken AddDiagnosticIfNone(EmbeddedDiagnostic diagnostic) => Diagnostics.Length > 0 ? this : WithDiagnostics([diagnostic]); + public EmbeddedSyntaxToken AddDiagnosticIfMissing(EmbeddedDiagnostic diagnostic) + => Diagnostics.Contains(diagnostic) ? this : With(diagnostics: this.Diagnostics.Add(diagnostic)); + public EmbeddedSyntaxToken WithDiagnostics(ImmutableArray diagnostics) => With(diagnostics: diagnostics);