Beispiel #1
0
        /// <summary>
        /// Attempt to consume the <paramref name="pattern"/> from the <paramref name="source"/>.
        /// </summary>
        /// <param name="pattern">The <see cref="Rune"/> 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 Rune pattern, String source, Case comparisonType, ITrace?trace)
        {
            Guard.NotNull(source, nameof(source));
            Source src = new Source(source);

            return(pattern.Consume(ref src, comparisonType, trace));
        }
Beispiel #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="Rune"/> 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 Rune pattern, ref Source source, Case comparisonType, ITrace?trace)
        {
            Result result = new Result(ref source);

            pattern.Consume(ref source, ref result, comparisonType, trace);
            return(result);
        }
Beispiel #3
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="Rune"/> to match.</param>
 /// <param name="source">The <see cref="Source"/> to consume.</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 Rune pattern, ref Source source, ITrace?trace) => pattern.Consume(ref source, Case.Sensitive, trace);
Beispiel #4
0
 /// <summary>
 /// Attempt to consume the <paramref name="pattern"/> from the <paramref name="source"/>.
 /// </summary>
 /// <param name="pattern">The <see cref="Rune"/> to match.</param>
 /// <param name="source">The <see cref="String"/> to consume.</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 Rune pattern, String source, ITrace?trace)
 {
     Guard.NotNull(source, nameof(source));
     return(pattern.Consume(source, Case.Sensitive, trace));
 }