Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
2e63600e
Commit
2e63600e
authored
Aug 31, 2017
by
Sarah Grebing
Browse files
bug fix: now possible to evalute "case true:"
parent
1dcc2138
Changes
4
Hide whitespace changes
Inline
Side-by-side
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/Interpreter.java
View file @
2e63600e
...
...
@@ -191,6 +191,13 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
}
}
/**
* Old visit method, for deocumentation purposes
*
* @param casesStatement
* @return
*/
@Deprecated
public
Object
visitOld
(
CasesStatement
casesStatement
)
{
enterScope
(
casesStatement
);
State
<
T
>
beforeCases
=
peekState
();
...
...
@@ -259,6 +266,12 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
return
null
;
}
/**
* Computes which goals are handled by the different cases in the order the cases appear in the script
* @param allGoalsBeforeCases
* @param cases all cases as ordered list
* @return a mapping of each goal to the matched case body together with variableassignments from the matching process
*/
private
Map
<
GoalNode
,
Pair
<
VariableAssignment
,
Statements
>>
matchGoalsToCases
(
List
<
GoalNode
<
T
>>
allGoalsBeforeCases
,
CasesStatement
cases
)
{
//list of cases
List
<
CaseStatement
>
caseStmts
=
cases
.
getCases
();
...
...
@@ -288,20 +301,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
}
return
returnMap
;
//matchGoal(allGoalsBeforeCases, acase)
/*
* //for all remaining goals execute default
if (!toMatch.isEmpty()) {
VariableAssignment va = new VariableAssignment();
Statements defaultCase = casesStatement.getDefaultCase();
for (GoalNode<T> goal : toMatch) {
resultingGoals.addAll(executeBody(defaultCase, goal, va).getGoals());
}
}
*
* */
}
/**
...
...
@@ -325,6 +325,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
}
return
matchedGoals
;
}
else
{
//handle try and closes
throw
new
NotImplementedException
();
}
}
...
...
@@ -391,7 +392,6 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
*/
private
VariableAssignment
evaluateMatchInGoal
(
Expression
matchExpression
,
GoalNode
<
T
>
goal
)
{
enterScope
(
matchExpression
);
// System.out.println("Goal to match " + goal.toCellTextForKeYData());
MatchEvaluator
mEval
=
new
MatchEvaluator
(
goal
.
getAssignments
(),
goal
,
matcherApi
);
mEval
.
getEntryListeners
().
addAll
(
entryListeners
);
mEval
.
getExitListeners
().
addAll
(
exitListeners
);
...
...
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/MatchEvaluator.java
View file @
2e63600e
package
edu.kit.iti.formal.psdbg.interpreter
;
import
edu.kit.iti.formal.psdbg.interpreter.data.GoalNode
;
import
edu.kit.iti.formal.psdbg.parser.data.Value
;
import
edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment
;
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.TypeFacade
;
import
lombok.Getter
;
...
...
@@ -57,6 +57,11 @@ public class MatchEvaluator extends DefaultASTVisitor<List<VariableAssignment>>
return
evaluateExpression
(
op
,
left
,
right
);
}
@Override
public
List
<
VariableAssignment
>
visit
(
BooleanLiteral
booleanLiteral
)
{
return
transformTruthValue
(
Value
.
from
(
booleanLiteral
));
}
/**
* Decide whether to evaluate using the MatchEvaluator or the standard evaluator depending on the content of the expression
*
...
...
@@ -207,7 +212,7 @@ public class MatchEvaluator extends DefaultASTVisitor<List<VariableAssignment>>
if
(
v
.
getType
().
equals
(
SimpleType
.
BOOL
))
{
List
<
VariableAssignment
>
transformedValue
=
new
ArrayList
<>();
if
(
v
.
getData
().
equals
(
Value
.
TRUE
))
{
if
(
((
Boolean
)
v
.
getData
()).
booleanValue
()
==
((
Boolean
)
Value
.
TRUE
.
getData
()).
booleanValue
()
||
v
.
getData
().
equals
(
Value
.
TRUE
))
{
transformedValue
.
add
(
new
VariableAssignment
(
null
));
}
return
transformedValue
;
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/InspectionViewsController.java
View file @
2e63600e
...
...
@@ -8,7 +8,7 @@ import org.dockfx.DockNode;
/**
* This controller manages a list of {@link InspectionView} and the associated {@link DockNode}s.
*
* Espe
i
cally, this class holds the active tab, which is connected with the {@link edu.kit.iti.formal.psdbg.interpreter.graphs.ProofTreeController},
* Espec
i
ally, this class holds the active tab, which is connected with the {@link edu.kit.iti.formal.psdbg.interpreter.graphs.ProofTreeController},
* and shows the current interpreter state.
*
* @author weigl
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ProofTree.java
View file @
2e63600e
...
...
@@ -21,6 +21,9 @@ import javafx.util.StringConverter;
import
java.util.stream.Collectors
;
/**
* KeY Proof Tree
*/
public
class
ProofTree
extends
BorderPane
{
private
ObjectProperty
<
Proof
>
proof
=
new
SimpleObjectProperty
<>();
private
ObjectProperty
<
Node
>
root
=
new
SimpleObjectProperty
<>();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment