Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
ProofScriptParser
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
24
Issues
24
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sarah.grebing
ProofScriptParser
Commits
3934685e
Commit
3934685e
authored
Mar 16, 2018
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix
parent
a7b1ed25
Pipeline
#19956
failed with stages
in 2 minutes and 13 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
20 deletions
+7
-20
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/matcher/KeyTermMatcher.java
.../iti/formal/psdbg/interpreter/matcher/KeyTermMatcher.java
+6
-19
rt-key/src/test/java/edu/kit/iti/formal/psdbg/interpreter/matcher/KeyMatcherFacadeTest.java
...ormal/psdbg/interpreter/matcher/KeyMatcherFacadeTest.java
+1
-1
No files found.
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/matcher/KeyTermMatcher.java
View file @
3934685e
...
...
@@ -19,7 +19,7 @@ public class KeyTermMatcher extends KeyTermBaseVisitor<Matchings, MatchPath> {
private
String
randomName
;
MatchPath
peek
;
//
MatchPath peek;
private
List
<
Integer
>
currentposition
=
new
ArrayList
<>();
...
...
@@ -42,18 +42,11 @@ public class KeyTermMatcher extends KeyTermBaseVisitor<Matchings, MatchPath> {
public
Matchings
matchesSequent
(
Sequent
sequent
,
Sequent
pattern
)
{
MatchPath
.
MPSequent
mps
=
MatchPathFacade
.
create
(
sequent
);
// MatchPath.MPSequent mps = new MatchPath.MPSequent(sequent);
Matchings
ms
=
matchesSemisequent
(
// new MatchPath.MPSemiSequent(mps, sequent.succedent(), false),
MatchPathFacade
.
createSuccedent
(
mps
),
pattern
.
succedent
());
//peek = new MatchPath.MPSemiSequent(mps, sequent.succedent(), true);
Matchings
ma
=
matchesSemisequent
(
MatchPathFacade
.
createAntecedent
(
mps
),
// new MatchPath.MPSemiSequent(mps, sequent.antecedent(), true),
pattern
.
antecedent
());
return
reduceConform
(
ms
,
ma
);
...
...
@@ -98,14 +91,6 @@ public class KeyTermMatcher extends KeyTermBaseVisitor<Matchings, MatchPath> {
return
ret
;
}
/* private MatchPath.MPTerm create(MatchPath.MPSequentFormula sf) {
return new MatchPath.MPTerm(sf, sf.getUnit().formula(), MatchPath.SEQUENT_FORMULA_ROOT);
}
private MatchPath.MPSequentFormula create(MatchPath.MPSemiSequent peek, int pos) {
return new MatchPath.MPSequentFormula(peek, peek.getUnit().get(pos), pos);
}
*/
/**
* Visit a '...'MatchPath'...' structure
...
...
@@ -116,7 +101,7 @@ public class KeyTermMatcher extends KeyTermBaseVisitor<Matchings, MatchPath> {
@DispatchOn
(
EllipsisOp
.
class
)
public
Matchings
visitEllipsisOp
(
Term
pattern
,
MatchPath
subject
)
{
Matchings
matchings
=
new
Matchings
();
subTerms
((
MatchPath
.
MPTerm
)
peek
).
forEach
(
sub
->
{
subTerms
((
MatchPath
.
MPTerm
)
subject
).
forEach
(
sub
->
{
Matchings
s
=
visit
(
pattern
.
sub
(
0
),
sub
);
matchings
.
addAll
(
s
);
});
...
...
@@ -236,7 +221,7 @@ public class KeyTermMatcher extends KeyTermBaseVisitor<Matchings, MatchPath> {
if
(
matchings
!=
NO_MATCH
)
{
String
name
=
pattern
.
sub
(
0
).
op
().
name
().
toString
();
for
(
Map
<
String
,
MatchPath
>
a
:
matchings
)
{
a
.
put
(
name
,
peek
);
a
.
put
(
name
,
subject
);
}
}
return
matchings
;
...
...
@@ -251,7 +236,8 @@ public class KeyTermMatcher extends KeyTermBaseVisitor<Matchings, MatchPath> {
if
(
subject
.
getUnit
().
subs
().
size
()
!=
pattern
.
subs
().
size
())
{
return
NO_MATCH
;
}
if
(
pattern
.
equals
(
subject1
.
getUnit
()))
return
EMPTY_MATCH
;
for
(
int
i
=
0
;
i
<
subject
.
getUnit
().
subs
().
size
();
i
++)
{
Term
tt
=
subject
.
getUnit
().
sub
(
i
);
Term
pt
=
pattern
.
sub
(
i
);
...
...
@@ -268,6 +254,7 @@ public class KeyTermMatcher extends KeyTermBaseVisitor<Matchings, MatchPath> {
//region helper
private
String
getBindingName
(
Name
name
)
{
if
(
name
.
toString
().
equals
(
"?"
))
return
getRandomName
();
return
name
.
toString
();
...
...
rt-key/src/test/java/edu/kit/iti/formal/psdbg/interpreter/matcher/KeyMatcherFacadeTest.java
View file @
3934685e
...
...
@@ -42,8 +42,8 @@ public class KeyMatcherFacadeTest {
@Test
public
void
matchSeq
()
throws
Exception
{
shouldMatch
(
"p ==>"
,
"p ==>"
);
shouldMatch
(
"==> pred(a), q"
,
"==> pred(?X:S), q"
);
shouldMatch
(
"==> p, q"
,
"==> ?X:Formula"
);
shouldMatch
(
"==> p, q"
,
"==> p, q"
);
shouldMatch
(
"==> p, q"
,
"==> q, p"
);
...
...
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