예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
 /// <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));
 }
예제 #4
0
        /// <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));
        }
예제 #5
0
 /// <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);
예제 #6
0
 internal static void Consume(this Char Pattern, ref Source Source, ref Result Result) => Pattern.Consume(ref Source, ref Result, Stringier.DefaultComparisonType);
예제 #7
0
 /// <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);
예제 #8
0
        /// <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));
        }
예제 #9
0
 /// <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);
예제 #10
0
 /// <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);