|
// <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 Aspire.Cli.Commands
{
partial class ProjectNameValidator
{
/// <remarks>
/// Pattern:<br/>
/// <code>^[^/\\\\]{1,254}$</code><br/>
/// Options:<br/>
/// <code>RegexOptions.Compiled</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of the string.<br/>
/// ○ Match a character in the set [^/\\] greedily at least 1 and at most 254 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", "8.0.12.26602")]
internal static partial global::System.Text.RegularExpressions.Regex GetProjectNameRegex() => global::System.Text.RegularExpressions.Generated.GetProjectNameRegex_0.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>^###### (.+?)\\s*$</code><br/>
/// Options:<br/>
/// <code>RegexOptions.Multiline</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of a line.<br/>
/// ○ Match the string "###### ".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '\n' lazily at least once.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ Match if at the end of a line.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex HeaderLevel6Regex() => global::System.Text.RegularExpressions.Generated.HeaderLevel6Regex_1.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>^##### (.+?)\\s*$</code><br/>
/// Options:<br/>
/// <code>RegexOptions.Multiline</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of a line.<br/>
/// ○ Match the string "##### ".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '\n' lazily at least once.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ Match if at the end of a line.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex HeaderLevel5Regex() => global::System.Text.RegularExpressions.Generated.HeaderLevel5Regex_2.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>^#### (.+?)\\s*$</code><br/>
/// Options:<br/>
/// <code>RegexOptions.Multiline</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of a line.<br/>
/// ○ Match the string "#### ".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '\n' lazily at least once.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ Match if at the end of a line.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex HeaderLevel4Regex() => global::System.Text.RegularExpressions.Generated.HeaderLevel4Regex_3.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>^### (.+?)\\s*$</code><br/>
/// Options:<br/>
/// <code>RegexOptions.Multiline</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of a line.<br/>
/// ○ Match the string "### ".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '\n' lazily at least once.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ Match if at the end of a line.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex HeaderLevel3Regex() => global::System.Text.RegularExpressions.Generated.HeaderLevel3Regex_4.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>^## (.+?)\\s*$</code><br/>
/// Options:<br/>
/// <code>RegexOptions.Multiline</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of a line.<br/>
/// ○ Match the string "## ".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '\n' lazily at least once.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ Match if at the end of a line.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex HeaderLevel2Regex() => global::System.Text.RegularExpressions.Generated.HeaderLevel2Regex_5.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>^# (.+?)\\s*$</code><br/>
/// Options:<br/>
/// <code>RegexOptions.Multiline</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match if at the beginning of a line.<br/>
/// ○ Match the string "# ".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '\n' lazily at least once.<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ Match if at the end of a line.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex HeaderLevel1Regex() => global::System.Text.RegularExpressions.Generated.HeaderLevel1Regex_6.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>\\*\\*([^*]+)\\*\\*</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match the string "**".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '*' atomically at least once.<br/>
/// ○ Match the string "**".<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex BoldDoubleAsterisksRegex() => global::System.Text.RegularExpressions.Generated.BoldDoubleAsterisksRegex_7.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>__([^_]+)__</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match the string "__".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '_' atomically at least once.<br/>
/// ○ Match the string "__".<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex BoldDoubleUnderscoresRegex() => global::System.Text.RegularExpressions.Generated.BoldDoubleUnderscoresRegex_8.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>(?<!\\*)\\*([^*\\n]+)\\*(?!\\*)</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Zero-width negative lookbehind.<br/>
/// ○ Match '*' right-to-left.<br/>
/// ○ Match '*'.<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character in the set [^\n*] atomically at least once.<br/>
/// ○ Match '*'.<br/>
/// ○ Zero-width negative lookahead.<br/>
/// ○ Match '*'.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex ItalicSingleAsteriskRegex() => global::System.Text.RegularExpressions.Generated.ItalicSingleAsteriskRegex_9.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>(?<!_)_([^_\\n]+)_(?!_)</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Zero-width negative lookbehind.<br/>
/// ○ Match '_' right-to-left.<br/>
/// ○ Match '_'.<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character in the set [^\n_] atomically at least once.<br/>
/// ○ Match '_'.<br/>
/// ○ Zero-width negative lookahead.<br/>
/// ○ Match '_'.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex ItalicSingleUnderscoreRegex() => global::System.Text.RegularExpressions.Generated.ItalicSingleUnderscoreRegex_10.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>~~([^~]+)~~</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match the string "~~".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '~' atomically at least once.<br/>
/// ○ Match the string "~~".<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex StrikethroughRegex() => global::System.Text.RegularExpressions.Generated.StrikethroughRegex_11.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>```\\s*(.*?)\\s*```</code><br/>
/// Options:<br/>
/// <code>RegexOptions.Singleline</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match the string "```".<br/>
/// ○ Match a whitespace character greedily any number of times.<br/>
/// ○ 1st capture group.<br/>
/// ○ Match any character lazily any number of times.<br/>
/// ○ Match a whitespace character atomically any number of times.<br/>
/// ○ Match the string "```".<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex CodeBlockRegex() => global::System.Text.RegularExpressions.Generated.CodeBlockRegex_12.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>`([^`]+)`</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match '`'.<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than '`' atomically at least once.<br/>
/// ○ Match '`'.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex InlineCodeRegex() => global::System.Text.RegularExpressions.Generated.InlineCodeRegex_13.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>!\\[([^\\]]*)\\]\\(([^)]+)\\)</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match the string "![".<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than ']' atomically any number of times.<br/>
/// ○ Match the string "](".<br/>
/// ○ 2nd capture group.<br/>
/// ○ Match a character other than ')' atomically at least once.<br/>
/// ○ Match ')'.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex ImageRegex() => global::System.Text.RegularExpressions.Generated.ImageRegex_14.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class MarkdownToSpectreConverter
{
/// <remarks>
/// Pattern:<br/>
/// <code>\\[([^\\]]+)\\]\\(([^)]+)\\)</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match '['.<br/>
/// ○ 1st capture group.<br/>
/// ○ Match a character other than ']' atomically at least once.<br/>
/// ○ Match the string "](".<br/>
/// ○ 2nd capture group.<br/>
/// ○ Match a character other than ')' atomically at least once.<br/>
/// ○ Match ')'.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex LinkRegex() => global::System.Text.RegularExpressions.Generated.LinkRegex_15.Instance;
}
}
namespace Aspire.Cli.Utils
{
partial class StringUtils
{
/// <remarks>
/// Pattern:<br/>
/// <code>\\[[^\\]]+\\]</code><br/>
/// Explanation:<br/>
/// <code>
/// ○ Match '['.<br/>
/// ○ Match a character other than ']' atomically at least once.<br/>
/// ○ Match ']'.<br/>
/// </code>
/// </remarks>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
private static partial global::System.Text.RegularExpressions.Regex RemoveSpectreFormattingRegex() => global::System.Text.RegularExpressions.Generated.RemoveSpectreFormattingRegex_16.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 GetProjectNameRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class GetProjectNameRegex_0 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly GetProjectNameRegex_0 Instance = new();
/// <summary>Initializes the instance.</summary>
private GetProjectNameRegex_0()
{
base.pattern = "^[^/\\\\]{1,254}$";
base.roptions = RegexOptions.Compiled;
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;
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 [^/\\] greedily at least 1 and at most 254 times.
//{
charloop_starting_pos = pos;
int iteration = 0;
while (iteration < 254 && (uint)iteration < (uint)slice.Length && (((ch = slice[iteration]) != '/') & (ch != '\\')))
{
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:
//}
// 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 HeaderLevel6Regex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class HeaderLevel6Regex_1 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly HeaderLevel6Regex_1 Instance = new();
/// <summary>Initializes the instance.</summary>
private HeaderLevel6Regex_1()
{
base.pattern = "^###### (.+?)\\s*$";
base.roptions = RegexOptions.Multiline;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 8 characters.
if (pos <= inputSpan.Length - 8)
{
// The pattern has a leading beginning-of-line anchor.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
int newlinePos = inputSpan.Slice(pos).IndexOf('\n');
if ((uint)newlinePos > inputSpan.Length - pos - 1)
{
goto NoMatchFound;
}
pos += newlinePos + 1;
if (pos > inputSpan.Length - 8)
{
goto NoMatchFound;
}
}
// The pattern has the literal "###### " at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("###### ");
if (i >= 0)
{
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;
int capture_starting_pos = 0;
int charloop_capture_pos = 0;
int charloop_starting_pos = 0, charloop_ending_pos = 0;
int lazyloop_capturepos = 0;
int lazyloop_pos = 0;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match if at the beginning of a line.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Match the string "###### ".
if (!slice.StartsWith("###### "))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
//{
pos += 7;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '\n' lazily at least once.
//{
if (slice.IsEmpty || slice[0] == '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
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')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
lazyloop_pos = pos;
LazyLoopEnd:
lazyloop_capturepos = base.Crawlpos();
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack;
CaptureBacktrack:
goto LazyLoopBacktrack;
CaptureSkipBacktrack:;
//}
// 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)
{
goto CaptureBacktrack;
}
pos = --charloop_ending_pos;
slice = inputSpan.Slice(pos);
CharLoopEnd:
charloop_capture_pos = base.Crawlpos();
//}
// Match if at the end of a line.
if ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')
{
goto CharLoopBacktrack;
}
// 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 HeaderLevel5Regex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class HeaderLevel5Regex_2 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly HeaderLevel5Regex_2 Instance = new();
/// <summary>Initializes the instance.</summary>
private HeaderLevel5Regex_2()
{
base.pattern = "^##### (.+?)\\s*$";
base.roptions = RegexOptions.Multiline;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 7 characters.
if (pos <= inputSpan.Length - 7)
{
// The pattern has a leading beginning-of-line anchor.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
int newlinePos = inputSpan.Slice(pos).IndexOf('\n');
if ((uint)newlinePos > inputSpan.Length - pos - 1)
{
goto NoMatchFound;
}
pos += newlinePos + 1;
if (pos > inputSpan.Length - 7)
{
goto NoMatchFound;
}
}
// The pattern has the literal "##### " at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("##### ");
if (i >= 0)
{
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;
int capture_starting_pos = 0;
int charloop_capture_pos = 0;
int charloop_starting_pos = 0, charloop_ending_pos = 0;
int lazyloop_capturepos = 0;
int lazyloop_pos = 0;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match if at the beginning of a line.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Match the string "##### ".
if (!slice.StartsWith("##### "))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
//{
pos += 6;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '\n' lazily at least once.
//{
if (slice.IsEmpty || slice[0] == '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
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')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
lazyloop_pos = pos;
LazyLoopEnd:
lazyloop_capturepos = base.Crawlpos();
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack;
CaptureBacktrack:
goto LazyLoopBacktrack;
CaptureSkipBacktrack:;
//}
// 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)
{
goto CaptureBacktrack;
}
pos = --charloop_ending_pos;
slice = inputSpan.Slice(pos);
CharLoopEnd:
charloop_capture_pos = base.Crawlpos();
//}
// Match if at the end of a line.
if ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')
{
goto CharLoopBacktrack;
}
// 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 HeaderLevel4Regex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class HeaderLevel4Regex_3 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly HeaderLevel4Regex_3 Instance = new();
/// <summary>Initializes the instance.</summary>
private HeaderLevel4Regex_3()
{
base.pattern = "^#### (.+?)\\s*$";
base.roptions = RegexOptions.Multiline;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 6 characters.
if (pos <= inputSpan.Length - 6)
{
// The pattern has a leading beginning-of-line anchor.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
int newlinePos = inputSpan.Slice(pos).IndexOf('\n');
if ((uint)newlinePos > inputSpan.Length - pos - 1)
{
goto NoMatchFound;
}
pos += newlinePos + 1;
if (pos > inputSpan.Length - 6)
{
goto NoMatchFound;
}
}
// The pattern has the literal "#### " at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("#### ");
if (i >= 0)
{
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;
int capture_starting_pos = 0;
int charloop_capture_pos = 0;
int charloop_starting_pos = 0, charloop_ending_pos = 0;
int lazyloop_capturepos = 0;
int lazyloop_pos = 0;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match if at the beginning of a line.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Match the string "#### ".
if (!slice.StartsWith("#### "))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
//{
pos += 5;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '\n' lazily at least once.
//{
if (slice.IsEmpty || slice[0] == '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
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')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
lazyloop_pos = pos;
LazyLoopEnd:
lazyloop_capturepos = base.Crawlpos();
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack;
CaptureBacktrack:
goto LazyLoopBacktrack;
CaptureSkipBacktrack:;
//}
// 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)
{
goto CaptureBacktrack;
}
pos = --charloop_ending_pos;
slice = inputSpan.Slice(pos);
CharLoopEnd:
charloop_capture_pos = base.Crawlpos();
//}
// Match if at the end of a line.
if ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')
{
goto CharLoopBacktrack;
}
// 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 HeaderLevel3Regex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class HeaderLevel3Regex_4 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly HeaderLevel3Regex_4 Instance = new();
/// <summary>Initializes the instance.</summary>
private HeaderLevel3Regex_4()
{
base.pattern = "^### (.+?)\\s*$";
base.roptions = RegexOptions.Multiline;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 5 characters.
if (pos <= inputSpan.Length - 5)
{
// The pattern has a leading beginning-of-line anchor.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
int newlinePos = inputSpan.Slice(pos).IndexOf('\n');
if ((uint)newlinePos > inputSpan.Length - pos - 1)
{
goto NoMatchFound;
}
pos += newlinePos + 1;
if (pos > inputSpan.Length - 5)
{
goto NoMatchFound;
}
}
// The pattern has the literal "### " at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("### ");
if (i >= 0)
{
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;
int capture_starting_pos = 0;
int charloop_capture_pos = 0;
int charloop_starting_pos = 0, charloop_ending_pos = 0;
int lazyloop_capturepos = 0;
int lazyloop_pos = 0;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match if at the beginning of a line.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Match the string "### ".
if (!slice.StartsWith("### "))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
//{
pos += 4;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '\n' lazily at least once.
//{
if (slice.IsEmpty || slice[0] == '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
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')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
lazyloop_pos = pos;
LazyLoopEnd:
lazyloop_capturepos = base.Crawlpos();
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack;
CaptureBacktrack:
goto LazyLoopBacktrack;
CaptureSkipBacktrack:;
//}
// 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)
{
goto CaptureBacktrack;
}
pos = --charloop_ending_pos;
slice = inputSpan.Slice(pos);
CharLoopEnd:
charloop_capture_pos = base.Crawlpos();
//}
// Match if at the end of a line.
if ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')
{
goto CharLoopBacktrack;
}
// 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 HeaderLevel2Regex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class HeaderLevel2Regex_5 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly HeaderLevel2Regex_5 Instance = new();
/// <summary>Initializes the instance.</summary>
private HeaderLevel2Regex_5()
{
base.pattern = "^## (.+?)\\s*$";
base.roptions = RegexOptions.Multiline;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 has a leading beginning-of-line anchor.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
int newlinePos = inputSpan.Slice(pos).IndexOf('\n');
if ((uint)newlinePos > inputSpan.Length - pos - 1)
{
goto NoMatchFound;
}
pos += newlinePos + 1;
if (pos > inputSpan.Length - 4)
{
goto NoMatchFound;
}
}
// The pattern has the literal "## " at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("## ");
if (i >= 0)
{
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;
int capture_starting_pos = 0;
int charloop_capture_pos = 0;
int charloop_starting_pos = 0, charloop_ending_pos = 0;
int lazyloop_capturepos = 0;
int lazyloop_pos = 0;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match if at the beginning of a line.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Match the string "## ".
if (!slice.StartsWith("## "))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
//{
pos += 3;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '\n' lazily at least once.
//{
if (slice.IsEmpty || slice[0] == '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
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')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
lazyloop_pos = pos;
LazyLoopEnd:
lazyloop_capturepos = base.Crawlpos();
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack;
CaptureBacktrack:
goto LazyLoopBacktrack;
CaptureSkipBacktrack:;
//}
// 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)
{
goto CaptureBacktrack;
}
pos = --charloop_ending_pos;
slice = inputSpan.Slice(pos);
CharLoopEnd:
charloop_capture_pos = base.Crawlpos();
//}
// Match if at the end of a line.
if ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')
{
goto CharLoopBacktrack;
}
// 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 HeaderLevel1Regex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class HeaderLevel1Regex_6 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly HeaderLevel1Regex_6 Instance = new();
/// <summary>Initializes the instance.</summary>
private HeaderLevel1Regex_6()
{
base.pattern = "^# (.+?)\\s*$";
base.roptions = RegexOptions.Multiline;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 3 characters.
if (pos <= inputSpan.Length - 3)
{
// The pattern has a leading beginning-of-line anchor.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
int newlinePos = inputSpan.Slice(pos).IndexOf('\n');
if ((uint)newlinePos > inputSpan.Length - pos - 1)
{
goto NoMatchFound;
}
pos += newlinePos + 1;
if (pos > inputSpan.Length - 3)
{
goto NoMatchFound;
}
}
// The pattern has the literal "# " at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("# ");
if (i >= 0)
{
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;
int capture_starting_pos = 0;
int charloop_capture_pos = 0;
int charloop_starting_pos = 0, charloop_ending_pos = 0;
int lazyloop_capturepos = 0;
int lazyloop_pos = 0;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match if at the beginning of a line.
if (pos > 0 && inputSpan[pos - 1] != '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Match the string "# ".
if (!slice.StartsWith("# "))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
//{
pos += 2;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '\n' lazily at least once.
//{
if (slice.IsEmpty || slice[0] == '\n')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
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')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
pos++;
slice = inputSpan.Slice(pos);
lazyloop_pos = pos;
LazyLoopEnd:
lazyloop_capturepos = base.Crawlpos();
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack;
CaptureBacktrack:
goto LazyLoopBacktrack;
CaptureSkipBacktrack:;
//}
// 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)
{
goto CaptureBacktrack;
}
pos = --charloop_ending_pos;
slice = inputSpan.Slice(pos);
CharLoopEnd:
charloop_capture_pos = base.Crawlpos();
//}
// Match if at the end of a line.
if ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')
{
goto CharLoopBacktrack;
}
// 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 BoldDoubleAsterisksRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class BoldDoubleAsterisksRegex_7 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly BoldDoubleAsterisksRegex_7 Instance = new();
/// <summary>Initializes the instance.</summary>
private BoldDoubleAsterisksRegex_7()
{
base.pattern = "\\*\\*([^*]+)\\*\\*";
base.roptions = RegexOptions.None;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 5 characters.
if (pos <= inputSpan.Length - 5)
{
// The pattern has the literal "**" at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("**");
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match the string "**".
if (!slice.StartsWith("**"))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
{
pos += 2;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '*' atomically at least once.
{
int iteration = slice.IndexOf('*');
if (iteration < 0)
{
iteration = slice.Length;
}
if (iteration == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration);
pos += iteration;
}
base.Capture(1, capture_starting_pos, pos);
}
// Match the string "**".
if (!slice.StartsWith("**"))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// The input matched.
pos += 2;
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 BoldDoubleUnderscoresRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class BoldDoubleUnderscoresRegex_8 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly BoldDoubleUnderscoresRegex_8 Instance = new();
/// <summary>Initializes the instance.</summary>
private BoldDoubleUnderscoresRegex_8()
{
base.pattern = "__([^_]+)__";
base.roptions = RegexOptions.None;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 5 characters.
if (pos <= inputSpan.Length - 5)
{
// The pattern has the literal "__" at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("__");
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match the string "__".
if (!slice.StartsWith("__"))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
{
pos += 2;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '_' atomically at least once.
{
int iteration = slice.IndexOf('_');
if (iteration < 0)
{
iteration = slice.Length;
}
if (iteration == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration);
pos += iteration;
}
base.Capture(1, capture_starting_pos, pos);
}
// Match the string "__".
if (!slice.StartsWith("__"))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// The input matched.
pos += 2;
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 ItalicSingleAsteriskRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class ItalicSingleAsteriskRegex_9 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly ItalicSingleAsteriskRegex_9 Instance = new();
/// <summary>Initializes the instance.</summary>
private ItalicSingleAsteriskRegex_9()
{
base.pattern = "(?<!\\*)\\*([^*\\n]+)\\*(?!\\*)";
base.roptions = RegexOptions.None;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 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.
int i = inputSpan.Slice(pos).IndexOf('*');
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Zero-width negative lookbehind.
{
slice = inputSpan.Slice(pos);
int negativelookbehind_starting_pos = pos;
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
// Match '*' right-to-left.
if ((uint)(pos - 1) >= inputSpan.Length || inputSpan[pos - 1] != '*')
{
goto NegativeLookaroundMatch;
}
pos--;
UncaptureUntil(0);
return false; // The input didn't match.
NegativeLookaroundMatch:
pos = negativelookbehind_starting_pos;
slice = inputSpan.Slice(pos);
}
// 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;
// Match a character in the set [^\n*] atomically at least once.
{
int iteration = slice.IndexOfAny('\n', '*');
if (iteration < 0)
{
iteration = slice.Length;
}
if (iteration == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration);
pos += iteration;
}
base.Capture(1, capture_starting_pos, pos);
}
// Match '*'.
if (slice.IsEmpty || slice[0] != '*')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Zero-width negative lookahead.
{
pos++;
slice = inputSpan.Slice(pos);
int negativelookahead_starting_pos = pos;
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
// Match '*'.
if (slice.IsEmpty || slice[0] != '*')
{
goto NegativeLookaroundMatch1;
}
UncaptureUntil(0);
return false; // The input didn't match.
NegativeLookaroundMatch1:
pos = negativelookahead_starting_pos;
slice = inputSpan.Slice(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>Custom <see cref="Regex"/>-derived type for the ItalicSingleUnderscoreRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class ItalicSingleUnderscoreRegex_10 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly ItalicSingleUnderscoreRegex_10 Instance = new();
/// <summary>Initializes the instance.</summary>
private ItalicSingleUnderscoreRegex_10()
{
base.pattern = "(?<!_)_([^_\\n]+)_(?!_)";
base.roptions = RegexOptions.None;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 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.
int i = inputSpan.Slice(pos).IndexOf('_');
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Zero-width negative lookbehind.
{
slice = inputSpan.Slice(pos);
int negativelookbehind_starting_pos = pos;
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
// Match '_' right-to-left.
if ((uint)(pos - 1) >= inputSpan.Length || inputSpan[pos - 1] != '_')
{
goto NegativeLookaroundMatch;
}
pos--;
UncaptureUntil(0);
return false; // The input didn't match.
NegativeLookaroundMatch:
pos = negativelookbehind_starting_pos;
slice = inputSpan.Slice(pos);
}
// 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;
// Match a character in the set [^\n_] atomically at least once.
{
int iteration = slice.IndexOfAny('\n', '_');
if (iteration < 0)
{
iteration = slice.Length;
}
if (iteration == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration);
pos += iteration;
}
base.Capture(1, capture_starting_pos, pos);
}
// Match '_'.
if (slice.IsEmpty || slice[0] != '_')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Zero-width negative lookahead.
{
pos++;
slice = inputSpan.Slice(pos);
int negativelookahead_starting_pos = pos;
if (Utilities.s_hasTimeout)
{
base.CheckTimeout();
}
// Match '_'.
if (slice.IsEmpty || slice[0] != '_')
{
goto NegativeLookaroundMatch1;
}
UncaptureUntil(0);
return false; // The input didn't match.
NegativeLookaroundMatch1:
pos = negativelookahead_starting_pos;
slice = inputSpan.Slice(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>Custom <see cref="Regex"/>-derived type for the StrikethroughRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class StrikethroughRegex_11 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly StrikethroughRegex_11 Instance = new();
/// <summary>Initializes the instance.</summary>
private StrikethroughRegex_11()
{
base.pattern = "~~([^~]+)~~";
base.roptions = RegexOptions.None;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 5 characters.
if (pos <= inputSpan.Length - 5)
{
// The pattern has the literal "~~" at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("~~");
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match the string "~~".
if (!slice.StartsWith("~~"))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
{
pos += 2;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than '~' atomically at least once.
{
int iteration = slice.IndexOf('~');
if (iteration < 0)
{
iteration = slice.Length;
}
if (iteration == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration);
pos += iteration;
}
base.Capture(1, capture_starting_pos, pos);
}
// Match the string "~~".
if (!slice.StartsWith("~~"))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// The input matched.
pos += 2;
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 CodeBlockRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class CodeBlockRegex_12 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly CodeBlockRegex_12 Instance = new();
/// <summary>Initializes the instance.</summary>
private CodeBlockRegex_12()
{
base.pattern = "```\\s*(.*?)\\s*```";
base.roptions = RegexOptions.Singleline;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 6 characters.
if (pos <= inputSpan.Length - 6)
{
// The pattern has the literal "```" at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("```");
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 charloop_capture_pos = 0;
int charloop_starting_pos = 0, charloop_ending_pos = 0;
int lazyloop_capturepos = 0;
int lazyloop_pos = 0;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match the string "```".
if (!slice.StartsWith("```"))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// Match a whitespace character greedily any number of times.
//{
pos += 3;
slice = inputSpan.Slice(pos);
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 any character 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 || false)
{
goto CharLoopBacktrack;
}
pos++;
slice = inputSpan.Slice(pos);
lazyloop_pos = pos;
LazyLoopEnd:
lazyloop_capturepos = base.Crawlpos();
//}
base.Capture(1, capture_starting_pos, pos);
goto CaptureSkipBacktrack;
CaptureBacktrack:
goto LazyLoopBacktrack;
CaptureSkipBacktrack:;
//}
// Match a whitespace character atomically any number of times.
{
int iteration1 = 0;
while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1]))
{
iteration1++;
}
slice = slice.Slice(iteration1);
pos += iteration1;
}
// Match the string "```".
if (!slice.StartsWith("```"))
{
goto CaptureBacktrack;
}
// The input matched.
pos += 3;
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 InlineCodeRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class InlineCodeRegex_13 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly InlineCodeRegex_13 Instance = new();
/// <summary>Initializes the instance.</summary>
private InlineCodeRegex_13()
{
base.pattern = "`([^`]+)`";
base.roptions = RegexOptions.None;
ValidateMatchTimeout(Utilities.s_defaultTimeout);
base.internalMatchTimeout = Utilities.s_defaultTimeout;
base.factory = new RunnerFactory();
base.capsize = 2;
}
/// <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 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.
int i = inputSpan.Slice(pos).IndexOf('`');
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// 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;
// Match a character other than '`' atomically at least once.
{
int iteration = slice.IndexOf('`');
if (iteration < 0)
{
iteration = slice.Length;
}
if (iteration == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration);
pos += iteration;
}
base.Capture(1, capture_starting_pos, pos);
}
// Match '`'.
if (slice.IsEmpty || slice[0] != '`')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// The input matched.
pos++;
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 ImageRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class ImageRegex_14 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly ImageRegex_14 Instance = new();
/// <summary>Initializes the instance.</summary>
private ImageRegex_14()
{
base.pattern = "!\\[([^\\]]*)\\]\\(([^)]+)\\)";
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 6 characters.
if (pos <= inputSpan.Length - 6)
{
// The pattern has the literal "![" at the beginning of the pattern. Find the next occurrence.
// If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf("![");
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match the string "![".
if (!slice.StartsWith("!["))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 1st capture group.
{
pos += 2;
slice = inputSpan.Slice(pos);
capture_starting_pos = pos;
// Match a character other than ']' atomically any number of times.
{
int iteration = slice.IndexOf(']');
if (iteration < 0)
{
iteration = slice.Length;
}
slice = slice.Slice(iteration);
pos += iteration;
}
base.Capture(1, capture_starting_pos, pos);
}
// Match the string "](".
if (!slice.StartsWith("]("))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 2nd capture group.
{
pos += 2;
slice = inputSpan.Slice(pos);
capture_starting_pos1 = pos;
// Match a character other than ')' atomically at least once.
{
int iteration1 = slice.IndexOf(')');
if (iteration1 < 0)
{
iteration1 = slice.Length;
}
if (iteration1 == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration1);
pos += iteration1;
}
base.Capture(2, capture_starting_pos1, pos);
}
// Match ')'.
if (slice.IsEmpty || slice[0] != ')')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// The input matched.
pos++;
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 LinkRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class LinkRegex_15 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly LinkRegex_15 Instance = new();
/// <summary>Initializes the instance.</summary>
private LinkRegex_15()
{
base.pattern = "\\[([^\\]]+)\\]\\(([^)]+)\\)";
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 6 characters.
if (pos <= inputSpan.Length - 6)
{
// The pattern begins with a character in the set [.
// Find the next occurrence. If it can't be found, there's no match.
int i = inputSpan.Slice(pos).IndexOf('[');
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// 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;
// Match a character other than ']' atomically at least once.
{
int iteration = slice.IndexOf(']');
if (iteration < 0)
{
iteration = slice.Length;
}
if (iteration == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration);
pos += iteration;
}
base.Capture(1, capture_starting_pos, pos);
}
// Match the string "](".
if (!slice.StartsWith("]("))
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// 2nd capture group.
{
pos += 2;
slice = inputSpan.Slice(pos);
capture_starting_pos1 = pos;
// Match a character other than ')' atomically at least once.
{
int iteration1 = slice.IndexOf(')');
if (iteration1 < 0)
{
iteration1 = slice.Length;
}
if (iteration1 == 0)
{
UncaptureUntil(0);
return false; // The input didn't match.
}
slice = slice.Slice(iteration1);
pos += iteration1;
}
base.Capture(2, capture_starting_pos1, pos);
}
// Match ')'.
if (slice.IsEmpty || slice[0] != ')')
{
UncaptureUntil(0);
return false; // The input didn't match.
}
// The input matched.
pos++;
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 RemoveSpectreFormattingRegex method.</summary>
[GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "8.0.12.26602")]
file sealed class RemoveSpectreFormattingRegex_16 : Regex
{
/// <summary>Cached, thread-safe singleton instance.</summary>
internal static readonly RemoveSpectreFormattingRegex_16 Instance = new();
/// <summary>Initializes the instance.</summary>
private RemoveSpectreFormattingRegex_16()
{
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;
// 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.
int i = inputSpan.Slice(pos).IndexOf('[');
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;
ReadOnlySpan<char> slice = inputSpan.Slice(pos);
// Match '['.
if (slice.IsEmpty || slice[0] != '[')
{
return false; // The input didn't match.
}
// Match a character other than ']' atomically at least once.
{
int iteration = slice.Slice(1).IndexOf(']');
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>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;
}
}
|