📄 traversalhelper.java
字号:
subsequentVisit(t); accept(t.childAt(1)); } protected void accept_FirstChild_v_SecondChild_v(GroovySourceAST t) { accept(t.childAt(0)); openingVisit(t); accept(t.childAt(1)); closingVisit(t); } protected void accept_FirstChild_v_SecondChildsChildren_v(GroovySourceAST t) { accept(t.childAt(0)); openingVisit(t); GroovySourceAST secondChild = t.childAt(1); if (secondChild != null) { acceptChildren(secondChild); } closingVisit(t); } protected void accept_FirstChild_v_SecondChild_v_ThirdChild_v(GroovySourceAST t) { accept(t.childAt(0)); openingVisit(t); accept(t.childAt(1)); subsequentVisit(t); accept(t.childAt(2)); 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 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -