< Summary

Line coverage
100%
Covered lines: 65
Uncovered lines: 0
Coverable lines: 65
Total lines: 239
Line coverage: 100%
Branch coverage
94%
Covered branches: 32
Total branches: 34
Branch coverage: 94.1%
Method coverage
100%
Covered methods: 6
Fully covered methods: 6
Total methods: 6
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
.ctor()100%11100%
CreateInstance()100%11100%
Scan(...)100%66100%
TryFindNextPossibleStartingPosition(...)100%44100%
TryMatchAtCurrentPosition(...)91.66%2424100%

File(s)

/home/ci/agent/workspace/dotnet-validation-docs_main/app/src/obj/Release/net10.0/generated/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs

#LineLine coverage
 1// <auto-generated/>
 2#nullable enable
 3#pragma warning disable
 4
 5namespace ArturRios.Validation
 6{
 7    partial class FluentValidator<T>
 8    {
 9        /// <remarks>
 10        /// Pattern:<br/>
 11        /// <code>(?&lt;!\\p{L})'|'(?!\\p{L})|\\.(?!\\S)</code><br/>
 12        /// Explanation:<br/>
 13        /// <code>
 14        /// ○ Match with 3 alternative expressions, atomically.<br/>
 15        ///     ○ Match a sequence of expressions.<br/>
 16        ///         ○ Zero-width negative lookbehind.<br/>
 17        ///             ○ Match a Unicode letter right-to-left.<br/>
 18        ///         ○ Match '\''.<br/>
 19        ///     ○ Match a sequence of expressions.<br/>
 20        ///         ○ Match '\''.<br/>
 21        ///         ○ Zero-width negative lookahead.<br/>
 22        ///             ○ Match a Unicode letter.<br/>
 23        ///     ○ Match a sequence of expressions.<br/>
 24        ///         ○ Match '.'.<br/>
 25        ///         ○ Zero-width negative lookahead.<br/>
 26        ///             ○ Match any character other than a whitespace character.<br/>
 27        /// </code>
 28        /// </remarks>
 29        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "10.0.15.504
 30        private static partial global::System.Text.RegularExpressions.Regex SpecialChars() => global::System.Text.Regula
 31    }
 32}
 33
 34namespace System.Text.RegularExpressions.Generated
 35{
 36    using System;
 37    using System.Buffers;
 38    using System.CodeDom.Compiler;
 39    using System.Collections;
 40    using System.ComponentModel;
 41    using System.Globalization;
 42    using System.Runtime.CompilerServices;
 43    using System.Text.RegularExpressions;
 44    using System.Threading;
 45
 46    /// <summary>Custom <see cref="Regex"/>-derived type for the SpecialChars method.</summary>
 47    [GeneratedCodeAttribute("System.Text.RegularExpressions.Generator", "10.0.15.504")]
 48    file sealed class SpecialChars_0 : Regex
 49    {
 50        /// <summary>Cached, thread-safe singleton instance.</summary>
 151        internal static readonly SpecialChars_0 Instance = new();
 52
 53        /// <summary>Initializes the instance.</summary>
 154        private SpecialChars_0()
 55        {
 156            base.pattern = "(?<!\\p{L})'|'(?!\\p{L})|\\.(?!\\S)";
 157            base.roptions = RegexOptions.None;
 158            base.internalMatchTimeout = TimeSpan.FromMilliseconds(100);
 159            base.factory = new RunnerFactory();
 160            base.capsize = 1;
 161        }
 62
 63        /// <summary>Provides a factory for creating <see cref="RegexRunner"/> instances to be used by methods on <see c
 64        private sealed class RunnerFactory : RegexRunnerFactory
 65        {
 66            /// <summary>Creates an instance of a <see cref="RegexRunner"/> used by methods on <see cref="Regex"/>.</sum
 167            protected override RegexRunner CreateInstance() => new Runner();
 68
 69            /// <summary>Provides the runner that contains the custom logic implementing the specified regular expressio
 70            private sealed class Runner : RegexRunner
 71            {
 72                /// <summary>Scan the <paramref name="inputSpan"/> starting from base.runtextstart for the next match.</
 73                /// <param name="inputSpan">The text being scanned by the regular expression.</param>
 74                protected override void Scan(ReadOnlySpan<char> inputSpan)
 75                {
 76                    // Search until we can't find a valid starting position, we find a match, or we reach the end of the
 14077                    while (TryFindNextPossibleStartingPosition(inputSpan) &&
 14078                           !TryMatchAtCurrentPosition(inputSpan) &&
 14079                           base.runtextpos != inputSpan.Length)
 80                    {
 1881                        base.runtextpos++;
 1882                        base.CheckTimeout();
 83                    }
 12284                }
 85
 86                /// <summary>Search <paramref name="inputSpan"/> starting from base.runtextpos for the next location a m
 87                /// <param name="inputSpan">The text being scanned by the regular expression.</param>
 88                /// <returns>true if a possible match was found; false if no more matches are possible.</returns>
 89                private bool TryFindNextPossibleStartingPosition(ReadOnlySpan<char> inputSpan)
 90                {
 14091                    int pos = base.runtextpos;
 92
 93                    // Empty matches aren't possible.
 14094                    if ((uint)pos < (uint)inputSpan.Length)
 95                    {
 96                        // The pattern begins with a character in the set ['.].
 97                        // Find the next occurrence. If it can't be found, there's no match.
 11698                        int i = inputSpan.Slice(pos).IndexOfAny('\'', '.');
 11699                        if (i >= 0)
 100                        {
 116101                            base.runtextpos = pos + i;
 116102                            return true;
 103                        }
 104                    }
 105
 106                    // No match found.
 24107                    base.runtextpos = inputSpan.Length;
 24108                    return false;
 109                }
 110
 111                /// <summary>Determine whether <paramref name="inputSpan"/> at base.runtextpos is a match for the regula
 112                /// <param name="inputSpan">The text being scanned by the regular expression.</param>
 113                /// <returns>true if the regular expression matches at the current position; otherwise, false.</returns>
 114                private bool TryMatchAtCurrentPosition(ReadOnlySpan<char> inputSpan)
 115                {
 116116                    int pos = base.runtextpos;
 116117                    int matchStart = pos;
 116118                    ReadOnlySpan<char> slice = inputSpan.Slice(pos);
 119
 120                    // Match with 3 alternative expressions, atomically.
 121                    {
 116122                        int alternation_starting_pos = pos;
 123
 124                        // Branch 0
 125                        {
 126                            // Zero-width negative lookbehind.
 127                            {
 116128                                slice = inputSpan.Slice(pos);
 116129                                int negativelookbehind__starting_pos = pos;
 116130                                base.CheckTimeout();
 131
 132                                // Match a Unicode letter right-to-left.
 116133                                if ((uint)(pos - 1) >= inputSpan.Length || !char.IsLetter(inputSpan[pos - 1]))
 134                                {
 135                                    goto NegativeLookaroundMatch;
 136                                }
 51137                                pos--;
 138
 51139                                goto AlternationBranch;
 140
 141                                NegativeLookaroundMatch:
 65142                                pos = negativelookbehind__starting_pos;
 65143                                slice = inputSpan.Slice(pos);
 144                            }
 145
 146                            // Match '\''.
 65147                            if (slice.IsEmpty || slice[0] != '\'')
 148                            {
 149                                goto AlternationBranch;
 150                            }
 151
 45152                            pos++;
 45153                            slice = inputSpan.Slice(pos);
 45154                            goto AlternationMatch;
 155
 156                            AlternationBranch:
 71157                            pos = alternation_starting_pos;
 71158                            slice = inputSpan.Slice(pos);
 159                        }
 160
 161                        // Branch 1
 162                        {
 163                            // Match '\''.
 71164                            if (slice.IsEmpty || slice[0] != '\'')
 165                            {
 166                                goto AlternationBranch1;
 167                            }
 168
 169                            // Zero-width negative lookahead.
 170                            {
 32171                                pos++;
 32172                                slice = inputSpan.Slice(pos);
 32173                                int negativelookahead__starting_pos = pos;
 32174                                base.CheckTimeout();
 175
 176                                // Match a Unicode letter.
 32177                                if (slice.IsEmpty || !char.IsLetter(slice[0]))
 178                                {
 179                                    goto NegativeLookaroundMatch1;
 180                                }
 181
 182                                goto AlternationBranch1;
 183
 184                                NegativeLookaroundMatch1:
 26185                                pos = negativelookahead__starting_pos;
 26186                                slice = inputSpan.Slice(pos);
 187                            }
 188
 26189                            goto AlternationMatch;
 190
 191                            AlternationBranch1:
 45192                            pos = alternation_starting_pos;
 45193                            slice = inputSpan.Slice(pos);
 194                        }
 195
 196                        // Branch 2
 197                        {
 198                            // Match '.'.
 45199                            if (slice.IsEmpty || slice[0] != '.')
 200                            {
 6201                                return false; // The input didn't match.
 202                            }
 203
 204                            // Zero-width negative lookahead.
 205                            {
 39206                                pos++;
 39207                                slice = inputSpan.Slice(pos);
 39208                                int negativelookahead__starting_pos1 = pos;
 39209                                base.CheckTimeout();
 210
 211                                // Match any character other than a whitespace character.
 39212                                if (slice.IsEmpty || char.IsWhiteSpace(slice[0]))
 213                                {
 214                                    goto NegativeLookaroundMatch2;
 215                                }
 216
 12217                                return false; // The input didn't match.
 218
 219                                NegativeLookaroundMatch2:
 27220                                pos = negativelookahead__starting_pos1;
 27221                                slice = inputSpan.Slice(pos);
 222                            }
 223
 224                        }
 225
 226                        AlternationMatch:;
 227                    }
 228
 229                    // The input matched.
 98230                    base.runtextpos = pos;
 98231                    base.Capture(0, matchStart, pos);
 98232                    return true;
 233                }
 234            }
 235        }
 236
 237    }
 238
 239}