public override int VisitProg(RASTElement currentNode)
        {
            scopeSystem.EnterEnviroment("Global");
            base.VisitProg(currentNode);
            scopeSystem.LeaveEnviroment();
            scopeSystem.WriteToFile(m_outputStream);

            return(0);
        }
예제 #2
0
        /// <summary>
        /// Visits the children of the specified context in the currentNode
        /// </summary>
        /// <param name="currentNode">The current node.</param>
        /// <returns></returns>
        public virtual Return VisitContext(RASTElement currentNode, ContextType context)
        {
            RAbstractIterator <RASTElement> it = m_iteratorFactory.CreateIteratorASTElementDescentantsContext(currentNode);

            // Call Accept to all children in the specified context of the current node
            for (it.ItBegin(context); !it.ItEnd(); it.ITNext())
            {
                it.M_item.AcceptVisitor(this);
            }

            return(default(Return));
        }
예제 #3
0
        /// <summary>
        /// <c>VisitChildren</c> method is used to visit child nodes of the node given
        /// as a parameter. This method provides default functionality for
        /// </summary>
        /// <param name="currentNode">The current node.</param>
        /// <returns></returns>
        public virtual Return VisitChildren(RASTElement currentNode)
        {
            RAbstractIterator <RASTElement> it = m_iteratorFactory.CreateIteratorASTElementDescentantsFlatten(currentNode);

            // Call Accept to all children of the current node
            for (it.ItBegin(); !it.ItEnd(); it.ITNext())
            {
                it.M_item.AcceptVisitor(this);
            }

            return(default(Return));
        }
        public override int VisitAssignmentOpetators(RASTElement currentNode)
        {
            RASTComposite current = currentNode as RASTComposite;

            // Visit assignment opetator left context
            if (current.GetNumberOfContextElements(ContextType.CT_EXPR_ASSIGNMENT_OPETATORS_LEFT) > 0)
            {
                foreach (RASTElement element in current.GetContextChildren(ContextType.CT_EXPR_ASSIGNMENT_OPETATORS_LEFT))
                {
                    scopeSystem.AddSymbol(element.M_Label, "Local Variable");
                }
            }

            base.VisitAssignmentOpetators(currentNode);

            return(0);
        }
        public override int VisitDefineFunction(RASTElement currentNode)
        {
            RASTComposite current = currentNode as RASTComposite;

            scopeSystem.EnterEnviroment(currentNode.M_Label);

            // Visit function's definition params context
            if (current.GetNumberOfContextElements(ContextType.CT_EXPR_DEFINE_FUNCTION_PARAMS) > 0)
            {
                foreach (RASTElement element in current.GetContextChildren(ContextType.CT_EXPR_DEFINE_FUNCTION_PARAMS))
                {
                    scopeSystem.AddSymbol(element.M_Label, "Formal Parameter");
                }
            }

            base.VisitDefineFunction(currentNode);

            scopeSystem.LeaveEnviroment();

            return(0);
        }
예제 #6
0
 public virtual Return VisitWrappedWithPercent(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #7
0
 public virtual Return VisitMultiplicationOrDivisionBinary(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #8
0
 public virtual Return VisitProg(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
 public virtual RAbstractIterator <RASTElement> CreateParenthesisIteratorEvents(RASTElement element,
                                                                                RASTGenericIteratorEvents events, object info = null)
 {
     return(CreateIteratorASTElementDescentantsFlattenEvents(element, events, info));
 }
예제 #10
0
 public virtual Return VisitBreakStatement(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #11
0
 public virtual Return VisitCOMPLEX(RASTElement currentNode)
 {
     return(base.VisitTerminal(currentNode));
 }
예제 #12
0
 public virtual Return VisitTildeBinary(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #13
0
 public virtual Return VisitCallFunction(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #14
0
 public virtual Return VisitMinusOrPlusBinary(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #15
0
 /// <summary>
 /// Visits the specified node by calling its Accept function. The method
 /// can be used to start a new traversal from the specified node
 /// </summary>
 /// <param name="node">The node.</param>
 /// <returns></returns>
 public virtual Return Visit(RASTElement node)
 {
     // Call Accept of the specific node
     return(node.AcceptVisitor <Return>(this));
 }
 public virtual void OnContextLeave(RASTElement node, RASTVisitorEventArgs args)
 {
     m_OnContextLeave?.Invoke(node, args);
 }
 public virtual void OnNodeEnter(RASTElement node, RASTVisitorEventArgs args)
 {
     m_OnNodeEnter?.Invoke(node, args);
 }
예제 #18
0
 /// <summary>
 /// Visits the terminal. It doen't go any further since this is a leaf node
 /// </summary>
 /// <param name="node">The node.</param>
 /// <returns></returns>
 public virtual Return VisitTerminal(RASTElement node)
 {
     return(default(Return));
 }
예제 #19
0
 public virtual Return VisitComparisons(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
 public override int VisitIDENTIFIER(RASTElement currentNode)
 {
     scopeSystem.AddSymbol(currentNode.M_Label, "Check Type");
     return(base.VisitIDENTIFIER(currentNode));
 }
예제 #21
0
 public virtual Return VisitAssignmentOpetators(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #22
0
 public virtual Return VisitSingleDoubleColonsOperators(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #23
0
 public virtual Return VisitHelpForMethods(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #24
0
 public virtual Return VisitDollarAtOperators(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #25
0
 public virtual Return VisitINTEGER(RASTElement currentNode)
 {
     return(base.VisitTerminal(currentNode));
 }
예제 #26
0
 public virtual Return VisitExponentiationBinary(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #27
0
 public virtual Return VisitLITERALSPECIFIER(RASTElement currentNode)
 {
     return(base.VisitTerminal(currentNode));
 }
예제 #28
0
 public virtual Return VisitColonOperator(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
예제 #29
0
 public virtual Return VisitIndexingByVectors(RASTElement currentNode)
 {
     return(base.VisitChildren(currentNode));
 }
 public virtual RAbstractIterator <RASTElement> CreateParenthesisIterator(RASTElement element)
 {
     return(CreateIteratorASTElementDescentantsFlatten(element));
 }