Commit 7e5e33d0 authored by Sarah Grebing's avatar Sarah Grebing

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/edu/kit/formal/psdb/gui/controller/DebuggerMain.java
#	src/main/java/edu/kit/formal/psdb/interpreter/graphs/ProofTreeController.java
parents 96b2b783 932ccd8b
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
</executions> </executions>
<configuration> <configuration>
<!-- The package of your generated sources --> <!-- The package of your generated sources -->
<packageName>edu.kit.formal.proofscriptparser.lint</packageName> <packageName>edu.kit.formal.psdb.lint</packageName>
</configuration> </configuration>
</plugin> </plugin>
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
<transformer <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass> <mainClass>
edu.kit.formal.gui.ProofScriptDebugger edu.kit.formal.psdb.gui.ProofScriptDebugger
</mainClass> </mainClass>
</transformer> </transformer>
</transformers> </transformers>
......
grammar MatchPattern;
/* Examples for testing
f(x)
f(x,y,g(y))
X
?Y
_
...
f(... ?X ...)
f(..., ?X)
f(..., ...?X...)
f(..., ... g(x) ...)
f(_, x, _, y, ... y ...)
*/
termPattern :
DONTCARE #dontCare
//| STARDONTCARE #starDontCare
| SID #schemaVar
| STARDONTCARE termPattern STARDONTCARE #anywhere
| func=ID ( '(' termPattern (',' termPattern)* ')')? #function
;
/*
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?;
ARROW : '⇒' | '==>';
DONTCARE: '?' | '_' | '█';
STARDONTCARE: '...' | '…';
DIGITS : DIGIT+ ;
fragment DIGIT : [0-9] ;
SID: '?' [_a-zA-Z0-9\\]+ ;
ID : [a-zA-Z\\_] ([_a-zA-Z0-9\\])* ;
COMMENT: '//' ~[\n\r]* -> channel(HIDDEN);
WS: [\n\f\r\t ] -> channel(HIDDEN);
\ No newline at end of file
grammar MatchPattern;
schemaTerm :
'_'
|'...'
| schemaVar
| logicalVar
| functionSymbol ('('schemaTerm (',' schemaTerm)? ')')?
;
termHelper :
schemaTerm
| functionSymbol '('termHelper (',' termHelper)? ')'
;
functionSymbol :
ID+
;
schemaVar:
'?'ID+
;
logicalVar:
ID+
;
DIGITS : DIGIT+ ;
fragment DIGIT : [0-9] ;
ID : [a-zA-Z] ([_a-zA-Z0-9] | '.' | '\\' | '[]' | '-')* ;
\ No newline at end of file
package edu.kit.formal.gui; package edu.kit.formal.psdb.gui;
/** /**
* Main Entry for Debugger GUI * Main Entry for Debugger GUI
...@@ -17,7 +17,6 @@ import org.apache.logging.log4j.LogManager; ...@@ -17,7 +17,6 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.dockfx.DockNode; import org.dockfx.DockNode;
import java.io.IOException;
import java.util.Locale; import java.util.Locale;
public class ProofScriptDebugger extends Application { public class ProofScriptDebugger extends Application {
...@@ -36,9 +35,9 @@ public class ProofScriptDebugger extends Application { ...@@ -36,9 +35,9 @@ public class ProofScriptDebugger extends Application {
Locale.setDefault(Locale.ENGLISH); Locale.setDefault(Locale.ENGLISH);
try { try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/DebuggerMain.fxml")); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/edu/kit/formal/psdb/gui/controller/DebuggerMain.fxml"));
Parent root = fxmlLoader.load(); Parent root = fxmlLoader.load();
//DebuggerMainWindowController controller = fxmlLoader.<DebuggerMainWindowController>getController(); //DebuggerMain controller = fxmlLoader.<DebuggerMain>getController();
Scene scene = new Scene(root); Scene scene = new Scene(root);
primaryStage.setOnCloseRequest(event -> Platform.exit()); primaryStage.setOnCloseRequest(event -> Platform.exit());
scene.getStylesheets().addAll( scene.getStylesheets().addAll(
...@@ -58,8 +57,9 @@ public class ProofScriptDebugger extends Application { ...@@ -58,8 +57,9 @@ public class ProofScriptDebugger extends Application {
//logger.error("sfklsajflksajfsdajfsdalfjsdaf", new IllegalAccessError("dlfsdalfjsadflj")); //logger.error("sfklsajflksajfsdajfsdalfjsdaf", new IllegalAccessError("dlfsdalfjsadflj"));
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
System.exit(1);
} }
} }
......
package edu.kit.formal.gui.controller; package edu.kit.formal.psdb.gui.controller;
import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.speclang.Contract; import de.uka.ilkd.key.speclang.Contract;
import javafx.beans.property.ObjectProperty; import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleListProperty; import javafx.beans.property.SimpleListProperty;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Modality; import javafx.stage.Modality;
import lombok.Getter; import lombok.Getter;
import java.awt.event.KeyEvent;
import java.util.List; import java.util.List;
/** /**
......
package edu.kit.formal.gui.controller; package edu.kit.formal.psdb.gui.controller;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import de.uka.ilkd.key.logic.PosInOccurrence; import de.uka.ilkd.key.logic.PosInOccurrence;
import de.uka.ilkd.key.rule.TacletApp; import de.uka.ilkd.key.rule.TacletApp;
import edu.kit.formal.gui.controls.ScriptArea; import edu.kit.formal.psdb.gui.controls.ScriptArea;
import edu.kit.formal.proofscriptparser.ast.CallStatement; import edu.kit.formal.psdb.parser.ast.CallStatement;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
package edu.kit.formal.gui.controller; package edu.kit.formal.psdb.gui.controller;
import edu.kit.formal.interpreter.HistoryListener; import edu.kit.formal.psdb.interpreter.HistoryListener;
import edu.kit.formal.interpreter.Interpreter; import edu.kit.formal.psdb.interpreter.Interpreter;
import edu.kit.formal.interpreter.data.GoalNode; import edu.kit.formal.psdb.interpreter.data.GoalNode;
import edu.kit.formal.interpreter.data.KeyData; import edu.kit.formal.psdb.interpreter.data.KeyData;
import edu.kit.formal.interpreter.data.State; import edu.kit.formal.psdb.interpreter.data.State;
import edu.kit.formal.proofscriptparser.DefaultASTVisitor; import edu.kit.formal.psdb.parser.DefaultASTVisitor;
import edu.kit.formal.proofscriptparser.Visitor; import edu.kit.formal.psdb.parser.Visitor;
import edu.kit.formal.proofscriptparser.ast.*; import edu.kit.formal.psdb.parser.ast.*;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
......
package edu.kit.formal.gui.controls; package edu.kit.formal.psdb.gui.controls;
import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.Token;
......
package edu.kit.formal.gui.controls; package edu.kit.formal.psdb.gui.controls;
import javafx.beans.property.BooleanProperty; import javafx.beans.property.BooleanProperty;
import javafx.beans.property.MapProperty; import javafx.beans.property.MapProperty;
......
package edu.kit.formal.gui.controls; package edu.kit.formal.psdb.gui.controls;
import com.sun.javafx.scene.control.skin.TabPaneSkin; import com.sun.javafx.scene.control.skin.TabPaneSkin;
import javafx.scene.Node; import javafx.scene.Node;
......
package edu.kit.formal.gui.controls; package edu.kit.formal.psdb.gui.controls;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; import edu.kit.formal.psdb.gui.controller.Events;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView; import edu.kit.formal.psdb.gui.model.MainScriptIdentifier;
import edu.kit.formal.gui.controller.Events; import javafx.beans.property.ObjectProperty;
import edu.kit.formal.gui.model.MainScriptIdentifier; import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.*;
import javafx.beans.value.ObservableStringValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.scene.control.*; import javafx.scene.control.Control;
import javafx.scene.input.MouseButton; import javafx.scene.control.Label;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.stage.Modality;
import org.apache.logging.log4j.Level;
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.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.appender.AbstractAppender;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.controlsfx.control.StatusBar; import org.controlsfx.control.StatusBar;
import java.util.Date;
import java.util.LinkedList;
/** /**
* Created by weigl on 09.06.2017. * Created on 09.06.2017
*
* @author Alexander Weigl
*/ */
public class DebuggerStatusBar extends StatusBar { public class DebuggerStatusBar extends StatusBar {
private static final Logger LOGGER = LogManager.getLogger(DebuggerStatusBar.class); private static final Logger LOGGER = LogManager.getLogger(DebuggerStatusBar.class);
private final Appender loggerHandler = createAppender(); //private final Dialog<Void> loggerDialog = createDialog();
private final ContextMenu contextMenu = createContextMenu(); //private final ContextMenu contextMenu = createContextMenu();
//private final Appender loggerHandler = createAppender();
//private LogCatchHandlerFX logCatchHandler = new LogCatchHandlerFX();
private ObjectProperty<MainScriptIdentifier> mainScriptIdentifier = new SimpleObjectProperty<>(); private ObjectProperty<MainScriptIdentifier> mainScriptIdentifier = new SimpleObjectProperty<>();
private Label lblCurrentNodes = new Label("#nodes: %s"); private Label lblCurrentNodes = new Label("#nodes: %s");
private Label lblMainscript = new Label(); private Label lblMainscript = new Label();
private ProgressIndicator progressIndicator = new ProgressIndicator(); private ProgressIndicator progressIndicator = new ProgressIndicator();
private LogCatchHandlerFX logCatchHandler = new LogCatchHandlerFX();
private final Dialog<Void> loggerDialog = createDialog();
private EventHandler<MouseEvent> toolTipHandler = event -> { private EventHandler<MouseEvent> toolTipHandler = event -> {
publishMessage(((Control) event.getTarget()).getTooltip().getText()); publishMessage(((Control) event.getTarget()).getTooltip().getText());
}; };
public DebuggerStatusBar() { public DebuggerStatusBar() {
listenOnField("psdbg"); //listenOnField("psdbg");
getRightItems().addAll( getRightItems().addAll(
lblMainscript, lblMainscript,
...@@ -53,11 +42,11 @@ public class DebuggerStatusBar extends StatusBar { ...@@ -53,11 +42,11 @@ public class DebuggerStatusBar extends StatusBar {
progressIndicator progressIndicator
); );
setOnMouseClicked(event -> { /*setOnMouseClicked(event -> {
if (event.getButton() == MouseButton.SECONDARY) { if (event.getButton() == MouseButton.SECONDARY) {
contextMenu.show(this, event.getScreenX(), event.getScreenY()); contextMenu.show(this, event.getScreenX(), event.getScreenY());
} }
}); });*/
mainScriptIdentifier.addListener((ov, o, n) -> { mainScriptIdentifier.addListener((ov, o, n) -> {
...@@ -84,9 +73,9 @@ public class DebuggerStatusBar extends StatusBar { ...@@ -84,9 +73,9 @@ public class DebuggerStatusBar extends StatusBar {
Events.fire(new Events.FocusScriptArea(area)); Events.fire(new Events.FocusScriptArea(area));
} }
}); });
} }
/*
private Appender createAppender() { private Appender createAppender() {
PatternLayout layout = PatternLayout.createDefaultLayout(); PatternLayout layout = PatternLayout.createDefaultLayout();
return new AbstractAppender("", null, layout) { return new AbstractAppender("", null, layout) {
...@@ -95,7 +84,7 @@ public class DebuggerStatusBar extends StatusBar { ...@@ -95,7 +84,7 @@ public class DebuggerStatusBar extends StatusBar {
publishMessage(event.getMessage().getFormattedMessage()); publishMessage(event.getMessage().getFormattedMessage());
} }
}; };
} }*/
public void publishMessage(String format, Object... args) { public void publishMessage(String format, Object... args) {
String msg = String.format(format, args); String msg = String.format(format, args);
...@@ -106,22 +95,24 @@ public class DebuggerStatusBar extends StatusBar { ...@@ -106,22 +95,24 @@ public class DebuggerStatusBar extends StatusBar {
return toolTipHandler; return toolTipHandler;
} }
/*
public void listenOnField(ObservableStringValue value) { public void listenOnField(ObservableStringValue value) {
value.addListener((observable, oldValue, newValue) -> { value.addListener((observable, oldValue, newValue) -> {
publishMessage(newValue); publishMessage(newValue);
}); });
} }*/
/*
public void listenOnField(Logger logger) { public void listenOnField(Logger logger) {
org.apache.logging.log4j.core.Logger plogger = ((org.apache.logging.log4j.core.Logger) logger); // Bypassing the public API org.apache.logging.log4j.core.Logger plogger = ((org.apache.logging.log4j.core.Logger) logger); // Bypassing the public API
plogger.addAppender(loggerHandler); plogger.addAppender(loggerHandler);
plogger.addAppender(logCatchHandler); plogger.addAppender(logCatchHandler);
logger.info("Listener added"); logger.info("Listener added");
} }*/
public void listenOnField(String loggerCategory) { /*public void listenOnField(String loggerCategory) {
listenOnField(LogManager.getLogger(loggerCategory)); listenOnField(LogManager.getLogger(loggerCategory));
} }*/
public void indicateProgress() { public void indicateProgress() {
progressIndicator.setProgress(-1); progressIndicator.setProgress(-1);
...@@ -131,14 +122,14 @@ public class DebuggerStatusBar extends StatusBar { ...@@ -131,14 +122,14 @@ public class DebuggerStatusBar extends StatusBar {
progressIndicator.setProgress(100); progressIndicator.setProgress(100);
} }
public ContextMenu createContextMenu() { /*public ContextMenu createContextMenu() {
ContextMenu cm = new ContextMenu(); ContextMenu cm = new ContextMenu();
Menu viewOptions = new Menu("View Options"); Menu viewOptions = new Menu("View Options");
MenuItem showLog = new MenuItem("Show Log", new MaterialDesignIconView(MaterialDesignIcon.FORMAT_LIST_BULLETED)); MenuItem showLog = new MenuItem("Show Log", new MaterialDesignIconView(MaterialDesignIcon.FORMAT_LIST_BULLETED));
showLog.setOnAction(this::showLog); showLog.setOnAction(this::showLog);
cm.getItems().addAll(viewOptions, showLog); cm.getItems().addAll(viewOptions, showLog);
return cm; return cm;
} }*/
public MainScriptIdentifier getMainScriptIdentifier() { public MainScriptIdentifier getMainScriptIdentifier() {
return mainScriptIdentifier.get(); return mainScriptIdentifier.get();
...@@ -151,12 +142,14 @@ public class DebuggerStatusBar extends StatusBar { ...@@ -151,12 +142,14 @@ public class DebuggerStatusBar extends StatusBar {
public ObjectProperty<MainScriptIdentifier> mainScriptIdentifierProperty() { public ObjectProperty<MainScriptIdentifier> mainScriptIdentifierProperty() {
return mainScriptIdentifier; return mainScriptIdentifier;
} }
}
/*
private void showLog(ActionEvent actionEvent) { private void showLog(ActionEvent actionEvent) {
loggerDialog.show(); loggerDialog.show();
} }*/
public Dialog<Void> createDialog() { /*public Dialog<Void> createDialog() {
final TableView<LogEvent> recordView = new TableView<>(logCatchHandler.recordsProperty()); final TableView<LogEvent> recordView = new TableView<>(logCatchHandler.recordsProperty());
recordView.setEditable(false); recordView.setEditable(false);
recordView.setSortPolicy(param -> false); recordView.setSortPolicy(param -> false);
...@@ -180,30 +173,21 @@ public class DebuggerStatusBar extends StatusBar { ...@@ -180,30 +173,21 @@ public class DebuggerStatusBar extends StatusBar {
messageColumn.setCellValueFactory( messageColumn.setCellValueFactory(
param -> { param -> {
return new SimpleStringProperty(param.getValue().getMessage().getFormattedMessage()); return new SimpleStringProperty(param.getValue().getMessage().getFormattedMessage());
/*String s = formatter.formatMessage(param.getValue()); }
if (param.getValue().getThrown() != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println();
param.getValue().getThrown().printStackTrace(pw);
pw.close();
s += "\n" + sw.toString();
}
return new SimpleStringProperty(s);*/
}
); );
Dialog<Void> dialog = new Dialog<>(); Dialog<Void> dialog=new Dialog<>();
dialog.setResizable(true); dialog.setResizable(true);
dialog.initModality(Modality.NONE); dialog.initModality(Modality.NONE);
dialog.setHeaderText("Logger Records"); dialog.setHeaderText("Logger Records");
DialogPane dpane = dialog.getDialogPane(); DialogPane dpane=dialog.getDialogPane();
dpane.setContent(new BorderPane(recordView)); dpane.setContent(new BorderPane(recordView));
dpane.getButtonTypes().setAll(ButtonType.CLOSE); dpane.getButtonTypes().setAll(ButtonType.CLOSE);
return dialog; return dialog;
} }*/
/*
public static class LogCatchHandlerFX extends AbstractAppender { public static class LogCatchHandlerFX extends AbstractAppender {
private ListProperty<LogEvent> records = new SimpleListProperty<>(FXCollections.observableList( private ListProperty<LogEvent> records = new SimpleListProperty<>(FXCollections.observableList(
new LinkedList<>() //remove of head new LinkedList<>() //remove of head
...@@ -243,6 +227,6 @@ public class DebuggerStatusBar extends StatusBar { ...@@ -243,6 +227,6 @@ public class DebuggerStatusBar extends StatusBar {
this.maxRecords = maxRecords; this.maxRecords = maxRecords;
} }
} }
} }*/
package edu.kit.formal.gui.controls; package edu.kit.formal.psdb.gui.controls;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import edu.kit.formal.interpreter.data.KeyData; import edu.kit.formal.psdb.interpreter.data.KeyData;
import javafx.beans.property.ObjectProperty; import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.fxml.FXML; import javafx.fxml.FXML;
......
package edu.kit.formal.gui.controls; package edu.kit.formal.psdb.gui.controls;
import edu.kit.formal.gui.model.InspectionModel; import edu.kit.formal.psdb.gui.model.InspectionModel;
import edu.kit.formal.interpreter.data.GoalNode; import edu.kit.formal.psdb.interpreter.data.GoalNode;
import edu.kit.formal.interpreter.data.KeyData; import edu.kit.formal.psdb.interpreter.data.KeyData;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
......
package edu.kit.formal.gui.controls; package edu.kit.formal.psdb.gui.controls;
import javafx.beans.property.SimpleMapProperty; import javafx.beans.property.SimpleMapProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
...@@ -8,7 +8,7 @@ import org.dockfx.DockNode; ...@@ -8,7 +8,7 @@ import org.dockfx.DockNode;
/** /**
* This controller manages a list of {@link InspectionView} and the associated {@link DockNode}s. * This controller manages a list of {@link InspectionView} and the associated {@link DockNode}s.
* *
* Espeically, this class holds the active tab, which is connected with the {@link edu.kit.formal.interpreter.graphs.ProofTreeController}, * Espeically, this class holds the active tab, which is connected with the {@link edu.kit.formal.psdb.interpreter.graphs.ProofTreeController},
* and shows the current interpreter state. * and shows the current interpreter state.
*