Commit 5be7abf6 authored by Sarah Grebing's avatar Sarah Grebing
Browse files

Merge remote-tracking branch 'origin/grebing_luong_workbranch' into grebing_luong_workbranch

# Conflicts:
#	ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptTreeGraph.java
parents aa69aa43 ee92cd85
...@@ -292,11 +292,12 @@ public class ScriptTreeGraph { ...@@ -292,11 +292,12 @@ public class ScriptTreeGraph {
case 0: case 0:
putIntoFront(callnode); putIntoFront(callnode);
checkIfForeachEnd(callnode); checkIfForeachEnd(callnode);
addPlaceholder(sn, sn.getNode());
break; break;
case 1: case 1:
// putIntoMapping(children.get(0).getData().getNode(), null); // putIntoMapping(children.get(0).getData().getNode(), null);
putIntoFront(children.get(0).getData().getNode()); putIntoFront(children.get(0).getData().getNode());
addPlaceholder(sn, children.get(0).getData().getNode(), false); addPlaceholder(sn, children.get(0).getData().getNode());
break; break;
default: //multiple open goals/children -> branch labels default: //multiple open goals/children -> branch labels
int branchcounter = 1; int branchcounter = 1;
...@@ -312,7 +313,7 @@ public class ScriptTreeGraph { ...@@ -312,7 +313,7 @@ public class ScriptTreeGraph {
Lists.reverse(branchlabel).forEach(k -> System.out.println(k.getNode().serialNr() + " " + k.getLabelName())); Lists.reverse(branchlabel).forEach(k -> System.out.println(k.getNode().serialNr() + " " + k.getLabelName()));
insertBranchLabels(callnode, branchlabel); insertBranchLabels(callnode, branchlabel);
addPlaceholder(branchlabel.get(0), gn.getData().getNode(), true); addPlaceholder(branchlabel.get(0), gn.getData().getNode());
} else { } else {
BranchLabelNode branchNode = new BranchLabelNode(childnode, "Case " + branchcounter); BranchLabelNode branchNode = new BranchLabelNode(childnode, "Case " + branchcounter);
...@@ -323,7 +324,7 @@ public class ScriptTreeGraph { ...@@ -323,7 +324,7 @@ public class ScriptTreeGraph {
if (mapping.get(childnode) != null) putIntoMapping(childnode, branchNode); if (mapping.get(childnode) != null) putIntoMapping(childnode, branchNode);
addPlaceholder(branchNode, childnode, true); addPlaceholder(branchNode, childnode);
branchcounter++; branchcounter++;
} }
...@@ -354,7 +355,7 @@ public class ScriptTreeGraph { ...@@ -354,7 +355,7 @@ public class ScriptTreeGraph {
replacePlaceholder(n, match); replacePlaceholder(n, match);
putIntoMapping(n, match); putIntoMapping(n, match);
addPlaceholder(match, n, false); addPlaceholder(match, n);
//front.remove(n); //front.remove(n);
return null; return null;
} }
...@@ -368,7 +369,7 @@ public class ScriptTreeGraph { ...@@ -368,7 +369,7 @@ public class ScriptTreeGraph {
Node n = nextintoptn.getStateBeforeStmt().getSelectedGoalNode().getData().getNode(); Node n = nextintoptn.getStateBeforeStmt().getSelectedGoalNode().getData().getNode();
replacePlaceholder(n, match); replacePlaceholder(n, match);
putIntoMapping(n, match); putIntoMapping(n, match);
addPlaceholder(match, n, false); addPlaceholder(match, n);
//front.remove(n); //front.remove(n);
return null; return null;
} }
...@@ -379,34 +380,31 @@ public class ScriptTreeGraph { ...@@ -379,34 +380,31 @@ public class ScriptTreeGraph {
if (goals.size() == 0) return null; if (goals.size() == 0) return null;
//TODO: sometime goals on different branches goals.forEach(k -> {
goals.forEach(k -> putIntoMapping(searchParentInMapping(k.getData().getNode()), new ForeachTreeNode(k.getData().getNode(), nextPtreeNode, nextPtreeNode.getStatement().getStartPosition().getLineNumber(),true))); ForeachTreeNode ftn = new ForeachTreeNode(
k.getData().getNode(),
// add to foreachNodes list nextPtreeNode,
List<GoalNode<KeyData>> goalsAfterForeach = new ArrayList<>(); nextPtreeNode.getStatement().getStartPosition().getLineNumber(),
assert nextPtreeNode.getStateAfterStmt() != null; true);
goalsAfterForeach.addAll(nextPtreeNode.getStateAfterStmt().getGoals());
/* List<GoalNode<KeyData>> aftergoals = replacePlaceholder(
(nextPtreeNode.getStateAfterStmt() != null) searchParentInMapping(k.getData().getNode()), ftn);
? nextPtreeNode.getStateAfterStmt().getGoals()
: addPlaceholder(ftn, k.getData().getNode());
(nextPtreeNode.getStepOver() != null && nextPtreeNode.getStepOver().getStateBeforeStmt() != null) ? nextPtreeNode.getStepOver().getStateBeforeStmt().getGoals() });
: new ArrayList<>();*/
// add to foreachNodes list -> so the end of a foreach can be catched
//aftergoals.forEach(k -> foreachNodes.put(k.getData().getNode(), nextPtreeNode)); List<GoalNode<KeyData>> aftergoals = (nextPtreeNode.getStateAfterStmt() != null)? nextPtreeNode.getStateAfterStmt().getGoals()
if(goalsAfterForeach.size() == 0){ : (nextPtreeNode.getStepOver() != null && nextPtreeNode.getStepOver().getStateBeforeStmt() != null) ? nextPtreeNode.getStepOver().getStateBeforeStmt().getGoals()
return null; : new ArrayList<>();
} aftergoals.forEach(k -> foreachNodes.put(k.getData().getNode(), nextPtreeNode));
//
for (GoalNode<KeyData> goalNode : goalsAfterForeach) {
foreachNodes.put(goalNode.getData().getNode(), nextPtreeNode);
}
return null; return null;
} }
} }
private void addPlaceholder(AbstractTreeNode parent, Node current, boolean isSplit) { private void addPlaceholder(AbstractTreeNode parent, Node current) {
PlaceholderNode phn = new PlaceholderNode(current); PlaceholderNode phn = new PlaceholderNode(current);
phn.setParent(parent); phn.setParent(parent);
...@@ -492,12 +490,14 @@ public class ScriptTreeGraph { ...@@ -492,12 +490,14 @@ public class ScriptTreeGraph {
private void checkIfForeachEnd(Node n) { private void checkIfForeachEnd(Node n) {
if(foreachNodes.containsKey(n)) { if(foreachNodes.containsKey(n)) {
PTreeNode ptn = foreachNodes.get(n); PTreeNode ptn = foreachNodes.get(n);
ForeachTreeNode ftn = new ForeachTreeNode(n, ptn, ptn.getStatement().getStartPosition().getLineNumber(), false); ForeachTreeNode ftn = new ForeachTreeNode(
addToSubChildren(nextPtreeNode.getStateBeforeStmt().getSelectedGoalNode().getData().getNode(), ftn); n,
ptn,
if(mapping.get(n) == null) { ptn.getStatement().getStartPosition().getLineNumber(),
putIntoMapping(n,ftn); false);
}
replacePlaceholder(nextPtreeNode.getStateBeforeStmt().getSelectedGoalNode().getData().getNode(), ftn);
addPlaceholder(ftn, n);
foreachNodes.remove(n); foreachNodes.remove(n);
......
...@@ -13,16 +13,12 @@ script full0(){ ...@@ -13,16 +13,12 @@ script full0(){
impRight; impRight;
impRight; impRight;
impLeft; impLeft;
cases { foreach{
case match `!q ==> p`: notLeft;
notLeft; }
foreach{
auto;
}
case match `q==>!p`:
notLeft;
}
} }
script full(){ script full(){
......
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