Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ProB Rodin Plugin
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
ProB Rodin Plugin
Commits
8eccaf54
Commit
8eccaf54
authored
12 years ago
by
Daniel Plagge
Browse files
Options
Downloads
Patches
Plain Diff
Added a flag that shows if a theory was used
parent
d6d36b0f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
de.prob.core/src/de/prob/eventb/translator/internal/TranslationVisitor.java
+12
-2
12 additions, 2 deletions
...e/prob/eventb/translator/internal/TranslationVisitor.java
with
12 additions
and
2 deletions
de.prob.core/src/de/prob/eventb/translator/internal/TranslationVisitor.java
+
12
−
2
View file @
8eccaf54
...
@@ -49,6 +49,8 @@ public class TranslationVisitor implements ISimpleVisitor {
...
@@ -49,6 +49,8 @@ public class TranslationVisitor implements ISimpleVisitor {
private
LookupStack
<
PSubstitution
>
substitutions
=
new
LookupStack
<
PSubstitution
>();
private
LookupStack
<
PSubstitution
>
substitutions
=
new
LookupStack
<
PSubstitution
>();
private
LookupStack
<
String
>
boundVariables
=
new
LookupStack
<
String
>();
private
LookupStack
<
String
>
boundVariables
=
new
LookupStack
<
String
>();
private
boolean
usesTheories
=
false
;
public
void
visitAssociativeExpression
(
public
void
visitAssociativeExpression
(
final
AssociativeExpression
expression
)
{
final
AssociativeExpression
expression
)
{
// BUNION, BINTER, BCOMP, FCOMP, OVR, PLUS, MUL
// BUNION, BINTER, BCOMP, FCOMP, OVR, PLUS, MUL
...
@@ -602,6 +604,7 @@ public class TranslationVisitor implements ISimpleVisitor {
...
@@ -602,6 +604,7 @@ public class TranslationVisitor implements ISimpleVisitor {
.
getChildPredicates
());
.
getChildPredicates
());
expressions
.
push
(
new
AExtendedExprExpression
(
new
TIdentifierLiteral
(
expressions
.
push
(
new
AExtendedExprExpression
(
new
TIdentifierLiteral
(
symbol
),
childExprs
,
childPreds
));
symbol
),
childExprs
,
childPreds
));
usesTheories
=
true
;
}
}
@Override
@Override
...
@@ -613,6 +616,7 @@ public class TranslationVisitor implements ISimpleVisitor {
...
@@ -613,6 +616,7 @@ public class TranslationVisitor implements ISimpleVisitor {
.
getChildPredicates
());
.
getChildPredicates
());
predicates
.
push
(
new
AExtendedPredPredicate
(
new
TIdentifierLiteral
(
predicates
.
push
(
new
AExtendedPredPredicate
(
new
TIdentifierLiteral
(
symbol
),
childExprs
,
childPreds
));
symbol
),
childExprs
,
childPreds
));
usesTheories
=
true
;
}
}
private
List
<
PExpression
>
getSubExpressions
(
final
Formula
<?>[]
children
)
{
private
List
<
PExpression
>
getSubExpressions
(
final
Formula
<?>[]
children
)
{
...
@@ -701,14 +705,20 @@ public class TranslationVisitor implements ISimpleVisitor {
...
@@ -701,14 +705,20 @@ public class TranslationVisitor implements ISimpleVisitor {
}
}
}
}
public
static
void
checkNewImplementation
(
Predicate
p
,
PPredicate
predicate
)
{
public
static
boolean
checkNewImplementation
(
Formula
<?>
p
,
Node
oldImplementation
)
{
TranslationVisitor
visitor
=
new
TranslationVisitor
();
TranslationVisitor
visitor
=
new
TranslationVisitor
();
p
.
accept
(
visitor
);
p
.
accept
(
visitor
);
final
String
expected
=
predicate
.
toString
();
final
String
expected
=
oldImplementation
.
toString
();
final
String
actual
=
visitor
.
getPredicate
().
toString
();
final
String
actual
=
visitor
.
getPredicate
().
toString
();
if
(!
expected
.
equals
(
actual
))
{
if
(!
expected
.
equals
(
actual
))
{
throw
new
AssertionError
(
"Expected:\n"
+
expected
+
"\n but was:\n"
throw
new
AssertionError
(
"Expected:\n"
+
expected
+
"\n but was:\n"
+
actual
);
+
actual
);
}
}
return
visitor
.
usesTheories
;
}
public
boolean
usesTheories
()
{
return
usesTheories
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment