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
db44f34a
Commit
db44f34a
authored
Jan 29, 2018
by
alexander.weigl
🐼
Browse files
Merge branch 'masterToMerge' into 'master'
Master to merge See merge request
!8
parents
a4d6ca6e
a7a05d05
Pipeline
#17466
failed with stages
Changes
58
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/ASTNode.java
View file @
db44f34a
...
...
@@ -31,12 +31,12 @@ import lombok.Setter;
import
org.antlr.v4.runtime.ParserRuleContext
;
import
javax.annotation.Nullable
;
import
java.util.Objects
;
/**
* @author Alexander Weigl
* @version 1 (27.04.17)
*/
@EqualsAndHashCode
public
abstract
class
ASTNode
<
T
extends
ParserRuleContext
>
implements
Visitable
,
Copyable
<
ASTNode
<
T
>>
{
/**
...
...
@@ -139,4 +139,17 @@ public abstract class ASTNode<T extends ParserRuleContext>
}
while
(
n
!=
null
);
return
depth
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
ASTNode
<?>
astNode
=
(
ASTNode
<?>)
o
;
return
Objects
.
equals
(
getRuleContext
(),
astNode
.
getRuleContext
());
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
getRuleContext
());
}
}
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/ProofScript.java
View file @
db44f34a
...
...
@@ -25,16 +25,16 @@ 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.Setter
;
import
lombok.*
;
import
java.util.Objects
;
/**
* @author Alexander Weigl
* @version 1 (27.04.17)
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
ProofScript
extends
ASTNode
<
ScriptLanguageParser
.
ScriptContext
>
{
@NonNull
@Getter
...
...
@@ -73,4 +73,19 @@ public class ProofScript extends ASTNode<ScriptLanguageParser.ScriptContext> {
return
getBody
()
!=
null
?
getBody
().
eq
(
that
.
getBody
())
:
that
.
getBody
()
==
null
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
if
(!
super
.
equals
(
o
))
return
false
;
ProofScript
that
=
(
ProofScript
)
o
;
return
Objects
.
equals
(
getName
(),
that
.
getName
())
&&
Objects
.
equals
(
getSignature
(),
that
.
getSignature
())
&&
Objects
.
equals
(
getBody
(),
that
.
getBody
());
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
super
.
hashCode
(),
getName
(),
getSignature
(),
getBody
());
}
}
rt-key/src/main/java/edu/kit/iti/formal/psdbg/RuleCommandHelper.java
0 → 100644
View file @
db44f34a
package
edu.kit.iti.formal.psdbg
;
import
de.uka.ilkd.key.java.Services
;
import
de.uka.ilkd.key.logic.Name
;
import
de.uka.ilkd.key.logic.PosInOccurrence
;
import
de.uka.ilkd.key.logic.PosInTerm
;
import
de.uka.ilkd.key.logic.SequentFormula
;
import
de.uka.ilkd.key.macros.scripts.RuleCommand
;
import
de.uka.ilkd.key.proof.Goal
;
import
de.uka.ilkd.key.proof.Proof
;
import
de.uka.ilkd.key.proof.RuleAppIndex
;
import
de.uka.ilkd.key.proof.rulefilter.TacletFilter
;
import
de.uka.ilkd.key.rule.*
;
import
org.key_project.util.collection.ImmutableList
;
import
org.key_project.util.collection.ImmutableSLList
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
RuleCommandHelper
{
private
final
Proof
proof
;
private
final
Services
services
;
private
final
Goal
g
;
private
final
RuleCommand
.
Parameters
parameters
;
public
RuleCommandHelper
(
Goal
g
,
RuleCommand
.
Parameters
parameters
)
{
this
.
proof
=
g
.
proof
();
this
.
services
=
proof
.
getServices
();
this
.
g
=
g
;
this
.
parameters
=
parameters
;
}
public
int
getOccurence
(
TacletApp
app
)
{
List
<
TacletApp
>
apps
=
getTacletApps
();
if
(
apps
.
isEmpty
())
{
return
-
1
;
}
if
(
apps
.
size
()==
1
)
{
return
0
;
}
return
0
;
//return apps.indexOf(app);
}
private
List
<
TacletApp
>
getTacletApps
()
{
ImmutableList
<
TacletApp
>
allApps
=
findAllTacletApps
();
return
filterList
(
allApps
);
}
public
ImmutableList
<
TacletApp
>
findAllTacletApps
()
{
TacletFilter
filter
=
new
TacletNameFilter
(
parameters
.
rulename
);
RuleAppIndex
index
=
g
.
ruleAppIndex
();
index
.
autoModeStopped
();
ImmutableList
<
TacletApp
>
allApps
=
ImmutableSLList
.
nil
();
for
(
SequentFormula
sf
:
g
.
node
().
sequent
().
antecedent
())
{
if
(
parameters
.
formula
!=
null
&&
!
sf
.
formula
().
equalsModRenaming
(
parameters
.
formula
))
{
continue
;
}
allApps
=
allApps
.
append
(
index
.
getTacletAppAtAndBelow
(
filter
,
new
PosInOccurrence
(
sf
,
PosInTerm
.
getTopLevel
(),
true
),
services
));
}
for
(
SequentFormula
sf
:
g
.
node
().
sequent
().
succedent
())
{
if
(
parameters
.
formula
!=
null
&&
!
sf
.
formula
().
equalsModRenaming
(
parameters
.
formula
))
{
continue
;
}
allApps
=
allApps
.
append
(
index
.
getTacletAppAtAndBelow
(
filter
,
new
PosInOccurrence
(
sf
,
PosInTerm
.
getTopLevel
(),
false
),
services
));
}
return
allApps
;
}
/*
* Filter those apps from a list that are according to the parameters.
*/
private
List
<
TacletApp
>
filterList
(
ImmutableList
<
TacletApp
>
list
)
{
List
<
TacletApp
>
matchingApps
=
new
ArrayList
<
TacletApp
>();
for
(
TacletApp
tacletApp
:
list
)
{
if
(
tacletApp
instanceof
PosTacletApp
)
{
PosTacletApp
pta
=
(
PosTacletApp
)
tacletApp
;
if
(
parameters
.
on
==
null
||
pta
.
posInOccurrence
().
subTerm
()
.
equalsModRenaming
(
parameters
.
on
))
{
matchingApps
.
add
(
pta
);
}
}
}
return
matchingApps
;
}
private
static
class
TacletNameFilter
extends
TacletFilter
{
private
final
Name
rulename
;
public
TacletNameFilter
(
String
rulename
)
{
this
.
rulename
=
new
Name
(
rulename
);
}
@Override
protected
boolean
filter
(
Taclet
taclet
)
{
return
taclet
.
name
().
equals
(
rulename
);
}
}
}
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/KeYMatcher.java
View file @
db44f34a
...
...
@@ -156,7 +156,7 @@ public class KeYMatcher implements MatcherApi<KeyData> {
}
assignments
.
forEach
(
variableAssignment
->
System
.
out
.
println
(
variableAssignment
));
//
assignments.forEach(variableAssignment -> System.out.println(variableAssignment));
return
assignments
.
isEmpty
()?
null
:
assignments
;
}
...
...
@@ -198,11 +198,11 @@ public class KeYMatcher implements MatcherApi<KeyData> {
Value
<
String
>
value
=
toValueTerm
(
currentState
.
getData
(),
matched
);
va
.
declare
(
s
,
value
.
getType
());
va
.
assign
(
s
,
value
);
LOGGER
.
error
(
"Variables to match "
+
s
+
" : "
+
value
);
//
LOGGER.
info
("Variables to match " + s + " : " + value);
}
}
List
<
VariableAssignment
>
retList
=
new
LinkedList
();
LOGGER
.
error
(
"Matched Variables "
+
va
.
toString
());
LOGGER
.
info
(
"Matched Variables "
+
va
.
toString
());
retList
.
add
(
va
);
return
retList
;
}
...
...
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/KeYProofFacade.java
View file @
db44f34a
...
...
@@ -21,7 +21,6 @@ import org.key_project.util.collection.ImmutableList;
import
java.io.File
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -201,6 +200,9 @@ public class KeYProofFacade {
public
void
setEnvironment
(
KeYEnvironment
environment
)
{
this
.
environment
.
set
(
environment
);
if
(
environment
!=
null
)
{
getEnvironment
().
getUi
().
getProofControl
().
setMinimizeInteraction
(
true
);
}
}
public
SimpleObjectProperty
<
KeYEnvironment
>
environmentProperty
()
{
...
...
@@ -233,7 +235,7 @@ public class KeYProofFacade {
ImmutableList
<
Goal
>
openGoals
=
p
.
getSubtreeGoals
(
p
.
root
());
List
<
GoalNode
<
KeyData
>>
goals
=
openGoals
.
stream
().
map
(
g
->
new
GoalNode
<>(
null
,
new
KeyData
(
g
,
env
,
p
),
false
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
return
goals
;
}
...
...
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/assume.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/
macro
s/auto.html
→
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/
command
s/auto.html
View file @
db44f34a
File moved
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/cut.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
smt
</title>
</head>
<body>
<h2
id=
"smt"
>
smt
</h2>
<blockquote>
<p>
Synopsis:
<code>
cut TERM
</code></p>
</blockquote>
<p></strong>
Description:
</strong>
Performs a cut and thus splits the sequent into two goals. The unnamed
argument is the formula to cut with
</p>
<p><strong>
Arguments:
</strong></p>
<ul>
<li><em>
TERM
</em>
formula to cut with
</li>
</ul>
Examples:
<code>
cut `value1 = value2`;
</code>
</body>
</html>
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/exit.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/focus.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/instantiate.html
View file @
db44f34a
...
...
@@ -11,10 +11,10 @@
</blockquote>
<p><strong>
Arguments:
</strong></p>
<ul>
<li><code>
formula
</code>
:
<em>
TERM
</em>
(
<em>
R
</em>
)null
</li>
<li><code>
var
</code>
:
<em>
STRING
</em>
(
<em>
R
</em>
)null
</li>
<li><code>
occ
</code>
:
<em>
INT
</em>
(
<em>
R
</em>
)n
ul
l
</li>
<li><code>
with
</code>
:
<em>
TERM
</em>
(
<em>
R
</em>
)null
</li>
<li><code>
formula
</code>
:
<em>
TERM
</em>
top-level formula where variables should be instantiated
</li>
<li><code>
var
</code>
:
<em>
STRING
</em>
the variable name that shoudl be instantiated
</li>
<li><code>
occ
</code>
:
<em>
INT
</em>
occurence of the top-level form
ul
a
</li>
<li><code>
with
</code>
:
<em>
TERM
</em>
the term with which variables should be instantiated
</li>
</ul>
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/javascript.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/leave.html
0 → 100644
View file @
db44f34a
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/let.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Title
</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/macro.html
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
macro
</title>
</head>
<body>
<h2
id=
"macro"
>
macro
</h2>
<blockquote>
<p>
Synopsis:
<code>
macro macroname
</code></p>
</blockquote>
<p></strong>
Description:
</strong>
The macro command applies the macro specified as argument
</p>
<code>
macro
</code>
keyword can be ommited
<p><strong>
Arguments:
</strong></p>
<ul>
<li>
macroname :
<em>
STRING
</em>
name of macro to apply
</li>
</ul>
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/schemaVar.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/script.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Call to subscripts
</title>
</head>
<body>
<h2
id=
"script"
>
Call to subscripts
</h2>
<blockquote>
<p>
Synopsis:
<code>
scriptname;
</code></p>
</blockquote>
Call of a subscript.
<p><strong>
Arguments:
</strong></p>
Arguments according to the subscript's declaration.
</body>
</html>
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/select.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/set.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
rt-key/src/main/resources/edu/kit/iti/formal/psdbg/commands/skip.html
0 → 100644
View file @
db44f34a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<body>
This command is currently not supported by PSDBG.
</body>
</html>
\ No newline at end of file
Prev
1
2
3
Next
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