public static Expression Clear(DispatchExpression e, SymbolTable s, Type t)
 {
     return(YacqExpression.Dispatch(
                s,
                DispatchTypes.Method,
                s.Resolve("*textbox*"),
                "Clear"
                ));
 }
Ejemplo n.º 2
0
 public override Expression Deserialize()
 {
     return(YacqExpression.Dispatch(
                this.DispatchType,
                this.Left.Null(n => Deserialize()),
                this.Name,
                this.TypeArguments.SelectAll(t => t.Deserialize()),
                this.Arguments.SelectAll(n => n.Deserialize())
                ));
 }
 public static Expression Write(DispatchExpression e, SymbolTable s, Type t)
 {
     return(YacqExpression.Dispatch(
                s,
                DispatchTypes.Method,
                s.Resolve("*textbox*"),
                "AppendText",
                YacqExpression.Dispatch(
                    s,
                    DispatchTypes.Method,
                    e.Left,
                    "ToString"
                    )
                ));
 }
Ejemplo n.º 4
0
 public void Run()
 {
     this.Output = "";
     Observable.Start(() =>
     {
         try
         {
             this.WriteOutput("Started.");
             var expr = YacqServices.Parse(
                 new SymbolTable()
             {
                 { DispatchTypes.Method, typeof(Object), "print", (e, s, t) =>
                   YacqExpression.Dispatch(
                       s,
                       DispatchTypes.Method,
                       Expression.Constant(this),
                       "Print",
                       e.Left
                       ) },
             },
                 this.Body
                 );
             this.WriteOutput("Parsed.\nGenerated Expression:\n" + expr);
             var func = Expression.Lambda(expr).Compile();
             this.WriteOutput("Compiled.");
             var ret = func.DynamicInvoke();
             this.WriteOutput("Finished.\nReturned Type: " + (ret != null ? ret.GetType().Name : "null"));
             if (ret != null)
             {
                 this.Output += "Returned Value:\n" + (ret is IEnumerable && !(ret is String)
                     ? String.Join(", ", ((IEnumerable)ret).OfType <Object>().Select(e => e.ToString()))
                     : ret
                                                       );
             }
         }
         catch (Exception ex)
         {
             this.WriteOutput(ex.ToString());
         }
     }).Subscribe(_ =>
     {
     });
 }
 public static Expression WriteLine(DispatchExpression e, SymbolTable s, Type t)
 {
     return(YacqExpression.Dispatch(
                s,
                DispatchTypes.Method,
                YacqExpression.Dispatch(
                    s,
                    DispatchTypes.Method,
                    "+",
                    YacqExpression.Dispatch(
                        s,
                        DispatchTypes.Method,
                        e.Left,
                        "ToString"
                        ),
                    Expression.Constant("\n")
                    ),
                "printn"
                ));
 }
Ejemplo n.º 6
0
            public static Expression Missing(DispatchExpression e, SymbolTable s, Type t)
            {
                Type type;

                if (e.DispatchType == DispatchTypes.Method &&
                    !s.ExistsKey(DispatchTypes.Method, e.Name) &&
                    (type = FilterRegistrant.GetFilter(e.Name).FirstOrDefault()) != null
                    )
                {
                    return(YacqExpression.Dispatch(
                               s,
                               DispatchTypes.Constructor,
                               YacqExpression.TypeCandidate(type),
                               null,
                               e.Arguments
                               )
                           .Method(s, "Filter", YacqExpression.Identifier(s, "it")));
                }
                return(DispatchExpression.DefaultMissing(e, s, t));
            }