Commit e7c3af0d authored by LULUDBR\Lulu's avatar LULUDBR\Lulu

Merge remote-tracking branch 'origin/master'

parents b36a3c1f 93bd3ef3
...@@ -114,6 +114,7 @@ public class TransformAst implements ScriptLanguageVisitor<Object> { ...@@ -114,6 +114,7 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
s.setSignature(sig); s.setSignature(sig);
} }
s.setBody((Statements) ctx.body.accept(this)); s.setBody((Statements) ctx.body.accept(this));
s.getBody().setParent(s);
return s; return s;
} }
......
...@@ -98,13 +98,9 @@ public class MatcherFacadeTest { ...@@ -98,13 +98,9 @@ public class MatcherFacadeTest {
shouldMatch("1*j", "1 + ?Y", "[]"); shouldMatch("1*j", "1 + ?Y", "[]");
shouldMatch("1*j", "1 * ?Y", "[{?Y=j}]"); shouldMatch("1*j", "1 * ?Y", "[{?Y=j}]");
//does not match
shouldMatch("1*j", "?Y * 1", "[{?Y=j}]"); shouldMatch("1*j", "?Y * 1", "[{?Y=j}]");
//shouldMatch("f(a) ==> f(a), f(b)" , "==> f(?X)", [{?X=a}]);
//shouldMatch("f(a) ==> f(a), f(b)" , "f(a) ==> f(?X)", [{?X=a}]);
//shouldNotMatch("f(a) ==> f(a), f(b)" , "f(?X) ==> f(?X), f(a)");
} }
@Test @Test
......
package edu.kit.iti.formal.psdbg.interpreter; package edu.kit.iti.formal.psdbg.interpreter;
import de.uka.ilkd.key.api.ProofApi;
import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.logic.Name; import de.uka.ilkd.key.logic.Name;
import de.uka.ilkd.key.logic.Term; import de.uka.ilkd.key.logic.Term;
...@@ -163,10 +162,11 @@ public class KeYMatcher implements MatcherApi<KeyData> { ...@@ -163,10 +162,11 @@ public class KeYMatcher implements MatcherApi<KeyData> {
private Value<String> toValueTerm(KeyData currentState, Term matched) { private Value<String> toValueTerm(KeyData currentState, Term matched) {
String reprTerm = LogicPrinter.quickPrintTerm(matched, currentState.getEnv().getServices()); String reprTerm = LogicPrinter.quickPrintTerm(matched, currentState.getEnv().getServices());
//Hack: to avoid newlines
String reprTermReformatted = reprTerm.trim();
return new Value<>( return new Value<>(
new TermType(new SortType(matched.sort())), new TermType(new SortType(matched.sort())),
reprTerm reprTermReformatted
); );
} }
......
...@@ -4,7 +4,6 @@ import de.uka.ilkd.key.control.AbstractUserInterfaceControl; ...@@ -4,7 +4,6 @@ import de.uka.ilkd.key.control.AbstractUserInterfaceControl;
import de.uka.ilkd.key.control.DefaultUserInterfaceControl; import de.uka.ilkd.key.control.DefaultUserInterfaceControl;
import de.uka.ilkd.key.macros.scripts.EngineState; import de.uka.ilkd.key.macros.scripts.EngineState;
import de.uka.ilkd.key.macros.scripts.ProofScriptCommand; import de.uka.ilkd.key.macros.scripts.ProofScriptCommand;
import de.uka.ilkd.key.macros.scripts.meta.ProofScriptArgument;
import de.uka.ilkd.key.proof.Goal; import de.uka.ilkd.key.proof.Goal;
import de.uka.ilkd.key.proof.Node; import de.uka.ilkd.key.proof.Node;
import edu.kit.iti.formal.psdbg.interpreter.Interpreter; import edu.kit.iti.formal.psdbg.interpreter.Interpreter;
...@@ -15,10 +14,14 @@ import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment; ...@@ -15,10 +14,14 @@ import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
import edu.kit.iti.formal.psdbg.parser.ast.CallStatement; import edu.kit.iti.formal.psdbg.parser.ast.CallStatement;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.key_project.util.collection.ImmutableList; import org.key_project.util.collection.ImmutableList;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
...@@ -61,7 +64,11 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> { ...@@ -61,7 +64,11 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
GoalNode<KeyData> expandedNode = state.getSelectedGoalNode(); GoalNode<KeyData> expandedNode = state.getSelectedGoalNode();
KeyData kd = expandedNode.getData(); KeyData kd = expandedNode.getData();
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
params.asMap().forEach((k, v) -> map.put(k.getIdentifier(), v.getData().toString())); params.asMap().forEach((k, v) -> {
System.out.println("v.getData().toString() = " + v.getData().toString());
map.put(k.getIdentifier(), v.getData().toString());
}
);
try { try {
EngineState estate = new EngineState(kd.getProof()); EngineState estate = new EngineState(kd.getProof());
estate.setGoal(kd.getNode()); estate.setGoal(kd.getNode());
...@@ -100,6 +107,17 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> { ...@@ -100,6 +107,17 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
@Override @Override
public String getHelp(CallStatement call) { public String getHelp(CallStatement call) {
ProofScriptCommand c = commands.get(call.getCommand()); ProofScriptCommand c = commands.get(call.getCommand());
URL res = getClass().getResource("/commands/" + call.getCommand() + ".html");
try {
return IOUtils.toString(res.toURI(), "utf-8");
} catch (NullPointerException | IOException | URISyntaxException e) {
return "No Help found for " + call.getCommand();
}
/*
StringBuilder html = new StringBuilder(); StringBuilder html = new StringBuilder();
...@@ -150,5 +168,6 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> { ...@@ -150,5 +168,6 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
html.append("</body></html>"); html.append("</body></html>");
return html.toString(); return html.toString();
*/
} }
} }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
...@@ -161,10 +161,10 @@ public class Interpreter<T> extends DefaultASTVisitor<Object> ...@@ -161,10 +161,10 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
} }
private Value evaluate(GoalNode<T> g, Expression expr) { private Value evaluate(GoalNode<T> g, Expression expr) {
enterScope(expr); //enterScope(expr);
Evaluator<T> evaluator = new Evaluator<>(g.getAssignments(), g); Evaluator<T> evaluator = new Evaluator<>(g.getAssignments(), g);
evaluator.setMatcher(matcherApi); evaluator.setMatcher(matcherApi);
exitScope(expr); //exitScope(expr);
return evaluator.eval(expr); return evaluator.eval(expr);
} }
......
...@@ -134,7 +134,7 @@ public class DebuggerFramework<T> { ...@@ -134,7 +134,7 @@ public class DebuggerFramework<T> {
private void run() { private void run() {
try { try {
interpreter.interpret(mainScript); interpreter.interpret(mainScript);
//dummyproofnode ptreeManager.fireStatePointerChanged();
succeedListener.accept(this); succeedListener.accept(this);
} catch (Exception e) { } catch (Exception e) {
error = e; error = e;
......
...@@ -76,7 +76,7 @@ public class ProofTreeManager<T> { ...@@ -76,7 +76,7 @@ public class ProofTreeManager<T> {
int ctxLength = node.getContext().length; int ctxLength = node.getContext().length;
// We got a step deeper in the ASTNode stack. // We got a step deeper in the ASTNode stack.
// So we a caller // So we have a caller
if (getContextDepth() < ctxLength) { if (getContextDepth() < ctxLength) {
pushContext(); pushContext();
intoCurrentContext(node); intoCurrentContext(node);
......
package edu.kit.iti.formal.psdbg; package edu.kit.iti.formal.psdbg.interpreter.dbg;
import edu.kit.iti.formal.psdbg.interpreter.dbg.*;
public class StepIntoCommand<T> extends DebuggerCommand<T> { public class StepIntoCommand<T> extends DebuggerCommand<T> {
@Override @Override
public void execute(DebuggerFramework<T> dbg) { public void execute(DebuggerFramework<T> dbg) {
PTreeNode<T> statePointer = dbg.getStatePointer(); PTreeNode<T> statePointer = dbg.getStatePointer();
assert statePointer != null; assert statePointer != null;
if (statePointer.isAtomic()) { if (statePointer.isAtomic()) { // atomic same as step over
new StepOverCommand<T>().execute(dbg); new StepOverCommand<T>().execute(dbg);
} else { } else {
dbg.releaseUntil(new Blocker.CounterBlocker(1)); if (statePointer.getStepInto() != null) { // if there is already an step into take it!
dbg.setStatePointer(statePointer.getStepInto());
} else {
if (!statePointer.isLastNode()) { // execute non last commands, one step wide!
dbg.releaseUntil(new Blocker.CounterBlocker(1));
}
}
} }
} }
} }
package edu.kit.iti.formal.psdbg.interpreter.dbg; package edu.kit.iti.formal.psdbg.interpreter.dbg;
import lombok.val;
public class StepIntoReverseCommand<T> extends DebuggerCommand<T> { public class StepIntoReverseCommand<T> extends DebuggerCommand<T> {
@Override @Override
public void execute(DebuggerFramework<T> dbg) throws DebuggerException { public void execute(DebuggerFramework<T> dbg) throws DebuggerException {
val statePointer = dbg.getCurrentStatePointer(); PTreeNode<T> statePointer = dbg.getStatePointer();
PTreeNode<T> stepBack = statePointer.getStepInvInto() != null ? assert statePointer != null;
statePointer.getStepInvInto() :
statePointer.getStepInvOver();
if (stepBack == null) { if (statePointer.getStepInvInto() != null) {
info("There is no previous state to the current one."); dbg.setStatePointer(statePointer.getStepInvInto());
} else {
if (statePointer.getStepInvOver() != null) {
PTreeNode<T> statementBefore = statePointer.getStepInvOver();
dbg.setStatePointer(statementBefore);
} else{
dbg.setStatePointer(statePointer);
}
} }
dbg.setStatePointer(stepBack);
} }
} }
...@@ -114,7 +114,7 @@ public class ContractChooser extends Dialog<Contract> { ...@@ -114,7 +114,7 @@ public class ContractChooser extends Dialog<Contract> {
text.getChildren().add(contract); text.getChildren().add(contract);
text.getChildren().add(name); text.getChildren().add(name);
text.getChildren().add(new Text("\n")); text.getChildren().add(new Text("\n"));
//text.getChildren().add(tcontent); //text.getChildren().addCell(tcontent);
for (String line : content.split("\n")) { for (String line : content.split("\n")) {
if (line.contains(":")) { if (line.contains(":")) {
......
...@@ -77,7 +77,7 @@ public class Events { ...@@ -77,7 +77,7 @@ public class Events {
@RequiredArgsConstructor @RequiredArgsConstructor
/** /**
* Event that should be fired when a new goal node was created to inform view * Event that should be fired when a new goal node was created to inform view
* components s.t. they can update their view * components s.t. they can updateTarget their view
*/ */
public static class EventForNewGoalView { public static class EventForNewGoalView {
private final ASTNode correspodingASTNode; private final ASTNode correspodingASTNode;
......
...@@ -41,7 +41,7 @@ public class ASTNodeHiglightListener<T> { ...@@ -41,7 +41,7 @@ public class ASTNodeHiglightListener<T> {
if (currentInterpreter != null) deinstall(interpreter); if (currentInterpreter != null) deinstall(interpreter);
int i = interpreter.getEntryListeners().size(); int i = interpreter.getEntryListeners().size();
interpreter.getEntryListeners().add(0, list); interpreter.getEntryListeners().add(0, list);
// interpreter.getExitListeners().add(0, exitListener); // interpreter.getExitListeners().addCell(0, exitListener);
currentInterpreter = interpreter; currentInterpreter = interpreter;
} }
......
...@@ -143,7 +143,7 @@ public class InspectionView extends BorderPane { ...@@ -143,7 +143,7 @@ public class InspectionView extends BorderPane {
Mode.LIVING.name(), Mode.LIVING.name(),
Mode.POSTMORTEM.name() Mode.POSTMORTEM.name()
); );
getStyleClass().add(mode.get().name()); getStyleClass().addCell(mode.get().name());
}); });
*/ */
} }
......
...@@ -344,9 +344,9 @@ public class ProofTree extends BorderPane { ...@@ -344,9 +344,9 @@ public class ProofTree extends BorderPane {
/* if(!label.equals("Proof")) { /* if(!label.equals("Proof")) {
TreeItem<TreeNode> self = new TreeItem<>(new TreeNode(n.serialNr() + ": " + toString(n), n)); TreeItem<TreeNode> self = new TreeItem<>(new TreeNode(n.serialNr() + ": " + toString(n), n));
ti.getChildren().add(self); ti.getChildren().addCell(self);
}*/ }*/
// ti.getChildren().add(e); // ti.getChildren().addCell(e);
return ti; return ti;
...@@ -373,7 +373,7 @@ public class ProofTree extends BorderPane { ...@@ -373,7 +373,7 @@ public class ProofTree extends BorderPane {
TreeItem<TreeNode> populate = populate(childNode.getNodeInfo().getBranchLabel(), childNode); TreeItem<TreeNode> populate = populate(childNode.getNodeInfo().getBranchLabel(), childNode);
// TreeItem<TreeNode> self = new TreeItem<>(new TreeNode(childNode.serialNr() + ": " + toString(childNode), childNode)); // TreeItem<TreeNode> self = new TreeItem<>(new TreeNode(childNode.serialNr() + ": " + toString(childNode), childNode));
// populate.getChildren().add(0, self); // populate.getChildren().addCell(0, self);
ti.getChildren().add(populate); ti.getChildren().add(populate);
} else { } else {
...@@ -385,11 +385,11 @@ public class ProofTree extends BorderPane { ...@@ -385,11 +385,11 @@ public class ProofTree extends BorderPane {
} }
} }
/* node.childrenIterator().forEachRemaining(child -> ti.getChildren().add( /* node.childrenIterator().forEachRemaining(child -> ti.getChildren().addCell(
populate(child.getNodeInfo().getBranchLabel(), child))); populate(child.getNodeInfo().getBranchLabel(), child)));
*/ */
//node.children().forEach(child -> //node.children().forEach(child ->
// ti.getChildren().add(populate(child.getNodeInfo().getBranchLabel(), child))); // ti.getChildren().addCell(populate(child.getNodeInfo().getBranchLabel(), child)));
} }
return ti; return ti;
......
...@@ -337,13 +337,13 @@ public class ScriptArea extends BorderPane { ...@@ -337,13 +337,13 @@ public class ScriptArea extends BorderPane {
codeArea.setStyleSpans(0, codeArea.getStyleSpans(0, getExecutionMarkerPosition()).mapStyles(styleMapper)); codeArea.setStyleSpans(0, codeArea.getStyleSpans(0, getExecutionMarkerPosition()).mapStyles(styleMapper));
//this results in a NotSupportedOperation Exception because the add to an immutable list is not allowed //this results in a NotSupportedOperation Exception because the addCell to an immutable list is not allowed
/* getStyleSpans(0, getExecutionMarkerPosition()).forEach(span -> { /* getStyleSpans(0, getExecutionMarkerPosition()).forEach(span -> {
Collection<String> style = span.getStyle(); Collection<String> style = span.getStyle();
if (style.isEmpty()) { if (style.isEmpty()) {
setStyle(0, getExecutionMarkerPosition(), Collections.singleton("NON_EXE_AREA")); setStyle(0, getExecutionMarkerPosition(), Collections.singleton("NON_EXE_AREA"));
} else { } else {
style.add("NON_EXE_AREA"); style.addCell("NON_EXE_AREA");
} }
}); });
*/ */
......
...@@ -117,7 +117,7 @@ public class SequentMatcher extends BorderPane { ...@@ -117,7 +117,7 @@ public class SequentMatcher extends BorderPane {
services); services);
ObservableList<Map<String, MatchPath>> resultlist = FXCollections.observableArrayList(matchings); ObservableList<Map<String, MatchPath>> resultlist = FXCollections.observableArrayList(matchings);
//If no matchings found, add "No matchings found" //If no matchings found, addCell "No matchings found"
if (resultlist.isEmpty()) { if (resultlist.isEmpty()) {
matchingsView.setVisible(false); matchingsView.setVisible(false);
nomatchings.setVisible(true); nomatchings.setVisible(true);
......
...@@ -154,7 +154,7 @@ public class SequentView extends CodeArea { ...@@ -154,7 +154,7 @@ public class SequentView extends CodeArea {
insertText(0, backend.getString()); insertText(0, backend.getString());
if (node.get().isClosed()) { if (node.get().isClosed()) {
this.setBorder(new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT))); this.setBorder(new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
this.getStyleClass().add("closed-sequent-view"); // this.getStyleClass().add("closed-sequent-view");
} else { } else {
this.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT))); this.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
this.getStyleClass().remove("closed-sequent-view"); this.getStyleClass().remove("closed-sequent-view");
......
...@@ -257,7 +257,7 @@ public class TacletContextMenu extends ContextMenu { ...@@ -257,7 +257,7 @@ public class TacletContextMenu extends ContextMenu {
// Items for insertion of hidden terms appear in a submenu. // Items for insertion of hidden terms appear in a submenu.
/*if (insertHiddenController.isResponsible(item)) { /*if (insertHiddenController.isResponsible(item)) {
insertHiddenController.add(item); insertHiddenController.addCell(item);
} else */ } else */
{ {
// If one of the sets contains the rule it is considered rare // If one of the sets contains the rule it is considered rare
...@@ -415,10 +415,10 @@ public class TacletContextMenu extends ContextMenu { ...@@ -415,10 +415,10 @@ public class TacletContextMenu extends ContextMenu {
String inputText) { String inputText) {
TextInputDialog dialog = new TextInputDialog(inputText); TextInputDialog dialog = new TextInputDialog(inputText);
// Get the Stage and add KeY Icon. // Get the Stage and addCell KeY Icon.
/* Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); /* Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow();
stage.getIcons() stage.getIcons()
.add(new Image(NUIConstants.KEY_APPLICATION_WINDOW_ICON_PATH)); .addCell(new Image(NUIConstants.KEY_APPLICATION_WINDOW_ICON_PATH));
dialog.setTitle("Abbreviation Dialog"); dialog.setTitle("Abbreviation Dialog");
dialog.setHeaderText(header); dialog.setHeaderText(header);
dialog.setContentText(message); dialog.setContentText(message);
......
...@@ -261,8 +261,8 @@ public class Utils { ...@@ -261,8 +261,8 @@ public class Utils {
GridPane expContent = new GridPane(); GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE); expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0); expContent.addCell(label, 0, 0);
expContent.add(textArea, 0, 1); expContent.addCell(textArea, 0, 1);
alert.getDialogPane().setExpandableContent(expContent); alert.getDialogPane().setExpandableContent(expContent);
*/ */
......
package edu.kit.iti.formal.psdbg.gui.graph;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.input.DragEvent;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import java.util.Arrays;
@RequiredArgsConstructor
public class Cell<T> extends Pane {
@Getter
private final T cellId;
/**
* if true, this cell is handled by the layouter.
*/
@Getter
@Setter
private boolean invalid = true;
private Dragger dragger = new Dragger(this);
public Cell(T cellId, Node... children) {
super(children);
getStyleClass().add("graph-cell");
this.cellId = cellId;
}
public Cell(T cellId, String... children) {
getStyleClass().add("graph-cell");
this.cellId = cellId;
VBox hbox = new VBox();
hbox.getStyleClass().add("vbox");
getChildren().addAll(hbox);
Arrays.stream(children).forEachOrdered(s -> hbox.getChildren().add(new Label(s)));
}
}
class Dragger {
private double mouseX;
private double mouseY;
public Dragger(Node node) {
assert node != null;
node.setOnMousePressed(event -> {
mouseX = event.getSceneX();
mouseY = event.getSceneY();
});
node.setOnMouseDragged(event -> {
double deltaX = event.getSceneX() - mouseX;
double deltaY = event.getSceneY() - mouseY;
node.relocate(node.getLayoutX() + deltaX, node.getLayoutY() + deltaY);
mouseX = event.getSceneX();
mouseY = event.getSceneY();
});
}
}
package edu.kit.iti.formal.psdbg.gui.graph;
import javafx.scene.layout.Pane;
public class CellLayer extends Pane {
}
package edu.kit.iti.formal.psdbg.gui.graph;
import javafx.beans.Observable;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Point2D;