| File: _generated\1\RegexGenerator.g.cs | Web Access |
| Project: src\aspnetcore\src\Servers\Kestrel\Core\src\Microsoft.AspNetCore.Server.Kestrel.Core.csproj (Microsoft.AspNetCore.Server.Kestrel.Core) |
// <auto-generated/> #nullable enable #pragma warning disable namespace Microsoft.AspNetCore.Certificates.Generation { partial class UnixCertificateManager { /// <remarks> /// Pattern:<br/> /// <code>OPENSSLDIR:\s*"([^"]+)"</code><br/> /// Explanation:<br/> /// <code> /// ○ Match the string "OPENSSLDIR:".<br/> /// ○ Match a whitespace character atomically any number of times.<br/> /// ○ Match '"'.<br/> /// ○ 1st capture group.<br/> /// ○ Match a character other than '"' atomically at least once.<br/> /// ○ Match '"'.<br/> /// </code> /// </remarks> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.36704")] private static partial global::System.Text.RegularExpressions.Regex OpenSslVersionRegex => global::System.Text.RegularExpressions.Generated.OpenSslVersionRegex_0.Instance; } } namespace Microsoft.AspNetCore.Certificates.Generation { partial class UnixCertificateManager { /// <remarks> /// Pattern:<br/> /// <code>^[0-9a-f]+\.[0-9]+$</code><br/> /// Explanation:<br/> /// <code> /// ○ Match if at the beginning of the string.<br/> /// ○ Match a lowercase hexadecimal digit atomically at least once.<br/> /// ○ Match '.'.<br/> /// ○ Match a character in the set [0-9] atomically at least once.<br/> /// ○ Match if at the end of the string or if before an ending newline.<br/> /// </code> /// </remarks> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.36704")] private static partial global::System.Text.RegularExpressions.Regex OpenSslHashFilenameRegex => global::System.Text.RegularExpressions.Generated.OpenSslHashFilenameRegex_1.Instance; } } namespace Microsoft.AspNetCore.Certificates.Generation { partial class UnixCertificateManager { /// <remarks> /// Pattern:<br/> /// <code>\.(pem|crt|cer)$</code><br/> /// Explanation:<br/> /// <code> /// ○ Match '.'.<br/> /// ○ 1st capture group.<br/> /// ○ Match with 2 alternative expressions.<br/> /// ○ Match the string "pem".<br/> /// ○ Match a sequence of expressions.<br/> /// ○ Match 'c'.<br/> /// ○ Match with 2 alternative expressions.<br/> /// ○ Match the string "rt".<br/> /// ○ Match the string "er".<br/> /// ○ Match if at the end of the string or if before an ending newline.<br/> /// </code> /// </remarks> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.36704")] private static partial global::System.Text.RegularExpressions.Regex OpenSslCertificateExtensionRegex => global::System.Text.RegularExpressions.Generated.OpenSslCertificateExtensionRegex_2.Instance; } } namespace System.Text.RegularExpressions.Generated { using System; using System.Buffers; using System.CodeDom.Compiler; using System.Collections; using System.ComponentModel; using System.Globalization; using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using System.Threading; /// <summary>Custom <see cref="Regex"/>-derived type for the OpenSslVersionRegex method.</summary> [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.36704")] [SkipLocalsInit] file sealed class OpenSslVersionRegex_0 : Regex { /// <summary>Cached, thread-safe singleton instance.</summary> internal static readonly OpenSslVersionRegex_0 Instance = new(); /// <summary>Initializes the instance.</summary> private OpenSslVersionRegex_0() { base.pattern = "OPENSSLDIR:\\s*\"([^\"]+)\""; base.roptions = RegexOptions.None; ValidateMatchTimeout(Utilities.s_defaultTimeout); base.internalMatchTimeout = Utilities.s_defaultTimeout; base.factory = new RunnerFactory(); base.capsize = 2; } /// <summary>Provides a factory for creating <see cref="RegexRunner"/> instances to be used by methods on <see cref="Regex"/>.</summary> private sealed class RunnerFactory : RegexRunnerFactory { /// <summary>Creates an instance of a <see cref="RegexRunner"/> used by methods on <see cref="Regex"/>.</summary> protected override RegexRunner CreateInstance() => new Runner(); /// <summary>Provides the runner that contains the custom logic implementing the specified regular expression.</summary> private sealed class Runner : RegexRunner { /// <summary>Scan the <paramref name="inputSpan"/> starting from base.runtextstart for the next match.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> protected override void Scan(ReadOnlySpan<char> inputSpan) { // Search until we can't find a valid starting position, we find a match, or we reach the end of the input. while (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan) && base.runtextpos != inputSpan.Length) { base.runtextpos++; if (Utilities.s_hasTimeout) { base.CheckTimeout(); } } } /// <summary>Search <paramref name="inputSpan"/> starting from base.runtextpos for the next location a match could possibly start.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> /// <returns>true if a possible match was found; false if no more matches are possible.</returns> private bool TryFindNextPossibleStartingPosition(ReadOnlySpan<char> inputSpan) { int pos = base.runtextpos; // Any possible match is at least 14 characters. if (pos <= inputSpan.Length - 14) { // The pattern has the literal "OPENSSLDIR:" at the beginning of the pattern. Find the next occurrence. // If it can't be found, there's no match. int i = inputSpan.Slice(pos).IndexOfAny(Utilities.s_indexOfString_6561199BCBB8490829F71D3C0AB5A8D82E7C7C1A521E49F6E6880A55FADC7161); if (i >= 0) { base.runtextpos = pos + i; return true; } } // No match found. base.runtextpos = inputSpan.Length; return false; } /// <summary>Determine whether <paramref name="inputSpan"/> at base.runtextpos is a match for the regular expression.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> /// <returns>true if the regular expression matches at the current position; otherwise, false.</returns> private bool TryMatchAtCurrentPosition(ReadOnlySpan<char> inputSpan) { int pos = base.runtextpos; int matchStart = pos; int capture_starting_pos = 0; ReadOnlySpan<char> slice = inputSpan.Slice(pos); // Match the string "OPENSSLDIR:". if (!slice.StartsWith("OPENSSLDIR:")) { UncaptureUntil(0); return false; // The input didn't match. } // Match a whitespace character atomically any number of times. { int iteration = 11; while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) { iteration++; } slice = slice.Slice(iteration); pos += iteration; } // Match '"'. if (slice.IsEmpty || slice[0] != '"') { UncaptureUntil(0); return false; // The input didn't match. } // 1st capture group. { pos++; slice = inputSpan.Slice(pos); capture_starting_pos = pos; // Match a character other than '"' atomically at least once. { int iteration1 = slice.IndexOf('"'); if (iteration1 < 0) { iteration1 = slice.Length; } if (iteration1 == 0) { UncaptureUntil(0); return false; // The input didn't match. } slice = slice.Slice(iteration1); pos += iteration1; } base.Capture(1, capture_starting_pos, pos); } // Match '"'. if (slice.IsEmpty || slice[0] != '"') { UncaptureUntil(0); return false; // The input didn't match. } // The input matched. pos++; base.runtextpos = pos; base.Capture(0, matchStart, pos); return true; // <summary>Undo captures until it reaches the specified capture position.</summary> [MethodImpl(MethodImplOptions.AggressiveInlining)] void UncaptureUntil(int capturePosition) { while (base.Crawlpos() > capturePosition) { base.Uncapture(); } } } } } } /// <summary>Custom <see cref="Regex"/>-derived type for the OpenSslHashFilenameRegex method.</summary> [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.36704")] [SkipLocalsInit] file sealed class OpenSslHashFilenameRegex_1 : Regex { /// <summary>Cached, thread-safe singleton instance.</summary> internal static readonly OpenSslHashFilenameRegex_1 Instance = new(); /// <summary>Initializes the instance.</summary> private OpenSslHashFilenameRegex_1() { base.pattern = "^[0-9a-f]+\\.[0-9]+$"; base.roptions = RegexOptions.None; ValidateMatchTimeout(Utilities.s_defaultTimeout); base.internalMatchTimeout = Utilities.s_defaultTimeout; base.factory = new RunnerFactory(); base.capsize = 1; } /// <summary>Provides a factory for creating <see cref="RegexRunner"/> instances to be used by methods on <see cref="Regex"/>.</summary> private sealed class RunnerFactory : RegexRunnerFactory { /// <summary>Creates an instance of a <see cref="RegexRunner"/> used by methods on <see cref="Regex"/>.</summary> protected override RegexRunner CreateInstance() => new Runner(); /// <summary>Provides the runner that contains the custom logic implementing the specified regular expression.</summary> private sealed class Runner : RegexRunner { /// <summary>Scan the <paramref name="inputSpan"/> starting from base.runtextstart for the next match.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> protected override void Scan(ReadOnlySpan<char> inputSpan) { // The pattern is anchored. Validate the current position and try to match at it only. if (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan)) { base.runtextpos = inputSpan.Length; } } /// <summary>Search <paramref name="inputSpan"/> starting from base.runtextpos for the next location a match could possibly start.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> /// <returns>true if a possible match was found; false if no more matches are possible.</returns> private bool TryFindNextPossibleStartingPosition(ReadOnlySpan<char> inputSpan) { int pos = base.runtextpos; // Any possible match is at least 3 characters. if (pos <= inputSpan.Length - 3) { // The pattern leads with a beginning (\A) anchor. if (pos == 0) { return true; } } // No match found. base.runtextpos = inputSpan.Length; return false; } /// <summary>Determine whether <paramref name="inputSpan"/> at base.runtextpos is a match for the regular expression.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> /// <returns>true if the regular expression matches at the current position; otherwise, false.</returns> private bool TryMatchAtCurrentPosition(ReadOnlySpan<char> inputSpan) { int pos = base.runtextpos; int matchStart = pos; ReadOnlySpan<char> slice = inputSpan.Slice(pos); // Match if at the beginning of the string. if (pos != 0) { return false; // The input didn't match. } // Match a lowercase hexadecimal digit atomically at least once. { int iteration = slice.IndexOfAnyExcept(Utilities.s_asciiHexDigitsLower); if (iteration < 0) { iteration = slice.Length; } if (iteration == 0) { return false; // The input didn't match. } slice = slice.Slice(iteration); pos += iteration; } // Match '.'. if (slice.IsEmpty || slice[0] != '.') { return false; // The input didn't match. } // Match a character in the set [0-9] atomically at least once. { int iteration1 = slice.Slice(1).IndexOfAnyExceptInRange('0', '9'); if (iteration1 < 0) { iteration1 = slice.Length - 1; } if (iteration1 == 0) { return false; // The input didn't match. } slice = slice.Slice(iteration1); pos += iteration1; } // Match if at the end of the string or if before an ending newline. if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n')) { return false; // The input didn't match. } // The input matched. pos++; base.runtextpos = pos; base.Capture(0, matchStart, pos); return true; } } } } /// <summary>Custom <see cref="Regex"/>-derived type for the OpenSslCertificateExtensionRegex method.</summary> [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.36704")] [SkipLocalsInit] file sealed class OpenSslCertificateExtensionRegex_2 : Regex { /// <summary>Cached, thread-safe singleton instance.</summary> internal static readonly OpenSslCertificateExtensionRegex_2 Instance = new(); /// <summary>Initializes the instance.</summary> private OpenSslCertificateExtensionRegex_2() { base.pattern = "\\.(pem|crt|cer)$"; base.roptions = RegexOptions.None; ValidateMatchTimeout(Utilities.s_defaultTimeout); base.internalMatchTimeout = Utilities.s_defaultTimeout; base.factory = new RunnerFactory(); base.capsize = 2; } /// <summary>Provides a factory for creating <see cref="RegexRunner"/> instances to be used by methods on <see cref="Regex"/>.</summary> private sealed class RunnerFactory : RegexRunnerFactory { /// <summary>Creates an instance of a <see cref="RegexRunner"/> used by methods on <see cref="Regex"/>.</summary> protected override RegexRunner CreateInstance() => new Runner(); /// <summary>Provides the runner that contains the custom logic implementing the specified regular expression.</summary> private sealed class Runner : RegexRunner { /// <summary>Scan the <paramref name="inputSpan"/> starting from base.runtextstart for the next match.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> protected override void Scan(ReadOnlySpan<char> inputSpan) { // Search until we can't find a valid starting position, we find a match, or we reach the end of the input. while (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan) && base.runtextpos != inputSpan.Length) { base.runtextpos++; if (Utilities.s_hasTimeout) { base.CheckTimeout(); } } } /// <summary>Search <paramref name="inputSpan"/> starting from base.runtextpos for the next location a match could possibly start.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> /// <returns>true if a possible match was found; false if no more matches are possible.</returns> private bool TryFindNextPossibleStartingPosition(ReadOnlySpan<char> inputSpan) { int pos = base.runtextpos; // Any possible match is at least 4 characters. if (pos <= inputSpan.Length - 4) { // The pattern has a trailing end (\Z) anchor, and any possible match is exactly 4 characters. if (pos < inputSpan.Length - 5) { base.runtextpos = inputSpan.Length - 5; } return true; } // No match found. base.runtextpos = inputSpan.Length; return false; } /// <summary>Determine whether <paramref name="inputSpan"/> at base.runtextpos is a match for the regular expression.</summary> /// <param name="inputSpan">The text being scanned by the regular expression.</param> /// <returns>true if the regular expression matches at the current position; otherwise, false.</returns> private bool TryMatchAtCurrentPosition(ReadOnlySpan<char> inputSpan) { int pos = base.runtextpos; int matchStart = pos; int alternation_branch = 0; int alternation_starting_capturepos = 0; int alternation_starting_pos = 0; int capture_starting_pos = 0; ReadOnlySpan<char> slice = inputSpan.Slice(pos); // Match '.'. if (slice.IsEmpty || slice[0] != '.') { UncaptureUntil(0); return false; // The input didn't match. } // 1st capture group. //{ pos++; slice = inputSpan.Slice(pos); capture_starting_pos = pos; // Match with 2 alternative expressions. //{ alternation_starting_pos = pos; alternation_starting_capturepos = base.Crawlpos(); // Branch 0 //{ // Match the string "pem". if (!slice.StartsWith("pem")) { goto AlternationBranch; } alternation_branch = 0; pos += 3; slice = inputSpan.Slice(pos); goto AlternationMatch; AlternationBranch: pos = alternation_starting_pos; slice = inputSpan.Slice(pos); UncaptureUntil(alternation_starting_capturepos); //} // Branch 1 //{ // Match 'c'. if (slice.IsEmpty || slice[0] != 'c') { UncaptureUntil(0); return false; // The input didn't match. } // Match with 2 alternative expressions. //{ if ((uint)slice.Length < 2) { UncaptureUntil(0); return false; // The input didn't match. } switch (slice[1]) { case 'r': // Match 't'. if ((uint)slice.Length < 3 || slice[2] != 't') { UncaptureUntil(0); return false; // The input didn't match. } pos += 3; slice = inputSpan.Slice(pos); break; case 'e': // Match 'r'. if ((uint)slice.Length < 3 || slice[2] != 'r') { UncaptureUntil(0); return false; // The input didn't match. } pos += 3; slice = inputSpan.Slice(pos); break; default: UncaptureUntil(0); return false; // The input didn't match. } //} alternation_branch = 1; goto AlternationMatch; //} AlternationBacktrack: if (Utilities.s_hasTimeout) { base.CheckTimeout(); } switch (alternation_branch) { case 0: goto AlternationBranch; case 1: UncaptureUntil(0); return false; // The input didn't match. } AlternationMatch:; //} base.Capture(1, capture_starting_pos, pos); goto CaptureSkipBacktrack; CaptureBacktrack: goto AlternationBacktrack; CaptureSkipBacktrack:; //} // Match if at the end of the string or if before an ending newline. if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) { goto CaptureBacktrack; } // The input matched. base.runtextpos = pos; base.Capture(0, matchStart, pos); return true; // <summary>Undo captures until it reaches the specified capture position.</summary> [MethodImpl(MethodImplOptions.AggressiveInlining)] void UncaptureUntil(int capturePosition) { while (base.Crawlpos() > capturePosition) { base.Uncapture(); } } } } } } /// <summary>Helper methods used by generated <see cref="Regex"/>-derived implementations.</summary> [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.36704")] file static class Utilities { /// <summary>Default timeout value set in <see cref="AppContext"/>, or <see cref="Regex.InfiniteMatchTimeout"/> if none was set.</summary> internal static readonly TimeSpan s_defaultTimeout = AppContext.GetData("REGEX_DEFAULT_MATCH_TIMEOUT") is TimeSpan timeout ? timeout : Regex.InfiniteMatchTimeout; /// <summary>Whether <see cref="s_defaultTimeout"/> is non-infinite.</summary> internal static readonly bool s_hasTimeout = s_defaultTimeout != Regex.InfiniteMatchTimeout; /// <summary>Supports searching for characters in or not in "0123456789abcdef".</summary> internal static readonly SearchValues<char> s_asciiHexDigitsLower = SearchValues.Create("0123456789abcdef"); /// <summary>Supports searching for the string "OPENSSLDIR:".</summary> internal static readonly SearchValues<string> s_indexOfString_6561199BCBB8490829F71D3C0AB5A8D82E7C7C1A521E49F6E6880A55FADC7161 = SearchValues.Create(["OPENSSLDIR:"], StringComparison.Ordinal); } }