예제 #1
0
        public static Parser <TValue> Except <TValue>(this Parser <TValue> first, Parser <TValue> second, IEqualityComparer <TValue> comparer)
        {
            var valueComparer = new ResultValueComparer <TValue>(comparer);

            return(input => first(input).Except(second(input), valueComparer));
        }
예제 #2
0
 public static Parser <TValue> Except <TValue>(this Parser <TValue> first, Parser <TValue> second)
 {
     return(input => first(input).Except(second(input), ResultValueComparer <TValue> .Default));
 }
예제 #3
0
 public static Parser <string> ManyWhile(this Parser <char> parser, Func <char, bool> predicate)
 {
     return(ManyWhile(parser, predicate, string.Empty, (xs, x) => xs + x));
 }
예제 #4
0
 public static Parser <TValue> OneOf <TValue>(this Parser <TValue> parser, params TValue[] values)
 {
     return(parser.Where(values.Contains));
 }
예제 #5
0
 public static Parser <IEnumerable <TValue> > ManyWhile <TValue>(this Parser <TValue> parser, Func <TValue, bool> predicate)
 {
     return(ManyWhile(parser, predicate, Enumerable.Empty <TValue>(), (xs, x) => xs.Concat(x)));
 }
예제 #6
0
 public static Parser <TValue> OneOf <TValue>(this Parser <TValue> parser, IEnumerable <TValue> values)
 {
     return(parser.Where(values.Contains));
 }