Beispiel #1
0
        static ContextFactory()
        {
            Default = CreateDefault();
            Default.ReadOnly = true;

            Empty = CreateEmpty();
            Empty.ReadOnly = true;
        }
Beispiel #2
0
 public static SharpAlg.Native.Parser.Parser AssertValue(this SharpAlg.Native.Parser.Parser parser, double? value, Expr expectedExpr = null, Context context = null)
 {
     return parser
         .IsEqual(x => x.errors.Errors, string.Empty)
         .IsEqual(x => x.errors.Count, 0)
         .IsEqual(x => value != null ? x.Expr.Evaluate(context) : null, value != null ? ExprTestHelper.AsNumber(value.Value) : null)
         .IsTrue(x => expectedExpr == null || x.Expr.ExprEquals(expectedExpr));
 }
 public static string Print(this Expr expr, Context context = null)
 {
     return expr.Visit(ExpressionPrinter.Create(context ?? ContextFactory.Default));
 }