Esempio n. 1
0
        /// <summary>
        /// build the XPTNode of a select statement block
        /// </summary>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public bool BuildXPTNode(SelectStatementBlockContext ctx)
        {
            if (ctx.XPTreeNode == null)
            {
                ctx.XPTreeNode = new OnTrack.Rulez.eXPressionTree.SelectionStatementBlock();
            }
            SelectionStatementBlock aBlock = (SelectionStatementBlock)ctx.XPTreeNode;

            // add the defined variables to the XPT
            foreach (VariableDefinition aVariable in ctx.names.Values)
            {
                ISymbol symbol = aBlock.AddNewVariable(aVariable.name, datatype: aVariable.datatype);
                // defaultvalue assignment
                if (aVariable.defaultvalue != null)
                {
                    aBlock.Nodes.Add(new eXPressionTree.Assignment(symbol, (IExpression)aVariable.defaultvalue));
                }
            }
            // add statements
            foreach (SelectStatementContext statementCTX in ctx.selectStatement())
            {
                // add it to the Block
                aBlock.Nodes.Add((IStatement)statementCTX.XPTreeNode);
            }

            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// build the XPTNode of a select statement block
        /// </summary>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public bool BuildXPTNode(SelectStatementBlockContext ctx)
        {
            if (ctx.XPTreeNode == null) ctx.XPTreeNode = new OnTrack.Rulez.eXPressionTree.SelectionStatementBlock();
            SelectionStatementBlock aBlock = (SelectionStatementBlock) ctx.XPTreeNode ;

            // add the defined variables to the XPT
            foreach (VariableDefinition aVariable in ctx.names.Values)
            {
                ISymbol symbol = aBlock.AddNewVariable(aVariable.name, datatype: aVariable.datatype);
                // defaultvalue assignment
                if (aVariable.defaultvalue != null) aBlock.Nodes.Add(new eXPressionTree.Assignment(symbol, (IExpression)aVariable.defaultvalue));
            }
            // add statements
            foreach (SelectStatementContext statementCTX in ctx.selectStatement() )
            {
                // add it to the Block
                aBlock.Nodes.Add((IStatement)statementCTX.XPTreeNode);
            }

            return true;
        }