lastlinevisitor.java
来自「Python Development Environment (Python I」· Java 代码 · 共 39 行
JAVA
39 行
package org.python.pydev.refactoring.ast.visitors.position;
import org.python.pydev.parser.jython.SimpleNode;
import org.python.pydev.parser.jython.ast.VisitorBase;
/**
* A node's last body statement isn't always the last line. We have to traverse the statement's AST node in many cases: e.g. a nested class,
* any control statement, etc.
*
* @author Ueli Kistler
*
*/
public class LastLineVisitor extends VisitorBase {
private int lastLine;
public LastLineVisitor() {
lastLine = 0;
}
@Override
public void traverse(SimpleNode node) throws Exception {
if (node != null)
node.traverse(this);
}
@Override
protected Object unhandled_node(SimpleNode node) throws Exception {
if (node.beginLine > lastLine)
lastLine = node.beginLine;
return null;
}
public int getLastLine() {
return lastLine;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?