1 package org.python.parser; 2 3 import org.python.parser.ast.*; 4 5 public class Visitor extends VisitorBase { 6 7 11 public void traverse(SimpleNode node) throws Exception { 12 node.traverse(this); 13 } 14 15 16 public void visit(SimpleNode[] nodes) throws Exception { 17 for (int i = 0; i < nodes.length; i++) { 18 visit(nodes[i]); 19 } 20 } 21 22 25 public Object visit(SimpleNode node) throws Exception { 26 open_level(node); 27 Object ret = node.accept(this); 28 close_level(node); 29 return ret; 30 } 31 32 33 protected Object unhandled_node(SimpleNode node) throws Exception { 34 return this; 35 } 36 37 protected void open_level(SimpleNode node) throws Exception { 38 } 39 40 protected void close_level(SimpleNode node) throws Exception { 41 } 42 } 43 | Popular Tags |