Newer
Older
// automatically generated by Xtext
grammar org.etsi.mts.tdl.graphical.labels.Data with org.eclipse.xtext.common.Terminals
//import "http://www.eclipse.org/uml2/4.0.0/Types"
import "http://www.etsi.org/spec/TDL/1.4.1"
//import "http://www.eclipse.org/uml2/5.0.0/Types" as types
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
//import "http://www.etsi.org/spec/TDL/STABLE" as tdl
TDLSpec returns Package:
{Package}
'TDLan Specification'
name=EString
'{'
(packagedElement+=PackageableElement ( packagedElement+=PackageableElement)* )?
(nestedPackage+=Package (nestedPackage+=Package)*)?
'}'
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
;
//#####################################################################################
DataUse returns DataUse:
StaticDataUse returns StaticDataUse:
SpecialValueUse | DataInstanceUse | LiteralValueUse;
DynamicDataUse returns DynamicDataUse:
VariableUse| FunctionCall | PredefinedFunctionCall | FormalParameterUse | TimeLabelUse;
SpecialValueUse returns StaticDataUse:
NoneValue | AnyValue | AnyNoneValue
;
EString returns ecore::EString:
ID
;
DataInstanceUse returns DataInstanceUse:
{DataInstanceUse}
(
( dataInstance=[DataInstance|NumberAsIdentifier] |
dataInstance=[DataInstance|EString]
)
(
(unassignedMember=UnassignedMemberTreatment)?
('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )?
('.' reduction+=MemberReference)*
)?
)
|
(
dataType=[StructuredDataType|EString]
(unassignedMember=UnassignedMemberTreatment)?
('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )
|
(
(unassignedMember=UnassignedMemberTreatment)?
('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )
)
|
{DataInstanceUse}
(
(dataType=[CollectionDataType|EString])?
(unassignedMember=UnassignedMemberTreatment)?
'{'
(item+=StaticDataUse ("," item+=StaticDataUse)*)?
'}'
)
//TODO: if for some reason the data instance use does have a name
//it will cause problems... same applies for other scenarios
//TODO: create a more elegant way to handle that gracefully)
//(name=EString)?
;
NumberAsIdentifier returns ecore::EString:
'-'? INT ('.' INT)?;
enum UnassignedMemberTreatment returns UnassignedMemberTreatment:
AnyValue = '?' | AnyValueOrOmit = '*';
LiteralValueUse returns LiteralValueUse:
{LiteralValueUse}
value=String0
(
':' dataType=[DataType|EString]
)?
;
MemberReference returns MemberReference:
member=[Member|EString]
;
FormalParameterUse returns FormalParameterUse:
parameter=[FormalParameter|EString]
('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )?
( "." reduction+=MemberReference)*
;
FunctionCall returns FunctionCall:
function=[Function|EString]
'('
(argument+=ParameterBinding ( "," argument+=ParameterBinding)*)?
')'
('.' reduction+=MemberReference)*
;
VariableUse returns VariableUse:
componentInstance=[ComponentInstance|EString]
'->'
variable=[Variable|EString]
('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )?
("." reduction+=MemberReference)*
;
TimeLabelUse returns TimeLabelUse:
//TODO: need to add kind
//TODO: need to add predefined function
timeLabel=[TimeLabel|EString]
;
ParameterBinding returns ParameterBinding:
parameter=[Parameter|EString]
':='
dataUse=DataUse
;
NoneValue returns OmitValue:
{OmitValue}
'omit'
;
AnyValue returns AnyValue:
'?'
(':' dataType=[DataType|EString])
;
AnyNoneValue returns AnyValueOrOmit:
{AnyValueOrOmit}
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
'*'
;
Annotation returns Annotation:
key=[AnnotationType|EString]
(':' value=String0)?
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
(name=EString)?
'}')?
';';
AnnotationType returns AnnotationType:
{AnnotationType}
'Annotation'
name=EString
('with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';';
Comment returns Comment:
'Note'
(name=EString)?
':'
body=String0
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';';
DataInstance returns DataInstance:
// SimpleDataInstance_Impl | StructuredDataInstance | Verdict | TimeLabel;
SimpleDataInstance_Impl | StructuredDataInstance;
DataType returns DataType:
SimpleDataType_Impl | StructuredDataType | Time;
EStringDot returns ecore::EString:
ID '.' ID
;
Function returns Function:
'Function'
name=EString
'(' (formalParameter+=FormalParameter ( "," formalParameter+=FormalParameter)* )? ')'
'returns'
returnType=[DataType|EString]
(':' body=String0)?
('with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';';
Member returns Member:
(isOptional=Optional)?
name=EString
'of' 'type'
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
dataType=[DataType|EString]
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?;
Optional returns ecore::EBoolean :
'optional'
;
MemberAssignment returns MemberAssignment:
member=[Member|EString]
'='
memberSpec=StaticDataUse
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
('name' name=EString)?
'}')?;
ParameterMapping returns ParameterMapping:
parameter=[Parameter|EString]
('mapped' 'to' parameterURI=String0)?
('as' name=EString)?
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';';
//OptionalBehaviour returns OptionalBehaviour:
// 'optionally'
// block=Block
// (
// 'with'
// '{'
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// ('test objectives' ':' testObjective+=[TestObjective|EString] ( "," testObjective+=[TestObjective|EString])* ';')?
// ('name' name=EString)?
// '}')?
// (exceptional+=ExceptionalBehaviour ( exceptional+=ExceptionalBehaviour)*)?
// (periodic+=PeriodicBehaviour ( periodic+=PeriodicBehaviour)* )?
// ';'
// ;
Package returns Package:
{Package}
'Package'
name=EString
'{'
(packagedElement+=PackageableElement ( packagedElement+=PackageableElement)* )?
(nestedPackage+=Package (nestedPackage+=Package)*)?
'}'
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
;
PackageableElement returns PackageableElement:
// AnnotationType | TestObjective | DataResourceMapping | DataElementMapping | SimpleDataType_Impl | SimpleDataInstance_Impl | StructuredDataType | StructuredDataInstance | Action_Impl | Function | Verdict | ComponentType | GateType | Time | TimeLabel | TestConfiguration | TestDescription;
AnnotationType | SimpleDataType_Impl | SimpleDataInstance_Impl | StructuredDataType | StructuredDataInstance | Function | Time | TestDescription;
Parameter returns Parameter:
Member | FormalParameter;
FormalParameter returns FormalParameter:
name=EString
'of' 'type'
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
dataType=[DataType|EString]
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?;
//Real returns Real:
// '-'? INT+'.'INT+
//;
//
SimpleDataInstance_Impl returns SimpleDataInstance:
dataType=[DataType|EString]
name=EString
('with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
;
SimpleDataType_Impl returns SimpleDataType:
{SimpleDataType}
//'Simple' 'Data' 'Type'
'Type'
name=EString
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';'
;
String0 returns ecore::EString:
STRING
;
StructuredDataInstance returns StructuredDataInstance:
{StructuredDataInstance}
dataType=[DataType|EString]
name=EString
('(' memberAssignment+=MemberAssignment (',' memberAssignment+=MemberAssignment)* ')' )?
('with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';'
;
StructuredDataType returns StructuredDataType:
{StructuredDataType}
//'Structured' 'Data' 'Type'
'Type'
name=EString
('(' member+=Member ( "," member+=Member)* ')')?
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';';
Time returns Time:
{Time}
'Time'
name=EString
('with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';';
TimeConstraint returns TimeConstraint:
(name=EString)?
timeConstraintExpression=DataUse
('with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
'}';
TimeLabel returns TimeLabel:
name=EString
// 'in'
// dataType=[DataType|EString]
('with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';';
Variable returns Variable:
'variable'
name=EString
'of' 'type'
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
dataType=[DataType|EString]
('with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
'}')?
';';
//
//StaticDataUse returns StaticDataUse:
// DataInstanceUse | AnyValue | AnyNoneValue | NoneValue;
//
//DataInstanceUse returns DataInstanceUse:
// //TODO: validate
// dataInstance=[DataInstance|EString]
// ('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )?
// ('.' reduction+=[Member|EString])*
// ('with'
// '{'
// ('name' name=EString)?
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// '}')?
// ;
//
//
//AnyNoneValue returns AnyNoneValue:
// 'any' 'or' 'no'
// dataType=[DataType|EString]
// (
// 'with'
// '{'
// ('reduction' '(' reduction+=[Member|EString] ( "," reduction+=[Member|EString])* ')' )?
// ('argument' '{' argument+=ParameterBinding ( "," argument+=ParameterBinding)* '}' )?
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// ('name' name=EString)?
// '}')?
// ;
//
//AnyValue returns AnyValue:
// 'any'
// dataType=[DataType|EString]
// (
// 'with'
// '{'
// ('reduction' '(' reduction+=[Member|EString] ( "," reduction+=[Member|EString])* ')' )?
// ('argument' '{' argument+=ParameterBinding ( "," argument+=ParameterBinding)* '}' )?
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// ('name' name=EString)?
// '}')?
// ;
//
//ParameterBinding returns ParameterBinding:
// parameter=[Parameter|EString]
// '='
// dataUse=DataUse
// (
// 'with'
// '{'
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// ('name' name=EString)?
// '}')?
// ;
//
//
//
//DataUse returns DataUse:
// DataInstanceUse | FunctionCall | FormalParameterUse | TimeLabelUse | VariableUse | AnyValue | AnyNoneValue | NoneValue;
//
//
//
//TimeLabelUse returns TimeLabelUse:
// timeLabel=[TimeLabel|EString]
// //('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )?
// //( "." reduction+=[Member|EString])*
// (
// 'with'
// '{'
// ('name' name=EString)?
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// '}')?;
//
//
//FormalParameterUse returns FormalParameterUse:
// 'parameter'
// parameter=[FormalParameter|EString]
// ('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )?
// ( "." reduction+=[Member|EString])*
// (
// 'with'
// '{'
// ('name' name=EString)?
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// '}')?;
//
//
//
//
//VariableUse returns VariableUse:
// //TODO: try to adjust syntax so that -> is not necessary
// componentInstance=[ComponentInstance|EString]
// '->'
// variable=[Variable|EString]
// ('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )?
// ("." reduction+=[Member|EString])*
// ('with'
// '{'
// ('name' name=EString)?
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// '}')?
// ;
//
//NoneValue returns NoneValue:
// 'no'
// dataType=[DataType|EString]
// (
// 'with'
// '{'
// ('argument' '{' argument+=ParameterBinding ( "," argument+=ParameterBinding)* '}' )?
// ('reduction' '(' reduction+=[Member|EString] ( "," reduction+=[Member|EString])* ')' )?
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// ('name' name=EString)?
// '}')?;
//
//
//FunctionCall returns FunctionCall:
// 'instance' 'returned' 'from'
// function=[Function|EString]
// '('
// (argument+=ParameterBinding ( "," argument+=ParameterBinding)*)?
// ')'
// ('.' reduction+=[Member|EString])*
// ('with'
// '{'
// ('name' name=EString)?
// (comment+=Comment (comment+=Comment)*)?
// (annotation+=Annotation (annotation+=Annotation)*)?
// '}')?
// ;
//
//
Interaction returns Message:
sourceGate=[GateReference|EStringDot]
('sends' | isTrigger=Trigger)
'to'
target+=Target ( "," target+=Target)*
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
('test' 'objectives' ':' testObjective+=[TestObjective|EString] ( "," testObjective+=[TestObjective|EString])* ';')?
('name' name=EString)? //USE FOR STEPS?
('time' 'label' timeLabel=TimeLabel)?
('time' 'constraints' ':' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* ';' )?
'}')?
';'
;
Trigger returns ecore::EBoolean :
'triggers'
;
Target returns Target:
targetGate=[GateReference|EStringDot]
(valueAssignment+=ValueAssignmentMessage)?
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
('name' name=EString)?
'}')?
;
ValueAssignmentMessage returns ValueAssignment:
//TODO: check what the correct syntax shall be
'where' 'it' 'is' 'assigned' 'to' variable=[Variable|EString]
(
'with'
'{'
(comment+=Comment (comment+=Comment)*)?
(annotation+=Annotation (annotation+=Annotation)*)?
('name' name=EString)?
'}')?
;
VerdictAssignment returns VerdictAssignment:
'set' 'verdict' 'to'
verdict=DataUse
;
Wait returns Wait:
( 'component' componentInstance=[ComponentInstance|EString])
'waits' 'for'
period=DataUse
;
Quiescence returns Quiescence:
('component' componentInstance=[ComponentInstance|EString] | 'gate' gateReference=[GateReference|EStringDot])
'is' 'quiet' 'for'
period=DataUse
;
TestDescription returns TestDescription:
'Test' 'Description'
name=EString
('(' formalParameter+=FormalParameter ( "," formalParameter+=FormalParameter)* ')')?
('uses' 'configuration' testConfiguration=[TestConfiguration|EString])
(behaviourDescription=BehaviourDescription)?
;
TestDescriptionReference returns TestDescriptionReference:
testDescription=[TestDescription|EString]
('(' actualParameter+=ParameterBinding ( "," actualParameter+=ParameterBinding)* ')' )?
(componentInstanceBinding+=ComponentInstanceBinding ( "," componentInstanceBinding+=ComponentInstanceBinding)*)?
;
ComponentInstanceBinding returns ComponentInstanceBinding:
actualComponent=[ComponentInstance|EString]
'->' formalComponent=[ComponentInstance|EString]
;
BehaviourDescription returns BehaviourDescription:
behaviour=Behaviour
;
Behaviour returns Behaviour:
Wait
| Quiescence
| CompoundBehaviour
| TestDescriptionReference
| Interaction
| Assertion
| Assignment
;
Block returns Block:
('[' guard+=LocalExpression ']')?
'{'
behaviour+=Behaviour ( behaviour+=Behaviour)*
'}'
;
LocalExpression returns LocalExpression:
expression=DataUse
;
CompoundBehaviour returns CompoundBehaviour:
block=Block
;
Assignment returns Assignment:
(componentInstance=[ComponentInstance|EString] '->')?
('name' name=EString)?
variable=VariableUse
'='
expression=DataUse
;
Assertion returns Assertion:
{Assertion}
condition=DataUse
('otherwise' otherwise=DataUse)?
;
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
PredefinedFunctionCall returns PredefinedFunctionCall:
PredefinedFunctionCallSize | PredefinedFunctionCallNot | PredefinedFunctionCallBinary
;
PredefinedFunctionCallSize returns PredefinedFunctionCall:
function=[PredefinedFunction|PredefinedIdentifierSize]
'('
actualParameters+=DataUse
')'
;
PredefinedFunctionCallNot returns PredefinedFunctionCall:
function=[PredefinedFunction|PredefinedIdentifierNot]
'('
actualParameters+=DataUse
')'
;
PredefinedFunctionCallBinary returns PredefinedFunctionCall:
'('
actualParameters+=DataUse
function=[PredefinedFunction|PredefinedIdentifierBinary]
actualParameters+=DataUse
')'
;
PredefinedIdentifierBinary returns ecore::EString:
'+' | '-' | '*' | '/' | 'mod'
| '>' | '<' | '>=' | '<=' | '>='
| '==' | '!=' | 'and' | 'or' | 'xor'
;
PredefinedIdentifierNot returns ecore::EString:
'not'
;
PredefinedIdentifierSize returns ecore::EString:
'size'
;
TimerStart returns TimerStart:
'start'
componentInstance=[ComponentInstance|EString]
'.'
timer=[Timer|EString]
'for'
period=DataUse
;
BoundedLoopBehaviour returns BoundedLoopBehaviour:
'repeat'
numIteration+=LocalExpression
'times'
// 'from' startValue=DataInstanceSpecification
// 'to' endValue=DataInstanceSpecification
// ('with step' stepValue=DataInstanceSpecification)?
block=Block
;