Exemplo n.º 1
0
        public static bool IsAssignmentNode(ProtoCore.AST.ImperativeAST.ImperativeNode node)
        {
            ProtoCore.AST.ImperativeAST.BinaryExpressionNode binaryNode =
                node as ProtoCore.AST.ImperativeAST.BinaryExpressionNode;

            return (null != binaryNode && (ProtoCore.DSASM.Operator.assign == binaryNode.Optr));
        }
Exemplo n.º 2
0
        public static bool IsReturnExpressionNode(ProtoCore.AST.ImperativeAST.ImperativeNode node)
        {
            ProtoCore.AST.ImperativeAST.BinaryExpressionNode binaryNode =
                node as ProtoCore.AST.ImperativeAST.BinaryExpressionNode;

            if (null == binaryNode)
                return false;

            return (binaryNode.LeftNode.Name == ProtoCore.DSDefinitions.Keyword.Return);
        }
Exemplo n.º 3
0
        public static ProtoCore.AST.ImperativeAST.ImperativeNode Clone(ProtoCore.AST.ImperativeAST.ImperativeNode rhsNode)
        {
            if (rhsNode is ProtoCore.AST.ImperativeAST.IdentifierNode)
            {
                return(new ProtoCore.AST.ImperativeAST.IdentifierNode(rhsNode as ProtoCore.AST.ImperativeAST.IdentifierNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.IdentifierListNode)
            {
                return(new ProtoCore.AST.ImperativeAST.IdentifierListNode(rhsNode as ProtoCore.AST.ImperativeAST.IdentifierListNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.BinaryExpressionNode)
            {
                return(new ProtoCore.AST.ImperativeAST.BinaryExpressionNode(rhsNode as ProtoCore.AST.ImperativeAST.BinaryExpressionNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.FunctionCallNode)
            {
                return(new ProtoCore.AST.ImperativeAST.FunctionCallNode(rhsNode as ProtoCore.AST.ImperativeAST.FunctionCallNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.CodeBlockNode)
            {
                return(new ProtoCore.AST.ImperativeAST.CodeBlockNode(rhsNode as ProtoCore.AST.ImperativeAST.CodeBlockNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.ArrayNode)
            {
                return(new ProtoCore.AST.ImperativeAST.ArrayNode(rhsNode as ProtoCore.AST.ImperativeAST.ArrayNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.IfStmtNode)
            {
                return(new ProtoCore.AST.ImperativeAST.IfStmtNode(rhsNode as ProtoCore.AST.ImperativeAST.IfStmtNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.ElseIfBlock)
            {
                return(new ProtoCore.AST.ImperativeAST.ElseIfBlock(rhsNode as ProtoCore.AST.ImperativeAST.ElseIfBlock));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.IfStmtPositionNode)
            {
                return(new ProtoCore.AST.ImperativeAST.IfStmtPositionNode(rhsNode as ProtoCore.AST.ImperativeAST.IfStmtPositionNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.ForLoopNode)
            {
                return(new ProtoCore.AST.ImperativeAST.ForLoopNode(rhsNode as ProtoCore.AST.ImperativeAST.ForLoopNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.WhileStmtNode)
            {
                return(new ProtoCore.AST.ImperativeAST.WhileStmtNode(rhsNode as ProtoCore.AST.ImperativeAST.WhileStmtNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.ExprListNode)
            {
                return(new ProtoCore.AST.ImperativeAST.ExprListNode(rhsNode as ProtoCore.AST.ImperativeAST.ExprListNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.LanguageBlockNode)
            {
                return(new ProtoCore.AST.ImperativeAST.LanguageBlockNode(rhsNode as ProtoCore.AST.ImperativeAST.LanguageBlockNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.RangeExprNode)
            {
                return(new ProtoCore.AST.ImperativeAST.RangeExprNode(rhsNode as ProtoCore.AST.ImperativeAST.RangeExprNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.BreakNode)
            {
                return(new ProtoCore.AST.ImperativeAST.BreakNode());
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.ContinueNode)
            {
                return(new ProtoCore.AST.ImperativeAST.ContinueNode());
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.IntNode)
            {
                return(new ProtoCore.AST.ImperativeAST.IntNode(rhsNode as ProtoCore.AST.ImperativeAST.IntNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.DoubleNode)
            {
                return(new ProtoCore.AST.ImperativeAST.DoubleNode(rhsNode as ProtoCore.AST.ImperativeAST.DoubleNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.BooleanNode)
            {
                return(new ProtoCore.AST.ImperativeAST.BooleanNode(rhsNode as ProtoCore.AST.ImperativeAST.BooleanNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.CharNode)
            {
                return(new ProtoCore.AST.ImperativeAST.CharNode(rhsNode as ProtoCore.AST.ImperativeAST.CharNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.StringNode)
            {
                return(new ProtoCore.AST.ImperativeAST.StringNode(rhsNode as ProtoCore.AST.ImperativeAST.StringNode));
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.NullNode)
            {
                return(new ProtoCore.AST.ImperativeAST.NullNode());
            }
            else if (rhsNode is ProtoCore.AST.ImperativeAST.UnaryExpressionNode)
            {
                return(new ProtoCore.AST.ImperativeAST.UnaryExpressionNode(rhsNode as ProtoCore.AST.ImperativeAST.UnaryExpressionNode));
            }
            else if (rhsNode is AST.ImperativeAST.InlineConditionalNode)
            {
                return(new AST.ImperativeAST.InlineConditionalNode(rhsNode as AST.ImperativeAST.InlineConditionalNode));
            }

            Validity.Assert(false);
            return(null);
        }
Exemplo n.º 4
0
 public override bool VisitImperativeNode(ImperativeNode node)
 {
     return(VisitAllChildren(node));
 }
Exemplo n.º 5
0
 public abstract TImperative VisitImperativeNode(ImperativeNode node);