public override RegexSpec Simplify(LexerSpec lexerSpec)
        {
            // a-b -> !(!a|b)
            var expanded = Expressions.Aggregate((exp1, exp2) => new ComplementSpec(new AlternationSpec(new[] { new ComplementSpec(exp1), exp2 })));

            return(expanded.Simplify(lexerSpec));
        }
Пример #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = Targets.Aggregate(29, (current, variable) => current * 19 + variable.GetHashCode());
         hash  = Expressions.Aggregate(hash, (current, expression) => current * 17 + expression.GetHashCode());
         hash += Local.GetHashCode();
         return(hash);
     }
 }
Пример #3
0
 public override bool Interpret(TContext context)
 {
     return(Expressions.Aggregate(true,
                                  (current, booleanExpression) => current && booleanExpression.Interpret(context)));
 }
Пример #4
0
 public double[,] Evaluate(ArrayQuery.Bounds bounds, bool strict) =>
 Expressions.Aggregate(EmptyMatrix <double> .Instance, (current, expression) =>
                       current.Concat(expression.Evaluate(bounds, strict), Row ? MatrixUtils.MatrixDimension.Row : MatrixUtils.MatrixDimension.Col));