diff --git a/docs/project/list-of-diagnostics.md b/docs/project/list-of-diagnostics.md index 6e927f4a65ee6..888f93dd0c90b 100644 --- a/docs/project/list-of-diagnostics.md +++ b/docs/project/list-of-diagnostics.md @@ -90,7 +90,7 @@ The PR that reveals the implementation of the ` diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs index bcdf77aa6aa02..48167f42d04f6 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs @@ -339,7 +339,7 @@ internal static bool TypeOfScriptObject_IsAssignableFrom(Type type) => public static readonly string NewObjectId = string.Empty; public const string NullObjectId = null; public const string FullSRSInternalsVisiblePattern = @"^[\s]*System\.Runtime\.Serialization[\s]*,[\s]*PublicKey[\s]*=[\s]*(?i:00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab)[\s]*$"; - [RegexGenerator(FullSRSInternalsVisiblePattern)] + [GeneratedRegex(FullSRSInternalsVisiblePattern)] public static partial Regex FullSRSInternalsVisibleRegex(); public const string Space = " "; public const string XsiPrefix = "i"; diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs b/src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs index 8e0219f4cc6d5..faaac5c18c7fb 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs @@ -1342,7 +1342,7 @@ private static bool MatchEnumeration(DateTime value, ArrayList enumeration, XmlS internal sealed partial class StringFacetsChecker : FacetsChecker { //All types derived from string & anyURI - [RegexGenerator("^([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*$", RegexOptions.ExplicitCapture)] + [GeneratedRegex("^([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*$", RegexOptions.ExplicitCapture)] private static partial Regex LanguageRegex(); internal override Exception? CheckValueFacets(object value, XmlSchemaDatatype datatype) diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/SourceInfo.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/SourceInfo.cs index 8ac018eccc7fe..971b9184216f1 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/SourceInfo.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/SourceInfo.cs @@ -15,11 +15,11 @@ internal sealed partial class SourceInfo { //a[ia] //((global::System.Xml.Serialization.XmlSerializerNamespaces)p[0]) - [RegexGenerator("([(][(](?[^)]+)[)])?(?[^[]+)[[](?.+)[]][)]?")] + [GeneratedRegex("([(][(](?[^)]+)[)])?(?[^[]+)[[](?.+)[]][)]?")] private static partial Regex Regex1(); //((global::Microsoft.CFx.Test.Common.TypeLibrary.IXSType_9)o), @"IXSType_9", @"", true, true); - [RegexGenerator("[(][(](?[^)]+)[)](?[^)]+)[)]")] + [GeneratedRegex("[(][(](?[^)]+)[)](?[^)]+)[)]")] private static partial Regex Regex2(); private static readonly Lazy s_iListGetItemMethod = new Lazy( diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs index 0e2fc049cde5c..7b39193b4a72d 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs @@ -2704,10 +2704,10 @@ private void WriteSourceBeginTyped(string source, TypeDesc? typeDesc) WriteSourceBegin(source); } - [RegexGenerator("(?[^ ]+) = .+EnsureArrayIndex[(](?[^,]+), (?[^,]+),[^;]+;(?[^[]+)[[](?[^+]+)[+][+][]]")] + [GeneratedRegex("(?[^ ]+) = .+EnsureArrayIndex[(](?[^,]+), (?[^,]+),[^;]+;(?[^[]+)[[](?[^+]+)[+][+][]]")] private static partial Regex EnsureArrayIndexRegex(); - [RegexGenerator("(?[^[]+)[[](?.+)[]]")] + [GeneratedRegex("(?[^[]+)[[](?.+)[]]")] private static partial Regex P0Regex(); private void WriteSourceBegin(string source) @@ -3520,19 +3520,19 @@ private static void WriteLocalDecl(string variableName, SourceInfo initValue) ReflectionAwareILGen.WriteLocalDecl(variableName, initValue); } - [RegexGenerator("UnknownNode[(]null, @[\"](?[^\"]*)[\"][)];")] + [GeneratedRegex("UnknownNode[(]null, @[\"](?[^\"]*)[\"][)];")] private static partial Regex UnknownNodeNullAnyTypeRegex(); - [RegexGenerator("UnknownNode[(][(]object[)](?[^,]+), @[\"](?[^\"]*)[\"][)];")] + [GeneratedRegex("UnknownNode[(][(]object[)](?[^,]+), @[\"](?[^\"]*)[\"][)];")] private static partial Regex UnknownNodeObjectEmptyRegex(); - [RegexGenerator("UnknownNode[(][(]object[)](?[^,]+), null[)];")] + [GeneratedRegex("UnknownNode[(][(]object[)](?[^,]+), null[)];")] private static partial Regex UnknownNodeObjectNullRegex(); - [RegexGenerator("UnknownNode[(][(]object[)](?[^)]+)[)];")] + [GeneratedRegex("UnknownNode[(][(]object[)](?[^)]+)[)];")] private static partial Regex UnknownNodeObjectRegex(); - [RegexGenerator("paramsRead\\[(?[0-9]+)\\]")] + [GeneratedRegex("paramsRead\\[(?[0-9]+)\\]")] private static partial Regex ParamsReadRegex(); private void ILGenElseString(string elseString) diff --git a/src/libraries/System.Private.Xml/src/System/Xml/XmlConvert.cs b/src/libraries/System.Private.Xml/src/System/Xml/XmlConvert.cs index 8678ca70ce846..c5935daf6ae4c 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/XmlConvert.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/XmlConvert.cs @@ -280,10 +280,10 @@ public partial class XmlConvert private const int EncodedCharLength = 7; // ("_xFFFF_".Length); - [RegexGenerator("_[Xx][0-9a-fA-F]{4}(?:_|[0-9a-fA-F]{4}_)")] + [GeneratedRegex("_[Xx][0-9a-fA-F]{4}(?:_|[0-9a-fA-F]{4}_)")] private static partial Regex DecodeCharRegex(); - [RegexGenerator("(?<=_)[Xx][0-9a-fA-F]{4}(?:_|[0-9a-fA-F]{4}_)")] + [GeneratedRegex("(?<=_)[Xx][0-9a-fA-F]{4}(?:_|[0-9a-fA-F]{4}_)")] private static partial Regex EncodeCharRegex(); private static int FromHex(char digit) diff --git a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs index 1eab33c43e78e..53b4eebac73af 100644 --- a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs @@ -2327,7 +2327,7 @@ public static IEnumerable SystemTimeZonesTestData() private const string IanaAbbreviationPattern = @"^(?:[A-Z][A-Za-z]+|[+-]\d{2}|[+-]\d{4})$"; - [RegexGenerator(IanaAbbreviationPattern)] + [GeneratedRegex(IanaAbbreviationPattern)] private static partial Regex IanaAbbreviationRegex(); // UTC aliases per https://github.com/unicode-org/cldr/blob/master/common/bcp47/timezone.xml diff --git a/src/libraries/System.Text.RegularExpressions/gen/DiagnosticDescriptors.cs b/src/libraries/System.Text.RegularExpressions/gen/DiagnosticDescriptors.cs index 390b678a13f40..1a18e364cbf84 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/DiagnosticDescriptors.cs +++ b/src/libraries/System.Text.RegularExpressions/gen/DiagnosticDescriptors.cs @@ -8,21 +8,21 @@ namespace System.Text.RegularExpressions.Generator { internal static class DiagnosticDescriptors { - private const string Category = "RegexGenerator"; + private const string Category = "GeneratedRegex"; - public static DiagnosticDescriptor InvalidRegexGeneratorAttribute { get; } = new DiagnosticDescriptor( + public static DiagnosticDescriptor InvalidGeneratedRegexAttribute { get; } = new DiagnosticDescriptor( id: "SYSLIB1040", - title: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), - messageFormat: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), + title: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), + messageFormat: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), category: Category, DiagnosticSeverity.Error, isEnabledByDefault: true, customTags: WellKnownDiagnosticTags.NotConfigurable); - public static DiagnosticDescriptor MultipleRegexGeneratorAttributes { get; } = new DiagnosticDescriptor( + public static DiagnosticDescriptor MultipleGeneratedRegexAttributes { get; } = new DiagnosticDescriptor( id: "SYSLIB1041", - title: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), - messageFormat: new LocalizableResourceString(nameof(SR.MultipleRegexGeneratorAttributesMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), + title: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), + messageFormat: new LocalizableResourceString(nameof(SR.MultipleGeneratedRegexAttributesMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), category: Category, DiagnosticSeverity.Error, isEnabledByDefault: true, @@ -30,7 +30,7 @@ internal static class DiagnosticDescriptors public static DiagnosticDescriptor InvalidRegexArguments { get; } = new DiagnosticDescriptor( id: "SYSLIB1042", - title: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), + title: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), messageFormat: new LocalizableResourceString(nameof(SR.InvalidRegexArgumentsMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), category: Category, DiagnosticSeverity.Error, @@ -39,7 +39,7 @@ internal static class DiagnosticDescriptors public static DiagnosticDescriptor RegexMethodMustHaveValidSignature { get; } = new DiagnosticDescriptor( id: "SYSLIB1043", - title: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), + title: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), messageFormat: new LocalizableResourceString(nameof(SR.RegexMethodMustHaveValidSignatureMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)), category: Category, DiagnosticSeverity.Error, diff --git a/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs b/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs index af840c78f158a..7a472a994c9c9 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs +++ b/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs @@ -16,7 +16,7 @@ namespace System.Text.RegularExpressions.Generator public partial class RegexGenerator { private const string RegexName = "System.Text.RegularExpressions.Regex"; - private const string RegexGeneratorAttributeName = "System.Text.RegularExpressions.RegexGeneratorAttribute"; + private const string GeneratedRegexAttributeName = "System.Text.RegularExpressions.GeneratedRegexAttribute"; // Returns null if nothing to do, Diagnostic if there's an error to report, or RegexType if the type was analyzed successfully. private static object? GetSemanticTargetForGeneration( @@ -27,9 +27,9 @@ public partial class RegexGenerator Compilation compilation = sm.Compilation; INamedTypeSymbol? regexSymbol = compilation.GetBestTypeByMetadataName(RegexName); - INamedTypeSymbol? regexGeneratorAttributeSymbol = compilation.GetBestTypeByMetadataName(RegexGeneratorAttributeName); + INamedTypeSymbol? generatedRegexAttributeSymbol = compilation.GetBestTypeByMetadataName(GeneratedRegexAttributeName); - if (regexSymbol is null || regexGeneratorAttributeSymbol is null) + if (regexSymbol is null || generatedRegexAttributeSymbol is null) { // Required types aren't available return null; @@ -59,25 +59,25 @@ public partial class RegexGenerator int? matchTimeout = null; foreach (AttributeData attributeData in boundAttributes) { - if (!SymbolEqualityComparer.Default.Equals(attributeData.AttributeClass, regexGeneratorAttributeSymbol)) + if (!SymbolEqualityComparer.Default.Equals(attributeData.AttributeClass, generatedRegexAttributeSymbol)) { continue; } if (attributeData.ConstructorArguments.Any(ca => ca.Kind == TypedConstantKind.Error)) { - return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexGeneratorAttribute, methodSyntax.GetLocation()); + return Diagnostic.Create(DiagnosticDescriptors.InvalidGeneratedRegexAttribute, methodSyntax.GetLocation()); } if (pattern is not null) { - return Diagnostic.Create(DiagnosticDescriptors.MultipleRegexGeneratorAttributes, methodSyntax.GetLocation()); + return Diagnostic.Create(DiagnosticDescriptors.MultipleGeneratedRegexAttributes, methodSyntax.GetLocation()); } ImmutableArray items = attributeData.ConstructorArguments; if (items.Length == 0 || items.Length > 3) { - return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexGeneratorAttribute, methodSyntax.GetLocation()); + return Diagnostic.Create(DiagnosticDescriptors.InvalidGeneratedRegexAttribute, methodSyntax.GetLocation()); } attributeFound = true; diff --git a/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.cs b/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.cs index b40b402b0c2ec..ed237b82379f1 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.cs +++ b/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.cs @@ -46,10 +46,10 @@ public void Initialize(IncrementalGeneratorInitializationContext context) IncrementalValueProvider> codeOrDiagnostics = context.SyntaxProvider - // Find all MethodDeclarationSyntax nodes attributed with RegexGenerator and gather the required information. + // Find all MethodDeclarationSyntax nodes attributed with GeneratedRegex and gather the required information. .ForAttributeWithMetadataName( context, - RegexGeneratorAttributeName, + GeneratedRegexAttributeName, (node, _) => node is MethodDeclarationSyntax, GetSemanticTargetForGeneration) .Where(static m => m is not null) diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/Strings.resx b/src/libraries/System.Text.RegularExpressions/gen/Resources/Strings.resx index ea9483ef6a9da..659933c9df7a9 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/Strings.resx +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/Strings.resx @@ -117,28 +117,28 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Invalid RegexGenerator usage - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + {Locked="GeneratedRegexAttribute"} - - The RegexGeneratorAttribute is malformed - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + {Locked="GeneratedRegexAttribute"} - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. The specified regex is invalid. '{0}' - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. - RegexGenerator limitation reached. + Regex generator limitation reached. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. Regular expression parser error '{0}' at offset {1}. @@ -275,9 +275,9 @@ {Locked="RegexOptions.NonBacktracking"} - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. - Convert to 'RegexGenerator'. + Convert to 'GeneratedRegexAttribute'. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.cs.xlf index 3b90c7a50a9d5..95fe06c674647 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.cs.xlf @@ -102,15 +102,15 @@ Zadaný regulární výraz je neplatný. {0} - - The RegexGeneratorAttribute is malformed - Atribut RegexGeneratorAttribute je nesprávný. - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + Atribut GeneratedRegexAttribute je nesprávný. + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Neplatné použití RegexGenerator - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Neplatné použití GeneratedRegexAttribute + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - Dosáhlo se omezení nástroje RegexGenerator. + Regex generator limitation reached. + Dosáhlo se omezení nástroje GeneratedRegexAttribute. @@ -152,9 +152,9 @@ Řídicí znak chybí. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Na stejnou metodu se uplatnilo několik RegexGeneratorAttributes, ale je povolena jenom jedna. + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Na stejnou metodu se uplatnilo několik GeneratedRegexAttributes, ale je povolena jenom jedna. @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - Metoda RegexGenerator musí být částečná, bez parametrů, negenerická, neabstraktní a musí vracet regulární výraz. + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + Metoda GeneratedRegexAttribute musí být částečná, bez parametrů, negenerická, neabstraktní a musí vracet regulární výraz. @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Pomocí regexGeneratorAttribute vygenerujte implementaci regulárního výrazu za kompilace. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Pomocí regexGeneratorAttribute vygenerujte implementaci regulárního výrazu za kompilace. - Convert to 'RegexGenerator'. - Převod na RegexGenerator + Convert to 'GeneratedRegexAttribute'. + Převod na GeneratedRegexAttribute diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.de.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.de.xlf index 60ed0c222af2d..454d10242ba88 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.de.xlf @@ -102,15 +102,15 @@ Der angegebene Regex ist ungültig. "{0}" - - The RegexGeneratorAttribute is malformed - Das RegexGeneratorAttribute ist falsch formatiert. - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + Das GeneratedRegexAttribute ist falsch formatiert. + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Ungültige RegexGenerator-Verwendung - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Ungültige GeneratedRegexAttribute-Verwendung + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - RegexGenerator-Begrenzung erreicht. + Regex generator limitation reached. + GeneratedRegexAttribute-Begrenzung erreicht. @@ -152,9 +152,9 @@ Fehlendes Steuerzeichen. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Mehrere RegexGeneratorAttributes wurden auf dieselbe Methode angewendet, aber nur eine ist zulässig + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Mehrere GeneratedRegexAttributes wurden auf dieselbe Methode angewendet, aber nur eine ist zulässig @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - Die „RegexGenerator“-Methode muss partiell, parameterlos, nicht generisch sein und Regex zurückgeben. + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + Die „GeneratedRegexAttribute“-Methode muss partiell, parameterlos, nicht generisch sein und Regex zurückgeben. @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Verwenden Sie „RegexGeneratorAttribute“, um die Implementierung regulärer Ausdrücke zur Kompilierzeit zu generieren. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Verwenden Sie „GeneratedRegexAttribute“, um die Implementierung regulärer Ausdrücke zur Kompilierzeit zu generieren. - Convert to 'RegexGenerator'. - In „RegexGenerator“ konvertieren. + Convert to 'GeneratedRegexAttribute'. + In „GeneratedRegexAttribute“ konvertieren. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.es.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.es.xlf index a1d2a681dc5c1..a05d51b3e1b82 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.es.xlf @@ -102,15 +102,15 @@ La expresión regular especificada no es válida. '{0}' - - The RegexGeneratorAttribute is malformed - RegexGeneratorAttribute tiene un formato incorrecto - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + GeneratedRegexAttribute tiene un formato incorrecto + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Uso de RegexGenerator no válido - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Uso de GeneratedRegexAttribute no válido + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - Se alcanzó la limitación de RegexGenerator. + Regex generator limitation reached. + Se alcanzó la limitación de GeneratedRegexAttribute. @@ -152,9 +152,9 @@ Falta el carácter de control. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Se aplicaron varios RegexGeneratorAttributes al mismo método, pero solo se permite uno. + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Se aplicaron varios GeneratedRegexAttributes al mismo método, pero solo se permite uno. @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - El método RegexGenerator debe ser parcial, sin parámetros, no genérico, no abstracto y devolver Regex + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + El método GeneratedRegexAttribute debe ser parcial, sin parámetros, no genérico, no abstracto y devolver Regex @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Use 'RegexGeneratorAttribute' para generar la implementación de expresiones regulares en tiempo de compilación. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Use 'GeneratedRegexAttribute' para generar la implementación de expresiones regulares en tiempo de compilación. - Convert to 'RegexGenerator'. - Convertir en 'RegexGenerator'. + Convert to 'GeneratedRegexAttribute'. + Convertir en 'GeneratedRegexAttribute'. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.fr.xlf index b2ce64a492368..65c8d29a99bc4 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.fr.xlf @@ -102,15 +102,15 @@ L’expression régulière spécifiée n’est pas valide. « {0} » - - The RegexGeneratorAttribute is malformed - RegexGeneratorAttribute est malformé - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + GeneratedRegexAttribute est malformé + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Utilisation de RegexGenerator non valide - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Utilisation de GeneratedRegexAttribute non valide + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - Limite RegexGenerator atteinte + Regex generator limitation reached. + Limite GeneratedRegexAttribute atteinte @@ -152,9 +152,9 @@ Caractère de contrôle manquant. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Plusieurs RegexGeneratorAttributes ont été appliqués à la même méthode, alors qu’un seul est autorisé + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Plusieurs GeneratedRegexAttributes ont été appliqués à la même méthode, alors qu’un seul est autorisé @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - La méthode RegexGenerator doit être partielle, sans paramètre, non générique, non abstraite et renvoyer Regex. + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + La méthode GeneratedRegexAttribute doit être partielle, sans paramètre, non générique, non abstraite et renvoyer Regex. @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Utilisez « RegexGeneratorAttribute » pour générer l’implémentation d’expression régulière au moment de la compilation. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Utilisez « GeneratedRegexAttribute » pour générer l’implémentation d’expression régulière au moment de la compilation. - Convert to 'RegexGenerator'. - Convertissez en 'RegexGenerator'. + Convert to 'GeneratedRegexAttribute'. + Convertissez en 'GeneratedRegexAttribute'. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.it.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.it.xlf index 1dfe863e4da93..dceb4f956732a 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.it.xlf @@ -102,15 +102,15 @@ L'espressione regolare specificata non è valida. '{0}' - - The RegexGeneratorAttribute is malformed - RegexGeneratorAttribute non è valido - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + GeneratedRegexAttribute non è valido + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Utilizzo di RegexGenerator non valido - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Utilizzo di GeneratedRegexAttribute non valido + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - È stata raggiunta la limitazione di RegexGenerator. + Regex generator limitation reached. + È stata raggiunta la limitazione di GeneratedRegexAttribute. @@ -152,9 +152,9 @@ Carattere di controllo mancante. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Allo stesso metodo sono stati applicati più RegexGeneratorAttribute, ma ne è consentito solo uno + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Allo stesso metodo sono stati applicati più GeneratedRegexAttribute, ma ne è consentito solo uno @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - Il metodo RegexGenerator deve essere parziale, senza parametri, non generico, non astratto e restituire Regex + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + Il metodo GeneratedRegexAttribute deve essere parziale, senza parametri, non generico, non astratto e restituire Regex @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Usare 'RegexGeneratorAttribute' per generare l'implementazione dell'espressione regolare in fase di compilazione. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Usare 'GeneratedRegexAttribute' per generare l'implementazione dell'espressione regolare in fase di compilazione. - Convert to 'RegexGenerator'. - Convertire in 'RegexGenerator'. + Convert to 'GeneratedRegexAttribute'. + Convertire in 'GeneratedRegexAttribute'. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ja.xlf index d64b9258a3994..0d30c03ab34ed 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ja.xlf @@ -102,15 +102,15 @@ 指定された正規表現が無効です。'{0}' - - The RegexGeneratorAttribute is malformed - RegexGeneratorAttribute の形式に誤りがあります - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + GeneratedRegexAttribute の形式に誤りがあります + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - RegexGenerator の使用法が無効です - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + GeneratedRegexAttribute の使用法が無効です + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - RegexGenerator の制限に達しました。 + Regex generator limitation reached. + GeneratedRegexAttribute の制限に達しました。 @@ -152,9 +152,9 @@ 制御文字がありません。 - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - 複数の RegexGeneratorAttributes が同じメソッドに適用されましたが、許可されるのは 1 つだけです + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + 複数の GeneratedRegexAttributes が同じメソッドに適用されましたが、許可されるのは 1 つだけです @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - RegexGenerator メソッドは、部分的、パラメーターなし、非ジェネリック、非抽象で、正規表現を返す必要があります + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + GeneratedRegexAttribute メソッドは、部分的、パラメーターなし、非ジェネリック、非抽象で、正規表現を返す必要があります @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - 「RegexGeneratorAttribute」を使用すると、コンパイル時に正規表現の実装が生成されます。 + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + 「GeneratedRegexAttribute」を使用すると、コンパイル時に正規表現の実装が生成されます。 - Convert to 'RegexGenerator'. - 「RegexGenerator」に変換します。 + Convert to 'GeneratedRegexAttribute'. + 「GeneratedRegexAttribute」に変換します。 diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ko.xlf index 673e5dae65b21..ee2e5c621a9b8 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ko.xlf @@ -102,15 +102,15 @@ 지정한 regex가 잘못되었습니다. '{0}' - - The RegexGeneratorAttribute is malformed - RegexGeneratorAttribute의 형식이 잘못되었습니다. - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + GeneratedRegexAttribute의 형식이 잘못되었습니다. + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - 잘못된 RegexGenerator 사용 - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + 잘못된 GeneratedRegexAttribute 사용 + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - RegexGenerator 제한에 도달했습니다. + Regex generator limitation reached. + GeneratedRegexAttribute 제한에 도달했습니다. @@ -152,9 +152,9 @@ 제어 문자가 없습니다. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - 동일한 메서드에 여러 RegexGeneratorAttributes가 적용되었지만 하나만 허용됩니다. + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + 동일한 메서드에 여러 GeneratedRegexAttributes가 적용되었지만 하나만 허용됩니다. @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - RegexGenerator 메서드는 부분적이고 매개 변수가 없고 제네릭이 아니어야 하며 비추상적이고 regex 반환이어야 합니다. + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + GeneratedRegexAttribute 메서드는 부분적이고 매개 변수가 없고 제네릭이 아니어야 하며 비추상적이고 regex 반환이어야 합니다. @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - 'RegexGeneratorAttribute'를 사용하여 컴파일 시간에 정규식 구현을 생성합니다. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + 'GeneratedRegexAttribute'를 사용하여 컴파일 시간에 정규식 구현을 생성합니다. - Convert to 'RegexGenerator'. - 'RegexGenerator'로 변환합니다. + Convert to 'GeneratedRegexAttribute'. + 'GeneratedRegexAttribute'로 변환합니다. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pl.xlf index 60ead507b9cb3..a03e258111c94 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pl.xlf @@ -102,15 +102,15 @@ Określone wyrażenie regularne jest nieprawidłowe. „{0}” - - The RegexGeneratorAttribute is malformed - Atrybut RegexGeneratorAttribute jest źle sformułowany - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + Atrybut GeneratedRegexAttribute jest źle sformułowany + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Nieprawidłowe użycie atrybutu RegexGenerator - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Nieprawidłowe użycie atrybutu GeneratedRegexAttribute + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - Osiągnięto ograniczenie RegexGenerator. + Regex generator limitation reached. + Osiągnięto ograniczenie GeneratedRegexAttribute. @@ -152,9 +152,9 @@ Brak znaku kontrolnego. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Do tej samej metody zastosowano wiele atrybutów RegexGeneratorAttributes, ale dozwolony jest tylko jeden + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Do tej samej metody zastosowano wiele atrybutów GeneratedRegexAttributes, ale dozwolony jest tylko jeden @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - Metoda RegexGenerator musi być częściowa, bez parametrów, niestanowa, nieabstrakcyjna i zwracać wyrażenia regularne + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + Metoda GeneratedRegexAttribute musi być częściowa, bez parametrów, niestanowa, nieabstrakcyjna i zwracać wyrażenia regularne @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Użyj atrybutu „RegexGeneratorAttribute”, aby wygenerować implementację wyrażenia regularnego w czasie kompilacji. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Użyj atrybutu „GeneratedRegexAttribute”, aby wygenerować implementację wyrażenia regularnego w czasie kompilacji. - Convert to 'RegexGenerator'. - Konwertuj na „RegexGenerator”. + Convert to 'GeneratedRegexAttribute'. + Konwertuj na „GeneratedRegexAttribute”. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pt-BR.xlf index 176819107534a..0dafb06bc3d6b 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pt-BR.xlf @@ -102,15 +102,15 @@ O regex especificado é inválido. '{0}' - - The RegexGeneratorAttribute is malformed - O RegexGeneratorAttribute está malformado - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + O GeneratedRegexAttribute está malformado + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Uso Inválido do RegexGenerator - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Uso Inválido do GeneratedRegexAttribute + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - Limitação de RegexGenerator atingida. + Regex generator limitation reached. + Limitação de GeneratedRegexAttribute atingida. @@ -152,9 +152,9 @@ Caractere de controle ausente. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Vários RegexGeneratorAttributes foram aplicados ao mesmo método, mas apenas um é permitido + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Vários GeneratedRegexAttributes foram aplicados ao mesmo método, mas apenas um é permitido @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - O método RegexGenerator deve ser parcial, sem parâmetros, não genérico, não abstrato e retornar Regex + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + O método GeneratedRegexAttribute deve ser parcial, sem parâmetros, não genérico, não abstrato e retornar Regex @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Use 'RegexGeneratorAttribute' para gerar a implementação da expressão regular em tempo de compilação. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Use 'GeneratedRegexAttribute' para gerar a implementação da expressão regular em tempo de compilação. - Convert to 'RegexGenerator'. - Converter para 'RegexGenerator'. + Convert to 'GeneratedRegexAttribute'. + Converter para 'GeneratedRegexAttribute'. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ru.xlf index ff3649296639e..05cc07f55aea5 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ru.xlf @@ -102,15 +102,15 @@ Указанное регулярное выражение недопустимо. "{0}" - - The RegexGeneratorAttribute is malformed - Ошибка в регулярном выражении RegexGeneratorAttribute - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + Ошибка в регулярном выражении GeneratedRegexAttribute + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Недопустимое использование RegexGenerator - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Недопустимое использование GeneratedRegexAttribute + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - Достигнуто ограничение RegexGenerator. + Regex generator limitation reached. + Достигнуто ограничение GeneratedRegexAttribute. @@ -152,9 +152,9 @@ Отсутствует управляющий символ. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Несколько RegexGeneratorAttributes были применены к одному методу, но разрешен только один + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Несколько GeneratedRegexAttributes были применены к одному методу, но разрешен только один @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - Метод RegexGenerator должен быть частичным, без параметров, неуниверсальным, неабстрактным и возвращать регулярное выражение + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + Метод GeneratedRegexAttribute должен быть частичным, без параметров, неуниверсальным, неабстрактным и возвращать регулярное выражение @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Используйте "RegexGeneratorAttribute", чтобы создавать реализацию регулярного выражения во время компиляции. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Используйте "GeneratedRegexAttribute", чтобы создавать реализацию регулярного выражения во время компиляции. - Convert to 'RegexGenerator'. - Преобразовать в "RegexGenerator". + Convert to 'GeneratedRegexAttribute'. + Преобразовать в "GeneratedRegexAttribute". diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.tr.xlf index bdeb44c3a3e51..b54abb823cada 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.tr.xlf @@ -102,15 +102,15 @@ Belirtilen normal ifade geçersiz. ''{0}” - - The RegexGeneratorAttribute is malformed - RegexGeneratorAttribute hatalı biçimlendirilmiş - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + GeneratedRegexAttribute hatalı biçimlendirilmiş + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - Geçersiz RegexGenerator kullanımı - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + Geçersiz GeneratedRegexAttribute kullanımı + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - RegexGenerator sınırına ulaşıldı. + Regex generator limitation reached. + GeneratedRegexAttribute sınırına ulaşıldı. @@ -152,9 +152,9 @@ Eksik denetim karakteri. - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - Aynı yönteme birden çok RegexGeneratorAttributes uygulandı, ancak yalnızca birine izin veriliyor + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + Aynı yönteme birden çok GeneratedRegexAttributes uygulandı, ancak yalnızca birine izin veriliyor @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - RegexGenerator yöntemi kısmi, parametresiz, genel olmayan, soyut olmayan özellikler taşımalıdır ve Normal ifade döndürmelidir + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + GeneratedRegexAttribute yöntemi kısmi, parametresiz, genel olmayan, soyut olmayan özellikler taşımalıdır ve Normal ifade döndürmelidir @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - Derleme zamanında normal ifade uygulamasını oluşturmak için “RegexGeneratorAttribute” kullanın. + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + Derleme zamanında normal ifade uygulamasını oluşturmak için “GeneratedRegexAttribute” kullanın. - Convert to 'RegexGenerator'. - “RegexGenerator”a dönüştürün. + Convert to 'GeneratedRegexAttribute'. + “GeneratedRegexAttribute”a dönüştürün. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hans.xlf index 65af5510d89ef..c965d67fad31f 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hans.xlf @@ -102,15 +102,15 @@ 指定的正则表达式无效。“{0}” - - The RegexGeneratorAttribute is malformed - RegexGeneratorAttribute 格式不正确 - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + GeneratedRegexAttribute 格式不正确 + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - 无效的 RegexGenerator 用法 - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + 无效的 GeneratedRegexAttribute 用法 + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - 已达到 RegexGenerator 限制。 + Regex generator limitation reached. + 已达到 GeneratedRegexAttribute 限制。 @@ -152,9 +152,9 @@ 缺少控制字符。 - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - 对同一方法应用了多个 RegexGeneratorAttribute,但只允许使用一个 + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + 对同一方法应用了多个 GeneratedRegexAttribute,但只允许使用一个 @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - RegexGenerator 方法必须是分部、无参数、非泛型、非抽象且返回正则表达式 + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + GeneratedRegexAttribute 方法必须是分部、无参数、非泛型、非抽象且返回正则表达式 @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - 在编译时使用 “RegexGeneratorAttribute” 生成正则表达式实现。 + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + 在编译时使用 “GeneratedRegexAttribute” 生成正则表达式实现。 - Convert to 'RegexGenerator'. - 转换为 “RegexGenerator”。 + Convert to 'GeneratedRegexAttribute'. + 转换为 “GeneratedRegexAttribute”。 diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hant.xlf index 468471def32c9..1a248f222ff16 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hant.xlf @@ -102,15 +102,15 @@ 指定的 RegEx 無效。'{0}' - - The RegexGeneratorAttribute is malformed - RegexGeneratorAttribute 格式錯誤 - {Locked="RegexGeneratorAttribute"} + + The GeneratedRegexAttribute is malformed + GeneratedRegexAttribute 格式錯誤 + {Locked="GeneratedRegexAttribute"} - - Invalid RegexGenerator usage - 無效的 RegexGenerator 使用方式 - {Locked="RegexGenerator"} + + Invalid GeneratedRegexAttribute usage + 無效的 GeneratedRegexAttribute 使用方式 + {Locked="GeneratedRegexAttribute"} Incomplete \\p{X} character escape. @@ -123,13 +123,13 @@ - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - The RegexGenerator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. + The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details. - RegexGenerator limitation reached. - 已達 RegexGenerator 限制。 + Regex generator limitation reached. + 已達 GeneratedRegexAttribute 限制。 @@ -152,9 +152,9 @@ 缺少控制字元。 - - Multiple RegexGeneratorAttributes were applied to the same method, but only one is allowed - 已將多個 RegexGeneratorAttributes 套用到同一個方法,但只允許一個 + + Multiple GeneratedRegexAttributes were applied to the same method, but only one is allowed. + 已將多個 GeneratedRegexAttributes 套用到同一個方法,但只允許一個 @@ -198,8 +198,8 @@ - RegexGenerator method must be partial, parameterless, non-generic, non-abstract, and return Regex - RegexGenerator 方法必須是部分、無參數、非泛型、非抽象,並且傳回 Regex + GeneratedRegexAttribute method must be partial, parameterless, non-generic, non-abstract, and return Regex. + GeneratedRegexAttribute 方法必須是部分、無參數、非泛型、非抽象,並且傳回 Regex @@ -258,13 +258,13 @@ - Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time. - 使用 'RegexGeneratorAttribute' 在編譯時間產生規則運算式實作。 + Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. + 使用 'GeneratedRegexAttribute' 在編譯時間產生規則運算式實作。 - Convert to 'RegexGenerator'. - 轉換成 'RegexGenerator'。 + Convert to 'GeneratedRegexAttribute'. + 轉換成 'GeneratedRegexAttribute'。 diff --git a/src/libraries/System.Text.RegularExpressions/gen/UpgradeToRegexGeneratorAnalyzer.cs b/src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexAnalyzer.cs similarity index 96% rename from src/libraries/System.Text.RegularExpressions/gen/UpgradeToRegexGeneratorAnalyzer.cs rename to src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexAnalyzer.cs index d3f68bd344b86..98db27c8d439c 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/UpgradeToRegexGeneratorAnalyzer.cs +++ b/src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexAnalyzer.cs @@ -22,10 +22,10 @@ namespace System.Text.RegularExpressions.Generator /// If so, it will emit an informational diagnostic to suggest use the Regex Generator. /// [DiagnosticAnalyzer(LanguageNames.CSharp)] - public sealed class UpgradeToRegexGeneratorAnalyzer : DiagnosticAnalyzer + public sealed class UpgradeToGeneratedRegexAnalyzer : DiagnosticAnalyzer { private const string RegexTypeName = "System.Text.RegularExpressions.Regex"; - private const string RegexGeneratorTypeName = "System.Text.RegularExpressions.RegexGeneratorAttribute"; + private const string GeneratedRegexTypeName = "System.Text.RegularExpressions.GeneratedRegexAttribute"; internal const string PatternArgumentName = "pattern"; internal const string OptionsArgumentName = "options"; @@ -104,7 +104,7 @@ private static void AnalyzeInvocation(OperationAnalysisContext context, INamedTy } // We need to save the parameters as properties so that we can save them onto the diagnostic so that the - // code fixer can later use that property bag to generate the code fix and emit the RegexGenerator attribute. + // code fixer can later use that property bag to generate the code fix and emit the GeneratedRegex attribute. if (staticMethodsToDetect.Contains(method)) { // Validate that arguments pattern and options are constant and timeout was not passed in. @@ -233,8 +233,8 @@ private static bool ProjectSupportsRegexSourceGenerator(Compilation compilation, return false; } - INamedTypeSymbol regexGeneratorAttributeTypeSymbol = compilation.GetTypeByMetadataName(RegexGeneratorTypeName); - if (regexGeneratorAttributeTypeSymbol == null) + INamedTypeSymbol generatedRegexAttributeTypeSymbol = compilation.GetTypeByMetadataName(GeneratedRegexTypeName); + if (generatedRegexAttributeTypeSymbol == null) { return false; } diff --git a/src/libraries/System.Text.RegularExpressions/gen/UpgradeToRegexGeneratorCodeFixer.cs b/src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexCodeFixer.cs similarity index 92% rename from src/libraries/System.Text.RegularExpressions/gen/UpgradeToRegexGeneratorCodeFixer.cs rename to src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexCodeFixer.cs index 9b0a35351488d..61fdc155a4b26 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/UpgradeToRegexGeneratorCodeFixer.cs +++ b/src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexCodeFixer.cs @@ -26,10 +26,10 @@ namespace System.Text.RegularExpressions.Generator /// source generation. /// [ExportCodeFixProvider(LanguageNames.CSharp), Shared] - public sealed class UpgradeToRegexGeneratorCodeFixer : CodeFixProvider + public sealed class UpgradeToGeneratedRegexCodeFixer : CodeFixProvider { private const string RegexTypeName = "System.Text.RegularExpressions.Regex"; - private const string RegexGeneratorTypeName = "System.Text.RegularExpressions.RegexGeneratorAttribute"; + private const string GeneratedRegexTypeName = "System.Text.RegularExpressions.GeneratedRegexAttribute"; private const string DefaultRegexMethodName = "MyRegex"; /// @@ -81,16 +81,16 @@ private static async Task ConvertToSourceGenerator(Document document, } Compilation compilation = semanticModel.Compilation; - // We then get the symbols for the Regex and RegexGeneratorAttribute types. + // We then get the symbols for the Regex and GeneratedRegexAttribute types. INamedTypeSymbol? regexSymbol = compilation.GetTypeByMetadataName(RegexTypeName); - INamedTypeSymbol? regexGeneratorAttributeSymbol = compilation.GetTypeByMetadataName(RegexGeneratorTypeName); - if (regexSymbol is null || regexGeneratorAttributeSymbol is null) + INamedTypeSymbol? generatedRegexAttributeSymbol = compilation.GetTypeByMetadataName(GeneratedRegexTypeName); + if (regexSymbol is null || generatedRegexAttributeSymbol is null) { return document; } // Save the operation object from the nodeToFix before it gets replaced by the new method invocation. - // We will later use this operation to get the parameters out and pass them into the RegexGenerator attribute. + // We will later use this operation to get the parameters out and pass them into the Regex attribute. IOperation? operation = semanticModel.GetOperation(nodeToFix, cancellationToken); if (operation is null) { @@ -165,7 +165,7 @@ private static async Task ConvertToSourceGenerator(Document document, { operationArguments = invocationOperation.Arguments; IEnumerable arguments = operationArguments - .Where(arg => arg.Parameter.Name is not (UpgradeToRegexGeneratorAnalyzer.OptionsArgumentName or UpgradeToRegexGeneratorAnalyzer.PatternArgumentName)) + .Where(arg => arg.Parameter.Name is not (UpgradeToGeneratedRegexAnalyzer.OptionsArgumentName or UpgradeToGeneratedRegexAnalyzer.PatternArgumentName)) .Select(arg => arg.Syntax); replacement = generator.InvocationExpression(generator.MemberAccessExpression(replacement, invocationOperation.TargetMethod.Name), arguments); @@ -177,9 +177,9 @@ private static async Task ConvertToSourceGenerator(Document document, newTypeDeclarationOrCompilationUnit = newTypeDeclarationOrCompilationUnit.ReplaceNode(nodeToFix, WithTrivia(replacement, nodeToFix)); - // Initialize the inputs for the RegexGenerator attribute. - SyntaxNode? patternValue = GetNode(operationArguments, generator, UpgradeToRegexGeneratorAnalyzer.PatternArgumentName); - SyntaxNode? regexOptionsValue = GetNode(operationArguments, generator, UpgradeToRegexGeneratorAnalyzer.OptionsArgumentName); + // Initialize the inputs for the GeneratedRegex attribute. + SyntaxNode? patternValue = GetNode(operationArguments, generator, UpgradeToGeneratedRegexAnalyzer.PatternArgumentName); + SyntaxNode? regexOptionsValue = GetNode(operationArguments, generator, UpgradeToGeneratedRegexAnalyzer.OptionsArgumentName); // Generate the new static partial method MethodDeclarationSyntax newMethod = (MethodDeclarationSyntax)generator.MethodDeclaration( @@ -191,8 +191,8 @@ private static async Task ConvertToSourceGenerator(Document document, // Allow user to pick a different name for the method. newMethod = newMethod.ReplaceToken(newMethod.Identifier, SyntaxFactory.Identifier(methodName).WithAdditionalAnnotations(RenameAnnotation.Create())); - // Generate the RegexGenerator attribute syntax node with the specified parameters. - SyntaxNode attributes = generator.Attribute(generator.TypeExpression(regexGeneratorAttributeSymbol), attributeArguments: (patternValue, regexOptionsValue) switch + // Generate the GeneratedRegex attribute syntax node with the specified parameters. + SyntaxNode attributes = generator.Attribute(generator.TypeExpression(generatedRegexAttributeSymbol), attributeArguments: (patternValue, regexOptionsValue) switch { ({ }, null) => new[] { patternValue }, ({ }, { }) => new[] { patternValue, regexOptionsValue }, @@ -232,8 +232,8 @@ static IEnumerable GetAllMembers(ITypeSymbol? symbol) return null; } - Debug.Assert(parameterName is UpgradeToRegexGeneratorAnalyzer.OptionsArgumentName or UpgradeToRegexGeneratorAnalyzer.PatternArgumentName); - if (parameterName == UpgradeToRegexGeneratorAnalyzer.OptionsArgumentName) + Debug.Assert(parameterName is UpgradeToGeneratedRegexAnalyzer.OptionsArgumentName or UpgradeToGeneratedRegexAnalyzer.PatternArgumentName); + if (parameterName == UpgradeToGeneratedRegexAnalyzer.OptionsArgumentName) { string optionsLiteral = Literal(((RegexOptions)(int)argument.Value.ConstantValue.Value).ToString()); return SyntaxFactory.ParseExpression(optionsLiteral); diff --git a/src/libraries/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs b/src/libraries/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs index 3b0b589da16c9..e400187b268ff 100644 --- a/src/libraries/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs +++ b/src/libraries/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs @@ -156,11 +156,11 @@ public Regex([System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.Co public System.TimeSpan MatchTimeout { get { throw null; } } public System.Text.RegularExpressions.RegexOptions Options { get { throw null; } } public bool RightToLeft { get { throw null; } } - [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the RegexGeneratorAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static void CompileToAssembly(System.Text.RegularExpressions.RegexCompilationInfo[] regexinfos, System.Reflection.AssemblyName assemblyname) { } - [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the RegexGeneratorAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static void CompileToAssembly(System.Text.RegularExpressions.RegexCompilationInfo[] regexinfos, System.Reflection.AssemblyName assemblyname, System.Reflection.Emit.CustomAttributeBuilder[]? attributes) { } - [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the RegexGeneratorAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static void CompileToAssembly(System.Text.RegularExpressions.RegexCompilationInfo[] regexinfos, System.Reflection.AssemblyName assemblyname, System.Reflection.Emit.CustomAttributeBuilder[]? attributes, string? resourceFile) { } public int Count(string input) { throw null; } public int Count(System.ReadOnlySpan input) { throw null; } @@ -236,7 +236,7 @@ public ref partial struct ValueMatchEnumerator public bool MoveNext() { throw null; } } } - [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the RegexGeneratorAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public partial class RegexCompilationInfo { public RegexCompilationInfo(string pattern, System.Text.RegularExpressions.RegexOptions options, string name, string fullnamespace, bool ispublic) { } @@ -249,11 +249,11 @@ public RegexCompilationInfo(string pattern, System.Text.RegularExpressions.Regex public string Pattern { get { throw null; } set { } } } [System.AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] - public sealed partial class RegexGeneratorAttribute : System.Attribute + public sealed partial class GeneratedRegexAttribute : System.Attribute { - public RegexGeneratorAttribute([System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex)] string pattern) { } - public RegexGeneratorAttribute([System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex, "options")] string pattern, System.Text.RegularExpressions.RegexOptions options) { } - public RegexGeneratorAttribute([System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex, "options")] string pattern, System.Text.RegularExpressions.RegexOptions options, int matchTimeoutMilliseconds) { } + public GeneratedRegexAttribute([System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex)] string pattern) { } + public GeneratedRegexAttribute([System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex, "options")] string pattern, System.Text.RegularExpressions.RegexOptions options) { } + public GeneratedRegexAttribute([System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex, "options")] string pattern, System.Text.RegularExpressions.RegexOptions options, int matchTimeoutMilliseconds) { } public string Pattern { get; } public System.Text.RegularExpressions.RegexOptions Options { get; } public int MatchTimeoutMilliseconds { get; } diff --git a/src/libraries/System.Text.RegularExpressions/src/Resources/Strings.resx b/src/libraries/System.Text.RegularExpressions/src/Resources/Strings.resx index cf84d5a5a896d..8356f2288dd11 100644 --- a/src/libraries/System.Text.RegularExpressions/src/Resources/Strings.resx +++ b/src/libraries/System.Text.RegularExpressions/src/Resources/Strings.resx @@ -1,17 +1,17 @@  - @@ -196,7 +196,7 @@ Collection is read-only. - This platform does not support writing compiled regular expressions to an assembly. Use RegexGeneratorAttribute with the regular expression source generator instead. + This platform does not support writing compiled regular expressions to an assembly. Use GeneratedRegexAttribute with the regular expression source generator instead. Quantifier '{0}' following nothing. diff --git a/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj b/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj index 8bab1fced79b6..9ea59414ae109 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj +++ b/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj @@ -30,7 +30,7 @@ - + diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGeneratorAttribute.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/GeneratedRegexAttribute.cs similarity index 78% rename from src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGeneratorAttribute.cs rename to src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/GeneratedRegexAttribute.cs index 8bd43c533a176..938f61d23eaa2 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGeneratorAttribute.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/GeneratedRegexAttribute.cs @@ -9,26 +9,26 @@ namespace System.Text.RegularExpressions; /// Instructs the System.Text.RegularExpressions source generator to generate an implementation of the specified regular expression. /// The generator associated with this attribute only supports C#. It only supplies an implementation when applied to static, partial, parameterless, non-generic methods that are typed to return . [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] -public sealed class RegexGeneratorAttribute : Attribute +public sealed class GeneratedRegexAttribute : Attribute { - /// Initializes a new instance of the with the specified pattern. + /// Initializes a new instance of the with the specified pattern. /// The regular expression pattern to match. - public RegexGeneratorAttribute([StringSyntax(StringSyntaxAttribute.Regex)] string pattern) : this (pattern, RegexOptions.None) + public GeneratedRegexAttribute([StringSyntax(StringSyntaxAttribute.Regex)] string pattern) : this (pattern, RegexOptions.None) { } - /// Initializes a new instance of the with the specified pattern and options. + /// Initializes a new instance of the with the specified pattern and options. /// The regular expression pattern to match. /// A bitwise combination of the enumeration values that modify the regular expression. - public RegexGeneratorAttribute([StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options) : this (pattern, options, Timeout.Infinite) + public GeneratedRegexAttribute([StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options) : this (pattern, options, Timeout.Infinite) { } - /// Initializes a new instance of the with the specified pattern, options, and timeout. + /// Initializes a new instance of the with the specified pattern, options, and timeout. /// The regular expression pattern to match. /// A bitwise combination of the enumeration values that modify the regular expression. /// A time-out interval (milliseconds), or to indicate that the method should not time out. - public RegexGeneratorAttribute([StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, int matchTimeoutMilliseconds) + public GeneratedRegexAttribute([StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, int matchTimeoutMilliseconds) { Pattern = pattern; Options = options; diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorAttributeTests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GeneratedRegexAttributeTests.cs similarity index 82% rename from src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorAttributeTests.cs rename to src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GeneratedRegexAttributeTests.cs index f6792c564678d..213dd053e826d 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorAttributeTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GeneratedRegexAttributeTests.cs @@ -6,7 +6,7 @@ namespace System.Text.RegularExpressions.Tests { - public class RegexGeneratorAttributeTests + public class GeneratedRegexAttributeTests { [Theory] [InlineData(null, RegexOptions.None, Timeout.Infinite)] @@ -14,25 +14,25 @@ public class RegexGeneratorAttributeTests [InlineData("a.*b", RegexOptions.Compiled | RegexOptions.CultureInvariant, 1)] public void Ctor_Roundtrips(string pattern, RegexOptions options, int matchTimeoutMilliseconds) { - RegexGeneratorAttribute a; + GeneratedRegexAttribute a; if (matchTimeoutMilliseconds == -1) { if (options == RegexOptions.None) { - a = new RegexGeneratorAttribute(pattern); + a = new GeneratedRegexAttribute(pattern); Assert.Equal(pattern, a.Pattern); Assert.Equal(RegexOptions.None, a.Options); Assert.Equal(Timeout.Infinite, a.MatchTimeoutMilliseconds); } - a = new RegexGeneratorAttribute(pattern, options); + a = new GeneratedRegexAttribute(pattern, options); Assert.Equal(pattern, a.Pattern); Assert.Equal(options, a.Options); Assert.Equal(Timeout.Infinite, a.MatchTimeoutMilliseconds); } - a = new RegexGeneratorAttribute(pattern, options, matchTimeoutMilliseconds); + a = new GeneratedRegexAttribute(pattern, options, matchTimeoutMilliseconds); Assert.Equal(pattern, a.Pattern); Assert.Equal(options, a.Options); Assert.Equal(matchTimeoutMilliseconds, a.MatchTimeoutMilliseconds); diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs index 98231e9ac00da..5afe2490b3e53 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs @@ -144,7 +144,7 @@ internal static async Task SourceGenRegexAsync( { Assert.True(regex.options is not null || regex.matchTimeout is null); code.AppendLine(" /// RegexGenerator method"); - code.Append($" [RegexGenerator({SymbolDisplay.FormatLiteral(regex.pattern, quote: true)}"); + code.Append($" [GeneratedRegex({SymbolDisplay.FormatLiteral(regex.pattern, quote: true)}"); if (regex.options is not null) { code.Append($", {string.Join(" | ", regex.options.ToString().Split(',').Select(o => $"RegexOptions.{o.Trim()}"))}"); diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorParserTests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorParserTests.cs index 2cfe7b2d875eb..39968b9f5bad5 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorParserTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorParserTests.cs @@ -22,8 +22,8 @@ public async Task Diagnostic_MultipleAttributes() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"")] - [RegexGenerator(""abc"")] + [GeneratedRegex(""ab"")] + [GeneratedRegex(""abc"")] private static partial Regex MultipleAttributes(); } "); @@ -33,7 +33,7 @@ partial class C public static IEnumerable Diagnostic_MalformedCtor_MemberData() { - const string Pre = "[RegexGenerator"; + const string Pre = "[GeneratedRegex"; const string Post = "]"; const string Middle = "\"abc\", RegexOptions.None, -1, \"extra\""; @@ -79,7 +79,7 @@ public async Task Diagnostic_InvalidRegexPattern(string pattern) using System.Text.RegularExpressions; partial class C {{ - [RegexGenerator({pattern})] + [GeneratedRegex({pattern})] private static partial Regex InvalidPattern(); }} "); @@ -95,7 +95,7 @@ public async Task Diagnostic_InvalidRegexOptions(int options) using System.Text.RegularExpressions; partial class C {{ - [RegexGenerator(""ab"", (RegexOptions){options})] + [GeneratedRegex(""ab"", (RegexOptions){options})] private static partial Regex InvalidPattern(); }} "); @@ -112,7 +112,7 @@ public async Task Diagnostic_InvalidRegexTimeout(int matchTimeout) using System.Text.RegularExpressions; partial class C {{ - [RegexGenerator(""ab"", RegexOptions.None, {matchTimeout.ToString(CultureInfo.InvariantCulture)})] + [GeneratedRegex(""ab"", RegexOptions.None, {matchTimeout.ToString(CultureInfo.InvariantCulture)})] private static partial Regex InvalidPattern(); }} "); @@ -127,7 +127,7 @@ public async Task Diagnostic_MethodMustReturnRegex() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial int MethodMustReturnRegex(); } "); @@ -142,7 +142,7 @@ public async Task Diagnostic_MethodMustNotBeGeneric() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex MethodMustNotBeGeneric(); } "); @@ -157,7 +157,7 @@ public async Task Diagnostic_MethodMustBeParameterless() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex MethodMustBeParameterless(int i); } "); @@ -172,7 +172,7 @@ public async Task Diagnostic_MethodMustBePartial() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static Regex MethodMustBePartial() => null; } "); @@ -188,13 +188,13 @@ public async Task Diagnostic_MethodMustBeNonAbstract() partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] public abstract partial Regex MethodMustBeNonAbstract(); } partial interface I { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] public static abstract partial Regex MethodMustBeNonAbstract(); } "); @@ -212,7 +212,7 @@ public async Task Diagnostic_InvalidLangVersion_LimitedSupport(LanguageVersion v using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex InvalidLangVersion(); } ", langVersion: version); @@ -227,7 +227,7 @@ public async Task Diagnostic_NonBacktracking_LimitedSupport() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"", RegexOptions.NonBacktracking)] + [GeneratedRegex(""ab"", RegexOptions.NonBacktracking)] private static partial Regex RightToLeftNotSupported(); } "); @@ -242,7 +242,7 @@ public async Task Diagnostic_CaseInsensitiveBackreference_LimitedSupport() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(@""(?i)(ab)\1"")] + [GeneratedRegex(@""(?i)(ab)\1"")] private static partial Regex CaseInsensitiveBackreferenceNotSupported(); } "); @@ -257,7 +257,7 @@ public async Task Diagnostic_TooMuchNesting_LimitedSupport() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""" + new string('(', 100) + "a" + new string(')', 100) + @""")] + [GeneratedRegex(""" + new string('(', 100) + "a" + new string(')', 100) + @""")] private static partial Regex TooMuchNestingNotSupported(); } "); @@ -266,20 +266,20 @@ partial class C } [Fact] - public async Task Diagnostic_CustomRegexGeneratorAttribute_ZeroArgCtor() + public async Task Diagnostic_CustomGeneratedRegexAttribute_ZeroArgCtor() { IReadOnlyList diagnostics = await RegexGeneratorHelper.RunGenerator(@" using System.Text.RegularExpressions; partial class C { - [RegexGenerator] + [GeneratedRegex] private static partial Regex InvalidCtor(); } namespace System.Text.RegularExpressions { [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] - public sealed class RegexGeneratorAttribute : Attribute + public sealed class GeneratedRegexAttribute : Attribute { } } @@ -289,22 +289,22 @@ public sealed class RegexGeneratorAttribute : Attribute } [Fact] - public async Task Diagnostic_CustomRegexGeneratorAttribute_FourArgCtor() + public async Task Diagnostic_CustomGeneratedRegexAttribute_FourArgCtor() { IReadOnlyList diagnostics = await RegexGeneratorHelper.RunGenerator(@" using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""a"", RegexOptions.None, -1, ""b""] + [GeneratedRegex(""a"", RegexOptions.None, -1, ""b""] private static partial Regex InvalidCtor(); } namespace System.Text.RegularExpressions { [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] - public sealed class RegexGeneratorAttribute : Attribute + public sealed class GeneratedRegexAttribute : Attribute { - public RegexGeneratorAttribute(string pattern, RegexOptions options, int timeout, string somethingElse) { } + public GeneratedRegexAttribute(string pattern, RegexOptions options, int timeout, string somethingElse) { } } } "); @@ -319,7 +319,7 @@ public async Task Valid_ClassWithoutNamespace() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } ", compile: true)); @@ -335,7 +335,7 @@ public async Task Valid_PatternOptions(string options) using System.Text.RegularExpressions; partial class C {{ - [RegexGenerator(""ab"", {options})] + [GeneratedRegex(""ab"", {options})] private static partial Regex Valid(); }} ", compile: true)); @@ -351,7 +351,7 @@ public async Task Valid_PatternOptionsTimeout(string timeout) using System.Text.RegularExpressions; partial class C {{ - [RegexGenerator(""ab"", RegexOptions.None, {timeout})] + [GeneratedRegex(""ab"", RegexOptions.None, {timeout})] private static partial Regex Valid(); }} ", compile: true)); @@ -364,7 +364,7 @@ public async Task Valid_NamedArguments() using System.Text.RegularExpressions; partial class C {{ - [RegexGenerator(pattern: ""ab"", options: RegexOptions.None, matchTimeoutMilliseconds: -1)] + [GeneratedRegex(pattern: ""ab"", options: RegexOptions.None, matchTimeoutMilliseconds: -1)] private static partial Regex Valid(); }} ", compile: true)); @@ -377,10 +377,10 @@ public async Task Valid_ReorderedNamedArguments() using System.Text.RegularExpressions; partial class C {{ - [RegexGenerator(options: RegexOptions.None, matchTimeoutMilliseconds: -1, pattern: ""ab"")] + [GeneratedRegex(options: RegexOptions.None, matchTimeoutMilliseconds: -1, pattern: ""ab"")] private static partial Regex Valid1(); - [RegexGenerator(matchTimeoutMilliseconds: -1, pattern: ""ab"", options: RegexOptions.None)] + [GeneratedRegex(matchTimeoutMilliseconds: -1, pattern: ""ab"", options: RegexOptions.None)] private static partial Regex Valid2(); }} ", compile: true)); @@ -395,7 +395,7 @@ public async Task Valid_AdditionalAttributes() partial class C {{ [SuppressMessage(""CATEGORY1"", ""SOMEID1"")] - [RegexGenerator(""abc"")] + [GeneratedRegex(""abc"")] [SuppressMessage(""CATEGORY2"", ""SOMEID2"")] private static partial Regex AdditionalAttributes(); }} @@ -413,7 +413,7 @@ namespace A { partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } } @@ -428,7 +428,7 @@ public async Task Valid_ClassWithFileScopedNamespace() namespace A; partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } ", compile: true)); @@ -445,7 +445,7 @@ namespace B { partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } } @@ -462,7 +462,7 @@ partial class B { partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } } @@ -480,7 +480,7 @@ partial class B { partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } } @@ -498,7 +498,7 @@ partial class B { partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } } @@ -522,7 +522,7 @@ private protected partial class E { private partial class F { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } } @@ -541,7 +541,7 @@ public async Task Valid_NullableRegex() using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex? Valid(); } ", compile: true)); @@ -559,7 +559,7 @@ public partial class B { private partial class C where T : IBlah { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] private static partial Regex Valid(); } } @@ -579,25 +579,25 @@ public async Task Valid_InterfaceStatics() partial interface INonGeneric { - [RegexGenerator("".+?"")] + [GeneratedRegex("".+?"")] public static partial Regex Test(); } partial interface IGeneric { - [RegexGenerator("".+?"")] + [GeneratedRegex("".+?"")] public static partial Regex Test(); } partial interface ICovariantGeneric { - [RegexGenerator("".+?"")] + [GeneratedRegex("".+?"")] public static partial Regex Test(); } partial interface IContravariantGeneric { - [RegexGenerator("".+?"")] + [GeneratedRegex("".+?"")] public static partial Regex Test(); } ", compile: true)); @@ -611,7 +611,7 @@ public async Task Valid_VirtualBaseImplementations() partial class C { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] public virtual partial Regex Valid(); } ", compile: true)); @@ -628,25 +628,25 @@ public partial class B { private partial class C { - [RegexGenerator(""1"")] + [GeneratedRegex(""1"")] public partial Regex Valid(); } private partial class C { - [RegexGenerator(""2"")] + [GeneratedRegex(""2"")] private static partial Regex Valid(); private partial class D { - [RegexGenerator(""3"")] + [GeneratedRegex(""3"")] internal partial Regex Valid(); } } private partial class E { - [RegexGenerator(""4"")] + [GeneratedRegex(""4"")] private static partial Regex Valid(); } } @@ -654,10 +654,10 @@ private partial class E partial class F { - [RegexGenerator(""5"")] + [GeneratedRegex(""5"")] public partial Regex Valid(); - [RegexGenerator(""6"")] + [GeneratedRegex(""6"")] public partial Regex Valid2(); } ", compile: true)); @@ -700,7 +700,7 @@ public async Task Valid_Modifiers(string type, string typeModifier, bool instanc using System.Text.RegularExpressions; {typeModifier} partial {type} C {{ - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] {methodVisibility} {(instance ? "" : "static")} partial Regex Valid(); }} ", compile: true)); @@ -713,21 +713,21 @@ public async Task Valid_MultiplRegexMethodsPerClass() using System.Text.RegularExpressions; partial class C1 { - [RegexGenerator(""a"")] + [GeneratedRegex(""a"")] private static partial Regex A(); - [RegexGenerator(""b"")] + [GeneratedRegex(""b"")] public static partial Regex B(); - [RegexGenerator(""b"")] + [GeneratedRegex(""b"")] public static partial Regex C(); } partial class C2 { - [RegexGenerator(""d"")] + [GeneratedRegex(""d"")] public static partial Regex D(); - [RegexGenerator(""d"")] + [GeneratedRegex(""d"")] public static partial Regex E(); } ", compile: true)); @@ -748,7 +748,7 @@ public partial record D { public partial struct E { - [RegexGenerator(""ab"")] + [GeneratedRegex(""ab"")] public static partial Regex Valid(); } } @@ -765,16 +765,16 @@ public async Task MultipleTypeDefinitions_DoesntBreakGeneration() namespace System.Text.RegularExpressions; [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] - internal sealed class RegexGeneratorAttribute : Attribute + internal sealed class GeneratedRegexAttribute : Attribute { - public RegexGeneratorAttribute(string pattern){} + public GeneratedRegexAttribute(string pattern){} }", "TestAssembly"); Assert.Empty(await RegexGeneratorHelper.RunGenerator(@" using System.Text.RegularExpressions; partial class C { - [RegexGenerator(""abc"")] + [GeneratedRegex(""abc"")] private static partial Regex Valid(); }", compile: true, additionalRefs: new[] { MetadataReference.CreateFromImage(referencedAssembly) })); } @@ -787,7 +787,7 @@ public async Task Valid_ConcatenatedLiteralsArgument() partial class C { - [RegexGenerator(""ab"" + ""[cd]"")] + [GeneratedRegex(""ab"" + ""[cd]"")] public static partial Regex Valid(); } ", compile: true)); @@ -801,7 +801,7 @@ public async Task Valid_InterpolatedLiteralsArgument() partial class C { - [RegexGenerator($""{""ab""}{""cd""}"")] + [GeneratedRegex($""{""ab""}{""cd""}"")] public static partial Regex Valid(); }", compile: true)); } diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj index d300f4598d3be..5dc9cfb99d77a 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj @@ -3,7 +3,7 @@ true - + $(NoWarn);xUnit2008;SYSLIB0036;SYSLIB1045 $(NetCoreAppCurrent);net48 true @@ -50,7 +50,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -79,6 +79,6 @@ - + diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToRegexGeneratorAnalyzerTests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToGeneratedRegexAnalyzerTests.cs similarity index 95% rename from src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToRegexGeneratorAnalyzerTests.cs rename to src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToGeneratedRegexAnalyzerTests.cs index 687e9ad2a9722..ae734a7b8590d 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToRegexGeneratorAnalyzerTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToGeneratedRegexAnalyzerTests.cs @@ -14,13 +14,13 @@ using Microsoft.CodeAnalysis.Testing; using Xunit; using VerifyCS = System.Text.RegularExpressions.Tests.CSharpCodeFixVerifier< - System.Text.RegularExpressions.Generator.UpgradeToRegexGeneratorAnalyzer, - System.Text.RegularExpressions.Generator.UpgradeToRegexGeneratorCodeFixer>; + System.Text.RegularExpressions.Generator.UpgradeToGeneratedRegexAnalyzer, + System.Text.RegularExpressions.Generator.UpgradeToGeneratedRegexCodeFixer>; namespace System.Text.RegularExpressions.Tests { [ActiveIssue("https://github.com/dotnet/runtime/issues/69823", TestRuntimes.Mono)] - public class UpgradeToRegexGeneratorAnalyzerTests + public class UpgradeToGeneratedRegexAnalyzerTests { private const string UseRegexSourceGeneratorDiagnosticId = @"SYSLIB1045"; @@ -94,7 +94,7 @@ public async Task TopLevelStatements(InvocationType invocationType) partial class Program { - [RegexGenerator("""")] + [GeneratedRegex("""")] private static partial Regex MyRegex(); }"; await new VerifyCS.Test @@ -206,7 +206,7 @@ public static void Main(string[] args) var isMatch = MyRegex().IsMatch(""""); } - [RegexGenerator("""")] + [GeneratedRegex("""")] private static partial Regex MyRegex(); }" }; @@ -232,7 +232,7 @@ public static void Main(string[] args) var isMatch = MyRegex().IsMatch(""""); } - [RegexGenerator("""")] + [GeneratedRegex("""")] private static partial Regex MyRegex(); }" }; @@ -260,7 +260,7 @@ public static void Main(string[] args) var isMatch = MyRegex().IsMatch(""""); } - [RegexGenerator("""")] + [GeneratedRegex("""")] private static partial Regex MyRegex(); }" }; } @@ -372,7 +372,7 @@ public static void Main(string[] args) var isMatch = MyRegex().IsMatch(""""); } - [RegexGenerator("""", RegexOptions.None)] + [GeneratedRegex("""", RegexOptions.None)] private static partial Regex MyRegex(); }" }; @@ -396,7 +396,7 @@ public static void Main(string[] args) var isMatch = MyRegex().IsMatch(""""); } - [RegexGenerator("""", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)] + [GeneratedRegex("""", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)] private static partial Regex MyRegex(); }" }; @@ -422,7 +422,7 @@ public static void Main(string[] args) var isMatch = MyRegex().IsMatch(""""); } - [RegexGenerator("""", RegexOptions.None)] + [GeneratedRegex("""", RegexOptions.None)] private static partial Regex MyRegex(); }" }; } @@ -531,7 +531,7 @@ public static void Main(string[] args) MyRegex().@@Method@@(""input""); } - [RegexGenerator(""a|b"", RegexOptions.None)] + [GeneratedRegex(""a|b"", RegexOptions.None)] private static partial Regex MyRegex(); }"; @@ -553,7 +553,7 @@ public static void Main(string[] args) MyRegex().@@Method@@(""input""); } - [RegexGenerator(""a|b"")] + [GeneratedRegex(""a|b"")] private static partial Regex MyRegex(); }"; @@ -593,7 +593,7 @@ public static void Main(string[] args) MyRegex().Replace(""input"", ""replacement""); } - [RegexGenerator(""a[b|c]*"", RegexOptions.CultureInvariant)] + [GeneratedRegex(""a[b|c]*"", RegexOptions.CultureInvariant)] private static partial Regex MyRegex(); } " }; @@ -616,7 +616,7 @@ public static void Main(string[] args) MyRegex().Replace(""input"", ""replacement""); } - [RegexGenerator(""a[b|c]*"")] + [GeneratedRegex(""a[b|c]*"")] private static partial Regex MyRegex(); } " }; @@ -664,7 +664,7 @@ public void Foo() Regex regex = MyRegex(); } - [RegexGenerator(""pattern"", RegexOptions.IgnorePatternWhitespace)] + [GeneratedRegex(""pattern"", RegexOptions.IgnorePatternWhitespace)] private static partial Regex MyRegex(); } } @@ -717,9 +717,9 @@ public static void Main() Regex regex2 = MyRegex1(); } - [RegexGenerator(""a|b"")] + [GeneratedRegex(""a|b"")] private static partial Regex MyRegex(); - [RegexGenerator(""c|d"", RegexOptions.CultureInvariant)] + [GeneratedRegex(""c|d"", RegexOptions.CultureInvariant)] private static partial Regex MyRegex1(); } "; @@ -753,7 +753,7 @@ static void Main(string[] args) Regex r = MyRegex(); } - [RegexGenerator(""a|b"", RegexOptions.None)] + [GeneratedRegex(""a|b"", RegexOptions.None)] private static partial Regex MyRegex(); }"; @@ -776,7 +776,7 @@ public async Task TopLevelStatements_MultipleSourceFiles() partial class Program { - [System.Text.RegularExpressions.RegexGenerator("""")] + [System.Text.RegularExpressions.GeneratedRegex("""")] private static partial System.Text.RegularExpressions.Regex MyRegex(); }" } }, @@ -800,7 +800,7 @@ static partial class Class { public static string CollapseWhitespace(this string text) => MyRegex().Replace(text, "" ""); - [RegexGenerator("" \\s+"")] + [GeneratedRegex("" \\s+"")] private static partial Regex MyRegex(); }"; @@ -823,7 +823,7 @@ public partial class C { void M1(Regex r) => _ = r; void M2() => M1(MyRegex()); - [RegexGenerator("""")] + [GeneratedRegex("""")] private static partial Regex MyRegex(); } "; @@ -853,7 +853,7 @@ public void Foo() Regex regex = MyRegex(); } - [RegexGenerator(""pattern"", (RegexOptions)2048)] + [GeneratedRegex(""pattern"", (RegexOptions)2048)] private static partial Regex MyRegex(); } "; @@ -885,7 +885,7 @@ public void Foo() Regex regex = MyRegex(); } - [RegexGenerator(""pattern"", (RegexOptions)2048)] + [GeneratedRegex(""pattern"", (RegexOptions)2048)] private static partial Regex MyRegex(); } "; @@ -915,7 +915,7 @@ public void Foo() Regex regex = MyRegex(); } - [RegexGenerator(""pattern"", (RegexOptions)(-10000))] + [GeneratedRegex(""pattern"", (RegexOptions)(-10000))] private static partial Regex MyRegex(); } ";