File: _generated\187\RegexGenerator.g.cs
Web Access
Project: src\src\sdk\src\Cli\dotnet\dotnet.csproj (dotnet)
// <auto-generated/>
#nullable enable
#pragma warning disable

namespace Microsoft.DotNet.Cli.Commands.Test.Terminal
{
    partial class TerminalTestReporter
    {
        /// <remarks>
        /// Pattern:<br/>
        /// <code>^   at ((?&lt;code&gt;.+) in (?&lt;file&gt;.+):line (?&lt;line&gt;\d+)|(?&lt;code1&gt;.+))$</code><br/>
        /// Options:<br/>
        /// <code>RegexOptions.ExplicitCapture</code><br/>
        /// Explanation:<br/>
        /// <code>
        /// ○ Match if at the beginning of the string.<br/>
        /// ○ Match the string "   at ".<br/>
        /// ○ Match with 2 alternative expressions.<br/>
        ///     ○ Match a sequence of expressions.<br/>
        ///         ○ "code" capture group.<br/>
        ///             ○ Match a character other than '\n' greedily at least once.<br/>
        ///         ○ Match the string " in ".<br/>
        ///         ○ "file" capture group.<br/>
        ///             ○ Match a character other than '\n' greedily at least once.<br/>
        ///         ○ Match the string ":line ".<br/>
        ///         ○ "line" capture group.<br/>
        ///             ○ Match a Unicode digit atomically at least once.<br/>
        ///     ○ "code1" capture group.<br/>
        ///         ○ Match a character other than '\n' greedily 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.26904")]
        private static partial global::System.Text.RegularExpressions.Regex GetFrameRegex() => global::System.Text.RegularExpressions.Generated.GetFrameRegex_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 GetFrameRegex method.</summary>
    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "11.0.14.26904")]
    [SkipLocalsInit]
    file sealed class GetFrameRegex_0 : Regex
    {
        /// <summary>Cached, thread-safe singleton instance.</summary>
        internal static readonly GetFrameRegex_0 Instance = new();
    
        /// <summary>Initializes the instance.</summary>
        private GetFrameRegex_0()
        {
            base.pattern = "^   at ((?<code>.+) in (?<file>.+):line (?<line>\\d+)|(?<code1>.+))$";
            base.roptions = RegexOptions.ExplicitCapture;
            ValidateMatchTimeout(Utilities.s_defaultTimeout);
            base.internalMatchTimeout = Utilities.s_defaultTimeout;
            base.factory = new RunnerFactory();
            base.CapNames = new Hashtable { { "0", 0 } ,  { "code", 1 } ,  { "code1", 4 } ,  { "file", 2 } ,  { "line", 3 }  };
            base.capslist = new string[] {"0", "code", "file", "line", "code1" };
            base.capsize = 5;
        }
            
        /// <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 7 characters.
                    if (pos <= inputSpan.Length - 7)
                    {
                        // 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;
                    int alternation_branch = 0;
                    int alternation_starting_capturepos = 0;
                    int alternation_starting_pos = 0;
                    int capture_starting_pos = 0;
                    int capture_starting_pos1 = 0;
                    int capture_starting_pos2 = 0;
                    int capture_starting_pos3 = 0;
                    int charloop_capture_pos = 0;
                    int charloop_capture_pos1 = 0;
                    int charloop_capture_pos2 = 0;
                    int charloop_starting_pos = 0, charloop_ending_pos = 0;
                    int charloop_starting_pos1 = 0, charloop_ending_pos1 = 0;
                    int charloop_starting_pos2 = 0, charloop_ending_pos2 = 0;
                    ReadOnlySpan<char> slice = inputSpan.Slice(pos);
                    
                    // Match if at the beginning of the string.
                    if (pos != 0)
                    {
                        UncaptureUntil(0);
                        return false; // The input didn't match.
                    }
                    
                    // Match the string "   at ".
                    if (!slice.StartsWith("   at "))
                    {
                        UncaptureUntil(0);
                        return false; // The input didn't match.
                    }
                    
                    // Match with 2 alternative expressions.
                    //{
                        alternation_starting_pos = pos;
                        alternation_starting_capturepos = base.Crawlpos();
                        
                        // Branch 0
                        //{
                            // "code" capture group.
                            //{
                                pos += 6;
                                slice = inputSpan.Slice(pos);
                                capture_starting_pos = pos;
                                
                                // Match a character other than '\n' greedily at least once.
                                //{
                                    charloop_starting_pos = pos;
                                    
                                    int iteration = slice.IndexOf('\n');
                                    if (iteration < 0)
                                    {
                                        iteration = slice.Length;
                                    }
                                    
                                    if (iteration == 0)
                                    {
                                        goto AlternationBranch;
                                    }
                                    
                                    slice = slice.Slice(iteration);
                                    pos += iteration;
                                    
                                    charloop_ending_pos = pos;
                                    charloop_starting_pos++;
                                    goto CharLoopEnd;
                                    
                                    CharLoopBacktrack:
                                    UncaptureUntil(charloop_capture_pos);
                                    
                                    if (Utilities.s_hasTimeout)
                                    {
                                        base.CheckTimeout();
                                    }
                                    
                                    if (charloop_starting_pos >= charloop_ending_pos ||
                                        (charloop_ending_pos = inputSpan.Slice(charloop_starting_pos, Math.Min(inputSpan.Length, charloop_ending_pos + 3) - charloop_starting_pos).LastIndexOf(" in ")) < 0)
                                    {
                                        goto AlternationBranch;
                                    }
                                    charloop_ending_pos += charloop_starting_pos;
                                    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 the string " in ".
                            if (!slice.StartsWith(" in "))
                            {
                                goto CaptureBacktrack;
                            }
                            
                            // "file" capture group.
                            //{
                                pos += 4;
                                slice = inputSpan.Slice(pos);
                                capture_starting_pos1 = pos;
                                
                                // Match a character other than '\n' greedily at least once.
                                //{
                                    charloop_starting_pos1 = pos;
                                    
                                    int iteration1 = slice.IndexOf('\n');
                                    if (iteration1 < 0)
                                    {
                                        iteration1 = slice.Length;
                                    }
                                    
                                    if (iteration1 == 0)
                                    {
                                        goto CaptureBacktrack;
                                    }
                                    
                                    slice = slice.Slice(iteration1);
                                    pos += iteration1;
                                    
                                    charloop_ending_pos1 = pos;
                                    charloop_starting_pos1++;
                                    goto CharLoopEnd1;
                                    
                                    CharLoopBacktrack1:
                                    UncaptureUntil(charloop_capture_pos1);
                                    
                                    if (Utilities.s_hasTimeout)
                                    {
                                        base.CheckTimeout();
                                    }
                                    
                                    if (charloop_starting_pos1 >= charloop_ending_pos1 ||
                                        (charloop_ending_pos1 = inputSpan.Slice(charloop_starting_pos1, Math.Min(inputSpan.Length, charloop_ending_pos1 + 5) - charloop_starting_pos1).LastIndexOf(":line ")) < 0)
                                    {
                                        goto CaptureBacktrack;
                                    }
                                    charloop_ending_pos1 += charloop_starting_pos1;
                                    pos = charloop_ending_pos1;
                                    slice = inputSpan.Slice(pos);
                                    
                                    CharLoopEnd1:
                                    charloop_capture_pos1 = base.Crawlpos();
                                //}
                                
                                base.Capture(2, capture_starting_pos1, pos);
                                
                                goto CaptureSkipBacktrack1;
                                
                                CaptureBacktrack1:
                                goto CharLoopBacktrack1;
                                
                                CaptureSkipBacktrack1:;
                            //}
                            
                            // Match the string ":line ".
                            if (!slice.StartsWith(":line "))
                            {
                                goto CaptureBacktrack1;
                            }
                            
                            // "line" capture group.
                            {
                                pos += 6;
                                slice = inputSpan.Slice(pos);
                                capture_starting_pos2 = pos;
                                
                                // Match a Unicode digit atomically at least once.
                                {
                                    int iteration2 = 0;
                                    while ((uint)iteration2 < (uint)slice.Length && char.IsDigit(slice[iteration2]))
                                    {
                                        iteration2++;
                                    }
                                    
                                    if (iteration2 == 0)
                                    {
                                        goto CaptureBacktrack1;
                                    }
                                    
                                    slice = slice.Slice(iteration2);
                                    pos += iteration2;
                                }
                                
                                base.Capture(3, capture_starting_pos2, pos);
                            }
                            
                            alternation_branch = 0;
                            goto AlternationMatch;
                            
                            AlternationBranch:
                            pos = alternation_starting_pos;
                            slice = inputSpan.Slice(pos);
                            UncaptureUntil(alternation_starting_capturepos);
                        //}
                        
                        // Branch 1
                        //{
                            // "code1" capture group.
                            //{
                                pos += 6;
                                slice = inputSpan.Slice(pos);
                                capture_starting_pos3 = pos;
                                
                                // Match a character other than '\n' greedily at least once.
                                //{
                                    charloop_starting_pos2 = pos;
                                    
                                    int iteration3 = slice.IndexOf('\n');
                                    if (iteration3 < 0)
                                    {
                                        iteration3 = slice.Length;
                                    }
                                    
                                    if (iteration3 == 0)
                                    {
                                        UncaptureUntil(0);
                                        return false; // The input didn't match.
                                    }
                                    
                                    slice = slice.Slice(iteration3);
                                    pos += iteration3;
                                    
                                    charloop_ending_pos2 = pos;
                                    charloop_starting_pos2++;
                                    goto CharLoopEnd2;
                                    
                                    CharLoopBacktrack2:
                                    UncaptureUntil(charloop_capture_pos2);
                                    
                                    if (Utilities.s_hasTimeout)
                                    {
                                        base.CheckTimeout();
                                    }
                                    
                                    if (charloop_starting_pos2 >= charloop_ending_pos2)
                                    {
                                        UncaptureUntil(0);
                                        return false; // The input didn't match.
                                    }
                                    pos = --charloop_ending_pos2;
                                    slice = inputSpan.Slice(pos);
                                    
                                    CharLoopEnd2:
                                    charloop_capture_pos2 = base.Crawlpos();
                                //}
                                
                                base.Capture(4, capture_starting_pos3, pos);
                                
                                goto CaptureSkipBacktrack2;
                                
                                CaptureBacktrack2:
                                goto CharLoopBacktrack2;
                                
                                CaptureSkipBacktrack2:;
                            //}
                            
                            alternation_branch = 1;
                            goto AlternationMatch;
                        //}
                        
                        AlternationBacktrack:
                        if (Utilities.s_hasTimeout)
                        {
                            base.CheckTimeout();
                        }
                        
                        switch (alternation_branch)
                        {
                            case 0:
                                goto CaptureBacktrack1;
                            case 1:
                                goto CaptureBacktrack2;
                        }
                        
                        AlternationMatch:;
                    //}
                    
                    // 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 AlternationBacktrack;
                    }
                    
                    // 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.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;
    }
}