Exemplo n.º 1
0
        private void Compile(dynamic c)
        {
            if (c.Catagory == Syntax.SyntaxCatagory.Declaration)
            {
                var v = new EvalutionVisitor();
                c.Accept(v, _evp);
                setResult(c.Name, "");
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.Expression)
            {
                var aa = ((List <Tech.QScript.Syntax.SyntaxNode>)Content).Where(x => ((Syntax.SyntaxNode)x).Catagory == Syntax.SyntaxCatagory.Declaration).ToList();
                foreach (Syntax.Declare ss in aa)
                {
                    Syntax.Declare d = (Syntax.Declare)ss;
                    c.ReplaceWith(d.Name, d.GetResult(d.Name));
                }
                var v = new EvalutionVisitor();
                c.Accept(v, _evp);
                AssignTo(c, v.result.Value);
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.function)
            {
                var v    = new EvalutionVisitor();
                var rslt = GetValue(((Tech.QScript.Syntax.Fun)c).Datasource);
                c.AddSource(rslt);
                c.Accept(v, _evp);
                AssignTo(c, v.result.Value);
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.Literal)
            {
                var v = new EvalutionVisitor();
                c.Accept(v, _evp);
                AssignTo(c, v.result.Value);
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.Query)
            {
                var v = new EvalutionVisitor();
                c.Accept(v, _evp);
                AssignTo(c, v.result.Value);
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.Statement)
            {
                var aa = ((List <Tech.QScript.Syntax.SyntaxNode>)Content).Where(x => ((Syntax.SyntaxNode)x).Catagory == Syntax.SyntaxCatagory.Declaration).ToList();
                foreach (Syntax.Declare ss in aa)
                {
                    Syntax.Declare d = (Syntax.Declare)ss;
                    c.addText(c.Text.Replace("[" + d.Name + "]", d.GetResult(d.Name)));
                }

                var v = new EvalutionVisitor();
                c.Accept(v, _evp);
                AssignTo(c, v.result.Value);
            }
            else
            {
            }
        }
Exemplo n.º 2
0
        private void AssignTo(dynamic c, string val)
        {
            var aa = ((List <Tech.QScript.Syntax.SyntaxNode>)Content).Where(x => ((Syntax.SyntaxNode)x).Catagory == Syntax.SyntaxCatagory.Declaration).ToList();
            var a  = (Syntax.Declare)(aa).Where(x => ((Syntax.Declare)x).Name == c.AssignTo.Name).ToList().FirstOrDefault();

            if (a != null)
            {
                var k = new EvalutionVisitor();
                a.setResult("", val);
                a.Accept(k);
            }
        }
Exemplo n.º 3
0
        private void Compile(dynamic c)
        {
            if (c.Catagory == Syntax.SyntaxCatagory.Declaration)
            {
                var v = new EvalutionVisitor();
                c.Accept(v);
                Result.Add(v.result);
                //var d = new Domain.Declaration();
                //var v = new EvalutionVisitor();
                //d.Accept(c, v);
                //return d;
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.Expression)
            {
                var v = new EvalutionVisitor();
                c.Accept(v);
                AssignTo(c, v.result);
                Result.Add(v.result);
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.function)
            {
                var v    = new EvalutionVisitor();
                var rslt = GetValue(c);
                c.AddSource(rslt);
                c.Accept(v);
                AssignTo(c, v.result);
                Result.Add(v.result);
                //var d = new Domain.Function();
                //var v = new EvalutionVisitor();
                //d.Accept(c, v);
                //return d;
                //  System.Data.DataTable dt = new System.Data.DataTable();
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.Literal)
            {
                //var d = new Domain.Value();
                //var v = new EvalutionVisitor();
                //d.Accept(c, v);
                //return d;
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.Query)
            {
                var v    = new EvalutionVisitor();
                var rslt = GetValue(c);
                c.AddSource(rslt);
                c.Accept(v);
                Result.Add(v.result);

                //var d = new Domain.Query();
                //var v = new EvalutionVisitor();
                //d.Accept(c, v);
                //return d;
            }
            else if (c.Catagory == Syntax.SyntaxCatagory.Statement)
            {
                //var d = new Domain.LogicalStatement();
                //var v = new EvalutionVisitor();
                //d.Accept(c, v);
                //return d;
            }
            // return null;
        }