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
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokens"></param>
        /// <returns></returns>
        private Syntax.Declare DeclarationParser(Token tokens)
        {
            var dec = new Tech.QScript.Syntax.Declare(tokens.Span);

            dec.Name = "";
            if (isParam(tokens.Value))
            {
                dec.Type = DeclartionType.Param;
            }
            else if (isVariable(tokens.Value))
            {
                dec.Type = DeclartionType.Variable;
            }
            else
            {
                AddError(Source.Severity.Error, "invalid declaration" + tokens.Value, tokens.Span);
            }
            setValue(ref dec, tokens.Value);
            return(dec);
        }
Exemplo n.º 3
0
 public Split(Declare assignTo, string dataSource, Source.SourceSpan span)
     : base(assignTo, FunctionType.Columnspit, dataSource, span)
 {
     _arguments = new List <ParamFields>();
 }
Exemplo n.º 4
0
 public Join(Declare assignTo, string dataSource, Source.SourceSpan span)
     : base(assignTo, FunctionType.Join, dataSource, span)
 {
     _arguments = new List <ParamFields>();
 }
Exemplo n.º 5
0
 public Pivot(Declare assignTo, string datasource, Source.SourceSpan span) : base(assignTo, FunctionType.Pivot, datasource, span)
 {
     RowArguments    = new List <ParamFields>();
     ColumnArguments = new List <ParamFields>();
     AggrArguments   = new List <ParamFields>();
 }
Exemplo n.º 6
0
 public TextCase(Declare assignTo, string dataSource, Source.SourceSpan span)
     : base(assignTo, FunctionType.ChangeCase, dataSource, span)
 {
 }
Exemplo n.º 7
0
 public Trancate(Declare assignTo, string dataSource, Source.SourceSpan span)
     : base(assignTo, FunctionType.Trancate, dataSource, span)
 {
 }
Exemplo n.º 8
0
 public abstract void Visit(Syntax.Declare element, EvaluationParam evp);
Exemplo n.º 9
0
 public Order(Declare assignTo, string datasource, Source.SourceSpan span)
     : base(assignTo, FunctionType.Order, datasource, span)
 {
     Fields = new List <ParamFields>();
 }
Exemplo n.º 10
0
 public abstract void Visit(Syntax.Declare element);
Exemplo n.º 11
0
 public Case(Declare assignTo, string datasource, Source.SourceSpan span) : base(assignTo, FunctionType.Case, datasource, span)
 {
     _cases = new List <CaseParam>();
 }
Exemplo n.º 12
0
 public IFStatement(Declare assignTo, Source.SourceSpan span) : base(TokenKind.If, span)
 {
     AssignTo = assignTo;
 }