コード例 #1
0
 internal WildcardParser(Span <WildcardInstruction> initialBuffer, StringPart pattern)
 {
     _pattern    = pattern;
     Steps       = new StackLoadedValueList <WildcardInstruction>(initialBuffer);
     _index      = -1;
     _chars      = _pattern.Pointer;
     _exactStart = null;
 }
コード例 #2
0
        internal static unsafe bool IsMatch(
            StringPart input,
            ReadOnlySpan <WildcardInstruction> instructions,
            ValueWildcardOptions options = default)
        {
            Span <Frame> state = instructions.Length > FrameStackAllocThreshold
                ? new Frame[instructions.Length]
                : stackalloc Frame[instructions.Length];

            var interpreter = new WildcardInterpreter(instructions, state, input, options);

            return(interpreter.IsMatch());
        }
コード例 #3
0
 private WildcardInterpreter(
     ReadOnlySpan <WildcardInstruction> instructions,
     Span <Frame> frames,
     StringPart source,
     ValueWildcardOptions options)
 {
     _instructions    = instructions;
     _frames          = frames;
     _source          = source;
     _culture         = options.Culture;
     _isCaseSensitive = options.IsCaseSensitive;
     _index           = 0;
     _textPosition    = 0;
 }
コード例 #4
0
 internal static WildcardInstruction Exact(StringPart arguments)
 => new WildcardInstruction(WildcardStepKind.Exact, arguments);
コード例 #5
0
 internal static WildcardInstruction PartialAnyOf(StringPart arguments)
 => new WildcardInstruction(WildcardStepKind.PartialAnyOf, arguments);
コード例 #6
0
 internal static WildcardInstruction AnyOf(StringPart arguments, bool isPartial = false)
 => new WildcardInstruction(
     isPartial ? WildcardStepKind.PartialAnyOf : WildcardStepKind.AnyOf,
     arguments);
コード例 #7
0
 private WildcardInstruction(WildcardStepKind kind, StringPart arguments)
 {
     Kind = kind;
     Args = arguments;
 }
コード例 #8
0
 /// <summary>
 /// Determines whether two read-only sequences are equal by comparing
 /// the elements using <see cref="IEquatable{T}.Equals(T)" />.
 /// </summary>
 /// <param name="other">
 /// The sequence to compare to.
 /// </param>
 /// <returns>
 /// <c>true</c> if the two sequences are equal; otherwise, <c>false</c>.
 /// </returns>
 public readonly bool SequenceEqual(StringPart other)
 {
     return(AsSpan().SequenceEqual(other.AsSpan()));
 }