File: _generated\4\RegexGenerator.g.cs
Web Access
Project: src\src\runtime\src\libraries\System.Data.OleDb\src\System.Data.OleDb.csproj (System.Data.OleDb)
// <auto-generated/>
#nullable enable
#pragma warning disable

namespace System.Data.Common
{
    partial class DbConnectionOptions
    {
        /// <remarks>
        /// Pattern:<br/>
        /// <code>^(?![;\s])[^\p{Cc}]+(?&lt;!\s)$</code><br/>
        /// Explanation:<br/>
        /// <code>
        /// ○ Match if at the beginning of the string.<br/>
        /// ○ Zero-width negative lookahead.<br/>
        ///     ○ Match a character in the set [;\s].<br/>
        /// ○ Match any character other than a Unicode control character greedily at least once.<br/>
        /// ○ Zero-width negative lookbehind.<br/>
        ///     ○ Match a whitespace character right-to-left.<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.26904")]
        private static partial global::System.Text.RegularExpressions.Regex ConnectionStringValidKeyRegex => global::System.Text.RegularExpressions.Generated.ConnectionStringValidKeyRegex_0.Instance;
    }
}

namespace System.Data.Common
{
    partial class DbConnectionOptions
    {
        /// <remarks>
        /// Pattern:<br/>
        /// <code>^[^"'=;\s\p{Cc}]*$</code><br/>
        /// Explanation:<br/>
        /// <code>
        /// ○ Match if at the beginning of the string.<br/>
        /// ○ Match a character in the set [^"';=\s\p{Cc}] atomically any number of times.<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.26904")]
        private static partial global::System.Text.RegularExpressions.Regex ConnectionStringQuoteValueRegex => global::System.Text.RegularExpressions.Generated.ConnectionStringQuoteValueRegex_1.Instance;
    }
}

namespace System.Data.Common
{
    partial class DbConnectionOptions
    {
        /// <remarks>
        /// Pattern:<br/>
        /// <code>^\{([^\}\u0000]|\}\})*\}$</code><br/>
        /// Options:<br/>
        /// <code>RegexOptions.ExplicitCapture</code><br/>
        /// Explanation:<br/>
        /// <code>
        /// ○ Match if at the beginning of the string.<br/>
        /// ○ Match '{'.<br/>
        /// ○ Loop greedily any number of times.<br/>
        ///     ○ Match with 2 alternative expressions.<br/>
        ///         ○ Match a character in the set [^\0}].<br/>
        ///         ○ Match the string "}}".<br/>
        /// ○ Match '}'.<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.26904")]
        private static partial global::System.Text.RegularExpressions.Regex ConnectionStringQuoteOdbcValueRegex => global::System.Text.RegularExpressions.Generated.ConnectionStringQuoteOdbcValueRegex_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 ConnectionStringValidKeyRegex method.</summary>
    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.26904")]
    [SkipLocalsInit]
    file sealed class ConnectionStringValidKeyRegex_0 : Regex
    {
        /// <summary>Cached, thread-safe singleton instance.</summary>
        internal static readonly ConnectionStringValidKeyRegex_0 Instance = new();
    
        /// <summary>Initializes the instance.</summary>
        private ConnectionStringValidKeyRegex_0()
        {
            base.pattern = "^(?![;\\s])[^\\p{Cc}]+(?<!\\s)$";
            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;
                    
                    // Empty matches aren't possible.
                    if ((uint)pos < (uint)inputSpan.Length)
                    {
                        // 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;
                    char ch;
                    int charloop_starting_pos = 0, charloop_ending_pos = 0;
                    int stackpos = 0;
                    ReadOnlySpan<char> slice = inputSpan.Slice(pos);
                    
                    // Match if at the beginning of the string.
                    if (pos != 0)
                    {
                        return false; // The input didn't match.
                    }
                    
                    // Zero-width negative lookahead.
                    {
                        slice = inputSpan.Slice(pos);
                        int negativelookahead__starting_pos = pos;
                        if (Utilities.s_hasTimeout)
                        {
                            base.CheckTimeout();
                        }
                        
                        int atomic_stackpos = stackpos;
                        
                        // Match a character in the set [;\s].
                        if (slice.IsEmpty || ((ch = slice[0]) < 128 ? ("㸀\0\u0001ࠀ\0\0\0\0"[ch >> 4] & (1 << (ch & 0xF))) == 0 : !RegexRunner.CharInClass((char)ch, "\0\u0002\u0001;<d")))
                        {
                            goto NegativeLookaroundMatch;
                        }
                        
                        stackpos = atomic_stackpos;
                        
                        return false; // The input didn't match.
                        
                        NegativeLookaroundMatch:
                        pos = negativelookahead__starting_pos;
                        slice = inputSpan.Slice(pos);
                    }
                    
                    // Match any character other than a Unicode control character greedily at least once.
                    //{
                        charloop_starting_pos = pos;
                        
                        int iteration = 0;
                        while ((uint)iteration < (uint)slice.Length && (char.GetUnicodeCategory(slice[iteration]) != UnicodeCategory.Control))
                        {
                            iteration++;
                        }
                        
                        if (iteration == 0)
                        {
                            return false; // The input didn't match.
                        }
                        
                        slice = slice.Slice(iteration);
                        pos += iteration;
                        
                        charloop_ending_pos = pos;
                        charloop_starting_pos++;
                        goto CharLoopEnd;
                        
                        CharLoopBacktrack:
                        
                        if (Utilities.s_hasTimeout)
                        {
                            base.CheckTimeout();
                        }
                        
                        if (charloop_starting_pos >= charloop_ending_pos)
                        {
                            return false; // The input didn't match.
                        }
                        pos = --charloop_ending_pos;
                        slice = inputSpan.Slice(pos);
                        
                        CharLoopEnd:
                    //}
                    
                    // Zero-width negative lookbehind.
                    {
                        slice = inputSpan.Slice(pos);
                        int negativelookbehind__starting_pos = pos;
                        if (Utilities.s_hasTimeout)
                        {
                            base.CheckTimeout();
                        }
                        
                        int atomic_stackpos1 = stackpos;
                        
                        // Match a whitespace character right-to-left.
                        if ((uint)(pos - 1) >= inputSpan.Length || !char.IsWhiteSpace(inputSpan[pos - 1]))
                        {
                            goto NegativeLookaroundMatch1;
                        }
                        pos--;
                        
                        stackpos = atomic_stackpos1;
                        
                        goto CharLoopBacktrack;
                        
                        NegativeLookaroundMatch1:
                        pos = negativelookbehind__starting_pos;
                        slice = inputSpan.Slice(pos);
                    }
                    
                    // 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 CharLoopBacktrack;
                    }
                    
                    // The input matched.
                    base.runtextpos = pos;
                    base.Capture(0, matchStart, pos);
                    return true;
                }
            }
        }

    }
    
    /// <summary>Custom <see cref="Regex"/>-derived type for the ConnectionStringQuoteValueRegex method.</summary>
    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.26904")]
    [SkipLocalsInit]
    file sealed class ConnectionStringQuoteValueRegex_1 : Regex
    {
        /// <summary>Cached, thread-safe singleton instance.</summary>
        internal static readonly ConnectionStringQuoteValueRegex_1 Instance = new();
    
        /// <summary>Initializes the instance.</summary>
        private ConnectionStringQuoteValueRegex_1()
        {
            base.pattern = "^[^\"'=;\\s\\p{Cc}]*$";
            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;
                    
                    // 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;
                    char ch;
                    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 character in the set [^"';=\s\p{Cc}] atomically any number of times.
                    {
                        int iteration = 0;
                        while ((uint)iteration < (uint)slice.Length && ((ch = slice[iteration]) < 128 ? ("\0\0コ\ud7ff\uffff\uffff\uffff翿"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\u0001\b\u0002\"#'(;<=>d\u000f")))
                        {
                            iteration++;
                        }
                        
                        slice = slice.Slice(iteration);
                        pos += iteration;
                    }
                    
                    // 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'))
                    {
                        return false; // The input didn't match.
                    }
                    
                    // The input matched.
                    base.runtextpos = pos;
                    base.Capture(0, matchStart, pos);
                    return true;
                }
            }
        }

    }
    
    /// <summary>Custom <see cref="Regex"/>-derived type for the ConnectionStringQuoteOdbcValueRegex method.</summary>
    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.26904")]
    [SkipLocalsInit]
    file sealed class ConnectionStringQuoteOdbcValueRegex_2 : Regex
    {
        /// <summary>Cached, thread-safe singleton instance.</summary>
        internal static readonly ConnectionStringQuoteOdbcValueRegex_2 Instance = new();
    
        /// <summary>Initializes the instance.</summary>
        private ConnectionStringQuoteOdbcValueRegex_2()
        {
            base.pattern = "^\\{([^\\}\0]|\\}\\})*\\}$";
            base.roptions = RegexOptions.ExplicitCapture;
            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 2 characters.
                    if (pos <= inputSpan.Length - 2)
                    {
                        // 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;
                    char ch;
                    int loop_iteration = 0;
                    int stackpos = 0;
                    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 '{'.
                    if (slice.IsEmpty || slice[0] != '{')
                    {
                        return false; // The input didn't match.
                    }
                    
                    // Loop greedily any number of times.
                    //{
                        pos++;
                        slice = inputSpan.Slice(pos);
                        loop_iteration = 0;
                        
                        LoopBody:
                        Utilities.StackPush(ref base.runstack!, ref stackpos, pos);
                        
                        loop_iteration++;
                        
                        // Match with 2 alternative expressions.
                        //{
                            int alternation_starting_pos = pos;
                            
                            // Branch 0
                            //{
                                // Match a character in the set [^\0}].
                                if (slice.IsEmpty || (((ch = slice[0]) == '\0') | (ch == '}')))
                                {
                                    goto AlternationBranch;
                                }
                                
                                Utilities.StackPush(ref base.runstack!, ref stackpos, 0, alternation_starting_pos);
                                pos++;
                                slice = inputSpan.Slice(pos);
                                goto AlternationMatch;
                                
                                AlternationBranch:
                                pos = alternation_starting_pos;
                                slice = inputSpan.Slice(pos);
                            //}
                            
                            // Branch 1
                            //{
                                // Match the string "}}".
                                if (!slice.StartsWith("}}"))
                                {
                                    goto LoopIterationNoMatch;
                                }
                                
                                Utilities.StackPush(ref base.runstack!, ref stackpos, 1, alternation_starting_pos);
                                pos += 2;
                                slice = inputSpan.Slice(pos);
                                goto AlternationMatch;
                            //}
                            
                            AlternationBacktrack:
                            if (Utilities.s_hasTimeout)
                            {
                                base.CheckTimeout();
                            }
                            
                            alternation_starting_pos = base.runstack![--stackpos];
                            switch (base.runstack![--stackpos])
                            {
                                case 0:
                                    goto AlternationBranch;
                                case 1:
                                    goto LoopIterationNoMatch;
                            }
                            
                            AlternationMatch:;
                        //}
                        
                        
                        // The loop has no upper bound. Continue iterating greedily.
                        goto LoopBody;
                        
                        // The loop iteration failed. Put state back to the way it was before the iteration.
                        LoopIterationNoMatch:
                        if (--loop_iteration < 0)
                        {
                            // Unable to match the remainder of the expression after exhausting the loop.
                            return false; // The input didn't match.
                        }
                        pos = base.runstack![--stackpos];
                        slice = inputSpan.Slice(pos);
                        goto LoopEnd;
                        
                        LoopBacktrack:
                        if (Utilities.s_hasTimeout)
                        {
                            base.CheckTimeout();
                        }
                        
                        if (loop_iteration == 0)
                        {
                            // No iterations of the loop remain to backtrack into. Fail the loop.
                            return false; // The input didn't match.
                        }
                        goto AlternationBacktrack;
                        LoopEnd:;
                    //}
                    
                    // Match '}'.
                    if (slice.IsEmpty || slice[0] != '}')
                    {
                        goto LoopBacktrack;
                    }
                    
                    // Match if at the end of the string or if before an ending newline.
                    if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n'))
                    {
                        goto LoopBacktrack;
                    }
                    
                    // The input matched.
                    pos++;
                    base.runtextpos = pos;
                    base.Capture(0, matchStart, pos);
                    return true;
                }
            }
        }

    }
    
    /// <summary>Helper methods used by generated <see cref="Regex"/>-derived implementations.</summary>
    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.26904")]
    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>Pushes 1 value onto the backtracking stack.</summary>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        internal static void StackPush(ref int[] stack, ref int pos, int arg0)
        {
            // If there's space available for the value, store it.
            int[] s = stack;
            int p = pos;
            if ((uint)p < (uint)s.Length)
            {
                s[p] = arg0;
                pos++;
                return;
            }
        
            // Otherwise, resize the stack to make room and try again.
            WithResize(ref stack, ref pos, arg0);
        
            // <summary>Resize the backtracking stack array and push 1 value onto the stack.</summary>
            [MethodImpl(MethodImplOptions.NoInlining)]
            static void WithResize(ref int[] stack, ref int pos, int arg0)
            {
                Array.Resize(ref stack, (pos + 0) * 2);
                StackPush(ref stack, ref pos, arg0);
            }
        }
        
        /// <summary>Pushes 2 values onto the backtracking stack.</summary>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        internal static void StackPush(ref int[] stack, ref int pos, int arg0, int arg1)
        {
            // If there's space available for all 2 values, store them.
            int[] s = stack;
            int p = pos;
            if ((uint)(p + 1) < (uint)s.Length)
            {
                s[p] = arg0;
                s[p + 1] = arg1;
                pos += 2;
                return;
            }
        
            // Otherwise, resize the stack to make room and try again.
            WithResize(ref stack, ref pos, arg0, arg1);
        
            // <summary>Resize the backtracking stack array and push 2 values onto the stack.</summary>
            [MethodImpl(MethodImplOptions.NoInlining)]
            static void WithResize(ref int[] stack, ref int pos, int arg0, int arg1)
            {
                Array.Resize(ref stack, (pos + 1) * 2);
                StackPush(ref stack, ref pos, arg0, arg1);
            }
        }
    }
}