internal static void Neglect(this Char Pattern, ref Source Source, ref Result Result, StringComparison ComparisonType) { if (Source.Length == 0) { Result.Error = new EndOfSourceError(Expected: Pattern); } else { if (!Stringier.Equals(Pattern, Source.Peek(), ComparisonType)) { Source.Position++; Result.Length++; Result.Error = null; } else { Result.Error = new NeglectFailedError(Neglected: Pattern); } } }
internal static void Consume(this String Pattern, ref Source Source, ref Result Result, StringComparison ComparisonType) { if (Pattern.Length > Source.Length) { Result.Error = new EndOfSourceError(Expected: Pattern); } else { ReadOnlySpan <Char> Peek = Source.Peek(Pattern.Length); if (Stringier.Equals(Pattern, Peek, ComparisonType)) { Source.Position += Peek.Length; Result.Length += Peek.Length; Result.Error = null; } else { Result.Error = new ConsumeFailedError(Expected: Pattern); } } }
public Boolean Equals(StringLiteral other) => Stringier.Equals(String, other.String, ComparisonType);
public override Boolean Equals(String other) => Stringier.Equals(String, other, ComparisonType);
public override Boolean Equals(ReadOnlySpan <Char> other) => Stringier.Equals(String, other, ComparisonType);
public Boolean Equals(CharLiteral other) => Stringier.Equals(Char, other.Char, ComparisonType);