Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tla2bAST
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
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tla2bAST
Commits
9c3acead
Commit
9c3acead
authored
4 years ago
by
Michael Leuschel
Browse files
Options
Downloads
Patches
Plain Diff
allow to use FALSE and TRUE for TLA actions
parent
cf9e459c
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
src/main/java/de/tla2b/translation/OperationsFinder.java
+17
-5
17 additions, 5 deletions
src/main/java/de/tla2b/translation/OperationsFinder.java
with
17 additions
and
5 deletions
src/main/java/de/tla2b/translation/OperationsFinder.java
+
17
−
5
View file @
9c3acead
package
de.tla2b.translation
;
import
java.util.ArrayList
;
import
util.UniqueString
;
import
tla2sany.semantic.ASTConstants
;
import
tla2sany.semantic.ExprNode
;
...
...
@@ -14,6 +15,7 @@ import de.tla2b.analysis.AbstractASTVisitor;
import
de.tla2b.analysis.BOperation
;
import
de.tla2b.analysis.SpecAnalyser
;
import
de.tla2b.global.BBuiltInOPs
;
import
de.tla2b.global.BBuildIns
;
import
de.tla2b.global.TranslationGlobals
;
public
class
OperationsFinder
extends
AbstractASTVisitor
implements
...
...
@@ -47,11 +49,11 @@ public class OperationsFinder extends AbstractASTVisitor implements
}
case
NumeralKind:
{
throw
new
RuntimeException
(
String
.
format
(
"Expected an action.%n%s"
,
n
.
getLocation
().
toString
()));
"Expected an action
(instead of a number)
.%n%s"
,
n
.
getLocation
().
toString
()));
}
case
StringKind:
{
throw
new
RuntimeException
(
String
.
format
(
"Expected an action.%n%s"
,
n
.
getLocation
().
toString
()));
"Expected an action
(instead of a string)
.%n%s"
,
n
.
getLocation
().
toString
()));
}
case
SubstInKind:
{
throw
new
RuntimeException
(
String
.
format
(
...
...
@@ -88,9 +90,10 @@ public class OperationsFinder extends AbstractASTVisitor implements
@Override
public
void
visitBuiltInNode
(
OpApplNode
n
)
{
int
opcode
=
BuiltInOPs
.
getOpCode
(
n
.
getOperator
().
getName
());
UniqueString
opname
=
n
.
getOperator
().
getName
();
int
opcode
=
BuiltInOPs
.
getOpCode
(
opname
);
switch
(
opcode
)
{
case
OPCODE_dl:
// DisjList
case
OPCODE_dl:
// DisjList
: split action further
{
if
(
n
.
getArgs
().
length
==
1
)
{
visitExprOrOpArgNode
(
n
.
getArgs
()[
0
]);
...
...
@@ -108,7 +111,7 @@ public class OperationsFinder extends AbstractASTVisitor implements
return
;
}
}
case
OPCODE_lor:
{
case
OPCODE_lor:
{
// logical or: split action further
String
oldName
=
currentName
;
ArrayList
<
OpApplNode
>
oldExists
=
new
ArrayList
<
OpApplNode
>(
exists
);
...
...
@@ -141,11 +144,20 @@ public class OperationsFinder extends AbstractASTVisitor implements
case
OPCODE_fa:
// $FcnApply f[1]
case
OPCODE_ite:
// IF THEN ELSE
case
OPCODE_case:
{
// no further decomposing: create a B operation
BOperation
op
=
new
BOperation
(
currentName
,
n
,
exists
,
specAnalyser
);
bOperations
.
add
(
op
);
return
;
}
}
//System.out.println("OPCODE of " + opname + " = "+ opcode);
if
(
opname
==
BBuildIns
.
OP_false
||
// FALSE: always disabled
opname
==
BBuildIns
.
OP_true
)
{
// TRUE: CHAOS
BOperation
op
=
new
BOperation
(
currentName
,
n
,
exists
,
specAnalyser
);
bOperations
.
add
(
op
);
return
;
}
throw
new
RuntimeException
(
String
.
format
(
"Expected an action at '%s' :%n%s"
,
n
.
getOperator
().
getName
()
...
...
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