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
d410e815
Commit
d410e815
authored
12 years ago
by
Daniel Plagge
Browse files
Options
Downloads
Patches
Plain Diff
some refactoring in Theories
parent
8eccaf54
Branches
Branches containing commit
Tags
Tags containing commit
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/Theories.java
+21
-4
21 additions, 4 deletions
de.prob.core/src/de/prob/eventb/translator/Theories.java
with
21 additions
and
4 deletions
de.prob.core/src/de/prob/eventb/translator/Theories.java
+
21
−
4
View file @
d410e815
...
@@ -37,6 +37,8 @@ import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog;
...
@@ -37,6 +37,8 @@ import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog;
import
de.be4.classicalb.core.parser.node.PExpression
;
import
de.be4.classicalb.core.parser.node.PExpression
;
import
de.be4.classicalb.core.parser.node.PPredicate
;
import
de.be4.classicalb.core.parser.node.PPredicate
;
import
de.prob.prolog.output.IPrologTermOutput
;
import
de.prob.prolog.output.IPrologTermOutput
;
import
de.prob.prolog.output.StructuredPrologOutput
;
import
de.prob.prolog.term.PrologTerm
;
public
class
Theories
{
public
class
Theories
{
private
static
final
String
PROB_THEORY_MAPPING_SUFFIX
=
"ptm"
;
private
static
final
String
PROB_THEORY_MAPPING_SUFFIX
=
"ptm"
;
...
@@ -47,7 +49,7 @@ public class Theories {
...
@@ -47,7 +49,7 @@ public class Theories {
final
IDeployedTheoryRoot
[]
theories
=
rProject
final
IDeployedTheoryRoot
[]
theories
=
rProject
.
getRootElementsOfType
(
IDeployedTheoryRoot
.
ELEMENT_TYPE
);
.
getRootElementsOfType
(
IDeployedTheoryRoot
.
ELEMENT_TYPE
);
for
(
IDeployedTheoryRoot
theory
:
theories
)
{
for
(
IDeployedTheoryRoot
theory
:
theories
)
{
p
rintTranslation
(
theory
,
pout
);
saveP
rintTranslation
(
theory
,
pout
);
}
}
final
ITheoryPathRoot
[]
theoryPaths
=
rProject
final
ITheoryPathRoot
[]
theoryPaths
=
rProject
.
getRootElementsOfType
(
ITheoryPathRoot
.
ELEMENT_TYPE
);
.
getRootElementsOfType
(
ITheoryPathRoot
.
ELEMENT_TYPE
);
...
@@ -55,15 +57,30 @@ public class Theories {
...
@@ -55,15 +57,30 @@ public class Theories {
for
(
IAvailableTheoryProject
ap
:
theoryPath
for
(
IAvailableTheoryProject
ap
:
theoryPath
.
getAvailableTheoryProjects
())
{
.
getAvailableTheoryProjects
())
{
for
(
IAvailableTheory
at
:
ap
.
getTheories
())
{
for
(
IAvailableTheory
at
:
ap
.
getTheories
())
{
p
rintTranslation
(
at
.
getDeployedTheory
(),
pout
);
saveP
rintTranslation
(
at
.
getDeployedTheory
(),
pout
);
}
}
}
}
}
}
}
}
private
static
void
printTranslation
(
IDeployedTheoryRoot
theory
,
/**
IPrologTermOutput
pto
)
throws
RodinDBException
{
* We currently write the translated theory into a PrologTerm object because
* the translation is currently very unstable and erroneous. Writing in a
* Prolog object makes sure that the output stream to the Prolog process
* will not be corrupted.
*/
private
static
void
savePrintTranslation
(
IDeployedTheoryRoot
theory
,
IPrologTermOutput
opto
)
throws
RodinDBException
{
final
StructuredPrologOutput
pto
=
new
StructuredPrologOutput
();
printTranslation
(
theory
,
pto
);
pto
.
fullstop
();
final
PrologTerm
result
=
pto
.
getSentences
().
get
(
0
);
opto
.
printTerm
(
result
);
}
private
static
void
printTranslation
(
IDeployedTheoryRoot
theory
,
StructuredPrologOutput
pto
)
throws
RodinDBException
{
pto
.
openTerm
(
"theory"
);
pto
.
openTerm
(
"theory"
);
printIdentifiers
(
theory
.
getSCTypeParameters
(),
pto
);
printIdentifiers
(
theory
.
getSCTypeParameters
(),
pto
);
printDataTypes
(
theory
,
pto
);
printDataTypes
(
theory
,
pto
);
...
...
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