Exemple #1
0
        public override int VisitExpr_PLUSMINUS(firstParser.Expr_PLUSMINUSContext context)
        {
            ASTComposite m_parent = m_parents.Peek();

            if (context.op.Type == firstParser.MINUS)
            {
                CASTSubtraction newnode = new CASTSubtraction(context.GetText(), nodeType.NT_SUBSTRACTION, m_parents.Peek(), 2);
                m_parent.AddChild(newnode, m_parentContext.Peek());
                m_parents.Push(newnode);

                this.VisitElementInContext(context.expr(0), m_parentContext, contextType.CT_SUBSTRACTION_LEFT);
                this.VisitElementInContext(context.expr(1), m_parentContext, contextType.CT_SUBSTRACTION_RIGHT);
            }
            else if (context.op.Type == firstParser.PLUS)
            {
                CASTAddition newnode = new CASTAddition(context.GetText(), nodeType.NT_ADDITION, m_parents.Peek(), 2);
                m_parent.AddChild(newnode, m_parentContext.Peek());
                m_parents.Push(newnode);

                this.VisitElementInContext(context.expr(0), m_parentContext, contextType.CT_ADDITION_LEFT);
                this.VisitElementInContext(context.expr(1), m_parentContext, contextType.CT_ADDITION_RIGHT);
            }

            m_parents.Pop();
            return(0);
        }
Exemple #2
0
        public override int VisitSubtraction(CASTSubtraction node)
        {
            ExtractSubgraphs(node, contextType.CT_SUBSTRACTION_LEFT);
            ExtractSubgraphs(node, contextType.CT_SUBSTRACTION_RIGHT);

            base.VisitSubtraction(node);

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

            return(0);
        }
 public virtual T VisitSubtraction(CASTSubtraction node)
 {
     VisitChildren(node);
     return(default(T));
 }