Ejemplo n.º 1
0
        public void Push(FunctionArgument _args, EvalContext cal)
        {
            OperationHelper.AssertArgsNumberThrowIf(this, 1, _args.Arguments);
            var v = cal.GetValue <IValue>(_args.Arguments[0]);

            stack.Enqueue(v);
        }
Ejemplo n.º 2
0
        public object Has(FunctionArgument _args, EvalContext cal)
        {
            var args = _args.Arguments;

            OperationHelper.AssertArgsNumberThrowIf(this, 1, args);
            OperationHelper.AssertCertainValueThrowIf(this, args);
            var ov = cal.GetValue <IValue>(args[0]);

            return(this.Contains(ov));
        }
Ejemplo n.º 3
0
        public static FileEasyWriter OpenEasyWrite(FunctionArgument _args, EvalContext cal)
        {
            var args = _args.Arguments;

            OperationHelper.AssertArgsNumberThrowIf(null, 1, args);
            OperationHelper.AssertCertainValueThrowIf(null, args);
            var ov = cal.GetValue <StringValue>(args)[0];

            return(new FileEasyWriter(ov));
        }
Ejemplo n.º 4
0
        public static bool Exists(FunctionArgument _args, EvalContext cal)
        {
            var args = _args.Arguments;

            OperationHelper.AssertArgsNumberThrowIf(null, 1, args);
            OperationHelper.AssertCertainValueThrowIf(null, args);
            var ov = cal.GetValue <StringValue>(args)[0];

            return(File.Exists(ov));
        }
Ejemplo n.º 5
0
        public static number Cos(FunctionArgument _args, EvalContext cal)
        {
            var args = _args.Arguments;

            OperationHelper.AssertArgsNumberThrowIf(null, 1, args);
            OperationHelper.AssertCertainValueThrowIf(null, args);
            var ov = cal.GetValue <number>(args[0]);

            return(new number(System.Math.Cos(ov)));
        }
Ejemplo n.º 6
0
        public static TupleValue Split(FunctionArgument _args, EvalContext cal)
        {
            var args = _args.Arguments;

            OperationHelper.AssertArgsNumberThrowIf(null, 2, args);
            OperationHelper.AssertCertainValueThrowIf(null, args);
            var ov = cal.GetValue <StringValue>(args);

            return(new TupleValue(ov[0].Value.Split(ov[1].Value[0]).Select(x => new iExpr.Values.ConcreteValue(new StringValue(x)))));
        }
Ejemplo n.º 7
0
        public static StringValue Substring(FunctionArgument _args, EvalContext cal)
        {
            var args = _args.Arguments;

            OperationHelper.AssertArgsNumberThrowIf(null, 3, args);
            OperationHelper.AssertCertainValueThrowIf(null, args);
            var ov    = cal.GetValue <StringValue>(args[0]);
            var begin = (int)cal.GetValue <RealNumber>(args[1]);
            var len   = (int)cal.GetValue <RealNumber>(args[2]);

            return(new StringValue(ov.Value.Substring(begin, len)));
        }
Ejemplo n.º 8
0
 public Gift(FunctionArgument _args, EvalContext cal)
 {
     OperationHelper.AssertArgsNumberThrowIf(this, 1, _args.Arguments);
     Name = cal.GetValue <string>(_args.Arguments[0]);
 }