Commit 050dee14 authored by Sarah Grebing's avatar Sarah Grebing

interim

parent 7e5e33d0
Pipeline #12924 failed with stage
in 1 minute and 36 seconds
......@@ -26,7 +26,7 @@ termPattern :
f(x), f(x,y,g(y)), X, ?Y, _, ..., f(... ?X ...), f(..., ?X), f(..., ...?X...), f(..., ... g(x) ...), f(_, x, _, y, ... y ...)
*/
semiSeqPattern : termPattern (',' termPattern)*;
sequentPattern : semiSeqPattern? ARROW semiSeqPattern?;
sequentPattern : antec=semiSeqPattern? ARROW succ=semiSeqPattern?;
ARROW : '⇒' | '==>';
DONTCARE: '?' | '_' | '█';
......
......@@ -7,6 +7,7 @@ import de.uka.ilkd.key.proof.init.ProofInputException;
import de.uka.ilkd.key.speclang.Contract;
import edu.kit.formal.psdb.gui.ProofScriptDebugger;
import edu.kit.formal.psdb.gui.controls.*;
import edu.kit.formal.psdb.gui.model.Breakpoint;
import edu.kit.formal.psdb.gui.model.InspectionModel;
import edu.kit.formal.psdb.interpreter.Interpreter;
import edu.kit.formal.psdb.interpreter.InterpreterBuilder;
......@@ -236,26 +237,56 @@ public class DebuggerMain implements Initializable {
}
public InspectionViewsController getInspectionViewsController() {
return inspectionViewsController;
}
public KeYProofFacade getFacade() {
return FACADE;
}
public InspectionViewsController getInspectionViewsController() {
return inspectionViewsController;
}
public void showCodeDock(ActionEvent actionEvent) {
if (!javaAreaDock.isDocked()) {
javaAreaDock.dock(dockStation, DockPos.RIGHT);
}
}
/* public InspectionViewsController getInspectionViewsController() {
return inspectionViewsController;
}
public KeYProofFacade getFacade() {
return FACADE;
}
public void showCodeDock(ActionEvent actionEvent) {
if (!javaAreaDock.isDocked()) {
javaAreaDock.dock(dockStation, DockPos.RIGHT);
}
}
*/
//region Actions: Execution
@FXML
public void executeToBreakpoint() {
}
//region Actions: Menu
/* @FXML
public void closeProgram() {
System.exit(0);
}*/
/* @FXML
public void openScript() {
File scriptFile = openFileChooserOpenDialog("Select Script File",
"Proof Script File", "kps");
if (scriptFile != null) {
openScript(scriptFile);
}
}*/
@FXML
public void executeScript() {
if (proofTreeController.isAlreadyExecuted()) {
......@@ -290,10 +321,40 @@ public class DebuggerMain implements Initializable {
}
}
/* private void saveScript(File scriptFile) {
try {
scriptController.saveCurrentScriptAs(scriptFile);
} catch (IOException e) {
Utils.showExceptionDialog("Could not save file", "Saving File Error", "Could not save to file " + scriptFile.getName(), e);
}
}
@FXML
public void saveAsScript() throws IOException {
File f = openFileChooserSaveDialog("Save script", "Save Script files", "kps");
if (f != null) {
/* if(!f.exists()){
f.createNewFile();
}
saveScript(f);
}
}*/
/* public void openScript(File scriptFile) {
assert scriptFile != null;
setInitialDirectory(scriptFile.getParentFile());
try {
String code = FileUtils.readFileToString(scriptFile, Charset.defaultCharset());
ScriptArea area = scriptController.createNewTab(scriptFile);
} catch (IOException e) {
Utils.showExceptionDialog("Exception occured", "",
"Could not load sourceName " + scriptFile, e);
}
}*/
public File getJavaFile() {
return javaFile.get();
}
//endregion
public void setJavaFile(File javaFile) {
this.javaFile.set(javaFile);
......@@ -358,69 +419,12 @@ public class DebuggerMain implements Initializable {
}
}
//region Actions: Menu
@FXML
public void closeProgram() {
System.exit(0);
}
@FXML
public void openScript() {
File scriptFile = openFileChooserOpenDialog("Select Script File",
"Proof Script File", "kps");
if (scriptFile != null) {
openScript(scriptFile);
/* @FXML
protected void loadKeYFile() {
File keyFile = openFileChooserOpenDialog("Select KeY File", "KeY Files", "key", "kps");
openKeyFile(keyFile);
}
}
@FXML
public void saveScript() {
try {
scriptController.saveCurrentScript();
} catch (IOException e) {
Utils.showExceptionDialog("Could not save file", "Saving File Error", "Could not save current script", e);
}
}
private void saveScript(File scriptFile) {
try {
scriptController.saveCurrentScriptAs(scriptFile);
} catch (IOException e) {
Utils.showExceptionDialog("Could not save file", "Saving File Error", "Could not save to file " + scriptFile.getName(), e);
}
}
@FXML
public void saveAsScript() throws IOException {
File f = openFileChooserSaveDialog("Save script", "Save Script files", "kps");
if (f != null) {
/* if(!f.exists()){
f.createNewFile();
}*/
saveScript(f);
}
}
public void openScript(File scriptFile) {
assert scriptFile != null;
setInitialDirectory(scriptFile.getParentFile());
try {
String code = FileUtils.readFileToString(scriptFile, Charset.defaultCharset());
ScriptArea area = scriptController.createNewTab(scriptFile);
} catch (IOException e) {
Utils.showExceptionDialog("Exception occured", "",
"Could not load sourceName " + scriptFile, e);
}
}
@FXML
protected void loadKeYFile() {
File keyFile = openFileChooserOpenDialog("Select KeY File", "KeY Files", "key", "kps");
openKeyFile(keyFile);
}
*/
public void openKeyFile(File keyFile) {
if (keyFile != null) {
setKeyFile(keyFile);
......@@ -429,7 +433,7 @@ public class DebuggerMain implements Initializable {
task.setOnSucceeded(event -> {
statusBar.publishMessage("Loaded key sourceName: %s", keyFile);
statusBar.stopProgress();
getInspectionViewsController().getActiveInspectionViewTab().getModel().getGoals().setAll(FACADE.getPseudoGoals());
// getInspectionViewsController().getActiveInspectionViewTab().getModel().getGoals().setAll(FACADE.getPseudoGoals());
});
task.setOnFailed(event -> {
......@@ -446,15 +450,47 @@ public class DebuggerMain implements Initializable {
}
}
public void openJavaFile(File javaFile) {
if (javaFile != null) {
setJavaFile(javaFile);
initialDirectory.set(javaFile.getParentFile());
contractLoaderService.start();
}
}
//endregion
//region Santa's Little Helper
public void setKeyFile(File keyFile) {
this.keyFile.set(keyFile);
}
@FXML
public void saveScript() {
try {
scriptController.saveCurrentScript();
} catch (IOException e) {
Utils.showExceptionDialog("Could not save file", "Saving File Error", "Could not save current script", e);
}
}
public void openJavaFile() {
loadJavaFile();
showCodeDock(null);
}
/**
* Save KeY proof as proof file
*
* @param actionEvent
* @param
*/
public void saveProof(ActionEvent actionEvent) {
/* public void saveProof(ActionEvent actionEvent) {
LOGGER.error("saveProof not implemented!!!");
}
}*/
//endregion
......@@ -467,17 +503,26 @@ public class DebuggerMain implements Initializable {
openJavaFile(javaFile);
}
public void openJavaFile(File javaFile) {
if (javaFile != null) {
setJavaFile(javaFile);
initialDirectory.set(javaFile.getParentFile());
contractLoaderService.start();
}
private File openFileChooserOpenDialog(String title, String description, String... fileEndings) {
FileChooser fileChooser = getFileChooser(title, description, fileEndings);
//File sourceName = fileChooser.showOpenDialog(inspectionViewsController.getInspectionViewTab().getGoalView().getScene().getWindow());
File file = fileChooser.showOpenDialog(statusBar.getScene().getWindow());
if (file != null) setInitialDirectory(file.getParentFile());
return file;
}
public void openJavaFile() {
loadJavaFile();
showCodeDock(null);
private FileChooser getFileChooser(String title, String description, String[] fileEndings) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(title);
fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(description, fileEndings));
if (initialDirectory.get() == null)
setInitialDirectory(new File("src/test/resources/edu/kit/formal/interpreter/contraposition/"));
if (!initialDirectory.get().exists())
setInitialDirectory(new File("."));
fileChooser.setInitialDirectory(initialDirectory.get());
return fileChooser;
}
@FXML
......@@ -514,18 +559,20 @@ public class DebuggerMain implements Initializable {
public void executeInDebugMode() {
executeScript(FACADE.buildInterpreter(), true);
}
//endregion
//region Santa's Little Helper
//region Actions: Menu
@FXML
public void closeProgram() {
System.exit(0);
}
/* public void openJavaFile() {
loadJavaFile();
showCodeDock(null);
}
*/
@FXML
public void openScript() {
File scriptFile = openFileChooserOpenDialog("Select Script File",
......@@ -535,14 +582,6 @@ public class DebuggerMain implements Initializable {
}
}
private File openFileChooserOpenDialog(String title, String description, String... fileEndings) {
FileChooser fileChooser = getFileChooser(title, description, fileEndings);
//File sourceName = fileChooser.showOpenDialog(inspectionViewsController.getInspectionViewTab().getGoalView().getScene().getWindow());
File file = fileChooser.showOpenDialog(statusBar.getScene().getWindow());
if (file != null) setInitialDirectory(file.getParentFile());
return file;
}
public void openScript(File scriptFile) {
assert scriptFile != null;
setInitialDirectory(scriptFile.getParentFile());
......@@ -555,30 +594,16 @@ public class DebuggerMain implements Initializable {
}
}
private FileChooser getFileChooser(String title, String description, String[] fileEndings) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(title);
fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(description, fileEndings));
if (initialDirectory.get() == null)
setInitialDirectory(new File("src/test/resources/edu/kit/formal/interpreter/contraposition/"));
if (!initialDirectory.get().exists())
setInitialDirectory(new File("."));
fileChooser.setInitialDirectory(initialDirectory.get());
return fileChooser;
}
@FXML
public void saveScript() {
try {
scriptController.saveCurrentScript();
} catch (IOException e) {
Utils.showExceptionDialog("Could not save file", "Saving File Error", "Could not save current script", e);
}
}
/* @FXML
public void saveScript() {
try {
scriptController.saveCurrentScript();
} catch (IOException e) {
Utils.showExceptionDialog("Could not save file", "Saving File Error", "Could not save current script", e);
}
}
*/
@FXML
public void saveAsScript() throws IOException {
File f = openFileChooserSaveDialog("Save script", "Save Script files", "kps");
......@@ -605,6 +630,7 @@ public class DebuggerMain implements Initializable {
if (file != null) setInitialDirectory(file.getParentFile());
return file;
}
//endregion
private void saveScript(File scriptFile) {
try {
......@@ -619,7 +645,6 @@ public class DebuggerMain implements Initializable {
File keyFile = openFileChooserOpenDialog("Select KeY File", "KeY Files", "key", "kps");
openKeyFile(keyFile);
}
//endregion
/**
* Save KeY proof as proof file
......@@ -631,37 +656,30 @@ public class DebuggerMain implements Initializable {
LOGGER.error("saveProof not implemented!!!");
}
public void openJavaFile() {
loadJavaFile();
showCodeDock(null);
}
@FXML
protected void loadJavaFile() {
File javaFile = openFileChooserOpenDialog("Select Java File", "Java Files", "java");
openJavaFile(javaFile);
}
/**
* Perform a step over
*
* @param actionEvent
*/
public void stepOver(ActionEvent actionEvent) {
LOGGER.debug("DebuggerMain.stepOver");
PTreeNode newState = proofTreeController.stepOver();
}
/**
* Perform a step back
*
* @param actionEvent
*/
public void stepBack(ActionEvent actionEvent) {
LOGGER.debug("DebuggerMain.stepBack");
PTreeNode newState = proofTreeController.stepBack();
}
public KeYProofFacade getFacade() {
return FACADE;
}
//region Property
public boolean isDebugMode() {
return debugMode.get();
}
//endregion
public void setDebugMode(boolean debugMode) {
this.debugMode.set(debugMode);
......@@ -691,12 +709,6 @@ public class DebuggerMain implements Initializable {
scriptController.newScript();
}
public void showCodeDock(ActionEvent actionEvent) {
if (!javaAreaDock.isDocked()) {
javaAreaDock.dock(dockStation, DockPos.RIGHT);
}
}
public void showWelcomeDock(ActionEvent actionEvent) {
if (!welcomePaneDock.isDocked()) {
welcomePaneDock.dock(dockStation, DockPos.CENTER);
......@@ -749,10 +761,6 @@ public class DebuggerMain implements Initializable {
return proofTreeController;
}
public InspectionViewsController getInspectionViewsController() {
return inspectionViewsController;
}
public ExecutorService getExecutorService() {
return executorService;
}
......@@ -777,26 +785,10 @@ public class DebuggerMain implements Initializable {
return welcomePane;
}
public File getJavaFile() {
return javaFile.get();
}
public void setJavaFile(File javaFile) {
this.javaFile.set(javaFile);
}
public ObjectProperty<File> javaFileProperty() {
return javaFile;
}
public File getKeyFile() {
return keyFile.get();
}
public void setKeyFile(File keyFile) {
this.keyFile.set(keyFile);
}
public ObjectProperty<File> keyFileProperty() {
return keyFile;
}
......@@ -842,6 +834,16 @@ public class DebuggerMain implements Initializable {
}
});
}
@Override
protected void failed() {
Utils.showExceptionDialog("", "", "", exceptionProperty().get());
}
@Override
protected Task<List<Contract>> createTask() {
return FACADE.getContractsForJavaFileTask(getJavaFile());
}
}
//endregion
......
......@@ -93,11 +93,22 @@ public class ProofTree extends BorderPane {
init();
}
private void init() {
if (root.get() != null)
treeProof.setRoot(new TreeItemNode(root.get()));
treeProof.refresh();
}
private TreeCell<Node> cellFactory(TreeView<Node> nodeTreeView) {
TextFieldTreeCell<Node> tftc = new TextFieldTreeCell<>();
tftc.setConverter(new StringConverter<Node>() {
@Override
public String toString(Node object) {
/* if (object.getAppliedRuleApp() != null) {
return object.getAppliedRuleApp().rule().displayName();
} else {
return object.name();
}*/
return object.sequent().toString();
}
......@@ -124,12 +135,6 @@ public class ProofTree extends BorderPane {
}
}
private void init() {
if (root.get() != null)
treeProof.setRoot(new TreeItemNode(root.get()));
treeProof.refresh();
}
public Object getColorOfNodes() {
return colorOfNodes.get();
}
......@@ -172,6 +177,11 @@ class TreeItemNode extends TreeItem<Node> {
super(value);
}
@Override
public boolean isLeaf() {
return getValue().leaf();
}
@Override
public ObservableList<TreeItem<Node>> getChildren() {
if (super.getChildren().size() != getValue().children().size())
......@@ -179,9 +189,4 @@ class TreeItemNode extends TreeItem<Node> {
getValue().children().stream().map(TreeItemNode::new).collect(Collectors.toList()));
return super.getChildren();
}
@Override
public boolean isLeaf() {
return getValue().leaf();
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import javafx.scene.layout.AnchorPane;
import java.io.File;
/**
* Welcome pane that allows for a more usable entry point
* Created by weigl on 7/7/17.
*/
public class WelcomePane extends AnchorPane {
......@@ -21,11 +22,11 @@ public class WelcomePane extends AnchorPane {
proofScriptDebugger.getWelcomePaneDock().close();
proofScriptDebugger.showActiveInspector(null);
proofScriptDebugger.openScript(
new File("src/test/resources/edu/kit/formal/interpreter/contraposition/w_branching.kps")
new File("src/test/resources/edu/kit/formal/psdb/interpreter/contraposition/w_branching.kps")
);
proofScriptDebugger.openKeyFile(
new File("src/test/resources/edu/kit/formal/interpreter/contraposition/contraposition.key"));
new File("src/test/resources/edu/kit/formal/psdb/interpreter/contraposition/contraposition.key"));
}
......@@ -33,10 +34,10 @@ public class WelcomePane extends AnchorPane {
proofScriptDebugger.getWelcomePaneDock().close();
proofScriptDebugger.showActiveInspector(null);
proofScriptDebugger.openScript(
new File("src/test/resources/edu/kit/formal/interpreter/javaExample/test.kps")
new File("src/test/resources/edu/kit/formal/psdb/interpreter/javaExample/test.kps")
);
proofScriptDebugger.openJavaFile(
new File("src/test/resources/edu/kit/formal/interpreter/javaExample/Test.java"));
new File("src/test/resources/edu/kit/formal/psdb/interpreter/javaExample/Test.java"));
}
public void loadHelpPage(ActionEvent event) {
......@@ -54,5 +55,20 @@ public class WelcomePane extends AnchorPane {
proofScriptDebugger.openScript();
}
public void loadNewScript(ActionEvent event) {
proofScriptDebugger.getWelcomePaneDock().close();
proofScriptDebugger.showActiveInspector(null);
proofScriptDebugger.getScriptController().newScript();
}
public void openScript(ActionEvent event) {
proofScriptDebugger.getWelcomePaneDock().close();
proofScriptDebugger.showActiveInspector(null);
proofScriptDebugger.openScript();
}
}
......@@ -51,10 +51,6 @@ public class PTreeNode {
this.scriptstmt = scriptstmt;
}
public boolean hasState() {
return state != null;
}
public LinkedList<ASTNode> getContext() {
return context;
}
......@@ -80,5 +76,11 @@ public class PTreeNode {
return sb.toString();
}
public boolean hasState() {
return state != null;
}
}
package edu.kit.formal.psdb.interpreter.graphs;
import com.google.common.eventbus.Subscribe;
import com.google.common.graph.MutableValueGraph;
import edu.kit.formal.psdb.gui.controller.Events;
import edu.kit.formal.psdb.gui.controller.PuppetMaster;
import edu.kit.formal.psdb.gui.controls.DebuggerStatusBar;
import edu.kit.formal.psdb.gui.model.Breakpoint;
import edu.kit.formal.psdb.interpreter.Interpreter;
import edu.kit.formal.psdb.interpreter.InterpretingService;
import edu.kit.formal.psdb.interpreter.data.GoalNode;
......@@ -155,6 +157,18 @@ public class ProofTreeController {
//TODO handle endpoint
private static boolean compareCtrlFlowNodes(ControlFlowNode newNode, ControlFlowNode oldNode) {
return newNode.getScriptstmt().getNodeName().equals(oldNode.getScriptstmt().getNodeName());
}
//TODO handle endpoint of graph
private static boolean comparePTreeNodes(PTreeNode newTreeNode, PTreeNode oldTreeNode) {
return false;
}
/**
* StepOver and return the node to which the state pointer is pointing to
*
......@@ -186,8 +200,6 @@ public class ProofTreeController {
return statePointer;
}
//TODO handle endpoint of graph
/**
* Step Back one Node in the stategraph
*
......@@ -312,17 +324,6 @@ public class ProofTreeController {
MutableValueGraph ctrlFlow = controlFlowGraphVisitor.getGraph();
}
private boolean compareCtrlFlowNodes(ControlFlowNode newNode, ControlFlowNode oldNode) {
return newNode.getScriptstmt().getNodeName().equals(oldNode.getScriptstmt().getNodeName());
}
private boolean comparePTreeNodes(PTreeNode newTreeNode, PTreeNode oldTreeNode) {
return false;
}
/**************************************************************************************************************
*
* Getter and Setter
......
package edu.kit.formal.psdb.termmatcher;
import de.uka.ilkd.key.logic.Semisequent;
import de.uka.ilkd.key.logic.Sequent;