/// <summary> /// Attempt to consume the <paramref name="Pattern"/> from the <paramref name="Source"/>, adjusting the position in the <paramref name="Source"/> as appropriate /// </summary> /// <param name="Pattern">The <see cref="Char"/> to match</param> /// <param name="Source">The <see cref="Source"/> to consume</param> /// <param name="ComparisonType">The <see cref="StringComparison"/> to use for pattern matching</param> /// <returns>A <see cref="Result"/> containing whether a match occured and the consumed string</returns> public static Result Consume(this Char Pattern, ref Source Source, StringComparison ComparisonType) { Result Result = new Result(ref Source); Pattern.Consume(ref Source, ref Result, ComparisonType); return(Result); }
/// <summary> /// Attempt to consume the <paramref name="pattern"/> from the <paramref name="source"/>, adjusting the position in the <paramref name="source"/> as appropriate. /// </summary> /// <param name="pattern">The <see cref="Char"/> to match.</param> /// <param name="source">The <see cref="Source"/> to consume.</param> /// <param name="comparisonType">Whether the comparison is sensitive to casing.</param> /// <param name="trace">The <see cref="ITrace"/> to record steps in.</param> /// <returns>A <see cref="Result"/> containing whether a match occured and the consumed string.</returns> public static Result Consume(this Char pattern, ref Source source, Case comparisonType, ITrace?trace) { Result result = new Result(ref source); pattern.Consume(ref source, ref result, comparisonType, trace); return(result); }
/// <summary> /// Attempt to consume the <paramref name="pattern"/> from the <paramref name="source"/>. /// </summary> /// <param name="pattern">The <see cref="Char"/> to match.</param> /// <param name="source">The <see cref="String"/> to consume.</param> /// <returns>A <see cref="Result"/> containing whether a match occured and the consumed string.</returns> public static Result Consume(this Char pattern, String source) { if (source is null) { throw new ArgumentNullException(nameof(source)); } return(pattern.Consume(source, StringComparison.Ordinal)); }
/// <summary> /// Attempt to consume the <paramref name="Pattern"/> from the <paramref name="Source"/>. /// </summary> /// <param name="pattern">The <see cref="Char"/> to match.</param> /// <param name="source">The <see cref="Source"/> to consume.</param> /// <param name="comparisonType">The <see cref="StringComparison"/> to use for pattern matching.</param> /// <returns>A <see cref="Result"/> containing whether a match occured and the consumed string.</returns> public static Result Consume(this Char pattern, String source, StringComparison comparisonType) { if (source is null) { throw new ArgumentNullException(nameof(source)); } Source src = new Source(source); return(pattern.Consume(ref src, comparisonType)); }
/// <summary> /// Attempt to consume the <paramref name="pattern" />, adjusting the <paramref name="source"/> and <paramref name="result"/> as appropriate. /// </summary> /// <param name="pattern">The <see cref="Char"/> pattern.</param> /// <param name="source">The <see cref="Source"/> to consume from.</param> /// <param name="result">The <see cref="Result"/> to store the result into.</param> internal static void Consume(this Char pattern, ref Source source, ref Result result) => pattern.Consume(ref source, ref result, Case.Sensitive, null);
internal static void Consume(this Char Pattern, ref Source Source, ref Result Result) => Pattern.Consume(ref Source, ref Result, Stringier.DefaultComparisonType);
/// <summary> /// Attempt to consume the <paramref name="Pattern"/> from the <paramref name="Source"/>, adjusting the position in the <paramref name="Source"/> as appropriate /// </summary> /// <param name="Pattern">The <see cref="Char"/> to match</param> /// <param name="Source">The <see cref="Source"/> to consume</param> /// <returns>A <see cref="Result"/> containing whether a match occured and the consumed string</returns> public static Result Consume(this Char Pattern, ref Source Source) => Pattern.Consume(ref Source, StringComparison.CurrentCulture);
/// <summary> /// Attempt to consume the <paramref name="Pattern"/> from the <paramref name="Source"/> /// </summary> /// <param name="Pattern">The <see cref="Char"/> to match</param> /// <param name="Source">The <see cref="Source"/> to consume</param> /// <param name="ComparisonType">The <see cref="StringComparison"/> to use for pattern matching</param> /// <returns>A <see cref="Result"/> containing whether a match occured and the consumed string</returns> public static Result Consume(this Char Pattern, String Source, StringComparison ComparisonType) { Source source = new Source(Source); return(Pattern.Consume(ref source, ComparisonType)); }
/// <summary> /// Attempt to consume the <paramref name="pattern" />, adjusting the <paramref name="source"/> and <paramref name="result"/> as appropriate. /// </summary> /// <param name="pattern">The <see cref="Char"/> pattern.</param> /// <param name="source">The <see cref="Source"/> to consume from.</param> /// <param name="result">The <see cref="Result"/> to store the result into.</param> internal static void Consume(this Char pattern, ref Source source, ref Result result) => pattern.Consume(ref source, ref result, StringComparison.Ordinal);
/// <summary> /// Attempt to consume the <paramref name="pattern"/> from the <paramref name="source"/>, adjusting the position in the <paramref name="source"/> as appropriate. /// </summary> /// <param name="pattern">The <see cref="Char"/> to match.</param> /// <param name="source">The <see cref="Source"/> to consume.</param> /// <returns>A <see cref="Result"/> containing whether a match occured and the consumed string.</returns> public static Result Consume(this Char pattern, ref Source source) => pattern.Consume(ref source, StringComparison.Ordinal);