Skip to content

Commit e51c41a

Browse files
authored
feat: renaming assign eval and removing naming requirements (#106)
1 parent fa69c13 commit e51c41a

File tree

7 files changed

+27
-24
lines changed

7 files changed

+27
-24
lines changed

src/main/kotlin/at/ac/uibk/dps/cirrina/execution/object/Action.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sealed interface Action {
66
companion object {
77
fun create(description: ActionDescription, name: String? = null): Action =
88
when (description) {
9-
is AssignDescription -> EvalAction(Expression.create(description.expression))
9+
is EvalDescription -> EvalAction(Expression.create(description.expression))
1010

1111
is InvokeDescription ->
1212
InvokeAction(

src/main/resources/pkl/csm/csml.pkl

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
module at.ac.uibk.dps.cirrina.csm.Csml
33

44
/// The name of an instance of a state machine or "*" to refer to all instances.
5-
typealias InstanceName = String(matches(Regex(#"^[a-zA-Z_]\w*$"#)))
5+
typealias InstanceName = String
66

77
/// The name of a state machine.
8-
typealias StateMachineName = String(matches(Regex(#"^[a-zA-Z_]\w*$"#)))
8+
typealias StateMachineName = String
99

1010
/// The subscription to events raised by state machine instances.
11-
typealias Subscription = String(matches(Regex(#"^([a-zA-Z_]\w*|\*)$"#)))
11+
typealias Subscription = String
1212

1313
class Instance {
1414
stateMachineName: StateMachineName
@@ -32,7 +32,7 @@ bindings: Listing<ServiceImplementationBinding>?
3232
typealias Expression = String
3333

3434
/// The name of a variable.
35-
typealias VariableName = String(matches(Regex(#"^[a-zA-Z_]\w*$"#)))
35+
typealias VariableName = String
3636

3737
/// A context declaration consisting of variable names and value expressions.
3838
typealias Context = Mapping<VariableName, Expression>
@@ -42,17 +42,17 @@ class CollaborativeStateMachineDescription {
4242
stateMachines: Mapping<StateMachineName, StateMachineDescription>
4343
}
4444

45-
typealias StateName = String(matches(Regex(#"^[a-zA-Z_]\w*$"#)))
45+
typealias StateName = String
4646

4747
class StateMachineDescription {
4848
states: Mapping<StateName, StateDescription>
4949
nested: Mapping<StateMachineName, StateMachineDescription>
5050
transient: Context?
5151
}
5252

53-
typealias EventName = String(matches(Regex(#"^[a-zA-Z_]\w*$"#)))
53+
typealias EventName = String
5454

55-
typealias TimeoutName = String(matches(Regex(#"^[a-zA-Z_]\w*$"#)))
55+
typealias TimeoutName = String
5656

5757
open class StateDescription {
5858
initial: Boolean = false
@@ -88,7 +88,7 @@ class TransitionDescription {
8888

8989
abstract class ActionDescription {}
9090

91-
typealias InvocationType = String(matches(Regex(#"^[a-zA-Z_]\w*$"#)))
91+
typealias InvocationType = String
9292

9393
typealias InvocationMode = "local"|"remote"
9494

@@ -99,10 +99,11 @@ class InvokeDescription extends ActionDescription {
9999
emits: Listing<EventDescription>
100100
}
101101

102-
class AssignDescription extends ActionDescription {
102+
class EvalDescription extends ActionDescription {
103103
expression: Expression
104104
}
105105

106+
106107
class EmitDescription extends ActionDescription {
107108
event: EventDescription
108109
target: Expression?
@@ -113,10 +114,12 @@ class TimeoutDescription extends ActionDescription {
113114
triggers: EmitDescription
114115
}
115116

117+
116118
class ResetDescription extends ActionDescription {
117119
name: TimeoutName
118120
}
119121

122+
120123
class CaseDescription {
121124
of: Expression
122125
yields: Listing<ActionDescription>
@@ -131,7 +134,7 @@ class LogDescription extends ActionDescription {
131134
message: Expression
132135
}
133136

134-
typealias EventTopic = String(matches(Regex(#"^[a-zA-Z_]\w*$"#)))
137+
typealias EventTopic = String
135138

136139
typealias EventChannel = "internal"|"external"|"peripheral"
137140

@@ -178,7 +181,7 @@ typealias Transition = TransitionDescription
178181

179182
// Action aliases
180183
typealias Action = ActionDescription
181-
typealias Assign = AssignDescription
184+
typealias Eval = EvalDescription
182185
typealias Invoke = InvokeDescription
183186
typealias Case = CaseDescription
184187
typealias Match = MatchDescription

src/test/resources/pkl/complete/main.pkl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ collaborativeStateMachine {
3131
emits { new Internal { topic = "e2" } }
3232
}
3333
}
34-
exit { new Assign { expression = "e = true" } }
34+
exit { new Eval { expression = "e = true" } }
3535
on {
3636
["e2"] = new Transition {
3737
to = "c"
38-
yields { new Assign { expression = "x = $v" } }
38+
yields { new Eval { expression = "x = $v" } }
3939
}
4040
}
4141
}
@@ -51,8 +51,8 @@ collaborativeStateMachine {
5151
["d"] = new State {
5252
static { ["d"] = "100" }
5353
entry {
54-
new Assign { expression = "v = x" }
55-
new Assign { expression = "d = d - 1" }
54+
new Eval { expression = "v = x" }
55+
new Eval { expression = "d = d - 1" }
5656
new Match {
5757
cases {
5858
new Case {
@@ -68,7 +68,7 @@ collaborativeStateMachine {
6868
["e4"] = new Transition { to = "d" }
6969
}
7070
}
71-
["e"] = new Terminal { entry { new Assign { expression = "b = true" } } }
71+
["e"] = new Terminal { entry { new Eval { expression = "b = true" } } }
7272
}
7373
transient { ["x"] = "0" }
7474
}

src/test/resources/pkl/events/main.pkl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ collaborativeStateMachine {
1717
["c"] = new Terminal {
1818
entry {
1919
new Emit { event { topic = "e5" } }
20-
new Assign { expression = "b = true" }
20+
new Eval { expression = "b = true" }
2121
}
2222
}
2323
["d"] = new Terminal {}
@@ -61,7 +61,7 @@ collaborativeStateMachine {
6161
}
6262
}
6363
["b"] = new Terminal {}
64-
["c"] = new Terminal { entry { new Assign { expression = "c = true" } } }
64+
["c"] = new Terminal { entry { new Eval { expression = "c = true" } } }
6565
}
6666
}
6767
}

src/test/resources/pkl/invoke/main.pkl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ collaborativeStateMachine {
2121
input { ["v"] = "v" }
2222
emits { new Internal { topic = "tob" } }
2323
}
24-
new Assign { expression = "e = e + 1" }
24+
new Eval { expression = "e = e + 1" }
2525
}
2626
}
2727
["tob"] = new Transition { to = "b" }
2828
}
2929
}
3030
["b"] = new State {
31-
entry { new Assign { expression = "v = $v" } }
31+
entry { new Eval { expression = "v = $v" } }
3232
always {
3333
new Transition {
3434
to = "a"

src/test/resources/pkl/pingPong/main.pkl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ collaborativeStateMachine {
66
states {
77
["a"] = new Initial {
88
entry {
9-
new Assign { expression = "v = v + 1" }
9+
new Eval { expression = "v = v + 1" }
1010
new Emit { event { topic = "e1" } }
1111
}
1212
on { ["e2"] = new Transition { to = "b" } }
@@ -32,7 +32,7 @@ collaborativeStateMachine {
3232
}
3333
["b"] = new State {
3434
entry {
35-
new Assign { expression = "v = v + 1" }
35+
new Eval { expression = "v = v + 1" }
3636
new Emit { event { topic = "e2" } }
3737
}
3838
on { ["e3"] = new Transition { to = "a" } }

src/test/resources/pkl/timeout/main.pkl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ collaborativeStateMachine {
1919
cases {
2020
new Case {
2121
of = "v < 10"
22-
yields { new Assign { expression = "v = v + 1" } }
22+
yields { new Eval { expression = "v = v + 1" } }
2323
}
2424
}
2525
default = new Emit { event = new Internal { topic = "tob" } }

0 commit comments

Comments
 (0)