示例#1
0
        protected override Result _execute(ImmutableArray <EvaluatedParameter> parameters, FunctionScope function_scope)
        {
            IArray result_array = new ArrayStructure();

            function_scope.Root.Arrays.Add(result_array);

            foreach (EvaluatedParameter param in parameters)
            {
                if (param.EvaluatedValue is ArrayPointerExpression array_pointer)
                {
                    foreach (ArrayItem item in array_pointer.Array.GetAll())
                    {
                        if (item.Key.IsDigitsOnly())
                        {
                            result_array.Set(new ArrayItem("", item.Value));
                        }
                        else
                        {
                            result_array.Set(new ArrayItem(item.Key, item.Value));
                        }
                    }
                }
            }

            return(new Result(result_array.AsExpression));
        }
示例#2
0
        public fsnipArray(string title, MainWindow mw, ArrayStructure _as, string[] labelArray = null)
        {
            InitializeComponent();

            groupBox.Header = title;
            refmw           = mw;
            refas           = _as;
            labels          = labelArray;
        }
示例#3
0
        protected override Result _execute(ImmutableArray <EvaluatedParameter> parameters, FunctionScope function_scope)
        {
            IArray arr = new ArrayStructure();

            function_scope.Root.Arrays.Add(arr);

            function_scope.Parent.FindNearestScope <IFunctionLikeScope> (s =>
            {
                foreach (var p in s.Signature.Parameters)
                {
                    arr.Set(new ArrayItem("", p.EvaluatedValue));
                }
            });

            return(new Result(arr.AsExpression));
        }
        public static Result Run(ArrayCreateExpression expression, Scope scope)
        {
            IArray arr = new ArrayStructure();

            scope.Root.Arrays.Add(arr);

            foreach (ArrayItemExpression item_expr in expression.Items)
            {
                FinalExpression key_expr   = Interpreters.Execute(item_expr.Key, scope).ResultValue;
                FinalExpression value_expr = Interpreters.Execute(item_expr.Value, scope).ResultValue;
                ArrayKey        key        = new ArrayKey(key_expr.GetStringValue());
                arr.Set(new ArrayItem(key, value_expr));
            }

            return(new Result(arr.AsExpression));
        }
示例#5
0
        static void Main(string [] args)
        {
            Context context = new Context(
                options: new ContextOptions
            {
                DEBUG_EXECUTION = false,
                WRITE_AST       = true,
            },
                parser: new PHP.Parser.Parser()
                );

            IArray array_server = new ArrayStructure();

            array_server ["HTTP_HOST"]              = "seg.posdb.de";
            array_server ["REMOTE_ADDR"]            = "127.0.0.1";
            array_server ["SERVER_ADDR"]            = "127.0.0.1";
            context.RootScope.Variables ["_SERVER"] = array_server.AsExpression;

            if (Directory.Exists("/Users/tobias/di" + "gi" + "tal" + "kr" + "aft/git/d" + @"k_fr" + @"am" + @"ew" + @"or" + @"k/"))
            {
                context.AddDirectory(@"/Users/tobias/di" + "gi" + "tal" + "kr" + "aft/git/df" + @"d_po" + @"sdb/src");
                context.AddDirectory(@"/Users/tobias/di" + "gi" + "tal" + "kr" + "aft/git/dk_" + @"fra" + @"mewo" + @"rk/src");
                context.AddDirectory(@"/Users/tobias/di" + "gi" + "tal" + "kr" + "aft/git/dk_" + @"r" + @"m/src");
                context.AddDirectory(@"/Users/tobias/di" + "gi" + "tal" + "kr" + "aft/git/dk_" + @"ap" + @"p/src");

                context.RunFile(@"/Users/tobias/di" + "gi" + "tal" + "kr" + "aft/git/dk_" + @"fra" + @"mewo" + @"rk/src/public/index.php");
            }
            else
            {
                context.AddDirectory(@"C:\tobias.schulz\GIT\df" + @"d_po" + @"sdb\src");
                context.AddDirectory(@"C:\tobias.schulz\GIT\dk_" + @"fra" + @"mewo" + @"rk\src");
                context.AddDirectory(@"C:\tobias.schulz\GIT\dk_" + @"r" + @"m\src");
                context.AddDirectory(@"C:\tobias.schulz\GIT\dk_" + @"ap" + @"p\src");

                context.RunFile(@"C:\tobias.schulz\GIT\d" + @"k_fr" + @"ame" + @"w" + @"ork\src\public\index.php");
            }

            Console.ReadLine();
        }
示例#6
0
        public string exportObjectStructure(FlatBase.GJDB database, FlatBase.ObjectStructure os, string catName, int id)
        {
            string json = "{";

            json += "\"$id\" : \"" + catName + id.ToString() + "\",";
            int c = 0;

            foreach (object o in os.FIELDS)
            {
                if (o is ObjectHeader)
                {
                    c++;
                    continue;
                }

                string safeName = os.fieldexportnames[c].Split('>')[0];
                json += "\"" + safeName + "\":";

                if (!(o is int) && !(o is ArrayStructure))
                {
                    json += "\"";
                }

                if (o is OReference)
                {
                    json += (o as OReference).REF;
                }
                else if (o is ArrayStructure)
                {
                    json += "[";
                    ArrayStructure AS = o as ArrayStructure;
                    //json += AS.save(database);
                    json += exportArray(database, AS);

                    /*foreach (ObjectStructure aos in AS.REFS)
                     * {
                     *  //json += aos.save() + ",";
                     * }*/
                    json += "]";
                }
                else
                {
                    json += o.ToString();
                }
                if (!(o is int) && !(o is ArrayStructure))
                {
                    json += "\"";
                }

                c++;

                if (c < os.FIELDS.Count)
                {
                    json += ",";
                }
            }

            json += "}";

            Console.WriteLine(c.ToString() + " fields exported");

            return(json);
        }
示例#7
0
 public AStructConverter(MainWindow mw, ArrayStructure ras)
 {
     refmw = mw;
     refas = ras;
 }