Commit fa3fc808 authored by Daniel Honsel's avatar Daniel Honsel
Browse files

updated grammar completely to ttcn-3 version 4.6.1

parent ecee629a
Loading
Loading
Loading
Loading
+54 −30
Original line number Diff line number Diff line
@@ -68,7 +68,8 @@ GroupDef:
	GROUPKEYWORD name=IDENTIFIER LBRACKET list=ModuleDefinitionsList? RBRACKET;

ExtFunctionDef:
	EXTKEYWORD FUNCTIONKEYWORD name=IDENTIFIER LPAREN list=FunctionFormalParList? RPAREN return=ReturnType?;
	EXTKEYWORD FUNCTIONKEYWORD det=DETERMINISTIC_MODIFIER? name=IDENTIFIER LPAREN list=FunctionFormalParList? RPAREN
	return=ReturnType?;

ExtConstDef:
	EXTKEYWORD CONSTKEYWORD type=Type id=IdentifierList;
@@ -138,7 +139,6 @@ IdentifierListOrAllWithExcept:
AllWithExcept:
	{AllWithExcept} ALLKEYWORD (EXCEPTKEYWORD idList=IdentifierList)?;


ImportTypeDefSpec:
	TYPEDEFKEYWORD idOrAll=IdentifierListOrAllWithExcept;

@@ -176,8 +176,8 @@ AllGroupsWithExcept:
	{AllGroupsWithExcept} ALLKEYWORD (EXCEPTKEYWORD idList=QualifiedIdentifierList)?;

AltstepDef:
	ALTSTEPKEYWORD name=IDENTIFIER LPAREN params=FunctionFormalParList? RPAREN spec=RunsOnSpec? LBRACKET
	local=AltstepLocalDefList guard=AltGuardList RBRACKET;
	ALTSTEPKEYWORD name=IDENTIFIER LPAREN params=FunctionFormalParList? RPAREN spec=RunsOnSpec? mtc=MtcSpec?
	system=SystemSpec? LBRACKET local=AltstepLocalDefList guard=AltGuardList RBRACKET;

AltstepLocalDefList:
	{AltstepLocalDefList} (defs+=AltstepLocalDef withstats+=WithStatement? sc+=SEMICOLON?)*;
@@ -284,13 +284,20 @@ GuardOp:
	killed=KilledStatement;

DoneStatement:
	ComponentId DOT DONEKEYWORD;
	component=ComponentOrAny DOT DONEKEYWORD index=IndexAssignment?;

KilledStatement:
	ComponentId DOT KILLEDKEYWORD;
	component=ComponentOrAny DOT KILLEDKEYWORD index=IndexAssignment?;

ComponentOrAny:
	compOrDefault=ComponentOrDefaultReference | {ComponentOrAny} (ANYKEYWORD (COMPONENTKEYWORD | FROMKEYWORD
	ref=VariableRef)) | {ComponentOrAny} (ALLKEYWORD COMPONENTKEYWORD);

ComponentId:
	ComponentOrDefaultReference | {ComponentId} (ANYKEYWORD | ALLKEYWORD) COMPONENTKEYWORD;
IndexAssignment:
	PORTREDIRECTSYMBOL index=IndexSpec;

IndexSpec:
	INDEX_MODIFIER VALUEKEYWORD ref=VariableRef;

GetReplyStatement:
	PortOrAny DOT reply=PortGetReplyOp;
@@ -305,10 +312,10 @@ CheckParameter:
	CheckPortOpsPresent | FromClausePresent | RedirectPresent;

RedirectPresent:
	PORTREDIRECTSYMBOL SenderSpec;
	PORTREDIRECTSYMBOL (sender=SenderSpec index=IndexSpec? | index=IndexSpec);

FromClausePresent:
	FromClause (PORTREDIRECTSYMBOL sender=SenderSpec)?;
	FromClause (PORTREDIRECTSYMBOL (sender=SenderSpec | index=IndexSpec?) | index=IndexSpec)?;

CheckPortOpsPresent:
	PortReceiveOp | PortGetCallOp | PortGetReplyOp | PortCatchOp;
@@ -321,7 +328,7 @@ PortRedirectWithValueAndParam:
	PORTREDIRECTSYMBOL RedirectWithValueAndParamSpec;

RedirectWithValueAndParamSpec:
	value=ValueSpec param=ParamSpec? sender=SenderSpec? | redirect=RedirectWithParamSpec;
	value=ValueSpec param=ParamSpec? sender=SenderSpec? index=IndexSpec? | redirect=RedirectWithParamSpec;

ValueMatchSpec:
	VALUEKEYWORD template=InLineTemplate;
@@ -346,7 +353,7 @@ PortRedirectWithParam:
	PORTREDIRECTSYMBOL redirect=RedirectWithParamSpec;

RedirectWithParamSpec:
	ParamSpec sender=SenderSpec? | sender=SenderSpec;
	(param=ParamSpec sender=SenderSpec? index=IndexSpec?) | (sender=SenderSpec index=IndexSpec?) | index=IndexSpec;

ParamSpec:
	PARAMKEYWORD ParamAssignmentList;
@@ -378,7 +385,8 @@ ReceiveStatement:

	// TODO: extend with other possible references
PortOrAny:
	ref=[FormalPortAndValuePar|IDENTIFIER] array=ArrayOrBitRef? | {PortOrAny} ANYKEYWORD PORTKEYWORD;
	ref=[FormalPortAndValuePar|IDENTIFIER] array=ArrayOrBitRef? | {PortOrAny} (ANYKEYWORD (PORTKEYWORD | FROMKEYWORD
	variable=VariableRef));

PortReceiveOp:
	{PortReceiveOp} RECEIVEOPKEYWORD (LPAREN template=InLineTemplate RPAREN)? from=FromClause? redirect=PortRedirect?;
@@ -390,7 +398,8 @@ AddressRefList:
	LPAREN templates+=InLineTemplate (COMMA templates+=InLineTemplate)* RPAREN;

PortRedirect:
	PORTREDIRECTSYMBOL (value=ValueSpec sender=SenderSpec? | SenderSpec);
	PORTREDIRECTSYMBOL ((value=ValueSpec sender=SenderSpec? index=IndexSpec?) | (sender=SenderSpec index=IndexSpec?) |
	index=IndexSpec);

SenderSpec:
	SENDERKEYWORD variable=VariableRef;
@@ -463,7 +472,7 @@ TimerStatements:
	start=StartTimerStatement | stop=StopTimerStatement | timeout=TimeoutStatement;

TimeoutStatement:
	ref=TimerRefOrAny DOT TIMEOUTKEYWORD;
	ref=TimerRefOrAny DOT TIMEOUTKEYWORD index=IndexAssignment?;

StartTimerStatement:
	ref=[TimerVarInstance|IDENTIFIER] arryRefs+=ArrayOrBitRef* DOT STARTKEYWORD (LPAREN expr=Expression RPAREN)?;
@@ -471,8 +480,10 @@ StartTimerStatement:
StopTimerStatement:
	ref=TimerRefOrAll DOT STOPKEYWORD;

	//TODO: find the correct cross reference: from type?
TimerRefOrAny:
	ref=[TimerVarInstance|IDENTIFIER] | {TimerRefOrAny} ANYKEYWORD timer=TIMERKEYWORD;
	ref=[TimerVarInstance|IDENTIFIER] | {TimerRefOrAny} ANYKEYWORD timer=TIMERKEYWORD | ANYKEYWORD FROMKEYWORD
	from=IDENTIFIER;

TimerRefOrAll:
	ref=[TimerVarInstance|IDENTIFIER] | {TimerRefOrAll} ALLKEYWORD timer=TIMERKEYWORD;
@@ -642,8 +653,8 @@ TimerInstance:
	TIMERKEYWORD list=VarList;

VarInstance:
	VARKEYWORD ((listType=Type list=VarList) | ((TEMPLATEKEYWORD | resTemplate=RestrictedTemplate) type=Type
	tempList=TempVarList));
	VARKEYWORD ((listMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? listType=Type list=VarList) | ((TEMPLATEKEYWORD |
	resTemplate=RestrictedTemplate) tempMod=(LAZY_MODIFIER | FUZZY_MODIFIER)? type=Type tempList=TempVarList));

VarList:
	variables+=SingleVarInstance (COMMA variables+=SingleVarInstance)*;
@@ -752,7 +763,7 @@ PortElement:
	name=IDENTIFIER array=ArrayDef?;

ComponentElementDef:
	port=PortInstance | variable=VarInstance | timer=TimerInstance | const=ConstDef;
	port=PortInstance | variable=VarInstance | timer=TimerInstance | const=ConstDef | template=TemplateDef;

ProcedureList:
	Direction allOrSigList=AllOrSignatureList;
@@ -852,8 +863,8 @@ PatternParticle:
	{PatternParticle} CSTRING | ReferencedValue;

TemplateDef:
	TEMPLATEKEYWORD restriction=TemplateRestriction? base=BaseTemplate derived=DerivedDef? ASSIGNMENTCHAR
	body=TemplateBody;
	TEMPLATEKEYWORD restriction=TemplateRestriction? fuzzy=FUZZY_MODIFIER? base=BaseTemplate derived=DerivedDef?
	ASSIGNMENTCHAR body=TemplateBody;

DerivedDef:
	MODIFIESKEYWORD template=[BaseTemplate|QualifiedIdentifier];
@@ -952,7 +963,7 @@ CreateOp:
	expr2=SingleExpression)? RPAREN)? ALIVEKEYWORD?;

RunningOp:
	ComponentId DOT RUNNINGKEYWORD;
	component=ComponentOrAny DOT RUNNINGKEYWORD index=IndexAssignment?;

OpCall:
	configuration=ConfigurationOps | verdict=GETLOCALVERDICT | timer=TimerOps | function=FunctionInstance
@@ -961,7 +972,7 @@ OpCall:
	field+=ExtendedFieldReference+;

AliveOp:
	ComponentId DOT ALIVEKEYWORD;
	component=ComponentOrAny DOT ALIVEKEYWORD index=IndexAssignment?;

TemplateListItem:
	body=TemplateBody | all=AllElementsFrom;
@@ -1205,7 +1216,7 @@ TimerOps:
	read=ReadTimerOp | run=RunningTimerOp;

RunningTimerOp:
	timerRef=TimerRefOrAny DOT RUNNINGKEYWORD;
	timerRef=TimerRefOrAny DOT RUNNINGKEYWORD index=IndexAssignment?;

ReadTimerOp:
	timer=[TimerVarInstance|IDENTIFIER] DOT READKEYWORD;
@@ -1250,7 +1261,8 @@ SelectCase:
	statement=StatementBlock;

FunctionDef:
	FUNCTIONKEYWORD name=IDENTIFIER LPAREN parameterList=FunctionFormalParList? RPAREN runsOn=RunsOnSpec? mtc=MtcSpec?
	FUNCTIONKEYWORD det=DETERMINISTIC_MODIFIER? name=IDENTIFIER LPAREN parameterList=FunctionFormalParList? RPAREN
	runsOn=RunsOnSpec? mtc=MtcSpec?
	system=SystemSpec? returnType=ReturnType? statement=StatementBlock;

MtcSpec:
@@ -1263,8 +1275,8 @@ FunctionFormalPar:
	value=FormalValuePar | timer=FormalTimerPar | template=FormalTemplatePar | port=FormalPortPar;

FormalValuePar:
	(inOut=(INPARKEYWORD | INOUTPARKEYWORD | OUTPARKEYWORD))? type=Type name=IDENTIFIER (ASSIGNMENTCHAR
	(expression=Expression | MINUS))?;
	(inOut=(INPARKEYWORD | INOUTPARKEYWORD | OUTPARKEYWORD))? (mod=LAZY_MODIFIER | mod=FUZZY_MODIFIER)? type=Type
	name=IDENTIFIER (ASSIGNMENTCHAR (expression=Expression | MINUS))?;

FormalTimerPar:
	INOUTPARKEYWORD? TIMERKEYWORD name=IDENTIFIER;
@@ -1274,7 +1286,7 @@ FormalPortPar:

FormalTemplatePar:
	(inOut=(INPARKEYWORD | OUTPARKEYWORD | INOUTPARKEYWORD))? (TEMPLATEKEYWORD | restriction=RestrictedTemplate)
	type=Type name=IDENTIFIER (ASSIGNMENTCHAR (templ=InLineTemplate | MINUS))?;
	(mod=LAZY_MODIFIER | mod=FUZZY_MODIFIER)? type=Type name=IDENTIFIER (ASSIGNMENTCHAR (templ=InLineTemplate | MINUS))?;

RunsOnSpec:
	RUNSKEYWORD ONKEYWORD component=[ComponentDef|QualifiedIdentifier];
@@ -1480,6 +1492,18 @@ terminal STRINGANYOROMIT returns ecore::EString:
terminal ASSIGNMENTCHAR returns ecore::EString:
	':=';

terminal INDEX_MODIFIER returns ecore::EString:
	'@index';

terminal DETERMINISTIC_MODIFIER returns ecore::EString:
	'@deterministic';

terminal LAZY_MODIFIER returns ecore::EString:
	'@lazy';

terminal FUZZY_MODIFIER returns ecore::EString:
	'@fuzzy';

terminal SELFOP returns ecore::EString:
	'self';