|
// <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 Microsoft.CodeAnalysis
{
partial class AnalyzerConfig
{
/// <remarks>
/// Pattern:<br/>
/// <code>^\\s*\\[(([^#;]|\\\\#|\\\\;)+)\\]\\s*([#;].*)?$</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of the string.<br/>
/// ○ Match a whitespace character atomically any number of times.<br/>
/// ○ Match '['.<br/>
/// ○ 1st capture group.<br/>
/// ○ Loop greedily at least once.<br/>
/// ○ 2nd capture group.<br/>
/// ○ Match with 3 alternative expressions.<br/>
/// ○ Match a character in the set [^#;].<br/>
/// ○ Match the string "\\#".<br/>
/// ○ Match the string "\\;".<br/>
/// ○ Match ']'.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ Optional (greedy).<br/>
/// ○ 3rd capture group.<br/>
/// ○ Match a character in the set [#;].<br/>
/// ○ Match a character other than '\n' greedily 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", "9.0.12.41916")]
private static partial global::System.Text.RegularExpressions.Regex GetSectionMatcherRegex() => global::System.Text.RegularExpressions.Generated.GetSectionMatcherRegex_0.Instance;
}
}
namespace Microsoft.CodeAnalysis
{
partial class AnalyzerConfig
{
/// <remarks>
/// Pattern:<br/>
/// <code>^\\s*([\\w\\.\\-_]+)\\s*[=:]\\s*(.*?)\\s*([#;].*)?$</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of the string.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character in the set [-._\w] greedily at least once.<br/>
/// ○ Match a whitespace character atomically any number of times.<br/>
/// ○ Match a character in the set [:=].<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ 2nd capture group.<br/>
/// ○ Match a character other than '\n' lazily any number of times.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ Optional (greedy).<br/>
/// ○ 3rd capture group.<br/>
/// ○ Match a character in the set [#;].<br/>
/// ○ Match a character other than '\n' greedily 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", "9.0.12.41916")]
private static partial global::System.Text.RegularExpressions.Regex GetPropertyMatcherRegex() => global::System.Text.RegularExpressions.Generated.GetPropertyMatcherRegex_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 GetSectionMatcherRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "9.0.12.41916")]
[SkipLocalsInit]
file sealed class GetSectionMatcherRegex_0 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly GetSectionMatcherRegex_0 Instance = new();
/// <summary>Initializes the instance.</summary>
private GetSectionMatcherRegex_0()
{
base.pattern = "^\\s*\\[(([^#;]|\\\\#|\\\\;)+)\\]\\s*([#;].*)?$";
base.roptions = RegexOptions.None;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 4;
}
/// <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;
char ch;
int capture_starting_pos = 0;
int charloop_capture_pos = 0;
int charloop_starting_pos = 0, charloop_ending_pos = 0;
int charloop_starting_pos1 = 0, charloop_ending_pos1 = 0;
int loop_iteration = 0;
int loop_iteration1 = 0;
int stackpos = 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 a whitespace character atomically any number of times.
{
int iteration = 0;
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;
// Loop greedily at least once.
//{
loop_iteration = 0;
LoopBody:
Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);
loop_iteration++;
// 2nd capture group.
//{
int capture_starting_pos1 = pos;
// Match with 3 alternative expressions.
//{
int alternation_starting_pos = pos;
int alternation_starting_capturepos = base.Crawlpos();
// Branch 0
//{
// Match a character in the set [^#;].
if (slice.IsEmpty || (((ch = slice[0]) == '#') | (ch == ';')))
{
goto AlternationBranch;
}
Utilities.StackPush(ref base.runstack!, ref stackpos, 0, alternation_starting_pos, alternation_starting_capturepos);
pos++;
slice = inputSpan.Slice(pos);
goto AlternationMatch;
AlternationBranch:
pos = alternation_starting_pos;
slice = inputSpan.Slice(pos);
UncaptureUntil(alternation_starting_capturepos);
//}
// Branch 1
//{
// Match the string "\\#".
if (!slice.StartsWith("\\#"))
{
goto AlternationBranch1;
}
Utilities.StackPush(ref base.runstack!, ref stackpos, 1, alternation_starting_pos, alternation_starting_capturepos);
pos += 2;
slice = inputSpan.Slice(pos);
goto AlternationMatch;
AlternationBranch1:
pos = alternation_starting_pos;
slice = inputSpan.Slice(pos);
UncaptureUntil(alternation_starting_capturepos);
//}
// Branch 2
//{
// Match the string "\\;".
if (!slice.StartsWith("\\;"))
{
goto LoopIterationNoMatch;
}
Utilities.StackPush(ref base.runstack!, ref stackpos, 2, alternation_starting_pos, alternation_starting_capturepos);
pos += 2;
slice = inputSpan.Slice(pos);
goto AlternationMatch;
//}
AlternationBacktrack:
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
Utilities.StackPop(base.runstack!, ref stackpos, out alternation_starting_capturepos, out alternation_starting_pos);
switch (base.runstack![--stackpos])
{
case 0:
goto AlternationBranch;
case 1:
goto AlternationBranch1;
case 2:
goto LoopIterationNoMatch;
}
AlternationMatch:;
//}
base.Capture(2, capture_starting_pos1, pos);
Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos1);
goto CaptureSkipBacktrack;
CaptureBacktrack:
capture_starting_pos1 = base.runstack![--stackpos];
goto AlternationBacktrack;
CaptureSkipBacktrack:;
//}
// 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.
UncaptureUntil(0);
return false; // The input didn't match.
}
pos = base.runstack![--stackpos];
UncaptureUntil(base.runstack![--stackpos]);
slice = inputSpan.Slice(pos);
if (loop_iteration == 0)
{
// No iterations have been matched to backtrack into. Fail the loop.
UncaptureUntil(0);
return false; // The input didn't match.
}
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.
UncaptureUntil(0);
return false; // The input didn't match.
}
goto CaptureBacktrack;
LoopEnd:;
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack1;
CaptureBacktrack1:
goto LoopBacktrack;
CaptureSkipBacktrack1:;
//}
// Match ']'.
if (slice.IsEmpty || slice[0] != ']')
{
goto CaptureBacktrack1;
}
// Match a whitespace character greedily any number of times.
//{
pos++;
slice = inputSpan.Slice(pos);
charloop_starting_pos = pos;
int iteration1 = 0;
while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1]))
{
iteration1++;
}
slice = slice.Slice(iteration1);
pos += iteration1;
charloop_ending_pos = pos;
goto CharLoopEnd;
CharLoopBacktrack:
UncaptureUntil(charloop_capture_pos);
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
if (charloop_starting_pos >= charloop_ending_pos)
{
goto CaptureBacktrack1;
}
pos = --charloop_ending_pos;
slice = inputSpan.Slice(pos);
CharLoopEnd:
charloop_capture_pos = base.Crawlpos();
//}
// Optional (greedy).
//{
loop_iteration1 = 0;
LoopBody1:
Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);
loop_iteration1++;
// 3rd capture group.
//{
int capture_starting_pos2 = pos;
// Match a character in the set [#;].
if (slice.IsEmpty || (((ch = slice[0]) != '#') & (ch != ';')))
{
goto LoopIterationNoMatch1;
}
// Match a character other than '\n' greedily any number of times.
//{
pos++;
slice = inputSpan.Slice(pos);
charloop_starting_pos1 = pos;
int iteration2 = slice.IndexOf('\n');
if (iteration2 < 0)
{
iteration2 = slice.Length;
}
slice = slice.Slice(iteration2);
pos += iteration2;
charloop_ending_pos1 = pos;
goto CharLoopEnd1;
CharLoopBacktrack1:
UncaptureUntil(base.runstack![--stackpos]);
Utilities.StackPop(base.runstack!, ref stackpos, out charloop_ending_pos1, out charloop_starting_pos1);
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
if (charloop_starting_pos1 >= charloop_ending_pos1)
{
goto LoopIterationNoMatch1;
}
pos = --charloop_ending_pos1;
slice = inputSpan.Slice(pos);
CharLoopEnd1:
Utilities.StackPush(ref base.runstack!, ref stackpos, charloop_starting_pos1, charloop_ending_pos1, base.Crawlpos());
//}
base.Capture(3, capture_starting_pos2, pos);
Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos2);
goto CaptureSkipBacktrack2;
CaptureBacktrack2:
capture_starting_pos2 = base.runstack![--stackpos];
goto CharLoopBacktrack1;
CaptureSkipBacktrack2:;
//}
// The loop has an upper bound of 1. Continue iterating greedily if it hasn't yet been reached.
if (loop_iteration1 == 0)
{
goto LoopBody1;
}
goto LoopEnd1;
// The loop iteration failed. Put state back to the way it was before the iteration.
LoopIterationNoMatch1:
if (--loop_iteration1 < 0)
{
// Unable to match the remainder of the expression after exhausting the loop.
goto CharLoopBacktrack;
}
pos = base.runstack![--stackpos];
UncaptureUntil(base.runstack![--stackpos]);
slice = inputSpan.Slice(pos);
goto LoopEnd1;
LoopBacktrack1:
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
if (loop_iteration1 == 0)
{
// No iterations of the loop remain to backtrack into. Fail the loop.
goto CharLoopBacktrack;
}
goto CaptureBacktrack2;
LoopEnd1:;
//}
// 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 LoopBacktrack1;
}
// 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>Custom <see cref="Regex"/>-derived type for the GetPropertyMatcherRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "9.0.12.41916")]
[SkipLocalsInit]
file sealed class GetPropertyMatcherRegex_1 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly GetPropertyMatcherRegex_1 Instance = new();
/// <summary>Initializes the instance.</summary>
private GetPropertyMatcherRegex_1()
{
base.pattern = "^\\s*([\\w\\.\\-_]+)\\s*[=:]\\s*(.*?)\\s*([#;].*)?$";
base.roptions = RegexOptions.None;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 4;
}
/// <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 capture_starting_pos = 0;
int capture_starting_pos1 = 0;
int charloop_capture_pos = 0;
int charloop_capture_pos1 = 0;
int charloop_capture_pos2 = 0;
int charloop_capture_pos3 = 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;
int charloop_starting_pos3 = 0, charloop_ending_pos3 = 0;
int charloop_starting_pos4 = 0, charloop_ending_pos4 = 0;
int lazyloop_capturepos = 0;
int lazyloop_pos = 0;
int loop_iteration = 0;
int stackpos = 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 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();
//}
// 1st capture group.
//{
capture_starting_pos = pos;
// Match a character in the set [-._\w] greedily at least once.
//{
charloop_starting_pos1 = pos;
int iteration1 = 0;
while ((uint)iteration1 < (uint)slice.Length && ((ch = slice[iteration1]) < 128 ? ("\0\0怀Ͽ\ufffe蟿\ufffe߿"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\0\u0004\n-/_`\0\u0002\u0004\u0005\u0003\u0001\u0006\t\u0013\0")))
{
iteration1++;
}
if (iteration1 == 0)
{
goto CharLoopBacktrack;
}
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)
{
goto CharLoopBacktrack;
}
pos = --charloop_ending_pos1;
slice = inputSpan.Slice(pos);
CharLoopEnd1:
charloop_capture_pos1 = base.Crawlpos();
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack;
CaptureBacktrack:
goto CharLoopBacktrack1;
CaptureSkipBacktrack:;
//}
// 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;
}
// Match a character in the set [:=].
if (slice.IsEmpty || (((ch = slice[0]) != ':') & (ch != '=')))
{
goto CaptureBacktrack;
}
// Match a whitespace character greedily any number of times.
//{
pos++;
slice = inputSpan.Slice(pos);
charloop_starting_pos2 = pos;
int iteration3 = 0;
while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3]))
{
iteration3++;
}
slice = slice.Slice(iteration3);
pos += iteration3;
charloop_ending_pos2 = pos;
goto CharLoopEnd2;
CharLoopBacktrack2:
UncaptureUntil(charloop_capture_pos2);
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
if (charloop_starting_pos2 >= charloop_ending_pos2)
{
goto CaptureBacktrack;
}
pos = --charloop_ending_pos2;
slice = inputSpan.Slice(pos);
CharLoopEnd2:
charloop_capture_pos2 = base.Crawlpos();
//}
// 2nd capture group.
//{
capture_starting_pos1 = pos;
// Match a character other than '\n' lazily any number of times.
//{
lazyloop_pos = pos;
goto LazyLoopEnd;
LazyLoopBacktrack:
UncaptureUntil(lazyloop_capturepos);
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
pos = lazyloop_pos;
slice = inputSpan.Slice(pos);
if (slice.IsEmpty || slice[0] == '\n')
{
goto CharLoopBacktrack2;
}
pos++;
slice = inputSpan.Slice(pos);
lazyloop_pos = pos;
LazyLoopEnd:
lazyloop_capturepos = base.Crawlpos();
//}
base.Capture(2, capture_starting_pos1, pos);
goto CaptureSkipBacktrack1;
CaptureBacktrack1:
goto LazyLoopBacktrack;
CaptureSkipBacktrack1:;
//}
// Match a whitespace character greedily any number of times.
//{
charloop_starting_pos3 = pos;
int iteration4 = 0;
while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4]))
{
iteration4++;
}
slice = slice.Slice(iteration4);
pos += iteration4;
charloop_ending_pos3 = pos;
goto CharLoopEnd3;
CharLoopBacktrack3:
UncaptureUntil(charloop_capture_pos3);
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
if (charloop_starting_pos3 >= charloop_ending_pos3)
{
goto CaptureBacktrack1;
}
pos = --charloop_ending_pos3;
slice = inputSpan.Slice(pos);
CharLoopEnd3:
charloop_capture_pos3 = base.Crawlpos();
//}
// Optional (greedy).
//{
loop_iteration = 0;
LoopBody:
Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);
loop_iteration++;
// 3rd capture group.
//{
int capture_starting_pos2 = pos;
// Match a character in the set [#;].
if (slice.IsEmpty || (((ch = slice[0]) != '#') & (ch != ';')))
{
goto LoopIterationNoMatch;
}
// Match a character other than '\n' greedily any number of times.
//{
pos++;
slice = inputSpan.Slice(pos);
charloop_starting_pos4 = pos;
int iteration5 = slice.IndexOf('\n');
if (iteration5 < 0)
{
iteration5 = slice.Length;
}
slice = slice.Slice(iteration5);
pos += iteration5;
charloop_ending_pos4 = pos;
goto CharLoopEnd4;
CharLoopBacktrack4:
UncaptureUntil(base.runstack![--stackpos]);
Utilities.StackPop(base.runstack!, ref stackpos, out charloop_ending_pos4, out charloop_starting_pos4);
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
if (charloop_starting_pos4 >= charloop_ending_pos4)
{
goto LoopIterationNoMatch;
}
pos = --charloop_ending_pos4;
slice = inputSpan.Slice(pos);
CharLoopEnd4:
Utilities.StackPush(ref base.runstack!, ref stackpos, charloop_starting_pos4, charloop_ending_pos4, base.Crawlpos());
//}
base.Capture(3, capture_starting_pos2, pos);
Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos2);
goto CaptureSkipBacktrack2;
CaptureBacktrack2:
capture_starting_pos2 = base.runstack![--stackpos];
goto CharLoopBacktrack4;
CaptureSkipBacktrack2:;
//}
// The loop has an upper bound of 1. Continue iterating greedily if it hasn't yet been reached.
if (loop_iteration == 0)
{
goto LoopBody;
}
goto LoopEnd;
// 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.
goto CharLoopBacktrack3;
}
pos = base.runstack![--stackpos];
UncaptureUntil(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.
goto CharLoopBacktrack3;
}
goto CaptureBacktrack2;
LoopEnd:;
//}
// 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 LoopBacktrack;
}
// 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", "9.0.12.41916")]
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>Pops 2 values from the backtracking stack.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void StackPop(int[] stack, ref int pos, out int arg0, out int arg1)
{
arg0 = stack[--pos];
arg1 = stack[--pos];
}
/// <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);
}
}
/// <summary>Pushes 3 values onto the backtracking stack.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void StackPush(ref int[] stack, ref int pos, int arg0, int arg1, int arg2)
{
// If there's space available for all 3 values, store them.
int[] s = stack;
int p = pos;
if ((uint)(p + 2) < (uint)s.Length)
{
s[p] = arg0;
s[p + 1] = arg1;
s[p + 2] = arg2;
pos += 3;
return;
}
// Otherwise, resize the stack to make room and try again.
WithResize(ref stack, ref pos, arg0, arg1, arg2);
// <summary>Resize the backtracking stack array and push 3 values onto the stack.</summary>
[MethodImpl(MethodImplOptions.NoInlining)]
static void WithResize(ref int[] stack, ref int pos, int arg0, int arg1, int arg2)
{
Array.Resize(ref stack, (pos + 2) * 2);
StackPush(ref stack, ref pos, arg0, arg1, arg2);
}
}
}
}
|