Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
sarah.grebing
ProofScriptParser
Commits
e9617e80
Commit
e9617e80
authored
Nov 10, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix that removed/expanded nodes were still in state due to selectedGoalNode field
parent
b3b1128d
Pipeline
#15275
passed with stages
in 10 minutes and 44 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
12 deletions
+44
-12
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/KeyInterpreter.java
.../edu/kit/iti/formal/psdbg/interpreter/KeyInterpreter.java
+1
-2
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/funchdl/MacroCommandHandler.java
...formal/psdbg/interpreter/funchdl/MacroCommandHandler.java
+11
-1
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/funchdl/ProofScriptCommandBuilder.java
.../psdbg/interpreter/funchdl/ProofScriptCommandBuilder.java
+10
-3
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/funchdl/RuleCommandHandler.java
.../formal/psdbg/interpreter/funchdl/RuleCommandHandler.java
+3
-0
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/Interpreter.java
...ava/edu/kit/iti/formal/psdbg/interpreter/Interpreter.java
+10
-1
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/data/State.java
...java/edu/kit/iti/formal/psdbg/interpreter/data/State.java
+8
-4
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/ProofScriptDebugger.java
...ava/edu/kit/iti/formal/psdbg/gui/ProofScriptDebugger.java
+1
-1
No files found.
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/KeyInterpreter.java
View file @
e9617e80
...
@@ -2,7 +2,6 @@ package edu.kit.iti.formal.psdbg.interpreter;
...
@@ -2,7 +2,6 @@ package edu.kit.iti.formal.psdbg.interpreter;
import
com.google.common.collect.BiMap
;
import
com.google.common.collect.BiMap
;
import
com.google.common.collect.ImmutableBiMap
;
import
com.google.common.collect.ImmutableBiMap
;
import
de.uka.ilkd.key.api.ScriptApi
;
import
de.uka.ilkd.key.api.VariableAssignments
;
import
de.uka.ilkd.key.api.VariableAssignments
;
import
de.uka.ilkd.key.proof.Node
;
import
de.uka.ilkd.key.proof.Node
;
import
de.uka.ilkd.key.proof.Proof
;
import
de.uka.ilkd.key.proof.Proof
;
...
@@ -66,7 +65,7 @@ public class KeyInterpreter extends Interpreter<KeyData> {
...
@@ -66,7 +65,7 @@ public class KeyInterpreter extends Interpreter<KeyData> {
}
}
}
}
//prune proof
//prune proof
logger
.debug("The closes script " + (allClosed ? "closed the proof.\n" : "did not close the proof.\n") + "Rolling Back proof now.");
LOGGER
.debug("The closes script " + (allClosed ? "closed the proof.\n" : "did not close the proof.\n") + "Rolling Back proof now.");
Proof currentKeYproof = selectedGoalNode.getData().getProof();
Proof currentKeYproof = selectedGoalNode.getData().getProof();
ImmutableList<Goal> subtreeGoals = currentKeYproof.getSubtreeGoals(((KeyData) selectedGoalNode.getData()).getNode());
ImmutableList<Goal> subtreeGoals = currentKeYproof.getSubtreeGoals(((KeyData) selectedGoalNode.getData()).getNode());
currentKeYproof.pruneProof(selectedGoalCopy.getData().getNode());
currentKeYproof.pruneProof(selectedGoalCopy.getData().getNode());
...
...
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/funchdl/MacroCommandHandler.java
View file @
e9617e80
...
@@ -15,6 +15,8 @@ import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
...
@@ -15,6 +15,8 @@ import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
import
edu.kit.iti.formal.psdbg.parser.ast.CallStatement
;
import
edu.kit.iti.formal.psdbg.parser.ast.CallStatement
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.key_project.util.collection.ImmutableList
;
import
org.key_project.util.collection.ImmutableList
;
import
java.util.Collection
;
import
java.util.Collection
;
...
@@ -28,6 +30,8 @@ import java.util.Map;
...
@@ -28,6 +30,8 @@ import java.util.Map;
*/
*/
@RequiredArgsConstructor
@RequiredArgsConstructor
public
class
MacroCommandHandler
implements
CommandHandler
<
KeyData
>
{
public
class
MacroCommandHandler
implements
CommandHandler
<
KeyData
>
{
protected
static
Logger
LOGGER
=
LogManager
.
getLogger
(
MacroCommandHandler
.
class
);
@Getter
@Getter
private
final
Map
<
String
,
ProofMacro
>
macros
;
private
final
Map
<
String
,
ProofMacro
>
macros
;
...
@@ -57,6 +61,7 @@ public class MacroCommandHandler implements CommandHandler<KeyData> {
...
@@ -57,6 +61,7 @@ public class MacroCommandHandler implements CommandHandler<KeyData> {
State
<
KeyData
>
state
=
interpreter
.
getCurrentState
();
State
<
KeyData
>
state
=
interpreter
.
getCurrentState
();
GoalNode
<
KeyData
>
expandedNode
=
state
.
getSelectedGoalNode
();
GoalNode
<
KeyData
>
expandedNode
=
state
.
getSelectedGoalNode
();
assert
state
.
getGoals
().
contains
(
expandedNode
);
try
{
try
{
...
@@ -67,6 +72,8 @@ public class MacroCommandHandler implements CommandHandler<KeyData> {
...
@@ -67,6 +72,8 @@ public class MacroCommandHandler implements CommandHandler<KeyData> {
ImmutableList
<
Goal
>
ngoals
=
expandedNode
.
getData
().
getProof
().
getSubtreeGoals
(
expandedNode
.
getData
().
getNode
());
ImmutableList
<
Goal
>
ngoals
=
expandedNode
.
getData
().
getProof
().
getSubtreeGoals
(
expandedNode
.
getData
().
getNode
());
state
.
getGoals
().
remove
(
expandedNode
);
state
.
getGoals
().
remove
(
expandedNode
);
state
.
setSelectedGoalNode
(
null
);
if
(
ngoals
.
isEmpty
())
{
if
(
ngoals
.
isEmpty
())
{
Node
start
=
expandedNode
.
getData
().
getNode
();
Node
start
=
expandedNode
.
getData
().
getNode
();
//start.leavesIterator()
//start.leavesIterator()
...
@@ -74,7 +81,7 @@ public class MacroCommandHandler implements CommandHandler<KeyData> {
...
@@ -74,7 +81,7 @@ public class MacroCommandHandler implements CommandHandler<KeyData> {
Iterator
<
Node
>
nodeIterator
=
start
.
leavesIterator
();
Iterator
<
Node
>
nodeIterator
=
start
.
leavesIterator
();
while
(
nodeIterator
.
hasNext
())
{
while
(
nodeIterator
.
hasNext
())
{
Node
n
=
nodeIterator
.
next
();
Node
n
=
nodeIterator
.
next
();
System
.
out
.
println
(
n
.
isClosed
());
LOGGER
.
error
(
n
.
isClosed
());
}
}
}
else
{
}
else
{
...
@@ -83,6 +90,9 @@ public class MacroCommandHandler implements CommandHandler<KeyData> {
...
@@ -83,6 +90,9 @@ public class MacroCommandHandler implements CommandHandler<KeyData> {
KeyData
kdn
=
new
KeyData
(
expandedNode
.
getData
(),
g
.
node
());
KeyData
kdn
=
new
KeyData
(
expandedNode
.
getData
(),
g
.
node
());
state
.
getGoals
().
add
(
new
GoalNode
<>(
expandedNode
,
kdn
,
kdn
.
isClosedNode
()));
state
.
getGoals
().
add
(
new
GoalNode
<>(
expandedNode
,
kdn
,
kdn
.
isClosedNode
()));
}
}
assert
!
state
.
getGoals
().
contains
(
expandedNode
);
}
}
}
}
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
...
...
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/funchdl/ProofScriptCommandBuilder.java
View file @
e9617e80
...
@@ -15,6 +15,8 @@ import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
...
@@ -15,6 +15,8 @@ import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
import
edu.kit.iti.formal.psdbg.parser.ast.CallStatement
;
import
edu.kit.iti.formal.psdbg.parser.ast.CallStatement
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.key_project.util.collection.ImmutableList
;
import
org.key_project.util.collection.ImmutableList
;
import
java.util.Collection
;
import
java.util.Collection
;
...
@@ -30,6 +32,8 @@ import java.util.Map;
...
@@ -30,6 +32,8 @@ import java.util.Map;
*/
*/
@RequiredArgsConstructor
@RequiredArgsConstructor
public
class
ProofScriptCommandBuilder
implements
CommandHandler
<
KeyData
>
{
public
class
ProofScriptCommandBuilder
implements
CommandHandler
<
KeyData
>
{
protected
static
Logger
LOGGER
=
LogManager
.
getLogger
(
ProofScriptCommandBuilder
.
class
);
@Getter
@Getter
private
final
Map
<
String
,
ProofScriptCommand
>
commands
;
private
final
Map
<
String
,
ProofScriptCommand
>
commands
;
...
@@ -65,7 +69,10 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
...
@@ -65,7 +69,10 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
AbstractUserInterfaceControl
uiControl
=
new
DefaultUserInterfaceControl
();
AbstractUserInterfaceControl
uiControl
=
new
DefaultUserInterfaceControl
();
c
.
execute
(
uiControl
,
cc
,
estate
);
c
.
execute
(
uiControl
,
cc
,
estate
);
//what happens if this is empty -> meaning proof is closed
//what happens if this is empty -> meaning proof is closed
state
.
getGoals
().
remove
(
expandedNode
);
if
(
state
.
getSelectedGoalNode
().
equals
(
expandedNode
))
{
state
.
setSelectedGoalNode
(
null
);
}
ImmutableList
<
Goal
>
ngoals
=
kd
.
getProof
().
getSubtreeGoals
(
kd
.
getNode
());
ImmutableList
<
Goal
>
ngoals
=
kd
.
getProof
().
getSubtreeGoals
(
kd
.
getNode
());
if
(
ngoals
.
isEmpty
())
{
if
(
ngoals
.
isEmpty
())
{
Node
start
=
expandedNode
.
getData
().
getNode
();
Node
start
=
expandedNode
.
getData
().
getNode
();
...
@@ -74,7 +81,7 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
...
@@ -74,7 +81,7 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
Iterator
<
Node
>
nodeIterator
=
start
.
leavesIterator
();
Iterator
<
Node
>
nodeIterator
=
start
.
leavesIterator
();
while
(
nodeIterator
.
hasNext
())
{
while
(
nodeIterator
.
hasNext
())
{
Node
n
=
nodeIterator
.
next
();
Node
n
=
nodeIterator
.
next
();
System
.
out
.
println
(
n
.
isClosed
());
LOGGER
.
error
(
n
.
isClosed
());
}
}
}
else
{
}
else
{
...
@@ -83,7 +90,7 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
...
@@ -83,7 +90,7 @@ public class ProofScriptCommandBuilder implements CommandHandler<KeyData> {
state
.
getGoals
().
add
(
new
GoalNode
<>(
expandedNode
,
kdn
,
kdn
.
isClosedNode
()));
state
.
getGoals
().
add
(
new
GoalNode
<>(
expandedNode
,
kdn
,
kdn
.
isClosedNode
()));
}
}
}
}
state
.
getGoals
().
remove
(
expandedNode
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
...
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/funchdl/RuleCommandHandler.java
View file @
e9617e80
...
@@ -68,6 +68,9 @@ public class RuleCommandHandler implements CommandHandler<KeyData> {
...
@@ -68,6 +68,9 @@ public class RuleCommandHandler implements CommandHandler<KeyData> {
ImmutableList
<
Goal
>
ngoals
=
kd
.
getProof
().
getSubtreeGoals
(
kd
.
getNode
());
ImmutableList
<
Goal
>
ngoals
=
kd
.
getProof
().
getSubtreeGoals
(
kd
.
getNode
());
state
.
getGoals
().
remove
(
expandedNode
);
state
.
getGoals
().
remove
(
expandedNode
);
if
(
state
.
getSelectedGoalNode
().
equals
(
expandedNode
))
{
state
.
setSelectedGoalNode
(
null
);
}
for
(
Goal
g
:
ngoals
)
{
for
(
Goal
g
:
ngoals
)
{
KeyData
kdn
=
new
KeyData
(
kd
,
g
.
node
());
KeyData
kdn
=
new
KeyData
(
kd
,
g
.
node
());
state
.
getGoals
().
add
(
new
GoalNode
<>(
expandedNode
,
kdn
,
kdn
.
getNode
().
isClosed
()));
state
.
getGoals
().
add
(
new
GoalNode
<>(
expandedNode
,
kdn
,
kdn
.
getNode
().
isClosed
()));
...
...
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/Interpreter.java
View file @
e9617e80
...
@@ -221,6 +221,9 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
...
@@ -221,6 +221,9 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
}
}
State
<
T
>
stateAfterCase
=
popState
();
//remove state from stack
State
<
T
>
stateAfterCase
=
popState
();
//remove state from stack
if
(
stateAfterCase
.
getSelectedGoalNode
()
!=
null
)
{
assert
stateAfterCase
.
getGoals
().
contains
(
stateAfterCase
.
getSelectedGoalNode
());
}
if
(
result
&&
stateAfterCase
.
getGoals
()
!=
null
)
{
if
(
result
&&
stateAfterCase
.
getGoals
()
!=
null
)
{
resultingGoals
.
addAll
(
stateAfterCase
.
getGoals
());
resultingGoals
.
addAll
(
stateAfterCase
.
getGoals
());
...
@@ -273,6 +276,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
...
@@ -273,6 +276,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
Expression
matchExpression
=
guardedCaseStatement
.
getGuard
();
Expression
matchExpression
=
guardedCaseStatement
.
getGuard
();
State
<
T
>
currentStateToMatch
=
peekState
();
State
<
T
>
currentStateToMatch
=
peekState
();
GoalNode
<
T
>
selectedGoal
=
currentStateToMatch
.
getSelectedGoalNode
();
GoalNode
<
T
>
selectedGoal
=
currentStateToMatch
.
getSelectedGoalNode
();
assert
currentStateToMatch
.
getGoals
().
contains
(
selectedGoal
);
VariableAssignment
va
=
evaluateMatchInGoal
(
matchExpression
,
selectedGoal
);
VariableAssignment
va
=
evaluateMatchInGoal
(
matchExpression
,
selectedGoal
);
try
{
try
{
...
@@ -510,6 +514,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
...
@@ -510,6 +514,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
enterScope
(
caseStmts
);
enterScope
(
caseStmts
);
goalNode
.
enterScope
(
va
);
goalNode
.
enterScope
(
va
);
State
<
T
>
s
=
newState
(
goalNode
);
State
<
T
>
s
=
newState
(
goalNode
);
assert
s
.
getGoals
().
contains
(
s
.
getSelectedGoalNode
());
caseStmts
.
accept
(
this
);
caseStmts
.
accept
(
this
);
//popState(s); //This may be incorrect-> Bug? -> Cases Statement needs to pop, as goals need to be collected
//popState(s); //This may be incorrect-> Bug? -> Cases Statement needs to pop, as goals need to be collected
exitScope
(
caseStmts
);
exitScope
(
caseStmts
);
...
@@ -644,7 +649,11 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
...
@@ -644,7 +649,11 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
//region State Handling
//region State Handling
public
GoalNode
<
T
>
getSelectedNode
()
{
public
GoalNode
<
T
>
getSelectedNode
()
{
try
{
try
{
return
stateStack
.
peek
().
getSelectedGoalNode
();
GoalNode
<
T
>
selectedGoalNode
=
stateStack
.
peek
().
getSelectedGoalNode
();
if
(
selectedGoalNode
!=
null
)
{
assert
stateStack
.
peek
().
getGoals
().
contains
(
selectedGoalNode
);
}
return
selectedGoalNode
;
}
catch
(
IllegalStateException
e
)
{
}
catch
(
IllegalStateException
e
)
{
if
(
scrictSelectedGoalMode
)
if
(
scrictSelectedGoalMode
)
throw
e
;
throw
e
;
...
...
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/data/State.java
View file @
e9617e80
...
@@ -79,10 +79,6 @@ public class State<T> {
...
@@ -79,10 +79,6 @@ public class State<T> {
return
new
State
<
T
>(
copiedGoals
,
refToSelGoal
);
return
new
State
<
T
>(
copiedGoals
,
refToSelGoal
);
}
}
public
void
setSelectedGoalNode
(
GoalNode
<
T
>
gn
)
{
this
.
selectedGoalNode
=
gn
;
}
public
GoalNode
<
T
>
getSelectedGoalNode
()
{
public
GoalNode
<
T
>
getSelectedGoalNode
()
{
/* if (selectedGoalNode == null) {
/* if (selectedGoalNode == null) {
throw new IllegalStateException("no selected node");
throw new IllegalStateException("no selected node");
...
@@ -96,9 +92,17 @@ public class State<T> {
...
@@ -96,9 +92,17 @@ public class State<T> {
if
(
getGoals
().
size
()
==
1
)
{
if
(
getGoals
().
size
()
==
1
)
{
selectedGoalNode
=
getGoals
().
get
(
0
);
selectedGoalNode
=
getGoals
().
get
(
0
);
}
}
return
selectedGoalNode
;
return
selectedGoalNode
;
}
}
public
void
setSelectedGoalNode
(
GoalNode
<
T
>
gn
)
{
if
(
gn
!=
null
)
{
assert
goals
.
contains
(
gn
);
}
this
.
selectedGoalNode
=
gn
;
}
public
String
toString
()
{
public
String
toString
()
{
if
(
selectedGoalNode
==
null
)
{
if
(
selectedGoalNode
==
null
)
{
return
"No Goal selected"
;
return
"No Goal selected"
;
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/ProofScriptDebugger.java
View file @
e9617e80
...
@@ -103,7 +103,7 @@ public class ProofScriptDebugger extends Application {
...
@@ -103,7 +103,7 @@ public class ProofScriptDebugger extends Application {
logger
.
info
(
"KeY: "
+
KeYConstants
.
COPYRIGHT
);
logger
.
info
(
"KeY: "
+
KeYConstants
.
COPYRIGHT
);
logger
.
info
(
"KeY Version: "
+
KeYConstants
.
VERSION
);
logger
.
info
(
"KeY Version: "
+
KeYConstants
.
VERSION
);
logger
.
info
(
"KeY Internal: "
+
KeYConstants
.
INTERNAL_VERSION
);
logger
.
info
(
"KeY Internal: "
+
KeYConstants
.
INTERNAL_VERSION
);
//
logger
.error("sfklsajflksajfsdajfsdalfjsdaf", new IllegalAccessError("dlfsdalfjsadflj"));
//
LOGGER
.error("sfklsajflksajfsdajfsdalfjsdaf", new IllegalAccessError("dlfsdalfjsadflj"));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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