Commit 2605e2cb authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ grammar refinements (data + configuration, WIP, lots of open

questions)
parent eb079c21
Loading
Loading
Loading
Loading
+276 −3
Original line number Diff line number Diff line
@@ -26,8 +26,20 @@ Package returns tdl::Package:
;

PackageableElement returns tdl::PackageableElement:
//    AnnotationType | TestObjective | DataResourceMapping | DataElementMapping | SimpleDataType_Impl | SimpleDataInstance | StructuredDataType | StructuredDataInstance | Action_Impl | Function | ComponentType | GateType | Time | TestConfiguration | TestDescription | PredefinedFunction | ProcedureSignature | CollectionDataType | CollectionDataInstance;
    AnnotationType | TestObjective  | DataResourceMapping | DataElementMapping | SimpleDataType_Impl | SimpleDataInstance | StructuredDataType | StructuredDataInstance
    AnnotationType | TestObjective
     | DataResourceMapping | DataElementMapping
     | SimpleDataType_Impl | SimpleDataInstance 
     | StructuredDataType | StructuredDataInstance 
     | CollectionDataType | CollectionDataInstance
     | ProcedureSignature 
     //TODO:fix problems with ambiguity
//     | Action_Impl | Function 
     | PredefinedFunction 
//     | Time 
     | ComponentType | GateType 
     | TestConfiguration 
     | TestDescription 
     
//    | PredefinedAnnotationType
;

@@ -143,7 +155,9 @@ SimpleDataInstance returns tdl::SimpleDataInstance:

StructuredDataType returns tdl::StructuredDataType:
    {tdl::StructuredDataType}
    (annotation+=AtAnnotation)*
    //TODO: add to all other elements?
    //TODO: extract to packageable element?
    PrefixFragment
    'Type'
    name=EString
    extension=Extension?
@@ -161,6 +175,7 @@ Member returns tdl::Member:
    ;

StructuredDataInstance returns tdl::StructuredDataInstance:
    PrefixFragment
    dataType=[tdl::DataType|EString]
    name=EString
    (unassignedMember=UnassignedMemberTreatment)?
@@ -176,14 +191,104 @@ MemberAssignment returns tdl::MemberAssignment:
    WithFragmentNested?
;

//TODO: test below
//TODO: stick with existing syntax and address urgent issues or
//      invent new parts? -> stick with existing and refine!!!! 
//      currently: a bit of reinvention

CollectionDataType returns tdl::CollectionDataType:
    PrefixFragment
    'Collection'
    name=EString
    'of' itemType=[tdl::DataType|EString]
;

CollectionDataInstance returns tdl::CollectionDataInstance:
    PrefixFragment
    //TODO: angle brackets?
    '['dataType=[tdl::DataType|EString]']'
    name=EString
    (BEGIN
        item+=StaticDataUse*
    END)?
;

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

ProcedureParameter returns tdl::ProcedureParameter:
    kind=ParameterKind
    dataType=[tdl::DataType|EString]
    name=EString
    WithFragmentNested?
;

enum ParameterKind returns tdl::ParameterKind:
    //TODO: add @ prefixes?
    In = 'in' | Out = 'out' | Exception = 'exception';

Parameter returns tdl::Parameter:
    Member | FormalParameter | ProcedureParameter;

FormalParameter returns tdl::FormalParameter:
    dataType=[tdl::DataType|EString]
    name=EString
    //TODO: fix fragments
    //WithFragmentNested
;

Variable returns tdl::Variable:
    PrefixFragment
    dataType=[tdl::DataType|EString]
    'variable'
    name=EString
;

//TODO: remove?
Action returns tdl::Action:
    Action_Impl | Function;

Action_Impl returns tdl::Action:
    {tdl::Action}
    PrefixFragment
    'Action'
    name=EString
    (formalParameter+=FormalParameter ( "," formalParameter+=FormalParameter)*)?
    (':' body=EString)?
    ;
    
Function returns tdl::Function:
    PrefixFragment
    'Function'
    name=EString
    (formalParameter+=FormalParameter ( "," formalParameter+=FormalParameter)*)?
    'returns' returnType=[tdl::DataType|EString]
    (':' body=EString)?
;


enum UnassignedMemberTreatment returns tdl::UnassignedMemberTreatment:
    AnyValue = '?' | AnyValueOrOmit = '*';

//TODO: check how this was handled before
//TODO: check all prefix fragments and whether there shall be 
//      with fragments as well for compatibility
PredefinedFunction returns tdl::PredefinedFunction:
    {tdl::PredefinedFunction}
    PrefixFragment
    'Predefined'
    name=EString
    ('returns' returnType=[tdl::DataType|EString])?
;

//## Data Use

//TODO: continue with data use...

StaticDataUse returns tdl::StaticDataUse:
    OmitValue //| AnyValue | AnyValueOrOmit | DataInstanceUse | LiteralValueUse
;
@@ -197,29 +302,190 @@ OmitValue returns tdl::OmitValue:

//# Time

Timer returns tdl::Timer:
    {tdl::Timer}
    PrefixFragment
    'timer'
    name=EString
;

//TODO: continue with the rest

//# Test Configuration

//TODO: test all and refine

GateType returns tdl::GateType:
    kind=GateTypeKind
    'Gate'
    name=EString
    ('extends' extension=Extension)?
    'supports' dataType+=[tdl::DataType|EString] ( "," dataType+=[tdl::DataType|EString])*  
;

enum GateTypeKind returns tdl::GateTypeKind:
    Message = 'Message' | Procedure = 'Procedure';

GateInstance returns tdl::GateInstance:
    PrefixFragment
    type=[tdl::GateType|EString]
    'gate'
    name=EString
;

ComponentType returns tdl::ComponentType:
    PrefixFragment
    'Component'
    name=EString
    ('extends' extension=Extension)?
    //TODO: align order
    BEGIN
        (gateInstance+=GateInstance)+ 
        (timer+=Timer)*
        (variable+=Variable)*
    END
;

ComponentInstance returns tdl::ComponentInstance:
    PrefixFragment
    type=[tdl::ComponentType|EString]
    'component'
    name=EString
    'as'
    //TODO: or use annotation syntax?
    role=ComponentInstanceRole
;

enum ComponentInstanceRole returns tdl::ComponentInstanceRole:
    SUT = 'SUT' | Tester = 'Tester';

GateReference returns tdl::GateReference:
    //name=EString
    //TODO: check how it was done previously
    //TODO: fix fragments
    component=[tdl::ComponentInstance|EString]
    '.' 
    gate=[tdl::GateInstance|EString]
//    WithFragmentNested?
//    NameFragment?
    ;
Connection returns tdl::Connection:
    'connect'
    endPoint+=GateReference ( 'to' endPoint+=GateReference)+ 
    //TODO: fix fragments
//    WithFragmentNested?
//    NameFragment?
    ;


TestConfiguration returns tdl::TestConfiguration:
    PrefixFragment
    'Configuration'
    name=EString
    BEGIN
        //TODO: enforce +?
        (componentInstance+=ComponentInstance)* 
        (connection+=Connection)* 
    END
;

//# Test Behaviour

//## Test Description

TestDescription returns tdl::TestDescription:
    PrefixFragment
    //TODO: add into a separate fragment?
    //TODO: Use @-prefix for objectives and notes?
    ('Objective' '(' testObjective+=[tdl::TestObjective|EString] ( "," testObjective+=[tdl::TestObjective|EString])* ')' )?
    'TestDescription'
    (isLocallyOrdered?='Implementation')?
    name=EString
    ('(' formalParameter+=FormalParameter ( "," formalParameter+=FormalParameter)* ')' )?
    'uses' testConfiguration=[tdl::TestConfiguration|EString]
    BEGIN
        (behaviourDescription=BehaviourDescription)?
    END
;

BehaviourDescription returns tdl::BehaviourDescription:
    behaviour=Behaviour
    //TODO: fix fragments
//    NameFragment?
//    WithFragmentNested?
;

//## Combined Behaviour

Behaviour returns tdl::Behaviour:
    //TimerStart | TimerStop | TimeOut | Wait | Quiescence | PeriodicBehaviour | AlternativeBehaviour | ParallelBehaviour | BoundedLoopBehaviour | OptionalBehaviour | UnboundedLoopBehaviour | ConditionalBehaviour | CompoundBehaviour | DefaultBehaviour | InterruptBehaviour | VerdictAssignment | Assertion | Stop | Break | Assignment | InlineAction | ActionReference | TestDescriptionReference | Interaction_Impl | Message | ProcedureCall;
    TimerStart | TimerStop
;


//## Atomic Behaviour



TimerStart returns tdl::TimerStart:
    PrefixFragment
    //TODO: add into a separate fragment?
    ('Objective' '(' testObjective+=[tdl::TestObjective|EString] ( "," testObjective+=[tdl::TestObjective|EString])* ')' )?
    'start'
    componentInstance=[tdl::ComponentInstance|EString]
    '.'
    timer=[tdl::Timer|EString]
    'for' period=StaticDataUse
    //TODO: shortcut, restore original
    //'for' period=DataUse
//    NameFragment?
    //TODO: extract to fragment
    //('timeConstraint' '{' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* '}' )?
    //('timeLabel' timeLabel=TimeLabel)?
;

TimerStop returns tdl::TimerStop:
    PrefixFragment
    //TODO: add into a separate fragment?
    ('Objective' '(' testObjective+=[tdl::TestObjective|EString] ( "," testObjective+=[tdl::TestObjective|EString])* ')' )?
    'stop'
    componentInstance=[tdl::ComponentInstance|EString]
    '.'
    timer=[tdl::Timer|EString]
//    NameFragment
    //TODO: extract to fragment
    //('timeConstraint' '{' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* '}' )?
    //('timeLabel' timeLabel=TimeLabel)?
;

TimeOut returns tdl::TimeOut:
    PrefixFragment
    //TODO: add into a separate fragment?
    ('Objective' '(' testObjective+=[tdl::TestObjective|EString] ( "," testObjective+=[tdl::TestObjective|EString])* ')' )?
    'expire'
    componentInstance=[tdl::ComponentInstance|EString]
    '.'
    timer=[tdl::Timer|EString]
//    NameFragment?
    //TODO: extract to fragment
    //('timeConstraint' '{' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* '}' )?
    //('timeLabel' timeLabel=TimeLabel)?
;



//# Auxiliary

//## Fragments

//Use: contained/standalone  block
fragment WithFragmentNested returns tdl::Element:
    BEGIN
    WithFragment
    END
;

//Use: inline block - within other blocks, e.g. with other contents 
fragment WithFragment returns tdl::Element:
    ('With:'
        BEGIN
@@ -229,6 +495,13 @@ fragment WithFragment returns tdl::Element:
    )
;

//Use: for packageable elements
fragment PrefixFragment returns tdl::Element:
    (comment+=Comment)*
    (annotation+=AtAnnotation)*
;


fragment NameFragment returns tdl::Element:
    'Name:' name=EString
;