internal WildcardParser(Span <WildcardInstruction> initialBuffer, StringPart pattern) { _pattern = pattern; Steps = new StackLoadedValueList <WildcardInstruction>(initialBuffer); _index = -1; _chars = _pattern.Pointer; _exactStart = null; }
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()); }
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; }
internal static WildcardInstruction Exact(StringPart arguments) => new WildcardInstruction(WildcardStepKind.Exact, arguments);
internal static WildcardInstruction PartialAnyOf(StringPart arguments) => new WildcardInstruction(WildcardStepKind.PartialAnyOf, arguments);
internal static WildcardInstruction AnyOf(StringPart arguments, bool isPartial = false) => new WildcardInstruction( isPartial ? WildcardStepKind.PartialAnyOf : WildcardStepKind.AnyOf, arguments);
private WildcardInstruction(WildcardStepKind kind, StringPart arguments) { Kind = kind; Args = arguments; }
/// <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())); }