Visitor.java :  » Scripting » Jython-2.5.1 » org » python » antlr » Java Open Source

Java Open Source » Scripting » Jython 2.5.1 
Jython 2.5.1 » org » python » antlr » Visitor.java
package org.python.antlr;

import org.python.antlr.ast.VisitorBase;

public class Visitor extends VisitorBase {

    /**
     * Visit each of the children one by one.
     * @args node The node whose children will be visited.
     */
    public void traverse(PythonTree node) throws Exception {
        node.traverse(this);
    }


    public void visit(PythonTree[] nodes) throws Exception {
        for (int i = 0; i < nodes.length; i++) {
            visit(nodes[i]);
        }
    }

    /**
     * Visit the node by calling a visitXXX method.
     */
    public Object visit(PythonTree node) throws Exception {
        Object ret = node.accept(this);
        return ret;
    }

    protected Object unhandled_node(PythonTree node) throws Exception {
        return this;
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.