Commit 479e2bf4 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ grammar alignment for part 4 + other fixes, #208

parent 120e91b7
Loading
Loading
Loading
Loading
+158 −124
Original line number Diff line number Diff line
@@ -37,14 +37,14 @@ PackageableElement returns tdl::PackageableElement:
     | ComponentType | GateType 
     | TestConfiguration 
     | TestDescription
     | TestPurposeDescription
     | TestVariantDescription
    //Part 4
    | Entity 
    | Event 
    | PICS
    | StructuredTestObjective
    | EventSpecificationTemplate
    | TestPurposeDescription
    | TestVariantDescription
    //Part 7
    | ExtendedTestConfiguration
    )
@@ -277,7 +277,6 @@ MemberAssignment returns tdl::MemberAssignment:
//CollectionDataType
CollectionDataType returns tdl::CollectionDataType:
    AnnotationCommentFragment
    PIXITAnnotationFragment?
    'Collection' name=Identifier
    ConstraintFragment
    'of' itemType=[tdl::DataType|Identifier]
@@ -286,6 +285,7 @@ CollectionDataType returns tdl::CollectionDataType:
//CollectionDataInstance
CollectionDataInstance returns tdl::CollectionDataInstance:
    AnnotationCommentFragment
    PIXITAnnotationFragment?
    dataType=[tdl::DataType|Identifier] 
    name=Identifier
    (unassignedMember=UnassignedMemberTreatment)?
@@ -373,6 +373,7 @@ PredefinedIdentifierBinary returns ecore::EString:
    | PredefinedIdentifierAnd
    | PredefinedIdentifierEquality
    | PredefinedIdentifierRelational
    | PredefinedIdentifierAdditive
    | PredefinedIdentifierMultiplicative
;

@@ -493,6 +494,7 @@ DataUseWrapped returns tdl::DataUse:
    | LParen DataUse RParen
;

//no longer used
fragment ReductionFragment returns tdl::DataUse:
    (reduction+=MemberReference)+
;
@@ -596,19 +598,6 @@ LiteralValueUse returns tdl::LiteralValueUse:
	CheckFragment?
;

CastDataUse returns tdl::CastDataUse:
	LParen
	//TODO: switch to 'from' keword?
    '<' dataType=[tdl::DataType|Identifier] '>'
    //dataType=[tdl::DataType|Identifier] 'from' 
	dataUse=DataUse
	//TODO: causes ambiguity
//	'as' dataType=[tdl::DataType|Identifier]
    RParen
	ParameterBindingFragment?
	// ReductionFragment now handled by PostfixExpression
;

//DynamicDataUse
DynamicDataUse returns tdl::DynamicDataUse:
    FunctionCall
@@ -645,7 +634,6 @@ VariableUse returns tdl::VariableUse:
    // ReductionFragment now handled by PostfixExpression
;

//TODO: towards scoped components
VariableUseAssignment returns tdl::VariableUse:
    (componentInstance=[tdl::ComponentInstance|Identifier] '::')? 
    variable=[tdl::Variable|Identifier]
@@ -653,6 +641,7 @@ VariableUseAssignment returns tdl::VariableUse:
;

//PredefinedFunctionCall
//no longer used
PredefinedFunctionCall returns tdl::PredefinedFunctionCall:
    PredefinedFunctionCallSize
    | PredefinedFunctionCallNot
@@ -665,16 +654,19 @@ PredefinedFunctionCallSize returns tdl::PredefinedFunctionCall:
    LParen actualParameters+=DataUse RParen
;

//no longer used
PredefinedFunctionCallNot returns tdl::PredefinedFunctionCall:
    function=[tdl::PredefinedFunction|PredefinedIdentifierNot]
    LParen actualParameters+=DataUse RParen
;

//no longer used
PredefinedFunctionCallMinus returns tdl::PredefinedFunctionCall:
    function=[tdl::PredefinedFunction|PredefinedIdentifierMinus]
    actualParameters+=DataUseWrapped
;

//no longer used
PredefinedFunctionCallBinary returns tdl::PredefinedFunctionCall:
    //Note: necessary to avoid left recursion
    LParen
@@ -684,6 +676,7 @@ PredefinedFunctionCallBinary returns tdl::PredefinedFunctionCall:
    RParen
;

//DataElementUse
DataElementUse returns tdl::DataElementUse:
    {tdl::DataElementUse}
    (
@@ -754,6 +747,21 @@ fragment CollectionItemFragment returns tdl::DataElementUse:
    '[' (item+=DataUse (',' item+=DataUse)*)? ']'
;

//CastDataUse
//Void.
//no longer used
CastDataUse returns tdl::CastDataUse:
	LParen
	//TODO: switch to 'from' keword?
    '<' dataType=[tdl::DataType|Identifier] '>'
    //dataType=[tdl::DataType|Identifier] 'from' 
	dataUse=DataUse
	//TODO: causes ambiguity
//	'as' dataType=[tdl::DataType|Identifier]
    RParen
	ParameterBindingFragment?
	// ReductionFragment now handled by PostfixExpression
;


//# Time
@@ -889,6 +897,7 @@ ComponentInstance returns tdl::ComponentInstance:
    'as' role=ComponentInstanceRole
;

//ComponentInstanceRole
enum ComponentInstanceRole returns tdl::ComponentInstanceRole:
    SUT = 'SUT' | Tester = 'Tester'
;
@@ -1445,7 +1454,9 @@ AIdentifier:
    | TestVariantDescriptionName
    | PICSName
    | PIXITName
    | 'when' | 'then' | 'check' | 'where'
    | When
    | Then 
    | CheckIdentifier
;

CheckIdentifier:
@@ -1558,11 +1569,13 @@ terminal END: '}';

//# Foundation

//Entity
Entity returns to::Entity:
    AnnotationCommentFragment
    'Entity' name=TOIdentifier
;

//Event
Event returns to::Event:
    AnnotationCommentFragment
    //DONE: extend identifiers with STRING or multi-word value converters?
@@ -1574,6 +1587,7 @@ Event returns to::Event:
    'Event' name=KIdentifier
;

//PICS
PICS returns to::PICS:
    AnnotationCommentFragment
    PICSName name=TOIdentifier
@@ -1594,6 +1608,7 @@ PICS returns to::PICS:
//DONE: See above regarding multiwords.. -> partially resolved
//DONE: Add predefined annotations for Blocks and Behaviours?

//Comment
Qualifier returns tdl::Comment:
    body=(TOIdentifier | NIdentifier) //DONE: Numbers as well? -> yes! Strings as well?? -> not for now!
;
@@ -1643,6 +1658,7 @@ QuantifiedQualifier returns tdl::Comment:
    | body='some'
;

//no longer used
ReferenceQualifier returns tdl::Comment:
    body=References
;
@@ -1661,6 +1677,8 @@ TimeConstraintQualifier returns tdl::Comment:
//      but also likely removing the formatting?
//      - also it will likely cause some conflicts, 
//      so it shall be used carefully where it makes sense only

//not used yet?
TimeConstraintQualifierRefined returns tdl::Comment:
    body=TimeConstraintKeyword
;
@@ -1669,22 +1687,10 @@ TimeConstraintKeyword returns ecore::EString:
    'before' | 'after' | 'during' | 'within'
;

//AnnotationType
//Void.

//TODO: this may need to be pulled to TX..
//TODO: quite a bit contrived.. -> may be restricted to TO... (separate editor?)
//@Override
//AnnotationType returns tdl::AnnotationType:
//    'Annotation' name = (
//        Identifier 
//        | InitialBlockName 
//        | ExpectedBlockName 
//        | FinalBlockName 
//        | TestPurposeDescriptionName
//        | When
//        | Then
//    )
//;

//Annotation
InitialConditionsAnnotation returns tdl::Annotation:
    key=[tdl::AnnotationType|InitialBlockName]
;
@@ -1717,8 +1723,18 @@ PICSAnnotation returns tdl::Annotation:
    key=[tdl::AnnotationType|PICSName]
;

//PackageableElement//@Override
//PackageableElement returns tdl::PackageableElement:
//    super
//    | Entity 
//    | Event 
//    | PICS
//    | StructuredTestObjective
//    | EventSpecificationTemplate 
//;


//## Element: Abstract 
//Element
fragment InitialConditionsFragment returns tdl::Element:
    annotation+=InitialConditionsAnnotation 
;
@@ -1735,22 +1751,11 @@ fragment ElementAndOrPrefix returns tdl::Element:
    comment+=AndOrQualifier
;

//@Override
//PackageableElement returns tdl::PackageableElement:
//    super
//    | Entity 
//    | Event 
//    | PICS
//    | StructuredTestObjective
//    | EventSpecificationTemplate
//    | TestPurposeDescription
//    | ExtendedTestConfiguration
//;

//# Test Objective

//StructuredTestObjective
StructuredTestObjective returns to::StructuredTestObjective:
    'Test' 'Purpose' name=TOIdentifier
    'Test' 'Purpose' name=TOIdentifier '@' 'TPLan3' 
    BEGIN
        ('Objective' ':' description=EString)?
        ('Reference' ':' objectiveURI+=EString (',' objectiveURI+=EString )*)?
@@ -1765,6 +1770,7 @@ StructuredTestObjective returns to::StructuredTestObjective:
    END
;

//PICSReference
FirstPICSReference returns to::PICSReference :
    (comment+=NotQualifier)?
    pics=[to::PICS|TOIdentifier]
@@ -1776,11 +1782,13 @@ PICSReference returns to::PICSReference :
    pics=[to::PICS|TOIdentifier]
; 

//InitialConditions
InitialConditions returns to::InitialConditions:
    InitialConditionsFragment
    'with' conditions=EventSequence 
;

//ExpectedBehaviour
ExpectedBehaviour returns to::ExpectedBehaviour:
    //DONE: are the event sequences mapped to distinct behaviours? -> initially no? perhaps yes?
    //DONE: it will mean that the event sequence will be annotated.. -> not at present  
@@ -1796,6 +1804,7 @@ ExpectedBehaviour returns to::ExpectedBehaviour:
    )
;

//FinalConditions
FinalConditions returns to::FinalConditions:
    FinalConditionsFragment
    'with' conditions=EventSequence 
@@ -1805,6 +1814,7 @@ FinalConditions returns to::FinalConditions:

//# Events

//EventSequence
EventSequence returns to::EventSequence:
    BEGIN 
        (RepeatedEventSequence | SimpleEventSequence)
@@ -1815,6 +1825,7 @@ SimpleEventSequence returns to::EventSequence:
    events+=FirstEventOccurrence (events+=EventOccurrence)*
;

//RepeatedEventSequence
RepeatedEventSequence returns to::RepeatedEventSequence:
    'repeat'
    (
@@ -1828,6 +1839,7 @@ RepeatedEventSequence returns to::RepeatedEventSequence:
    END
;

//EventOccurrence
FirstEventOccurrence returns to::EventOccurrence:
	EventOccurrenceFragment
;
@@ -1853,6 +1865,7 @@ fragment EventTimingPrefix returns to::EventOccurrence:
    )    
;

//no longer used
fragment EventTimingSuffix returns to::EventOccurrence:
    'with'
    BEGIN
@@ -1861,32 +1874,17 @@ fragment EventTimingSuffix returns to::EventOccurrence:
    END
;

//no longer used
fragment EventTimeLabelFragment returns to::EventOccurrence:
    timeLabel=TimeLabel 
;

//no longer used
fragment EventTimeConstraintFragment returns to::EventOccurrence:
    LBrace timeConstraint+=TimeConstraint ( ',' timeConstraint+=TimeConstraint)* RBrace
;


PrefixTimeLabel returns tdl::TimeLabel:
    {tdl::TimeLabel}
    '(.)' 'at' 'time' 'point'
    name=TOIdentifier
;

PrefixTimeConstraint returns tdl::TimeConstraint:
    {tdl::TimeConstraint}
    '(!)' 
    (comment+=Qualifier)*
    comment+=TimeConstraintQualifier
    //TODO: ambiguity
//    (comment+=(Qualifier | CommonWordQualifier | ArticleQualifier))*
    timeConstraintExpression=DataUse
;


//EventOccurrenceSpecification
EventOccurrenceSpecification returns to::EventOccurrenceSpecification:
    entityReference=EntityReference?
    eventReference=EventReference
@@ -1898,6 +1896,7 @@ EventOccurrenceSpecification returns to::EventOccurrenceSpecification:
    CommentFragment?
;

//EntityReference
EntityReference returns to::EntityReference:
    EntityReferenceFragment
;
@@ -1916,7 +1915,7 @@ fragment EntityReferenceFragment returns to::EntityReference:
    )
;


//EventReference
EventReference returns to::EventReference:
    (comment+=Qualifier | comment+=CommonWordQualifier | comment+=NotQualifier)*
    event=[to::Event|KIdentifier] 
@@ -1924,6 +1923,7 @@ EventReference returns to::EventReference:

//# Data

//Value
Value returns to::Value:
    LiteralValue 
    | DataReference 
@@ -1939,15 +1939,17 @@ Argument returns to::Value:
    | LiteralValueReferenceArgument
;

LiteralOrDataReferenceAsBinding returns to::Value:
    LiteralValueAsBinding | DataReferenceAsBinding
;

fragment ValueReferenceFragment returns to::Value:
    comment+=NotQualifier?
    comment+=AssignmentQualifier
;

LiteralOrDataReferenceAsBinding returns to::Value:
    LiteralValueAsBinding | DataReferenceAsBinding
;

//LiteralValue
LiteralValue returns to::LiteralValue:
    comment+=NotQualifier?
    comment+=AssignmentQualifier
@@ -1973,6 +1975,7 @@ fragment LiteralValueFragment returns to::LiteralValue:
    )?
;

//Content
DataContent returns to::Content:
    comment+=NotQualifier?
//    (parameter=[Parameter|Identifier] | name=Identifier | name=NumberAsIdentifier)
@@ -1989,7 +1992,7 @@ DataContent returns to::Content:
    )?
; 


//LiteralValueReference
LiteralValueReference returns to::LiteralValueReference:
    ValueReferenceFragment
    LiteralValueReferenceFragment
@@ -2010,6 +2013,7 @@ fragment LiteralValueReferenceFragment returns to::LiteralValueReference:
    content=[to::LiteralValue|TOIdentifier]
;

//ContentReference
ContentReference returns to::ContentReference:
    ValueReferenceFragment
    ContentReferenceFragment
@@ -2033,6 +2037,7 @@ fragment ContentReferenceFragment returns to::ContentReference:
    content=[to::Content|TOIdentifier]
;

//DataReference
DataReference returns to::DataReference:
    //TODO: is this still needed? causes ambiguity..
    //        -> does not seem to be the case, perhaps for typed?! -> likely not
@@ -2071,51 +2076,73 @@ fragment DataReferenceFragment returns to::DataReference:
    content=TODataElementUse
;

TODataElementUse returns tdl::DataElementUse:
    dataElement=[tdl::NamedElement|TOIdentifier]
    //UnassignedFragmentNamedElement?
	(TOParameterBindingFragment | TOCollectionItemFragment | TOMemberReferenceFragment)? 
	//ReductionFragment?
	//TODO: for some reason the fragment breaks serialisation..
	//(reduction+=MemberReference)*
	//->CollectionItemFragment?
	//CheckFragment?
//DataUse
TODataUse returns tdl::DataUse:
	TODataElementUse | LiteralValueUse | SpecialValueUse
;

fragment TOParameterBindingFragment returns tdl::DataUse:
    'containing' BEGIN argument+=TOParameterBinding ( ',' argument+=TOParameterBinding)* END
;

fragment TOCollectionItemFragment returns tdl::DataElementUse:
    'containing' BEGIN item+=TODataElementUse (',' item+=TODataElementUse)* END
;

fragment TOMemberReferenceFragment returns tdl::DataUse:
    (reduction+=TOMemberReference)+
;

//MemberReference
TOMemberReference returns tdl::MemberReference:
    ('.' member=[tdl::Member|ParameterIdentifier])
    |
    ('.' 'get' LParen collectionIndex=TODataUse RParen)
;

//ParameterBinding
TOParameterBinding returns tdl::ParameterBinding:
    parameter=[tdl::Parameter|TOIdentifier]
    comment+=AssignmentQualifier
	dataUse=TODataUse
;

TODataUse returns tdl::DataUse:
	TODataElementUse | TOLiteralValueUse | SpecialValueUse
//DataElementUse
TODataElementUse returns tdl::DataElementUse:
    dataElement=[tdl::NamedElement|TOIdentifier]
    //UnassignedFragmentNamedElement?
	(TOParameterBindingFragment | TOCollectionItemFragment | TOMemberReferenceFragment)? 
	//ReductionFragment?
	//TODO: for some reason the fragment breaks serialisation..
	//(reduction+=MemberReference)*
	//->CollectionItemFragment?
	//CheckFragment?
;

TOLiteralValueUse returns tdl::LiteralValueUse:
    (value=STRING | intValue=BIGINTEGER | boolValue=BOOLEAN)
fragment TOCollectionItemFragment returns tdl::DataElementUse:
    'containing' BEGIN item+=TODataElementUse (',' item+=TODataElementUse)* END
;

//# Time

//TimeLabel
PrefixTimeLabel returns tdl::TimeLabel:
    {tdl::TimeLabel}
    '(.)' 'at' 'time' 'point'
    name=TOIdentifier
;

//TimeConstraint
PrefixTimeConstraint returns tdl::TimeConstraint:
    {tdl::TimeConstraint}
    '(!)' 
    (comment+=Qualifier)*
    comment+=TimeConstraintQualifier
    //TODO: ambiguity
//    (comment+=(Qualifier | CommonWordQualifier | ArticleQualifier))*
    timeConstraintExpression=DataUse
;


//# Event Templates

//EventSpecificationTemplate
EventSpecificationTemplate returns to::EventSpecificationTemplate:
    AnnotationCommentFragment
    'Template' name=TOIdentifier
@@ -2124,6 +2151,7 @@ EventSpecificationTemplate returns to::EventSpecificationTemplate:
    END
;

//EventTemplateOccurrence
FirstEventTemplateOccurrence returns to::EventTemplateOccurrence:
    EventTemplateOccurrenceFragment
;
@@ -2149,6 +2177,7 @@ fragment EventTemplateOccurrenceFragment returns to::EventTemplateOccurrence:
    CommentFragment?
;

//EntityBinding
EntityBinding returns to::EntityBinding:
    templateEntity=EntityReference
    'replaced' 'by'
@@ -2158,6 +2187,7 @@ EntityBinding returns to::EntityBinding:

//# Structured Test Objective Variants

//StructuredTestObjectiveVariant
Variant returns to::TestObjectiveVariant:
    'Variant' name=TOIdentifier
    BEGIN
@@ -2174,11 +2204,13 @@ Variant returns to::TestObjectiveVariant:
    END
;

//Variants
Variants returns to::Variants:
    variants+=Variant+
    WithCommentFragment?
;

//VariantBinding
VariantBinding returns to::VariantBinding:
    VariantBindingValue
    | VariantBindingAttribute 
@@ -2207,6 +2239,8 @@ VariantBindingPredefined returns to::VariantBinding:
;

//# Test Description

//TestDescription
TestPurposeDescription returns tdl::TestDescription:
    annotation+=TestPurposeDescriptionAnnotation
    //TODO: locally ordered?
@@ -2221,18 +2255,14 @@ TestPurposeDescription returns tdl::TestDescription:
    END
;

//TODO: distribute below
TestVariantDescription returns tdl::TestDescription:
    annotation+=TestVariantDescriptionAnnotation
    
    //TODO: locally ordered?
    //('TestDescription' | isLocallyOrdered?='Test')
    name=TOIdentifier
    //TODO: parameters?
    (LParen formalParameter+=FormalParameter ( ',' formalParameter+=FormalParameter)* RParen )?
    //TODO: Reference, PICS?, Objective reference vs Objective inline (all annotations?) or simply defer to objective
//	(behaviourDescription=TVDBehaviourDescription)

    BEGIN
        TDObjectiveFragment?
        //TODO: why is configuration not serialised?!
@@ -2241,40 +2271,17 @@ TestVariantDescription returns tdl::TestDescription:
    END
;

TVDBehaviourDescription returns tdl::BehaviourDescription:
    behaviour=TVDCompoundBehaviour
;

TVDCompoundBehaviour returns tdl::CompoundBehaviour:
    //(annotation+=PICSAnnotation ':')?
    block=TVDBlock
;

TVDBlock returns tdl::Block:
    //NOTE: No guard -> guard is PICS
    //TODO: annotation has to be pulled up? or pushed down?
    //TODO: Objective
    (annotation+=PICSAnnotation ':' guard+=LocalExpression)?
    behaviour+=VariantBehaviour 
//BehaviourDescription
TPDBehaviourDescription returns tdl::BehaviourDescription:
    behaviour=TPDCompoundBehaviour
;

VariantBehaviour returns tdl::TestDescriptionReference:
    'Bindings' ':' testDescription=[tdl::TestDescription|DeclName]
    (BEGIN 
    	argument+=ParameterBinding 
    	( ',' argument+=ParameterBinding)* 
	END)?
	//TODO: skip / merge above
    ('with' BEGIN
        componentInstanceBinding+=ComponentInstanceBinding 
        (',' componentInstanceBinding+=ComponentInstanceBinding)*
    END)?
TVDBehaviourDescription returns tdl::BehaviourDescription:
    behaviour=TVDCompoundBehaviour
;

TPDBehaviourDescription returns tdl::BehaviourDescription:
    behaviour=TPDCompoundBehaviour
;

//CompoundBehaviour
TPDCompoundBehaviour returns tdl::CompoundBehaviour:
    //(annotation+=PICSAnnotation ':')?
    block=TPDBlock
@@ -2314,6 +2321,13 @@ ThenBehaviour returns tdl::CompoundBehaviour:
    block=Block
;

TVDCompoundBehaviour returns tdl::CompoundBehaviour:
    //(annotation+=PICSAnnotation ':')?
    block=TVDBlock
;


//Block
TPDBlock returns tdl::Block:
    //NOTE: No guard -> guard is PICS
    //TODO: annotation has to be pulled up? or pushed down?
@@ -2328,7 +2342,27 @@ WhenThenBlock returns tdl::Block:
    behaviour+=ThenBehaviour 
;

TVDBlock returns tdl::Block:
    //NOTE: No guard -> guard is PICS
    //TODO: annotation has to be pulled up? or pushed down?
    //TODO: Objective
    (annotation+=PICSAnnotation ':' guard+=LocalExpression)?
    behaviour+=VariantBehaviour 
;

//TestDescriptionReference
VariantBehaviour returns tdl::TestDescriptionReference:
    'Bindings' ':' testDescription=[tdl::TestDescription|DeclName]
    (BEGIN 
    	argument+=ParameterBinding 
    	( ',' argument+=ParameterBinding)* 
	END)?
	//TODO: skip / merge above
    ('with' BEGIN
        componentInstanceBinding+=ComponentInstanceBinding 
        (',' componentInstanceBinding+=ComponentInstanceBinding)*
    END)?
;



@@ -2439,7 +2473,7 @@ FinalBlockName:
;

TestPurposeDescriptionName:
    'Test' 'Purpose' 'Description'
    'Test' 'Purpose'
;

TestVariantDescriptionName: