Commit 450ad8d1 authored by Sarah Grebing's avatar Sarah Grebing

Bugfix: matching expressions over state variables was not working; two minor...

Bugfix: matching expressions over state variables was not working; two minor issues fiexd because it did not compile
parent 5bd02453
Pipeline #15083 failed with stage
in 2 minutes and 7 seconds
......@@ -350,9 +350,9 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
CaseStatement cs = null;
if (ctx.TRY() != null) {
cs = new TryCase();
} else if (ctx.closesScript != null) {
} else if (ctx.closesGuard != null) {
cs = new ClosesCase();
Statements closes = (Statements) ctx.closesScript.accept(this);
Statements closes = (Statements) ctx.closesGuard.accept(this);
((ClosesCase) cs).setClosesGuard(closes);
closes.setParent(cs);
} else {
......
......@@ -11,6 +11,7 @@ import edu.kit.iti.formal.psdbg.parser.DefaultASTVisitor;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import edu.kit.iti.formal.psdbg.parser.ast.*;
import edu.kit.iti.formal.psdbg.parser.data.Value;
import edu.kit.iti.formal.psdbg.parser.types.SimpleType;
import edu.kit.iti.formal.psdbg.parser.types.Type;
import lombok.Getter;
import lombok.Setter;
......@@ -439,12 +440,25 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
*/
private VariableAssignment evaluateMatchInGoal(Expression matchExpression, GoalNode<T> goal) {
enterScope(matchExpression);
MatchEvaluator mEval = new MatchEvaluator(goal.getAssignments(), goal, matcherApi);
mEval.getEntryListeners().addAll(getEntryListeners());
mEval.getExitListeners().addAll(getExitListeners());
exitScope(matchExpression);
List<VariableAssignment> matchResult;
if (matchExpression.hasMatchExpression()) {
MatchEvaluator mEval = new MatchEvaluator(goal.getAssignments(), goal, matcherApi);
mEval.getEntryListeners().addAll(getEntryListeners());
mEval.getExitListeners().addAll(getExitListeners());
exitScope(matchExpression);
matchResult = mEval.eval(matchExpression);
} else {
List<VariableAssignment> matchResult = mEval.eval(matchExpression);
matchResult = new ArrayList<>();
Evaluator eval = new Evaluator(goal.getAssignments(), goal);
Value eval1 = eval.eval(matchExpression);
if (eval1.getType().equals(SimpleType.BOOL) && eval1.equals(Value.TRUE)) {
VariableAssignment emptyAssignment = new VariableAssignment(null);
matchResult.add(emptyAssignment);
}
exitScope(matchExpression);
}
if (matchResult.isEmpty()) {
return null;
} else {
......
......@@ -9,7 +9,6 @@ import javafx.scene.control.*;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Modality;
import lombok.Getter;
import java.util.List;
......@@ -25,7 +24,7 @@ import java.util.List;
* @author A. Weigl
*/
public class ContractChooser extends Dialog<Contract> {
@Getter
private final MultipleSelectionModel<Contract> selectionModel;
private final ObjectProperty<ObservableList<Contract>> items;
......
......@@ -130,8 +130,8 @@ public class SequentView extends CodeArea {
NamespaceSet nss = services.getNamespaces();
Sequent sequent = node.get().sequent();
filter = new IdentitySequentPrintFilter();
filter.setSequent(sequent);
filter = new IdentitySequentPrintFilter(sequent);
//filter.setSequent(sequent);
ProgramPrinter prgPrinter = new ProgramPrinter(new StringWriter());
this.backend = new LogicPrinter.PosTableStringBackend(80);
......
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