Commit 49fc9a6c authored by Johannes Roith's avatar Johannes Roith

add FindNextCodeBlockLine for debugger.

parent b08129f9
package de.in.tum.www2.cup.analysis;
import de.in.tum.www2.cup.Position;
import de.in.tum.www2.cup.Range;
import de.in.tum.www2.cup.ast.*;
public class FindNextCodeBlockLine extends Visitor<Object>
{
private int line;
private int result;
public int getResult() {
return result;
}
public FindNextCodeBlockLine(int line) {
this.line = line;
this.result = -1;
}
private void doCheck(AbstractNode node) {
if (node == null)
return;
int blockLine = node.getBegin().getLine();
if (result != -1)
return;
if (line >= blockLine && line <= node.getEnd().getLine()) {
result = line;
return;
}
if (blockLine > line)
result = blockLine;
}
@Override
public void postVisit (ActionCodeBlock node, Object data) {
doCheck(node);
}
@Override
public void postVisit (SpecialCodeBlock node, Object data) {
doCheck(node);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment