Commit 654e43c7 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

* mostly formatting improvements, removed actions, lowercased timelabelusekind

parent 7c08c161
Loading
Loading
Loading
Loading
+56 −149
Original line number Diff line number Diff line
@@ -15,10 +15,8 @@ import "http://www.etsi.org/spec/TDL/1.3.1/configurations" as extendedconfigurat

//Needs to be the first rule
Package returns tdl::Package:
    {tdl::Package}
    AnnotationFragment
    'Package'
    name=Identifier
    'Package' name=Identifier
    BEGIN
        (^import+=ElementImport)*
        (packagedElement+=PackageableElement)*
@@ -61,7 +59,6 @@ PackageableElement returns tdl::PackageableElement:


ElementImport returns tdl::ElementImport:
    {tdl::ElementImport} 
    AnnotationCommentFragment
    'Import'
    ('all' | 
@@ -82,18 +79,14 @@ Annotation returns tdl::Annotation:
;

AnnotationType returns tdl::AnnotationType:
    {tdl::AnnotationType}
    AnnotationCommentFragment
    'AnnotationType'
    name=Identifier
    'AnnotationType' name=Identifier
    extension=Extension?
;

TestObjective returns tdl::TestObjective:
    {tdl::TestObjective}
    AnnotationCommentFragment
    'TestObjective'
    name=Identifier
    'TestObjective' name=Identifier
    (
        BEGIN
            ('Description:' description=EString)?
@@ -109,8 +102,7 @@ Extension returns tdl::Extension:

ConstraintType returns tdl::ConstraintType: 
    AnnotationCommentFragment
    'Constraint'
    name=Identifier
    'Constraint' name=Identifier
;

Constraint returns tdl::Constraint: 
@@ -124,17 +116,14 @@ Constraint returns tdl::Constraint:
//## Data Definition

DataResourceMapping returns tdl::DataResourceMapping:
    {tdl::DataResourceMapping}
    AnnotationCommentFragment
    'Use'
    resourceURI=EString
    'Use' resourceURI=EString
    'as' name=Identifier
;

DataElementMapping returns tdl::DataElementMapping:
    AnnotationCommentFragment
    'Map' 
    mappableDataElement=[tdl::MappableDataElement|Identifier]
    'Map' mappableDataElement=[tdl::MappableDataElement|Identifier]
    ('to' elementURI=EString)?
    'in' dataResourceMapping=[tdl::DataResourceMapping|Identifier]
    'as' name=Identifier
@@ -153,11 +142,9 @@ ParameterMapping returns tdl::ParameterMapping:


SimpleDataType_Impl returns tdl::SimpleDataType:
    {tdl::SimpleDataType}
    AnnotationCommentFragment
    'Type'
    ConstraintFragment?
    name=Identifier
    'Type' name=Identifier
;

SimpleDataInstance returns tdl::SimpleDataInstance:
@@ -168,12 +155,9 @@ SimpleDataInstance returns tdl::SimpleDataInstance:

//TODO: alternative specification dialects?
StructuredDataType returns tdl::StructuredDataType:
    {tdl::StructuredDataType}
    AnnotationCommentFragment
    'Type'
    //TODO: reconsider order (conflicts, also for other types)
    ConstraintFragment?
    name=Identifier
    'Type' name=Identifier
    extension=Extension?
    '('
        (member+=Member (',' member+=Member)*)?
@@ -212,9 +196,8 @@ MemberAssignment returns tdl::MemberAssignment:

CollectionDataType returns tdl::CollectionDataType:
    AnnotationCommentFragment
    'Collection'
    name=Identifier
    ConstraintFragment?
    'Collection' name=Identifier
    'of' itemType=[tdl::DataType|Identifier]
;

@@ -227,8 +210,7 @@ CollectionDataInstance returns tdl::CollectionDataInstance:

ProcedureSignature returns tdl::ProcedureSignature:
    AnnotationCommentFragment
    'Signature'
    name=Identifier
    'Signature' name=Identifier
    '(' parameter+=ProcedureParameter ( "," parameter+=ProcedureParameter)* ')'
;

@@ -256,8 +238,7 @@ FormalParameter returns tdl::FormalParameter:

Variable returns tdl::Variable:
    AnnotationCommentFragment
    'variable'
    dataType=[tdl::DataType|Identifier]
    'variable' dataType=[tdl::DataType|Identifier]
    name=Identifier
    WithCommentFragment?
;
@@ -267,18 +248,15 @@ Action returns tdl::Action:
    Action_Impl | Function;

Action_Impl returns tdl::Action:
    {tdl::Action}
    AnnotationCommentFragment
    'Action'
    name=Identifier
    'Action' name=Identifier
    ('(' formalParameter+=FormalParameter ( "," formalParameter+=FormalParameter)* ')')?
    (':' body=EString)?
    ;
    
Function returns tdl::Function:
    AnnotationCommentFragment
    'Function'
    name=Identifier
    'Function' name=Identifier
    ('(' formalParameter+=FormalParameter ( "," formalParameter+=FormalParameter)* ')')?
    'returns' returnType=[tdl::DataType|Identifier]
    (':' body=EString)?
@@ -288,7 +266,6 @@ enum UnassignedMemberTreatment returns tdl::UnassignedMemberTreatment:
    AnyValue = '?' | AnyValueOrOmit = '*';

PredefinedFunction returns tdl::PredefinedFunction:
    {tdl::PredefinedFunction}
    AnnotationCommentFragment
    'Predefined' 
    (name=PredefinedIdentifierBinary
@@ -314,8 +291,7 @@ PredefinedIdentifierSize returns ecore::EString:

EnumDataType returns tdl::EnumDataType: 
    AnnotationCommentFragment
    'Enumerated'
    name=Identifier
    'Enumerated' name=Identifier
    BEGIN
        //TODO: without type specification?
        (value+=SimpleDataInstance)+
@@ -335,7 +311,6 @@ ParameterBinding returns tdl::ParameterBinding:
;

MemberReference returns tdl::MemberReference:
    {tdl::MemberReference}
    member=[tdl::Member|Identifier] 
    (->'[' collectionIndex=DataUse ']')? 
;
@@ -352,7 +327,6 @@ StaticDataUse returns tdl::StaticDataUse:
;

DataInstanceUse returns tdl::DataInstanceUse:
    {tdl::DataInstanceUse}
    (dataInstance=[tdl::DataInstance|Identifier]
    |
    ('a' dataType=[tdl::StructuredDataType|Identifier]))
@@ -407,23 +381,19 @@ SpecialValueUse returns tdl::SpecialValueUse:
;

AnyValue returns tdl::AnyValue:
    {tdl::AnyValue}
    name='?'
    ('of' 'type' dataType=[tdl::DataType|Identifier])?
;

AnyValueOrOmit returns tdl::OmitValue:
    {tdl::OmitValue}
    name='*'
;

OmitValue returns tdl::OmitValue:
    {tdl::OmitValue}
    name='omit'
;

LiteralValueUse returns tdl::LiteralValueUse:
    {tdl::LiteralValueUse}
    //NOTE: Reduction and argument are excluded
    (value=STRING | intValue=BIGINTEGER | boolValue=BOOLEAN)
    //TODO: add option to have the type after wards without any keyword e.g. 100 s?
@@ -440,15 +410,13 @@ DynamicDataUse returns tdl::DynamicDataUse:

FunctionCall returns tdl::FunctionCall:
    //TODO: refine syntax
    'instance' 'returned' 'from'
    function=[tdl::Function|Identifier] 
    'instance' 'returned' 'from' function=[tdl::Function|Identifier] 
    '(' BareParameterBindingFragment? ')'
    ReductionFragment
;

FormalParameterUse returns tdl::FormalParameterUse:
    'parameter'
    parameter=[tdl::FormalParameter|Identifier]
    'parameter' parameter=[tdl::FormalParameter|Identifier]
    ParameterBindingFragment?
    ReductionFragment
;
@@ -489,14 +457,11 @@ PredefinedFunctionCallBinary returns tdl::PredefinedFunctionCall:
//# Time

Time returns tdl::Time:
    {tdl::Time}
    AnnotationCommentFragment
    'Time'
    name=Identifier
    'Time' name=Identifier
;

TimeLabel returns tdl::TimeLabel:
    {tdl::TimeLabel}
    //NOTE: No annotations or comments
    name=Identifier
;
@@ -510,7 +475,7 @@ TimeLabelUse returns tdl::TimeLabelUse:


enum TimeLabelUseKind returns tdl::TimeLabelUseKind:
    Last = 'Last' | Previous = 'Previous' | First = 'First'
    Last = 'last' | Previous = 'previous' | First = 'first'
;

TimeConstraint returns tdl::TimeConstraint:
@@ -519,10 +484,8 @@ TimeConstraint returns tdl::TimeConstraint:
;

Timer returns tdl::Timer:
    {tdl::Timer}
    AnnotationCommentFragment
    'timer'
    name=Identifier
    'timer' name=Identifier
;

TimeOperation returns tdl::TimeOperation: 
@@ -531,17 +494,14 @@ TimeOperation returns tdl::TimeOperation:

Wait returns tdl::Wait: 
    AtomicPrefixFragment
    'wait' 'for'
    period=DataUse
    'wait' 'for' period=DataUse
    ( 'on' componentInstance=[tdl::ComponentInstance|Identifier])
;

Quiescence returns tdl::Quiescence: 
    AtomicPrefixFragment
    'quiet' 'for'
    period=DataUse 
    (
        'on' (
    'quiet' 'for' period=DataUse 
    (  'on' (
            componentInstance=[tdl::ComponentInstance|Identifier] 
            | gateReference=[tdl::GateReference|IdentifierDot]
        )
@@ -555,28 +515,22 @@ TimerOperation returns tdl::TimerOperation:

TimerStart returns tdl::TimerStart:
    AtomicPrefixFragment
    'start'
    componentInstance=[tdl::ComponentInstance|Identifier]
    'start' componentInstance=[tdl::ComponentInstance|Identifier]
    //TODO: use '->' instead?
    '.'
    timer=[tdl::Timer|Identifier]
    '.' timer=[tdl::Timer|Identifier]
    'for' period=DataUse
;

TimerStop returns tdl::TimerStop:
    AtomicPrefixFragment
    'stop'
    componentInstance=[tdl::ComponentInstance|Identifier]
    '.'
    timer=[tdl::Timer|Identifier]
    'stop' componentInstance=[tdl::ComponentInstance|Identifier]
    '.' timer=[tdl::Timer|Identifier]
;

TimeOut returns tdl::TimeOut:
    AtomicPrefixFragment
    'time' 'out' 'on'
    componentInstance=[tdl::ComponentInstance|Identifier]
    '.'
    timer=[tdl::Timer|Identifier]
    'time' 'out' 'on' componentInstance=[tdl::ComponentInstance|Identifier]
    '.' timer=[tdl::Timer|Identifier]
;

//# Test Configuration
@@ -584,8 +538,7 @@ TimeOut returns tdl::TimeOut:
GateType returns tdl::GateType:
    AnnotationCommentFragment
    kind=GateTypeKind
    'Gate'
    name=Identifier
    'Gate' name=Identifier
    (extension=Extension)?
    'accepts' dataType+=[tdl::DataType|Identifier] ( "," dataType+=[tdl::DataType|Identifier])*
;
@@ -595,16 +548,14 @@ enum GateTypeKind returns tdl::GateTypeKind:

GateInstance returns tdl::GateInstance:
    AnnotationCommentFragment
    'gate'
    type=[tdl::GateType|Identifier]
    'gate' type=[tdl::GateType|Identifier]
    name=Identifier
    WithCommentFragment?  
;

ComponentType returns tdl::ComponentType:
    AnnotationCommentFragment
    'Component'
    name=Identifier
    'Component' name=Identifier
    (extension=Extension)?
    BEGIN
        (timer+=Timer)*
@@ -615,8 +566,7 @@ ComponentType returns tdl::ComponentType:

ComponentInstance returns tdl::ComponentInstance:
    AnnotationCommentFragment
    'create'
    role=ComponentInstanceRole
    'create' role=ComponentInstanceRole
    name=Identifier
    'of' 'type' type=[tdl::ComponentType|Identifier]
;
@@ -634,16 +584,15 @@ GateReference returns tdl::GateReference:

Connection returns tdl::Connection:
    AnnotationCommentFragment
    'connect'
    endPoint+=GateReference 'to' endPoint+=GateReference
    'connect' endPoint+=GateReference 
    'to' endPoint+=GateReference
    WithNameFragment?
;


TestConfiguration returns tdl::TestConfiguration:
    AnnotationCommentFragment
    'Configuration'
    name=Identifier
    'Configuration' name=Identifier
    BEGIN
        (componentInstance+=ComponentInstance)* 
        (connection+=Connection)* 
@@ -694,8 +643,7 @@ LocalExpression returns tdl::LocalExpression:

LocalLoopExpression returns tdl::LocalExpression:
    //NOTE: No annotations or comments
    expression=DataUse
    'times'
    expression=DataUse 'times'
    ('on' scope=[tdl::ComponentInstance|Identifier])?
;

@@ -719,21 +667,18 @@ CompoundBehaviour returns tdl::CompoundBehaviour:

BoundedLoopBehaviour returns tdl::BoundedLoopBehaviour:
    AnnotationFragment
    'repeat'
    numIteration+=LocalLoopExpression (',' numIteration+=LocalLoopExpression)*
    'repeat' numIteration+=LocalLoopExpression (',' numIteration+=LocalLoopExpression)*
    block=Block
;

UnboundedLoopBehaviour returns tdl::UnboundedLoopBehaviour:
    AnnotationFragment
    'repeat'
    block=Block
    'repeat' block=Block
;

OptionalBehaviour returns tdl::OptionalBehaviour:
    AnnotationFragment
    'optionally'
    block=Block
    'optionally' block=Block
;

MultipleCombinedBehaviour returns tdl::MultipleCombinedBehaviour:
@@ -752,8 +697,7 @@ ConditionalBehaviour returns tdl::ConditionalBehaviour:

AlternativeBehaviour returns tdl::AlternativeBehaviour:
    AnnotationFragment
    'alternatively'
    block+=Block
    'alternatively' block+=Block
    //TODO: enforce 2+? 
    ('or' block+=Block)* 
;
@@ -822,15 +766,13 @@ Stop returns tdl::Stop:

VerdictAssignment returns tdl::VerdictAssignment:
    AtomicPrefixFragment
    'set' 'verdict' 'to'
    verdict=DataUse
    'set' 'verdict' 'to' verdict=DataUse
;

Assertion returns tdl::Assertion:
    {tdl::Assertion}
    AtomicPrefixFragment
    'assert'
    condition=DataUse
    'assert' condition=DataUse
    ('on' componentInstance=[tdl::ComponentInstance|Identifier])?
    //TODO: simplify syntax
    ('otherwise' 'set' 'verdict' 'to' otherwise=DataUse)?
@@ -846,8 +788,7 @@ Message returns tdl::Message:
//    | sourceGate=[tdl::GateReference|Identifier]
    ('sends' | (isTrigger?='triggers')) 
    argument=DataUse
    'to' 
    target+=TargetMessage ( "," target+=TargetMessage)* 
    'to' target+=TargetMessage ( "," target+=TargetMessage)* 
;

TargetMessage returns tdl::Target:
@@ -869,11 +810,9 @@ ReceiveMessage returns tdl::Message:
    AtomicPrefixFragment
    //NOTE: Only single target possible
    target+=ReceiveTargetMessage //( "," target+=ReceiveTargetMessage)*
    'receives' 
    (isTrigger?='trigger')? 
    'receives' (isTrigger?='trigger')? 
    argument=DataUse
    'from' 
    sourceGate=[tdl::GateReference|IdentifierDot]
    'from' sourceGate=[tdl::GateReference|IdentifierDot]
;

ReceiveTargetMessage returns tdl::Target:
@@ -892,11 +831,9 @@ ReceiveValueAssignmentMessage returns tdl::ValueAssignment:
ProcedureCall returns tdl::ProcedureCall:
    AtomicPrefixFragment
    sourceGate=[tdl::GateReference|IdentifierDot]
    'calls' 
    signature=[tdl::ProcedureSignature|Identifier]
    'calls' signature=[tdl::ProcedureSignature|Identifier]
    '('argument+=ParameterBinding ("," argument+=ParameterBinding)*')'
    'on' 
    target+=TargetProcedure
    'on' target+=TargetProcedure
;

ProcedureCallResponse returns tdl::ProcedureCall:
@@ -904,12 +841,9 @@ ProcedureCallResponse returns tdl::ProcedureCall:
    //TODO: this shall probably be switched
    (replyTo=[tdl::ProcedureCall|Identifier] ':')?
    sourceGate=[tdl::GateReference|IdentifierDot]
    'responds'
    'with' 
    signature=[tdl::ProcedureSignature|Identifier]
    'responds' 'with' signature=[tdl::ProcedureSignature|Identifier]
    '('argument+=ParameterBinding ("," argument+=ParameterBinding)*')'
    'to' 
    target+=TargetProcedure
    'to' target+=TargetProcedure
;

TargetProcedure returns tdl::Target:
@@ -927,8 +861,7 @@ ValueAssignmentProcedure returns tdl::ValueAssignment:
    
TestDescriptionReference returns tdl::TestDescriptionReference:
    AtomicPrefixFragment
    'execute'
    testDescription=[tdl::TestDescription|Identifier]
    'execute' testDescription=[tdl::TestDescription|Identifier]
    ('(' actualParameter+=ParameterBinding ( "," actualParameter+=ParameterBinding)* ')' )?
    (BEGIN
        componentInstanceBinding+=ComponentInstanceBinding (',' componentInstanceBinding+=ComponentInstanceBinding)+
@@ -947,8 +880,7 @@ ActionBehaviour returns tdl::ActionBehaviour:

ActionReference returns tdl::ActionReference:
    AtomicPrefixFragment
    'perform'
    action=[tdl::Action|Identifier]
    'perform' action=[tdl::Action|Identifier]
    ('(' actualParameter+=ParameterBinding ( "," actualParameter+=ParameterBinding)* ')' )?
    ('on' componentInstance=[tdl::ComponentInstance|Identifier])?
;
@@ -956,16 +888,14 @@ ActionReference returns tdl::ActionReference:
InlineAction returns tdl::InlineAction:
    AtomicPrefixFragment
    //TODO: simplify syntax further
    'perform' 'action' ':'
    body=EString
    'perform' 'action' ':' body=EString
    ('on' componentInstance=[tdl::ComponentInstance|Identifier])?
;

Assignment returns tdl::Assignment:
    AtomicPrefixFragment
    variable=VariableUse
    '=' 
    expression=DataUse
    '=' expression=DataUse
    ('on' componentInstance=[tdl::ComponentInstance|Identifier])?
;

@@ -1146,29 +1076,6 @@ fragment WithCombinedFragment returns tdl::CombinedBehaviour:
;




//fragment PrefixNameFragment returns tdl::Element:
//    '@' NameFragment
//;
//
//fragment PrefixObjectiveFragment returns tdl::Behaviour:
//    '@' ObjectiveFragment
//;
//
//fragment PrefixTDObjectiveFragment returns tdl::TestDescription:
//    '@' TDObjectiveFragment
//;
//
//fragment PrefixTimeConstraintFragment returns tdl::AtomicBehaviour:
//    '@' TimeConstraintFragment
//;
//
//fragment PrefixTimeLabelFragment returns tdl::AtomicBehaviour:
//    '@' TimeLabelFragment
//;


//## ValueConverter Rules (Pseudo-terminals)

//TODO: why does this strip quotes when it is a single word?