Commit c7ec5de9 authored by Alexander Weigl's avatar Alexander Weigl

Merge remote-tracking branch 'origin/extendedState' into weigl-sync

# Conflicts:
#	rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/graphs/ControlFlowVisitor.java
#	rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/graphs/PTreeNode.java
#	rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/graphs/StateGraphWrapper.java
#	ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/ProofTreeController.java
parents bc93a6d2 704840d3
......@@ -25,6 +25,7 @@ package edu.kit.iti.formal.psdbg.parser.ast;
import edu.kit.iti.formal.psdbg.parser.Visitable;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.antlr.v4.runtime.ParserRuleContext;
......@@ -35,6 +36,7 @@ import javax.annotation.Nullable;
* @author Alexander Weigl
* @version 1 (27.04.17)
*/
@EqualsAndHashCode
public abstract class ASTNode<T extends ParserRuleContext>
implements Visitable, Copyable<ASTNode<T>> {
/**
......
......@@ -36,11 +36,13 @@ import lombok.*;
* @author Alexander Weigl
* @version 1 (28.04.17)
*/
@Data
@ToString(includeFieldNames = true)
@NoArgsConstructor
@RequiredArgsConstructor()
@AllArgsConstructor
@Getter
@Setter
public class AssignmentStatement
extends Statement<ScriptLanguageParser.AssignmentContext> {
@NonNull
......
......@@ -34,7 +34,8 @@ import lombok.*;
* @author Alexander Weigl
* @version 1 (28.04.17)
*/
@Data
@Getter
@Setter
@NoArgsConstructor
@RequiredArgsConstructor
@AllArgsConstructor
......
......@@ -23,19 +23,20 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
/**
* @author Alexander Weigl
* @version 1 (28.04.17)
*/
@Data
@NoArgsConstructor
@Getter
@Setter
@RequiredArgsConstructor
@AllArgsConstructor
public class CaseStatement extends Statement<ScriptLanguageParser.CasesListContext> {
public boolean isClosedStmt;
......
......@@ -23,11 +23,12 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
......@@ -36,7 +37,9 @@ import java.util.List;
* @author Alexander Weigl
* @version 1 (28.04.17)
*/
@Data
@Setter
@Getter
@RequiredArgsConstructor
public class CasesStatement extends Statement<ScriptLanguageParser.CasesStmtContext> {
@NonNull private final List<CaseStatement> cases = new ArrayList<>();
// @NonNull private Statements defaultCase = new Statements();
......
......@@ -2,9 +2,11 @@ package edu.kit.iti.formal.psdbg.parser.ast;
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data
@Getter
@Setter
public class DefaultCaseStatement extends Statement<ScriptLanguageParser.StmtListContext> {
protected Statements body;
......
......@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* @author Alexander Weigl
* @version 1 (29.04.17)
*/
@Data
@Getter
@Setter
public class ForeachStatement extends GoalSelector<ScriptLanguageParser.ForEachStmtContext> {
public ForeachStatement() {
}
......
......@@ -31,7 +31,13 @@ import org.antlr.v4.runtime.ParserRuleContext;
* @author Alexander Weigl
* @version 1 (29.04.17)
*/
@Data @AllArgsConstructor @NoArgsConstructor public abstract class GoalSelector<T extends ParserRuleContext>
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public abstract class GoalSelector<T extends ParserRuleContext>
extends Statement<T> {
@Getter
@Setter
@NonNull private Statements body = new Statements();
}
......@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* @author Alexander Weigl
* @version 1 (29.04.17)
*/
@Data
@Getter
@Setter
public class RepeatStatement extends GoalSelector<ScriptLanguageParser.RepeatStmtContext> {
public RepeatStatement() {
}
......
......@@ -23,11 +23,9 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitable;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.*;
......@@ -40,7 +38,6 @@ import java.util.stream.Stream;
* @author Alexander Weigl
* @version 1 (27.04.17)
*/
@EqualsAndHashCode
@ToString
public class Statements extends ASTNode<ScriptLanguageParser.StmtListContext>
implements Visitable, Iterable<Statement> {
......@@ -182,4 +179,5 @@ public class Statements extends ASTNode<ScriptLanguageParser.StmtListContext>
s.setRuleContext(this.getRuleContext());
return s;
}
}
......@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* @author Alexander Weigl
* @version 1 (29.04.17)
*/
@Data
@Getter
@Setter
public class TheOnlyStatement extends GoalSelector<ScriptLanguageParser.TheOnlyStmtContext> {
public TheOnlyStatement() {
}
......
package edu.kit.iti.formal.psdbg.interpreter.graphs;
import edu.kit.iti.formal.psdbg.interpreter.data.InterpreterExtendedState;
import edu.kit.iti.formal.psdbg.interpreter.data.State;
import edu.kit.iti.formal.psdbg.parser.ast.ASTNode;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.util.Stack;
/**
* Inner class representing nodes in the stategraph graph
* A node contains a reference to the ASTNode and a reference to the corresponding interpreter state if this state is already interpreted, null otherwise.
*/
@Data
public class PTreeNode<T> {
/**
* State after statement
*/
//private State<T> state;
private InterpreterExtendedState<T> extendedState = new InterpreterExtendedState<>(null);
/**
* Statement
*/
private ASTNode scriptStmt;
/**
* Call context
*/
@Getter
@Setter
private Stack<ASTNode> context = new Stack<>();
private boolean root;
PTreeNode(ASTNode node) {
this.setScriptStmt(node);
}
public void setExtendedState(InterpreterExtendedState<T> extendedState) {
this.extendedState = extendedState;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Node {");
if (scriptStmt != null) {
sb.append(scriptStmt.getNodeName() + "\n");
} else {
sb.append("Root Node");
}
/* if (hasState()) {
sb.append("\nState " + state.getGoals() + "\n");
} else {
sb.append("No State yet");
}*/
if (extendedState != null) {
sb.append(extendedStateToString());
} else {
sb.append("No extended State yet");
}
sb.append("}");
return sb.toString();
}
public String extendedStateToString() {
return this.extendedState.toString();
}
}
......@@ -119,7 +119,7 @@ public class SequentView extends CodeArea {
NamespaceSet nss = services.getNamespaces();
Sequent sequent = node.get().sequent();
filter = new IdentitySequentPrintFilter();
filter = new IdentitySequentPrintFilter(sequent);
ProgramPrinter prgPrinter = new ProgramPrinter(new StringWriter());
this.backend = new LogicPrinter.PosTableStringBackend(80);
......
......@@ -7,10 +7,15 @@ cases{
case match `q==>`:
impRight;
notRight;
case match `==>`:
impRight;
notRight;
close;
}
auto;
}
......@@ -31,7 +36,7 @@ cases{
impRight;
}
}
script test2(){
impRight;
......
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