Ejemplo n.º 1
0
        public override IEnumerable <MatchResult> Match(Value v, MatchContext context)
        {
            if (!(v is ExpressionValue expr))
            {
                return(new MatchResult[0]);
            }

            return(_head.Match(expr.Head, context)
                   .SelectMany(res => PatternMatching.SequenceMatch(_parts, expr.Parts, res.Context)
                               .Select(partRes => partRes.Context.WithMatch(_engine.Expr(
                                                                                _engine.PatternMatching.ToSingle(res.SequenceMatch),
                                                                                partRes.SequenceMatch
                                                                                )))));
        }
Ejemplo n.º 2
0
        public override IEnumerable <MatchResult> Match(Value expr, MatchContext context)
        {
            var engine = expr.Engine;

            return(_pattern.Match(expr, context).Where(ApplyCondition));
        }
Ejemplo n.º 3
0
 public override IEnumerable <MatchResult> Match(Value expr, MatchContext context)
 {
     return(_pattern.Match(expr, context).Select(FilterMatch).Where(x => x != null));
 }