Пример #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
            {
            }
        }
Пример #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);
        }
Пример #3
0
 public Split(Declare assignTo, string dataSource, Source.SourceSpan span)
     : base(assignTo, FunctionType.Columnspit, dataSource, span)
 {
     _arguments = new List <ParamFields>();
 }
Пример #4
0
 public Join(Declare assignTo, string dataSource, Source.SourceSpan span)
     : base(assignTo, FunctionType.Join, dataSource, span)
 {
     _arguments = new List <ParamFields>();
 }
Пример #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>();
 }
Пример #6
0
 public TextCase(Declare assignTo, string dataSource, Source.SourceSpan span)
     : base(assignTo, FunctionType.ChangeCase, dataSource, span)
 {
 }
Пример #7
0
 public Trancate(Declare assignTo, string dataSource, Source.SourceSpan span)
     : base(assignTo, FunctionType.Trancate, dataSource, span)
 {
 }
Пример #8
0
 public abstract void Visit(Syntax.Declare element, EvaluationParam evp);
Пример #9
0
 public Order(Declare assignTo, string datasource, Source.SourceSpan span)
     : base(assignTo, FunctionType.Order, datasource, span)
 {
     Fields = new List <ParamFields>();
 }
Пример #10
0
 public abstract void Visit(Syntax.Declare element);
Пример #11
0
 public Case(Declare assignTo, string datasource, Source.SourceSpan span) : base(assignTo, FunctionType.Case, datasource, span)
 {
     _cases = new List <CaseParam>();
 }
Пример #12
0
 public IFStatement(Declare assignTo, Source.SourceSpan span) : base(TokenKind.If, span)
 {
     AssignTo = assignTo;
 }