Exemplo n.º 1
0
        public override int VisitExprMinusOrPlusUnary(RParser.ExprMinusOrPlusUnaryContext context)
        {
            string label = "MinusOrPlusUnary_" + ms_ASTElementCounter.ToString();

            m_outputStream.WriteLine("\"{0}\"->\"{1}\";", m_PTPath.Peek(), label);
            ms_ASTElementCounter++;
            m_PTPath.Push(label);

            base.VisitExprMinusOrPlusUnary(context);

            // POSTORDER ACTIONS
            m_PTPath.Pop();

            return(0);
        }
Exemplo n.º 2
0
        public override int VisitExprMinusOrPlusUnary(RParser.ExprMinusOrPlusUnaryContext context)
        {
            RASTComposite parent = m_parents.Peek();

            // PREORDER ACTIONS
            // Create new element
            RASTComposite newElement = new RMinusOrPlusUnary(parent);

            // Update parents stack
            m_parents.Push(newElement);

            // Add new element to the parent's descentants
            parent.AddChild(newElement, m_currentContext.Peek());

            // VISIT CHILDREN
            VisitElementInContext(context.expr(), ContextType.CT_EXPR_MINUS_OR_PLUS_UNARY);

            // POSTORDER ACTIONS

            // Update parents stack
            m_parents.Pop();

            return(0);
        }