Пример #1
0
 /// <summary>
 /// Matches the optional value.
 /// </summary>
 public static void Option <TElem, TResult>(this IMatchContext <TElem?, TResult> context, Func <TElem, Option <TResult> > func) where TElem : struct
 {
     context.Case(new OptionMatchCase <TElem, TResult>(func));
 }
Пример #2
0
 /// <summary>
 /// Destructs an array.
 /// </summary>
 public static void Array <TElem, TResult>(this IMatchContext <TElem[], TResult> context, Func <TElem, TElem, TElem, Option <TResult> > func)
 {
     context.Case(new ArrayMatchCase <TElem, TElem[], TResult>(func));
 }
Пример #3
0
 /// <summary>
 /// Matches the value against a regex.
 /// </summary>
 public static void Regex <TResult>(this IMatchContext <string, TResult> context, Regex regex, TResult value)
 {
     context.Regex(regex, () => value);
 }
Пример #4
0
 /// <summary>
 /// Matches the value against a regex.
 /// </summary>
 public static void Regex <TResult>(this IMatchContext <string, TResult> context, Regex regex, Func <string, string, string, string, string, string, string, string, string, string, Option <TResult> > func)
 {
     context.Case(new RegexMatchCase <TResult>(regex, func));
 }
Пример #5
0
 /// <summary>
 /// Sets up a type check.
 /// </summary>
 public static OfTypeMatchCaseBuilder <TValue, TResult> OfType <TValue, TResult>(this IMatchContext <TValue, TResult> context)
 {
     return(new OfTypeMatchCaseBuilder <TValue, TResult>(context));
 }
Пример #6
0
 /// <summary>
 /// Matches an arbitrary pattern.
 /// </summary>
 public static PatternMatchCaseBuilder <TValue, TResult> Pattern <TValue, TResult>(this IMatchContext <TValue, TResult> context, Expression <Func <IPatternBuilder, object> > expr)
 {
     return(new PatternMatchCaseBuilder <TValue, TResult>(context, expr));
 }
Пример #7
0
 /// <summary>
 /// Destructs a tuple.
 /// </summary>
 public static void Tuple <T1, T2, T3, T4, T5, T6, T7, TRest, TResult>(this IMatchContext <ValueTuple <T1, T2, T3, T4, T5, T6, T7, TRest>, TResult> context, Func <T1, T2, T3, T4, T5, T6, T7, TRest, Option <TResult> > func)
     where TRest : struct
 {
     context.Case(new TupleMatchCase <ValueTuple <T1, T2, T3, T4, T5, T6, T7, TRest>, TResult>(func));
 }
Пример #8
0
 /// <summary>
 /// Returns a default value.
 /// </summary>
 public static void Default <TValue, TResult>(this IMatchContext <TValue, TResult> context, TResult result)
 {
     context.Case(new DefaultMatchCase <TValue, TResult>(() => result));
 }
Пример #9
0
 /// <summary>
 /// Checks if the matched value equals a given value.
 /// </summary>
 public static void Value <TValue, TResult>(this IMatchContext <TValue, TResult> context, TValue value, Func <Option <TResult> > func)
 {
     context.Case(new ValueMatchCase <TValue, TResult>(value, func));
 }
Пример #10
0
 /// <summary>
 /// Destructs a tuple.
 /// </summary>
 public static void Tuple <T1, T2, T3, T4, T5, T6, TResult>(this IMatchContext <ValueTuple <T1, T2, T3, T4, T5, T6>, TResult> context, Func <T1, T2, T3, T4, T5, T6, Option <TResult> > func)
 {
     context.Case(new TupleMatchCase <ValueTuple <T1, T2, T3, T4, T5, T6>, TResult>(func));
 }
Пример #11
0
 /// <summary>
 /// Destructs a tuple.
 /// </summary>
 public static void Tuple <T1, T2, TResult>(this IMatchContext <Tuple <T1, T2>, TResult> context, Func <T1, T2, Option <TResult> > func)
 {
     context.Case(new TupleMatchCase <Tuple <T1, T2>, TResult>(func));
 }
Пример #12
0
 /// <summary>
 /// Destructs a sequence.
 /// </summary>
 public static void SeqRest <TElem, TResult>(this IMatchContext <IEnumerable <TElem>, TResult> context, Func <TElem, TElem, TElem, TElem, TElem, TElem, TElem, TElem, TElem, IEnumerable <TElem>, Option <TResult> > func)
 {
     context.Case(new SeqRestMatchCase <TElem, IEnumerable <TElem>, TResult>(func));
 }
Пример #13
0
 /// <summary>
 /// Binds the value to a new name.
 /// </summary>
 public static void Default <TValue, TResult>(this IMatchContext <TValue, TResult> context, Func <TValue, Option <TResult> > func)
 {
     context.Case(new DefaultBindMatchCase <TValue, TResult>(func));
 }
Пример #14
0
 public PatternMatchCaseBuilder(IMatchContext <TValue, TResult> context, Expression <Func <IPatternBuilder, object> > expr)
 {
     _context = context;
     _expr    = expr;
 }
Пример #15
0
 /// <summary>
 /// Checks if the matched value equals a given value.
 /// </summary>
 public static void Value <TValue, TResult>(this IMatchContext <TValue, TResult> context, TValue value, TResult result)
 {
     context.Case(new ValueMatchCase <TValue, TResult>(value, () => result));
 }
Пример #16
0
 public ResolveContext(
     IMatchContext <IValueBuilder> valueContext, IMatchContext <IReferenceConverter> referenceContext)
 {
     ValueContext     = valueContext;
     ReferenceContext = referenceContext;
 }
Пример #17
0
 public OfTypeMatchCaseBuilder(IMatchContext <TValue, TResult> context)
 {
     _context = context;
 }