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)); }
public static Parser <TValue> Except <TValue>(this Parser <TValue> first, Parser <TValue> second) { return(input => first(input).Except(second(input), ResultValueComparer <TValue> .Default)); }
public static Parser <string> ManyWhile(this Parser <char> parser, Func <char, bool> predicate) { return(ManyWhile(parser, predicate, string.Empty, (xs, x) => xs + x)); }
public static Parser <TValue> OneOf <TValue>(this Parser <TValue> parser, params TValue[] values) { return(parser.Where(values.Contains)); }
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))); }
public static Parser <TValue> OneOf <TValue>(this Parser <TValue> parser, IEnumerable <TValue> values) { return(parser.Where(values.Contains)); }