Commit 3722b8cb authored by Sarah Grebing's avatar Sarah Grebing

Line highlight first version

parent d0906b07
Pipeline #11892 passed with stage
in 2 minutes and 18 seconds
...@@ -225,22 +225,24 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -225,22 +225,24 @@ public class DebuggerMainWindowController implements Initializable {
pc.setCurrentInterpreter(currentInterpreter); pc.setCurrentInterpreter(currentInterpreter);
pc.setMainScript(scripts.get(0)); pc.setMainScript(scripts.get(0));
pc.executeScript(this.debugMode.get());
pc.currentGoalsProperty().addListener((o, old, fresh) -> { pc.currentGoalsProperty().addListener((o, old, fresh) -> {
if (fresh != null) { if (fresh != null) {
model.currentGoalNodesProperty().setAll(fresh); model.currentGoalNodesProperty().setAll(fresh);
} }
}); });
pc.executeScript(this.debugMode.get());
model.currentSelectedGoalNodeProperty().bind(pc.currentSelectedGoalProperty()); model.currentSelectedGoalNodeProperty().bind(pc.currentSelectedGoalProperty());
/* pc.currentGoalsProperty().addListener((observable, oldValue, newValue) -> { pc.startHighlightPositionPropertyProperty().addListener((observable, oldValue, newValue) -> {
if(newValue != null) { if (newValue.getLineNumber() > -1) {
model.currentGoalNodesProperty().get(). tabPane.getSelectedScriptArea().highlightStmt(newValue.getLineNumber(), "line-highlight-postmortem");
setAll(pc.currentGoalsProperty()); }
if (oldValue.getLineNumber() > -1) {
tabPane.getSelectedScriptArea().removeHighlightStmt(oldValue.getLineNumber());
} }
});*/
});
//highlight signature of main script //highlight signature of main script
tabPane.getSelectedScriptArea().setDebugMark(scripts.get(0).getStartPosition().getLineNumber()); tabPane.getSelectedScriptArea().setDebugMark(scripts.get(0).getStartPosition().getLineNumber());
} catch (RecognitionException e) { } catch (RecognitionException e) {
...@@ -389,18 +391,12 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -389,18 +391,12 @@ public class DebuggerMainWindowController implements Initializable {
} }
public void stepOver(ActionEvent actionEvent) { public void stepOver(ActionEvent actionEvent) {
// blocker.getStepUntilBlock().addAndGet(1);
// blocker.unlock();
PTreeNode newState = pc.stepOver(); PTreeNode newState = pc.stepOver();
// model.currentGoalNodesProperty().setAll(newState.getState().getGoals());
// model.setCurrentSelectedGoalNode(newState.getState().getSelectedGoalNode());
} }
public void stepBack(ActionEvent actionEvent) { public void stepBack(ActionEvent actionEvent) {
PTreeNode newState = pc.stepBack(); PTreeNode newState = pc.stepBack();
// model.currentGoalNodesProperty().setAll(newState.getState().getGoals());
// model.setCurrentSelectedGoalNode(newState.getState().getSelectedGoalNode());
} }
...@@ -432,8 +428,9 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -432,8 +428,9 @@ public class DebuggerMainWindowController implements Initializable {
} }
public void stopDebugMode(ActionEvent actionEvent) { public void stopDebugMode(ActionEvent actionEvent) {
//linenumberMainscript from model? //linenumberMainscript from model?
// tabPane.getActiveScriptAreaTab().getScriptArea().removeHighlightStmt(lineNumberMainScript); //tabPane.getActiveScriptAreaTab().getScriptArea().removeHighlightStmt(lineNumberMainScript);
//inspectionViewTabPane.getInspectionViewTab.clear(); //inspectionViewTabPane.getInspectionViewTab.clear();
} }
......
...@@ -13,12 +13,15 @@ import java.util.*; ...@@ -13,12 +13,15 @@ import java.util.*;
/** /**
* Visitor to create ProgramFlowGraph * Visitor to create ProgramFlowGraph
*/ */
public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { public class ControlFlowVisitor extends DefaultASTVisitor<Void> {
/** /**
* Lookup for names of scripts * Lookup for names of scripts
*/ */
private final CommandLookup functionLookup; private final CommandLookup functionLookup;
/**
* Mapping of ASTNodes to CFG nodes
*/
private Map<ASTNode, ControlFlowNode> mappingOfNodes; private Map<ASTNode, ControlFlowNode> mappingOfNodes;
/** /**
* Last visited Node * Last visited Node
...@@ -30,17 +33,17 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -30,17 +33,17 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
*/ */
private MutableValueGraph<ControlFlowNode, EdgeTypes> graph = ValueGraphBuilder.directed().allowsSelfLoops(true).build(); private MutableValueGraph<ControlFlowNode, EdgeTypes> graph = ValueGraphBuilder.directed().allowsSelfLoops(true).build();
/**
* Call context
*/
private LinkedList<ASTNode> context = new LinkedList<>(); private LinkedList<ASTNode> context = new LinkedList<>();
public ProgramFlowVisitor(CommandLookup functionLookup) {
public ControlFlowVisitor(CommandLookup functionLookup) {
this.functionLookup = functionLookup; this.functionLookup = functionLookup;
mappingOfNodes = new HashMap<>(); mappingOfNodes = new HashMap<>();
} }
public MutableValueGraph<ControlFlowNode, EdgeTypes> getGraph() {
return graph;
}
public Set<EndpointPair<ControlFlowNode>> getAllEdgesForNodeAsTarget(ASTNode node) { public Set<EndpointPair<ControlFlowNode>> getAllEdgesForNodeAsTarget(ASTNode node) {
...@@ -68,9 +71,10 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -68,9 +71,10 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
public Void visit(ProofScript proofScript) { public Void visit(ProofScript proofScript) {
ControlFlowNode scriptNode = new ControlFlowNode(proofScript); ControlFlowNode scriptNode = new ControlFlowNode(proofScript);
context.add(proofScript);
mappingOfNodes.put(proofScript, scriptNode); mappingOfNodes.put(proofScript, scriptNode);
graph.addNode(scriptNode); graph.addNode(scriptNode);
System.out.println("\n" + scriptNode + "\n"); //System.out.println("\n" + scriptNode + "\n");
lastNode = scriptNode; lastNode = scriptNode;
return this.visit(proofScript.getBody()); return this.visit(proofScript.getBody());
...@@ -82,7 +86,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -82,7 +86,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
ControlFlowNode assignmentNode = new ControlFlowNode(assignment); ControlFlowNode assignmentNode = new ControlFlowNode(assignment);
mappingOfNodes.put(assignment, assignmentNode); mappingOfNodes.put(assignment, assignmentNode);
graph.addNode(assignmentNode); graph.addNode(assignmentNode);
System.out.println("\n" + assignmentNode + "\n"); //System.out.println("\n" + assignmentNode + "\n");
lastNode = assignmentNode; lastNode = assignmentNode;
return null; return null;
} }
...@@ -149,7 +153,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -149,7 +153,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
ControlFlowNode currentNode = new ControlFlowNode(foreach); ControlFlowNode currentNode = new ControlFlowNode(foreach);
mappingOfNodes.put(foreach, currentNode); mappingOfNodes.put(foreach, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n"); //System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK); graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK);
lastNode = currentNode; lastNode = currentNode;
...@@ -164,7 +168,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -164,7 +168,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
ControlFlowNode currentNode = new ControlFlowNode(theOnly); ControlFlowNode currentNode = new ControlFlowNode(theOnly);
mappingOfNodes.put(theOnly, currentNode); mappingOfNodes.put(theOnly, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n"); //System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK); graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK);
lastNode = currentNode; lastNode = currentNode;
...@@ -180,7 +184,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -180,7 +184,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
ControlFlowNode currentNode = new ControlFlowNode(repeatStatement); ControlFlowNode currentNode = new ControlFlowNode(repeatStatement);
mappingOfNodes.put(repeatStatement, currentNode); mappingOfNodes.put(repeatStatement, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n"); // System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK); graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK);
lastNode = currentNode; lastNode = currentNode;
...@@ -195,7 +199,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -195,7 +199,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
ControlFlowNode currentNode = new ControlFlowNode(casesStatement); ControlFlowNode currentNode = new ControlFlowNode(casesStatement);
mappingOfNodes.put(casesStatement, currentNode); mappingOfNodes.put(casesStatement, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n"); //System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK); graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK);
List<CaseStatement> cases = casesStatement.getCases(); List<CaseStatement> cases = casesStatement.getCases();
...@@ -203,7 +207,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -203,7 +207,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
ControlFlowNode caseNode = new ControlFlowNode(aCase); ControlFlowNode caseNode = new ControlFlowNode(aCase);
mappingOfNodes.put(aCase, caseNode); mappingOfNodes.put(aCase, caseNode);
graph.addNode(caseNode); graph.addNode(caseNode);
System.out.println("\n" + caseNode + "\n"); //System.out.println("\n" + caseNode + "\n");
graph.putEdgeValue(currentNode, caseNode, EdgeTypes.STEP_OVER); //??is this right? graph.putEdgeValue(currentNode, caseNode, EdgeTypes.STEP_OVER); //??is this right?
graph.putEdgeValue(caseNode, currentNode, EdgeTypes.STEP_BACK); graph.putEdgeValue(caseNode, currentNode, EdgeTypes.STEP_BACK);
lastNode = caseNode; lastNode = caseNode;
...@@ -241,5 +245,10 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -241,5 +245,10 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
return sb.toString(); return sb.toString();
} }
public MutableValueGraph<ControlFlowNode, EdgeTypes> getGraph() {
return graph;
}
} }
...@@ -6,7 +6,6 @@ import edu.kit.formal.interpreter.InterpretingService; ...@@ -6,7 +6,6 @@ import edu.kit.formal.interpreter.InterpretingService;
import edu.kit.formal.interpreter.data.GoalNode; import edu.kit.formal.interpreter.data.GoalNode;
import edu.kit.formal.interpreter.data.KeyData; import edu.kit.formal.interpreter.data.KeyData;
import edu.kit.formal.interpreter.data.State; import edu.kit.formal.interpreter.data.State;
import edu.kit.formal.proofscriptparser.Visitor;
import edu.kit.formal.proofscriptparser.ast.Position; import edu.kit.formal.proofscriptparser.ast.Position;
import edu.kit.formal.proofscriptparser.ast.ProofScript; import edu.kit.formal.proofscriptparser.ast.ProofScript;
import javafx.beans.property.ListProperty; import javafx.beans.property.ListProperty;
...@@ -54,6 +53,7 @@ public class ProofTreeController { ...@@ -54,6 +53,7 @@ public class ProofTreeController {
*/ */
private SimpleObjectProperty<PTreeNode> nextComputedNode = new SimpleObjectProperty<>(); private SimpleObjectProperty<PTreeNode> nextComputedNode = new SimpleObjectProperty<>();
private SimpleObjectProperty<Position> startHighlightPositionProperty = new SimpleObjectProperty<>(); private SimpleObjectProperty<Position> startHighlightPositionProperty = new SimpleObjectProperty<>();
private SimpleObjectProperty<Position> endHighlightPositionProperty = new SimpleObjectProperty<>(); private SimpleObjectProperty<Position> endHighlightPositionProperty = new SimpleObjectProperty<>();
...@@ -61,12 +61,12 @@ public class ProofTreeController { ...@@ -61,12 +61,12 @@ public class ProofTreeController {
/** /**
* Visitor to retrieve state graph * Visitor to retrieve state graph
*/ */
private StateGraphVisitor stateGraphVisitor; private StateGraphWrapper stateGraphWrapper;
/** /**
* Graph that is computed on the fly in order to allow stepping * Graph that is computed on the fly in order to allow stepping
*/ */
private ProgramFlowVisitor controlFlowGraphVisitor; private ControlFlowVisitor controlFlowGraphVisitor;
/** /**
...@@ -108,6 +108,7 @@ public class ProofTreeController { ...@@ -108,6 +108,7 @@ public class ProofTreeController {
//update statepointer //update statepointer
this.statePointer = newValue; this.statePointer = newValue;
setNewState(this.statePointer.getState()); setNewState(this.statePointer.getState());
}); });
...@@ -120,7 +121,7 @@ public class ProofTreeController { ...@@ -120,7 +121,7 @@ public class ProofTreeController {
* @param mainScript * @param mainScript
*/ */
private void buildControlFlowGraph(ProofScript mainScript) { private void buildControlFlowGraph(ProofScript mainScript) {
this.controlFlowGraphVisitor = new ProgramFlowVisitor(currentInterpreter.getFunctionLookup()); this.controlFlowGraphVisitor = new ControlFlowVisitor(currentInterpreter.getFunctionLookup());
mainScript.accept(controlFlowGraphVisitor); mainScript.accept(controlFlowGraphVisitor);
System.out.println("CFG\n" + controlFlowGraphVisitor.asdot()); System.out.println("CFG\n" + controlFlowGraphVisitor.asdot());
...@@ -139,14 +140,17 @@ public class ProofTreeController { ...@@ -139,14 +140,17 @@ public class ProofTreeController {
//if pointer is null, we do not have a root yet //if pointer is null, we do not have a root yet
if (currentPointer == null) { if (currentPointer == null) {
//ask for root //ask for root
currentPointer = stateGraphVisitor.rootProperty().get(); currentPointer = stateGraphWrapper.rootProperty().get();
statePointer = currentPointer; statePointer = currentPointer;
} }
PTreeNode nextNode = stateGraphVisitor.getStepOver(currentPointer); //get next node
PTreeNode nextNode = stateGraphWrapper.getStepOver(currentPointer);
//if nextnode is null ask interpreter
if (nextNode != null) { if (nextNode != null) {
this.statePointer = nextNode; this.statePointer = nextNode;
setNewState(statePointer.getState()); setNewState(statePointer.getState());
// setHighlightStmt(this.statePointer.getScriptstmt().getStartPosition(), this.statePointer.getScriptstmt().getStartPosition());
} else { } else {
//no next node is present yet //no next node is present yet
//let interpreter run for one step and let listener handle updating the statepointer //let interpreter run for one step and let listener handle updating the statepointer
...@@ -164,8 +168,9 @@ public class ProofTreeController { ...@@ -164,8 +168,9 @@ public class ProofTreeController {
*/ */
public PTreeNode stepBack() { public PTreeNode stepBack() {
PTreeNode current = statePointer; PTreeNode current = statePointer;
this.statePointer = stateGraphVisitor.getStepBack(current); this.statePointer = stateGraphWrapper.getStepBack(current);
setNewState(statePointer.getState()); setNewState(statePointer.getState());
//setHighlightStmt(this.statePointer.getScriptstmt().getStartPosition(), this.statePointer.getScriptstmt().getStartPosition());
return statePointer; return statePointer;
} }
...@@ -190,12 +195,10 @@ public class ProofTreeController { ...@@ -190,12 +195,10 @@ public class ProofTreeController {
//build CFG //build CFG
buildControlFlowGraph(mainScript); buildControlFlowGraph(mainScript);
//build StateGraph //build StateGraph
this.stateGraphVisitor = new StateGraphVisitor(this.currentInterpreter, this.mainScript, this.controlFlowGraphVisitor); this.stateGraphWrapper = new StateGraphWrapper(currentInterpreter, this.mainScript, this.controlFlowGraphVisitor);
currentInterpreter.getEntryListeners().add(this.stateGraphVisitor); this.stateGraphWrapper.install(currentInterpreter);
//currentInterpreter.getExitListeners().add(this.stateGraphVisitor); this.stateGraphWrapper.addChangeListener(graphChangedListener);
this.stateGraphVisitor.addChangeListener(graphChangedListener);
blocker.getStepUntilBlock().set(1); blocker.getStepUntilBlock().set(1);
} }
interpreterService.interpreterProperty().set(currentInterpreter); interpreterService.interpreterProperty().set(currentInterpreter);
...@@ -214,9 +217,24 @@ public class ProofTreeController { ...@@ -214,9 +217,24 @@ public class ProofTreeController {
private void setNewState(State<KeyData> state) { private void setNewState(State<KeyData> state) {
this.setCurrentGoals(state.getGoals()); this.setCurrentGoals(state.getGoals());
this.setCurrentSelectedGoal(state.getSelectedGoalNode()); this.setCurrentSelectedGoal(state.getSelectedGoalNode());
setHighlightStmt(this.statePointer.getScriptstmt().getStartPosition(), this.statePointer.getScriptstmt().getStartPosition());
System.out.println("New State from this command: " + this.statePointer.getScriptstmt().getNodeName() + "@" + this.statePointer.getScriptstmt().getStartPosition()); System.out.println("New State from this command: " + this.statePointer.getScriptstmt().getNodeName() + "@" + this.statePointer.getScriptstmt().getStartPosition());
} }
/**
* Set Position for highlighting statement
*
* @param start
* @param end
*/
private void setHighlightStmt(Position start, Position end) {
this.startHighlightPositionProperty.set(start);
this.endHighlightPositionProperty.set(end);
}
/************************************************************************************************************** /**************************************************************************************************************
* *
* Getter and Setter * Getter and Setter
...@@ -232,8 +250,8 @@ public class ProofTreeController { ...@@ -232,8 +250,8 @@ public class ProofTreeController {
} }
public Visitor getStateVisitor() { public StateGraphWrapper getStateVisitor() {
return this.stateGraphVisitor; return this.stateGraphWrapper;
} }
public List<GoalNode<KeyData>> getCurrentGoals() { public List<GoalNode<KeyData>> getCurrentGoals() {
...@@ -268,6 +286,28 @@ public class ProofTreeController { ...@@ -268,6 +286,28 @@ public class ProofTreeController {
return executeNotPossible; return executeNotPossible;
} }
public Position getStartHighlightPositionProperty() {
return startHighlightPositionProperty.get();
}
public void setStartHighlightPositionProperty(Position startHighlightPositionProperty) {
this.startHighlightPositionProperty.set(startHighlightPositionProperty);
}
public SimpleObjectProperty<Position> startHighlightPositionPropertyProperty() {
return startHighlightPositionProperty;
}
public Position getEndHighlightPositionProperty() {
return endHighlightPositionProperty.get();
}
public void setEndHighlightPositionProperty(Position endHighlightPositionProperty) {
this.endHighlightPositionProperty.set(endHighlightPositionProperty);
}
public SimpleObjectProperty<Position> endHighlightPositionPropertyProperty() {
return endHighlightPositionProperty;
}
} }
...@@ -9,15 +9,13 @@ import edu.kit.formal.interpreter.data.KeyData; ...@@ -9,15 +9,13 @@ import edu.kit.formal.interpreter.data.KeyData;
import edu.kit.formal.interpreter.data.State; import edu.kit.formal.interpreter.data.State;
import edu.kit.formal.interpreter.exceptions.StateGraphException; import edu.kit.formal.interpreter.exceptions.StateGraphException;
import edu.kit.formal.proofscriptparser.DefaultASTVisitor; import edu.kit.formal.proofscriptparser.DefaultASTVisitor;
import edu.kit.formal.proofscriptparser.Visitor;
import edu.kit.formal.proofscriptparser.ast.*; import edu.kit.formal.proofscriptparser.ast.*;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import lombok.Getter; import lombok.Getter;
import java.util.ArrayList; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/** /**
...@@ -25,7 +23,7 @@ import java.util.Set; ...@@ -25,7 +23,7 @@ import java.util.Set;
* A Node in the graph is a PTreeNode {@link PTreeNode} * A Node in the graph is a PTreeNode {@link PTreeNode}
* Edges are computed on the fly while * Edges are computed on the fly while
*/ */
public class StateGraphVisitor extends DefaultASTVisitor<Void> { public class StateGraphWrapper {
/** /**
* Listeners getting informed when new node added to state graph * Listeners getting informed when new node added to state graph
...@@ -56,21 +54,28 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> { ...@@ -56,21 +54,28 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> {
private PTreeNode lastNode; private PTreeNode lastNode;
/** /**
* Visitor for control flow graph * Mapping ASTNode to PTreeNode
*/ */
private ProgramFlowVisitor cfgVisitor;
private HashMap<ASTNode, PTreeNode> addedNodes = new LinkedHashMap<>();
/**
* Visitor for control flow graph
*/
private ControlFlowVisitor cfgVisitor;
private Visitor<Void> entryListener = new StateGraphWrapper.EntryListener();
private Visitor<Void> exitListener = new StateGraphWrapper.ExitListener();
private ProofScript mainScript; private ProofScript mainScript;
public StateGraphVisitor(Interpreter inter, ProofScript mainScript, ProgramFlowVisitor cfgVisitor) { public StateGraphWrapper(Interpreter inter, ProofScript mainScript, ControlFlowVisitor cfgVisitor) {
stateGraph = ValueGraphBuilder.directed().build(); stateGraph = ValueGraphBuilder.directed().build();
this.currentInterpreter = inter; this.currentInterpreter = inter;
this.cfgVisitor = cfgVisitor; this.cfgVisitor = cfgVisitor;
this.mainScript = mainScript; this.mainScript = mainScript;
//createRootNode(); // createRootNode(null);
} }
...@@ -107,7 +112,12 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> { ...@@ -107,7 +112,12 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> {
//careful TODO look for right edges //careful TODO look for right edges
//TODO handle endpoint of graph //TODO handle endpoint of graph
public PTreeNode getStepOver(PTreeNode statePointer) { public PTreeNode getStepOver(PTreeNode statePointer) {
/*Set<PTreeNode> pTreeNodesNeigbours = stateGraph.adjacentNodes(statePointer);
if(pTreeNodesNeigbours.isEmpty()){
return null;
}else{
pTreeNodesNeigbours.forEach(e-> System.out.println(e.getScriptstmt().getNodeName()+e.getScriptstmt().getStartPosition()));
}*/
if (statePointer == null) { if (statePointer == null) {
return this.rootProperty().get(); return this.rootProperty().get();
} }
...@@ -119,6 +129,7 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> { ...@@ -119,6 +129,7 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> {