-
Notifications
You must be signed in to change notification settings - Fork 11
/
TextualScenario.xtext
125 lines (97 loc) · 2.74 KB
/
TextualScenario.xtext
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*******************************************************************************
* Copyright (c) 2020 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales - initial API and implementation
*******************************************************************************/
grammar org.polarsys.capella.scenario.editor.dsl.TextualScenario with org.eclipse.xtext.common.Terminals
generate textualScenario "http://www.polarsys.org/capella/scenario/editor/dsl/TextualScenario"
Model:
'scenario' begin = '{' participants+=Participant*
(elements+=Element)*
end = '}';
Participant:
GenericComponent | GenericFunction
;
GenericComponent:
Entity | Actor | Component | ConfigurationItem | Role
;
GenericFunction:
Function | Activity
;
Element:
Message | CombinedFragment | StateFragment | Reference
;
Actor:
keyword = 'actor' name=STRING
;
Component:
keyword = 'component' name=STRING
;
ConfigurationItem:
keyword = 'configuration_item' name=STRING
;
Function:
keyword = 'function' name=STRING
;
Activity:
keyword = 'activity' name=STRING
;
Entity:
keyword = 'entity' name=STRING
;
Role:
keyword = 'role' name=STRING
;
Message:
SequenceMessageType | ArmTimerMessage | ParticipantDeactivation | LostFoundMessage
;
SequenceMessageType:
(SequenceMessage | CreateMessage | DeleteMessage)
;
SequenceMessage:
source=STRING arrow = '->' target=STRING (execution = 'withExecution')? (return='withReturn')? doubleDot = ':' name=STRING
;
CreateMessage:
source=STRING arrow = '->+' target=STRING doubleDot = ':' name=STRING
;
DeleteMessage:
source=STRING arrow = '->x' target=STRING doubleDot = ':' name=STRING
;
ArmTimerMessage:
arrow = "->>" participant=STRING (execution = 'withExecution')? doubleDot = ':' name=STRING
;
LostFoundMessage:
LostMessage | FoundMessage
;
LostMessage:
source=STRING arrow = '->o' doubleDot = ':' name=STRING
;
FoundMessage:
arrow = 'o->' target=STRING (execution = 'withExecution')? doubleDot = ':' name=STRING
;
ParticipantDeactivation:
keyword = 'deactivate' name=STRING
;
CombinedFragment:
keyword = ('alt'|'loop'|'par'|'assert'|'critical'|'ignore'|'neg'|'opt'|'seq'|'strict'|'unset')
(expression=STRING)? over='over' (timelines+=STRING)+ block=Block (operands+=Operand)*
;
Operand:
keyword='else'? (expression=STRING)? block=Block
;
Block:
begin="{" (blockElements+=Element)* end="}"
;
StateFragment:
on='on' timeline=STRING keyword=('state' | 'mode' | 'function') name=STRING
;
Reference:
keyword = 'ref' name=STRING over = 'over' (timelines+=STRING)+
;