File: RegexGenerator.g.cs
Project: src\tests\ConfigurationSchemaGenerator.Tests\ConfigurationSchemaGenerator.Tests.csproj (ConfigurationSchemaGenerator.Tests)
// <auto-generated/>
#nullable enable
#pragma warning disable CS0162 // Unreachable code
#pragma warning disable CS0164 // Unreferenced label
#pragma warning disable CS0219 // Variable assigned but never used
 
namespace ConfigurationSchemaGenerator
{
    partial class ConfigSchemaEmitter
    {
        /// <remarks>
        /// Pattern:<br/>
        /// <code>(\\s*)(?:\\r?\\n\\s*\\r?\\n)(\\s*)</code><br/>
        /// Explanation:<br/>
        /// <code>
        /// ○ 1st capture group.<br/>
        ///     ○ Match a whitespace character greedily any number of times.<br/>
        /// ○ Match '\r' atomically, optionally.<br/>
        /// ○ Match '\n'.<br/>
        /// ○ Match a whitespace character greedily any number of times.<br/>
        /// ○ Match '\r' atomically, optionally.<br/>
        /// ○ Match '\n'.<br/>
        /// ○ 2nd capture group.<br/>
        ///     ○ Match a whitespace character atomically any number of times.<br/>
        /// </code>
        /// </remarks>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
        private static partial global::System.Text.RegularExpressions.Regex BlankLinesInDocComment() => global::System.Text.RegularExpressions.Generated.BlankLinesInDocComment_0.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 BlankLinesInDocComment method.</summary>
    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
    file sealed class BlankLinesInDocComment_0 : Regex
    {
        /// <summary>Cached, thread-safe singleton instance.</summary>
        internal static readonly BlankLinesInDocComment_0 Instance = new();
    
        /// <summary>Initializes the instance.</summary>
        private BlankLinesInDocComment_0()
        {
            base.pattern = "(\\s*)(?:\\r?\\n\\s*\\r?\\n)(\\s*)";
            base.roptions = RegexOptions.None;
            ValidateMatchTimeout(Utilities.s_defaultTimeout);
            base.internalMatchTimeout = Utilities.s_defaultTimeout;
            base.factory = new RunnerFactory();
            base.capsize = 3;
        }
            
        /// <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 2 characters.
                    if (pos <= inputSpan.Length - 2)
                    {
                        // The pattern begins with a character in the set [\n\r\s].
                        // Find the next occurrence. If it can't be found, there's no match.
                        int i = inputSpan.Slice(pos).IndexOfNonAsciiOrAny_8B92819EE0E023DF05EDC6DA74E6EA157483C6C14B7270096ACB9FE21B051E4B();
                        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;
                    int capture_starting_pos1 = 0;
                    int charloop_capture_pos = 0;
                    int charloop_capture_pos1 = 0;
                    int charloop_starting_pos = 0, charloop_ending_pos = 0;
                    int charloop_starting_pos1 = 0, charloop_ending_pos1 = 0;
                    ReadOnlySpan<char> slice = inputSpan.Slice(pos);
                    
                    // 1st capture group.
                    //{
                        capture_starting_pos = pos;
                        
                        // Match a whitespace character greedily any number of times.
                        //{
                            charloop_starting_pos = pos;
                            
                            int iteration = 0;
                            while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration]))
                            {
                                iteration++;
                            }
                            
                            slice = slice.Slice(iteration);
                            pos += iteration;
                            
                            charloop_ending_pos = pos;
                            goto CharLoopEnd;
                            
                            CharLoopBacktrack:
                            UncaptureUntil(charloop_capture_pos);
                            
                            if (Utilities.s_hasTimeout)
                            {
                                base.CheckTimeout();
                            }
                            
                            if (charloop_starting_pos >= charloop_ending_pos)
                            {
                                UncaptureUntil(0);
                                return false; // The input didn't match.
                            }
                            pos = --charloop_ending_pos;
                            slice = inputSpan.Slice(pos);
                            
                            CharLoopEnd:
                            charloop_capture_pos = base.Crawlpos();
                        //}
                        
                        base.Capture(1, capture_starting_pos, pos);
                        
                        goto CaptureSkipBacktrack;
                        
                        CaptureBacktrack:
                        goto CharLoopBacktrack;
                        
                        CaptureSkipBacktrack:;
                    //}
                    
                    // Match '\r' atomically, optionally.
                    {
                        if (!slice.IsEmpty && slice[0] == '\r')
                        {
                            slice = slice.Slice(1);
                            pos++;
                        }
                    }
                    
                    // Match '\n'.
                    if (slice.IsEmpty || slice[0] != '\n')
                    {
                        goto CaptureBacktrack;
                    }
                    
                    // Match a whitespace character greedily any number of times.
                    //{
                        pos++;
                        slice = inputSpan.Slice(pos);
                        charloop_starting_pos1 = pos;
                        
                        int iteration1 = 0;
                        while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1]))
                        {
                            iteration1++;
                        }
                        
                        slice = slice.Slice(iteration1);
                        pos += iteration1;
                        
                        charloop_ending_pos1 = pos;
                        goto CharLoopEnd1;
                        
                        CharLoopBacktrack1:
                        UncaptureUntil(charloop_capture_pos1);
                        
                        if (Utilities.s_hasTimeout)
                        {
                            base.CheckTimeout();
                        }
                        
                        if (charloop_starting_pos1 >= charloop_ending_pos1)
                        {
                            goto CaptureBacktrack;
                        }
                        pos = --charloop_ending_pos1;
                        slice = inputSpan.Slice(pos);
                        
                        CharLoopEnd1:
                        charloop_capture_pos1 = base.Crawlpos();
                    //}
                    
                    // Match '\r' atomically, optionally.
                    {
                        if (!slice.IsEmpty && slice[0] == '\r')
                        {
                            slice = slice.Slice(1);
                            pos++;
                        }
                    }
                    
                    // Match '\n'.
                    if (slice.IsEmpty || slice[0] != '\n')
                    {
                        goto CharLoopBacktrack1;
                    }
                    
                    // 2nd capture group.
                    {
                        pos++;
                        slice = inputSpan.Slice(pos);
                        capture_starting_pos1 = pos;
                        
                        // Match a whitespace character atomically any number of times.
                        {
                            int iteration2 = 0;
                            while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2]))
                            {
                                iteration2++;
                            }
                            
                            slice = slice.Slice(iteration2);
                            pos += iteration2;
                        }
                        
                        base.Capture(2, capture_starting_pos1, pos);
                    }
                    
                    // 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", "8.0.12.26602")]
    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>Finds the next index of any character that matches a character in the set [\n\r\s].</summary>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        internal static int IndexOfNonAsciiOrAny_8B92819EE0E023DF05EDC6DA74E6EA157483C6C14B7270096ACB9FE21B051E4B(this ReadOnlySpan<char> span)
        {
            int i = span.IndexOfAnyExcept(Utilities.s_asciiExceptWhiteSpace);
            if ((uint)i < (uint)span.Length)
            {
                if (char.IsAscii(span[i]))
                {
                    return i;
                }
        
                char ch;
                do
                {
                    if (((ch = span[i]) < 128 ? ("㸀\0\u0001\0\0\0\0\0"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\0\u0004\u0001\n\v\r\u000ed")))
                    {
                        return i;
                    }
                    i++;
                }
                while ((uint)i < (uint)span.Length);
            }
        
            return -1;
        }
        
        /// <summary>Supports searching for characters in or not in "\0\u0001\u0002\u0003\u0004\u0005\u0006\a\b\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f!\"#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u007f".</summary>
        internal static readonly SearchValues<char> s_asciiExceptWhiteSpace = SearchValues.Create("\0\u0001\u0002\u0003\u0004\u0005\u0006\a\b\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u007f");
    }
}