Ejemplo n.º 1
0
 //
 public static T Case <T, In, NothingOrPrepared>(this MatchCollector <T, In, NothingOrPrepared> that,
                                                 In expected, Action <In> result)
 {
     return(that.Add(new MatchSingle <In, NothingOrPrepared>(
                         expected,
                         F.ReturnDefault <In, NothingOrPrepared>(result))));
 }
Ejemplo n.º 2
0
 public static T Case <T, In, NothingOrPrepared>(this MatchCollector <T, In, NothingOrPrepared> that,
                                                 Func <In, bool> expected, Action result)
 {
     return(that.Add(new Match <In, NothingOrPrepared>(
                         expected,
                         F.ReturnDefault <In, NothingOrPrepared>(F.IgnoreInput <In>(result)))));
 }
Ejemplo n.º 3
0
 public static T Regex <T, Out>(this MatchCollector <T, string, Out> that,
                                Regex expected,
                                Func <Out> result)
 {
     return(that.Add(new Match <string, Out>(
                         expected.IsMatch,
                         F.IgnoreInput <string, Out>(result))));
 }
Ejemplo n.º 4
0
 public static T Regex <T, NothingOrPrepared>(this MatchCollector <T, string, NothingOrPrepared> that,
                                              Regex expected,
                                              Action <Match> result)
 {
     return(that.Add(new Match <string, NothingOrPrepared>(
                         expected.IsMatch,
                         F.ReturnDefault <string, NothingOrPrepared>(i => result(expected.Match(i))))));
 }
Ejemplo n.º 5
0
 public static T Regex <T, NothingOrPrepared>(this MatchCollector <T, string, NothingOrPrepared> that,
                                              Regex expected,
                                              Action result)
 {
     return(that.Add(new Match <string, NothingOrPrepared>(
                         expected.IsMatch,
                         F.ReturnDefault <string, NothingOrPrepared>(F.IgnoreInput <string>(result)))));
 }
Ejemplo n.º 6
0
        public static T Fields <T, In, Out>(this MatchCollector <T, In, Out> that, Action <MatchFields <In, Out> > fields)
        {
            var m = new MatchFields <In, Out>();

            m.Fields = true;
            fields(m);
            return(that.Add(new SwitchMatchFields <In, Out>(m.Funcs.ToArray(), m.TypeOfFields)));
        }
Ejemplo n.º 7
0
 public static T Regex <T, Out>(this MatchCollector <T, string, Out> that,
                                Regex expected,
                                Func <Match, Out> result)
 {
     return(that.Add(new Match <string, Out>(expected.IsMatch, i => result(expected.Match(i)))));
 }
Ejemplo n.º 8
0
 public static T Else <T, In>(this MatchCollector <T, In, Prepared> that,
                              Action <In> result)
 {
     return(that.Add(new MatchElse <In, Prepared>(
                         F.ReturnDefault <In, Prepared>(result))));
 }
Ejemplo n.º 9
0
 public static T Case <T, On, In>(
     this MatchCollector <T, In, Nothing> that, Action <On> func)
     where On : In
 {
     return(that.Add(new MatchType <On, In, Nothing>(F.ReturnDefault <On, Nothing>(func))));
 }