Commit 445f6a6d authored by Sarah Grebing's avatar Sarah Grebing

Bugfixes from friday: Leere Liste der offenen Ziele

parent 1e0289cf
Pipeline #17140 passed with stages
in 9 minutes and 8 seconds
......@@ -37,14 +37,13 @@ import lombok.*;
@Getter
@Setter
@NoArgsConstructor
@RequiredArgsConstructor
@AllArgsConstructor
public class CallStatement extends Statement<ScriptLanguageParser.ScriptCommandContext> {
/**
* The name of the command.
*/
@NonNull
private String command;
private String command = "";
/**
* The list of parameters.
......
......@@ -254,6 +254,9 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
newStateAfterCases = new State<T>(openGoalListAfterCases, null);
}
stateStack.push(newStateAfterCases);
} else {
stateStack.push(new State<>());
}
//stateStack.peek().getGoals().removeAll(beforeCases.getGoals());
......@@ -532,26 +535,29 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
@Override
public Object visit(CallStatement call) {
enterScope(call);
// System.out.println(stateStack.peek().hashCode());
//neuer VarScope
//enter new variable scope
VariableAssignment params = evaluateParameters(call.getParameters());
GoalNode<T> g = getSelectedNode();
g.enterScope();
try {
functionLookup.callCommand(this, call, params);
} catch (RuntimeException e) {
System.err.println("Call command not applicable");
throw e;
//TODO handling of error state for each visit
//State<T> newErrorState = newState(null, null);
//newErrorState.setErrorState(true);
//pushState(newErrorState);
} finally {
g.exitScope();
// System.out.println(stateStack.peek().hashCode());
exitScope(call);
if (!call.getCommand().isEmpty()) //real call, can handle pseudo calls!
{
// System.out.println(stateStack.peek().hashCode());
//neuer VarScope
//enter new variable scope
VariableAssignment params = evaluateParameters(call.getParameters());
GoalNode<T> g = getSelectedNode();
g.enterScope();
try {
functionLookup.callCommand(this, call, params);
} catch (RuntimeException e) {
System.err.println("Call command not applicable");
throw e;
//TODO handling of error state for each visit
//State<T> newErrorState = newState(null, null);
//newErrorState.setErrorState(true);
//pushState(newErrorState);
} finally {
g.exitScope();
// System.out.println(stateStack.peek().hashCode());
}
}
exitScope(call);
return null;
}
......
......@@ -49,6 +49,14 @@ public class State<T> {
setSelectedGoalNode(goal);
}
/**
* creates a state with no goals.
*/
public State() {
goals = new ArrayList<>();
setSelectedGoalNode(null);
}
public List<GoalNode<T>> getGoals() {
return goals;
......
......@@ -4,6 +4,7 @@ import com.google.common.graph.MutableValueGraph;
import edu.kit.iti.formal.psdbg.interpreter.Interpreter;
import edu.kit.iti.formal.psdbg.interpreter.graphs.ControlFlowNode;
import edu.kit.iti.formal.psdbg.interpreter.graphs.ControlFlowTypes;
import edu.kit.iti.formal.psdbg.parser.ast.CallStatement;
import edu.kit.iti.formal.psdbg.parser.ast.ProofScript;
import lombok.Getter;
import lombok.Setter;
......@@ -134,7 +135,8 @@ public class DebuggerFramework<T> {
private void run() {
try {
interpreter.interpret(mainScript);
ptreeManager.fireStatePointerChanged();
interpreter.visit(new CallStatement());
// ptreeManager.fireStatePointerChanged();
succeedListener.accept(this);
} catch (Exception e) {
error = e;
......
......@@ -13,7 +13,7 @@ script split_from_quicksort() {
cases{
case match `==> seqDef(_,_,_) = seqDef(_, _, _)`:
auto;
case match `==> (\exists ?X (\exists ?Y _))`: //this should match
case match `==> (\exists ?X (\exists ?Y _))`:
instantiate var=`?X`[?X \ X] with=`i_0`;
instantiate var=`?Y`[?Y \ Y] with=`j_0`;
auto;
......
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