traversalhelper.java
来自「Groovy动态语言 运行在JVM中的动态语言 可以方便的处理业务逻辑变化大的业」· Java 代码 · 共 534 行 · 第 1/3 页
JAVA
534 行
closingVisit(t);
}
protected void accept_FirstSecondAndThirdChild_v_v_ForthChild(GroovySourceAST t) {
GroovySourceAST child1 = (GroovySourceAST)t.getFirstChild();
if (child1 != null){
accept(child1);
GroovySourceAST child2 = (GroovySourceAST)child1.getNextSibling();
if (child2 != null) {
accept(child2);
GroovySourceAST child3 = (GroovySourceAST)child2.getNextSibling();
if (child3 != null) {
accept(child3);
openingVisit(t);
GroovySourceAST child4 = (GroovySourceAST)child3.getNextSibling();
if (child4 != null) {
subsequentVisit(t);
accept(child4);
}
}
}
}
}
protected void accept_v_FirstChild_2ndv_SecondChild_v___LastChild_v(GroovySourceAST t) {
openingVisit(t);
GroovySourceAST child = (GroovySourceAST)t.getFirstChild();
if (child != null){
accept(child);
GroovySourceAST sibling = (GroovySourceAST)child.getNextSibling();
if (sibling != null) {
secondVisit(t);
accept(sibling);
sibling = (GroovySourceAST)sibling.getNextSibling();
while (sibling != null) {
subsequentVisit(t);
accept(sibling);
sibling = (GroovySourceAST)sibling.getNextSibling();
}
}
}
closingVisit(t);
}
protected void accept_v_FirstChild_v_SecondChild_v___LastChild_v(GroovySourceAST t) {
openingVisit(t);
GroovySourceAST child = (GroovySourceAST)t.getFirstChild();
if (child != null){
accept(child);
GroovySourceAST sibling = (GroovySourceAST)child.getNextSibling();
while (sibling != null) {
subsequentVisit(t);
accept(sibling);
sibling = (GroovySourceAST)sibling.getNextSibling();
}
}
closingVisit(t);
}
protected void accept_v_FirstChild_v(GroovySourceAST t) {
openingVisit(t);
accept(t.childAt(0));
closingVisit(t);
}
protected void accept_v_AllChildren_v_Siblings(GroovySourceAST t) {
openingVisit(t);
acceptChildren(t);
closingVisit(t);
acceptSiblings(t);
}
protected void accept_v_AllChildren_v(GroovySourceAST t) {
openingVisit(t);
acceptChildren(t);
closingVisit(t);
}
protected void accept_FirstChild_v_RestOfTheChildren(GroovySourceAST t) {
accept(t.childAt(0));
openingVisit(t);
closingVisit(t);
acceptSiblings(t.childAt(0));
}
protected void accept_FirstChild_v_RestOfTheChildren_v_LastChild(GroovySourceAST t) {
int count = 0;
accept(t.childAt(0));
count++;
openingVisit(t);
if (t.childAt(0) != null) {
GroovySourceAST sibling = (GroovySourceAST)t.childAt(0).getNextSibling();
while (sibling != null) {
if (count == t.getNumberOfChildren() - 1) {closingVisit(t);}
accept(sibling);
count++;
sibling = (GroovySourceAST)sibling.getNextSibling();
}
}
}
protected void accept_FirstChild_v_RestOfTheChildren_v(GroovySourceAST t) {
accept(t.childAt(0));
openingVisit(t);
acceptSiblings(t.childAt(0));
closingVisit(t);
}
protected void accept_v_FirstChild_v_RestOfTheChildren(GroovySourceAST t) {
accept_v_FirstChild_v(t);
acceptSiblings(t.childAt(0));
}
protected void accept_v_FirstChild_v_RestOfTheChildren_v(GroovySourceAST t) {
openingVisit(t);
accept(t.childAt(0));
subsequentVisit(t);
acceptSiblings(t.childAt(0));
closingVisit(t);
}
protected void acceptSiblings(GroovySourceAST t) {
if (t != null) {
GroovySourceAST sibling = (GroovySourceAST)t.getNextSibling();
while (sibling != null) {
accept(sibling);
sibling = (GroovySourceAST)sibling.getNextSibling();
}
}
}
protected void acceptChildren(GroovySourceAST t) {
if (t != null) {
GroovySourceAST child = (GroovySourceAST)t.getFirstChild();
if (child != null){
accept(child);
acceptSiblings(child);
}
}
}
protected void skip(GroovySourceAST expr) {
unvisitedNodes.remove(expr);
}
protected void openingVisit(GroovySourceAST t) {
unvisitedNodes.remove(t);
int n = Visitor.OPENING_VISIT;
visitNode(t, n);
}
protected void secondVisit(GroovySourceAST t) {
int n = Visitor.SECOND_VISIT;
visitNode(t, n);
}
protected void subsequentVisit(GroovySourceAST t) {
int n = Visitor.SUBSEQUENT_VISIT;
visitNode(t, n);
}
protected void closingVisit(GroovySourceAST t) {
int n = Visitor.CLOSING_VISIT;
visitNode(t, n);
}
public AST process(AST t) {
GroovySourceAST node = (GroovySourceAST) t;
// process each node in turn
setUp(node);
accept(node);
acceptSiblings(node);
tearDown(node);
return null;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?