File: RegexGenerator.g.cs
Project: src\src\tools\illink\src\linker\Mono.Linker.csproj (illink)
// <auto-generated/>
#nullable enable
#pragma warning disable
 
namespace Mono.Linker.Steps
{
    partial class MarkStep
    {
        /// <remarks>
        /// Pattern:<br/>
        /// <code>{[^{}]+}</code><br/>
        /// Explanation:<br/>
        /// <code>
        /// ○ Match '{'.<br/>
        /// ○ Match a character in the set [^{}] atomically at least once.<br/>
        /// ○ Match '}'.<br/>
        /// </code>
        /// </remarks>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "10.0.12.42111")]
        private static partial global::System.Text.RegularExpressions.Regex DebuggerDisplayAttributeValueRegex() => global::System.Text.RegularExpressions.Generated.DebuggerDisplayAttributeValueRegex_0.Instance;
    }
}
 
namespace Mono.Linker.Steps
{
    partial class MarkStep
    {
        /// <remarks>
        /// Pattern:<br/>
        /// <code>.+,\\s*nq</code><br/>
        /// Explanation:<br/>
        /// <code>
        /// ○ Match a character other than '\n' greedily at least once.<br/>
        /// ○ Match ','.<br/>
        /// ○ Match a whitespace character atomically any number of times.<br/>
        /// ○ Match the string "nq".<br/>
        /// </code>
        /// </remarks>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "10.0.12.42111")]
        private static partial global::System.Text.RegularExpressions.Regex ContainsNqSuffixRegex() => global::System.Text.RegularExpressions.Generated.ContainsNqSuffixRegex_1.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 DebuggerDisplayAttributeValueRegex method.</summary>
    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "10.0.12.42111")]
    [SkipLocalsInit]
    file sealed class DebuggerDisplayAttributeValueRegex_0 : Regex
    {
        /// <summary>Cached, thread-safe singleton instance.</summary>
        internal static readonly DebuggerDisplayAttributeValueRegex_0 Instance = new();
    
        /// <summary>Initializes the instance.</summary>
        private DebuggerDisplayAttributeValueRegex_0()
        {
            base.pattern = "{[^{}]+}";
            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)
                {
                    // 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;
                    char ch;
                    
                    // Any possible match is at least 3 characters.
                    if (pos <= inputSpan.Length - 3)
                    {
                        // The pattern begins with a character in the set {.
                        // Find the next occurrence. If it can't be found, there's no match.
                        ReadOnlySpan<char> span = inputSpan.Slice(pos);
                        for (int i = 0; i < span.Length - 2; i++)
                        {
                            int indexOfPos = span.Slice(i).IndexOf('{');
                            if (indexOfPos < 0)
                            {
                                goto NoMatchFound;
                            }
                            i += indexOfPos;
                            
                            // The primary set being searched for was found. 1 more set will be checked so as
                            // to minimize the number of places TryMatchAtCurrentPosition is run unnecessarily.
                            // Make sure it fits in the remainder of the input.
                            if ((uint)(i + 1) >= (uint)span.Length)
                            {
                                goto NoMatchFound;
                            }
                            
                            if ((((ch = span[i + 1]) != '{') & (ch != '}')))
                            {
                                base.runtextpos = pos + i;
                                return true;
                            }
                        }
                    }
                    
                    // No match found.
                    NoMatchFound:
                    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 (slice.IsEmpty || slice[0] != '{')
                    {
                        return false; // The input didn't match.
                    }
                    
                    // Match a character in the set [^{}] atomically at least once.
                    {
                        int iteration = slice.Slice(1).IndexOfAny('{', '}');
                        if (iteration < 0)
                        {
                            iteration = slice.Length - 1;
                        }
                        
                        if (iteration == 0)
                        {
                            return false; // The input didn't match.
                        }
                        
                        slice = slice.Slice(iteration);
                        pos += iteration;
                    }
                    
                    // Match '}'.
                    if ((uint)slice.Length < 2 || slice[1] != '}')
                    {
                        return false; // The input didn't match.
                    }
                    
                    // The input matched.
                    pos += 2;
                    base.runtextpos = pos;
                    base.Capture(0, matchStart, pos);
                    return true;
                }
            }
        }
 
    }
    
    /// <summary>Custom <see cref="Regex"/>-derived type for the ContainsNqSuffixRegex method.</summary>
    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "10.0.12.42111")]
    [SkipLocalsInit]
    file sealed class ContainsNqSuffixRegex_1 : Regex
    {
        /// <summary>Cached, thread-safe singleton instance.</summary>
        internal static readonly ContainsNqSuffixRegex_1 Instance = new();
    
        /// <summary>Initializes the instance.</summary>
        private ContainsNqSuffixRegex_1()
        {
            base.pattern = ".+,\\s*nq";
            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)
                {
                    // 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 begins with a character in the set [^\n].
                        // Find the next occurrence. If it can't be found, there's no match.
                        ReadOnlySpan<char> span = inputSpan.Slice(pos);
                        for (int i = 0; i < span.Length; i++)
                        {
                            if ((span[i] != '\n'))
                            {
                                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 charloop_starting_pos = 0, charloop_ending_pos = 0;
                    ReadOnlySpan<char> slice = inputSpan.Slice(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)
                        {
                            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 ||
                            (charloop_ending_pos = inputSpan.Slice(charloop_starting_pos, charloop_ending_pos - charloop_starting_pos).LastIndexOf(',')) < 0)
                        {
                            return false; // The input didn't match.
                        }
                        charloop_ending_pos += charloop_starting_pos;
                        pos = charloop_ending_pos;
                        slice = inputSpan.Slice(pos);
                        
                        CharLoopEnd:
                    //}
                    
                    // Advance the next matching position.
                    if (base.runtextpos < pos)
                    {
                        base.runtextpos = pos;
                    }
                    
                    // Match ','.
                    if (slice.IsEmpty || slice[0] != ',')
                    {
                        goto CharLoopBacktrack;
                    }
                    
                    // Match a whitespace character atomically any number of times.
                    {
                        int iteration1 = 1;
                        while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1]))
                        {
                            iteration1++;
                        }
                        
                        slice = slice.Slice(iteration1);
                        pos += iteration1;
                    }
                    
                    // Match the string "nq".
                    if (!slice.StartsWith("nq"))
                    {
                        goto CharLoopBacktrack;
                    }
                    
                    // The input matched.
                    pos += 2;
                    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", "10.0.12.42111")]
    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;
    }
}