-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathVisitor.java
More file actions
36 lines (28 loc) · 814 Bytes
/
Visitor.java
File metadata and controls
36 lines (28 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.python.antlr;
import org.python.antlr.ast.VisitorBase;
public class Visitor extends VisitorBase {
/**
* Visit each of the children one by one.
* @param node The node whose children will be visited.
*/
@Override
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;
}
@Override
protected Object unhandled_node(PythonTree node) throws Exception {
return this;
}
}