Exemplo n.º 1
0
        public override int VisitExpr_MULDIV(firstParser.Expr_MULDIVContext context)
        {
            ASTComposite m_parent = m_parents.Peek();

            if (context.op.Type == firstParser.MULT)
            {
                CASTMultiplication newnode = new CASTMultiplication(context.GetText(), nodeType.NT_MULTIPLICATION, m_parents.Peek(), 2);
                m_parent.AddChild(newnode, m_parentContext.Peek());
                m_parents.Push(newnode);

                this.VisitElementInContext(context.expr(0), m_parentContext, contextType.CT_MULTIPLICATION_LEFT);
                this.VisitElementInContext(context.expr(1), m_parentContext, contextType.CT_MULTIPLICATION_RIGHT);
            }
            else if (context.op.Type == firstParser.DIV)
            {
                CASTDivision newnode = new CASTDivision(context.GetText(), nodeType.NT_DIVISION, m_parents.Peek(), 2);
                m_parent.AddChild(newnode, m_parentContext.Peek());
                m_parents.Push(newnode);

                this.VisitElementInContext(context.expr(0), m_parentContext, contextType.CT_DIVISION_LEFT);
                this.VisitElementInContext(context.expr(1), m_parentContext, contextType.CT_DIVISION_RIGHT);
            }

            m_parents.Pop();
            return(0);
        }
Exemplo n.º 2
0
        public override int VisitDivision(CASTDivision node)
        {
            ExtractSubgraphs(node, contextType.CT_DIVISION_LEFT);
            ExtractSubgraphs(node, contextType.CT_DIVISION_RIGHT);

            base.VisitDivision(node);

            m_ostream.WriteLine("{0}->{1}", node.MParent.MNodeName, node.MNodeName);

            return(0);
        }
 public virtual T VisitDivision(CASTDivision node)
 {
     VisitChildren(node);
     return(default(T));
 }