Commit | Line | Data |
---|---|---|
970ed795 | 1 | /****************************************************************************** |
d44e3c4f | 2 | * Copyright (c) 2000-2016 Ericsson Telecom AB |
970ed795 EL |
3 | * All rights reserved. This program and the accompanying materials |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
d44e3c4f | 7 | * |
8 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Lovassy, Arpad | |
11 | * Szabo, Janos Zoltan – initial implementation | |
12 | * | |
970ed795 EL |
13 | ******************************************************************************/ |
14 | ||
15 | /* | |
16 | ||
17 | Parser source code for TTCN-3 (input of bison) | |
18 | Rev: PA10 | |
19 | Date: April 15 2005 | |
20 | Author: Janos Zoltan Szabo (ejnosza) | |
21 | ||
22 | Revision history: | |
23 | ||
24 | Rev. Date Author Comments | |
25 | PA1 Nov 10 2000 tmpjsz Generated from the prototype compiler. | |
26 | (Actions were removed.) | |
27 | PA2 Dec 5 2000 tmpjsz Many minor changes. | |
28 | Updated according to BNF v1.0.9. | |
29 | PA3 Dec 11 2000 tmpjsz Added support for module definitive | |
30 | identifiers. | |
31 | PA5 Sep 19 - Oct 1 2001 tmpjsz Upgrade to BNF v1.1.2. | |
32 | PA6 Apr 16-18 2002 tmpjsz Upgrade to BNF v2.2.0 (Rev. 12.5) | |
33 | PA7 Nov 26-27 2002 tmpjsz Upgrade to BNF v2.2.1 (Rev. 12.7) | |
34 | PA8 May 10-13 2004 ejnosza Upgrade to BNF v3.0.0Mockupv1 | |
35 | PA9 March 2005 ejnosza Added support for multi-dimension | |
36 | sub-references in port/timer/component | |
37 | operations. | |
38 | PA10 Apr 13-15 2005 ejnosza Upgrade to final BNF v3.0.0 | |
39 | ||
40 | */ | |
41 | ||
42 | %{ | |
43 | ||
44 | #include <stdio.h> | |
45 | #include <string.h> | |
46 | #include <stdlib.h> | |
47 | #include <errno.h> | |
48 | ||
49 | void yyerror(char *s); | |
50 | int yylex(); | |
51 | ||
52 | #define YYERROR_VERBOSE | |
53 | ||
54 | %} | |
55 | ||
56 | /* Bison declarations */ | |
57 | ||
58 | /* Terminal symbols of TTCN-3 */ | |
59 | ||
60 | /* Inline constants */ | |
61 | ||
62 | %token Number | |
63 | %token FloatValue | |
64 | %token Identifier | |
65 | ||
66 | %token BooleanConst | |
67 | %token VerdictConst | |
68 | %token Bstring | |
69 | %token Hstring | |
70 | %token Ostring | |
71 | %token Cstring | |
72 | %token NullKeyword | |
73 | %token BitStringMatch | |
74 | %token HexStringMatch | |
75 | %token OctetStringMatch | |
76 | ||
77 | /* Keywords */ | |
78 | ||
79 | %token ActionKeyword | |
80 | %token ActivateKeyword | |
81 | %token AddressKeyword | |
82 | %token AliveKeyword | |
83 | %token AllKeyword | |
84 | %token AltKeyword | |
85 | %token AltstepKeyword | |
86 | %token AnyKeyword | |
87 | %token AnyTypeKeyword | |
88 | %token BitStringKeyword | |
89 | %token BooleanKeyword | |
90 | %token CallOpKeyword | |
91 | %token CaseKeyword | |
92 | %token CatchOpKeyword | |
93 | %token CharKeyword | |
94 | %token CharStringKeyword | |
95 | %token CheckOpKeyword | |
96 | %token ClearOpKeyword | |
97 | %token ComplementKeyword | |
98 | %token ComponentKeyword | |
99 | %token ConnectKeyword | |
100 | %token ConstKeyword | |
101 | %token ControlKeyword | |
102 | %token CreateKeyword | |
103 | %token DeactivateKeyword | |
104 | %token DefaultKeyword | |
105 | %token DisconnectKeyword | |
106 | %token DisplayKeyword | |
107 | %token DoKeyword | |
108 | %token DoneKeyword | |
109 | %token ElseKeyword | |
110 | %token EncodeKeyword | |
111 | %token EnumKeyword | |
112 | %token ExceptKeyword | |
113 | %token ExceptionKeyword | |
114 | %token ExecuteKeyword | |
115 | %token ExtendsKeyword | |
116 | %token ExtensionKeyword | |
117 | %token ExtKeyword | |
118 | %token FloatKeyword | |
119 | %token ForKeyword | |
120 | %token FromKeyword | |
121 | %token FunctionKeyword | |
122 | %token GetCallOpKeyword | |
123 | %token GetReplyOpKeyword | |
124 | %token GetVerdictKeyword | |
125 | %token GotoKeyword | |
126 | %token GroupKeyword | |
127 | %token HexStringKeyword | |
128 | %token IfKeyword | |
129 | %token IfPresentKeyword | |
130 | %token ImportKeyword | |
131 | %token InParKeyword | |
132 | %token InfinityKeyword | |
133 | %token InOutParKeyword | |
134 | %token IntegerKeyword | |
135 | %token InterleavedKeyword | |
136 | %token KillKeyword | |
137 | %token KilledKeyword | |
138 | %token LabelKeyword | |
139 | %token LanguageKeyword | |
140 | %token LengthKeyword | |
141 | %token LogKeyword | |
142 | %token MapKeyword | |
143 | %token MatchKeyword | |
144 | %token MessageKeyword | |
145 | %token MixedKeyword | |
146 | %token ModifiesKeyword | |
147 | %token TTCN3ModuleKeyword | |
148 | %token ModuleParKeyword | |
149 | %token MTCKeyword | |
150 | %token NoBlockKeyword | |
151 | %token NowaitKeyword | |
152 | %token ObjectIdentifierKeyword | |
153 | %token OctetStringKeyword | |
154 | %token OfKeyword | |
155 | %token OmitKeyword | |
156 | %token OnKeyword | |
157 | %token OptionalKeyword | |
158 | %token OutParKeyword | |
159 | %token OverrideKeyword | |
160 | %token ParamKeyword | |
161 | %token PatternKeyword | |
162 | %token PermutationKeyword | |
163 | %token PortKeyword | |
164 | %token ProcedureKeyword | |
165 | %token RaiseKeyword | |
166 | %token ReadKeyword | |
167 | %token ReceiveOpKeyword | |
168 | %token RecordKeyword | |
169 | %token RecursiveKeyword | |
170 | %token RepeatKeyword | |
171 | %token ReplyKeyword | |
172 | %token ReturnKeyword | |
173 | %token RunningKeyword | |
174 | %token RunsKeyword | |
175 | %token SelectKeyword | |
176 | %token SelfOp | |
177 | %token SendOpKeyword | |
178 | %token SenderKeyword | |
179 | %token SetKeyword | |
180 | %token SetVerdictKeyword | |
181 | %token SignatureKeyword | |
182 | %token StartKeyword | |
183 | %token StopKeyword | |
184 | %token SubsetKeyword | |
185 | %token SupersetKeyword | |
186 | %token SystemKeyword | |
187 | %token TemplateKeyword | |
188 | %token TestcaseKeyword | |
189 | %token TimeoutKeyword | |
190 | %token TimerKeyword | |
191 | %token ToKeyword | |
192 | %token TriggerOpKeyword | |
193 | %token TypeDefKeyword | |
194 | %token UnionKeyword | |
195 | %token UniversalKeyword | |
196 | %token UnmapKeyword | |
197 | %token ValueKeyword | |
198 | %token ValueofKeyword | |
199 | %token VarKeyword | |
200 | %token VariantKeyword | |
201 | %token VerdictTypeKeyword | |
202 | %token WhileKeyword | |
203 | %token WithKeyword | |
204 | ||
205 | /* Keywords combined with a leading dot */ | |
206 | ||
207 | %token DotAliveKeyword | |
208 | %token DotCallOpKeyword | |
209 | %token DotCatchOpKeyword | |
210 | %token DotCheckOpKeyword | |
211 | %token DotClearOpKeyword | |
212 | %token DotCreateKeyword | |
213 | %token DotDoneKeyword | |
214 | %token DotGetCallOpKeyword | |
215 | %token DotGetReplyOpKeyword | |
216 | %token DotKillKeyword | |
217 | %token DotKilledKeyword | |
218 | %token DotRaiseKeyword | |
219 | %token DotReadKeyword | |
220 | %token DotReceiveOpKeyword | |
221 | %token DotReplyKeyword | |
222 | %token DotRunningKeyword | |
223 | %token DotSendOpKeyword | |
224 | %token DotStartKeyword | |
225 | %token DotStopKeyword | |
226 | %token DotTimeoutKeyword | |
227 | %token DotTriggerOpKeyword | |
228 | ||
229 | /* Multi-character operators */ | |
230 | ||
231 | %token AssignmentChar ":=" | |
232 | %token DotDot ".." | |
233 | %token PortRedirectSymbol "->" | |
234 | %token EQ "==" | |
235 | %token NE "!=" | |
236 | %token GE ">=" | |
237 | %token LE "<=" | |
238 | %token Or "or" | |
239 | %token Or4b "or4b" | |
240 | %token Xor "xor" | |
241 | %token Xor4b "xor4b" | |
242 | %token Mod "mod" | |
243 | %token Rem "rem" | |
244 | %token And "and" | |
245 | %token And4b "and4b" | |
246 | %token Not "not" | |
247 | %token Not4b "not4b" | |
248 | %token SL "<<" | |
249 | %token SR ">>" | |
250 | %token RL "<@" | |
251 | %token RR "@>" | |
252 | ||
253 | /* Operator precedences */ | |
254 | ||
255 | /* | |
256 | %left Or | |
257 | %left Xor | |
258 | %left And | |
259 | %left Not | |
260 | %left EQ NE | |
261 | %left '<' '>' GE LE | |
262 | %left SL SR RL RR | |
263 | %left Or4b | |
264 | %left Xor4b | |
265 | %left And4b | |
266 | %left Not4b | |
267 | %left '+' '-' '&' | |
268 | %left '*' '/' Mod Rem | |
269 | %left UnarySign | |
270 | */ | |
271 | ||
272 | %expect 16 | |
273 | ||
274 | /* | |
275 | Source of conflicts (16 S/R): | |
276 | ||
277 | 1.) 7 conflicts in one state | |
278 | The Expression after 'return' keyword is optional in ReturnStatement. | |
279 | For 7 tokens the parser cannot decide whether the token is a part of | |
280 | the return expression (shift) or it is the beginning of the next statement | |
281 | (reduce). | |
282 | ||
283 | 2.) 8 distinct states, each with one conflict caused by token '[' | |
284 | The local definitions in altsteps can be followed immediately by the guard | |
285 | expression. When the parser sees the '[' token it cannot decide whether it | |
286 | belongs to the local definition as array dimension or array subreference | |
287 | (shift) or it is the beginning of the first guard expression (reduce). | |
288 | The situations are the following: | |
289 | - var t v := ref <here> [ | |
290 | - var t v := ref[subref] <here> [ | |
291 | - var t v := ref.integer <here> [ | |
292 | - var t v := ref.subref <here> [ | |
293 | - timer t <here> [ | |
294 | - var t v <here> [ | |
295 | - var t v := ref.objid{...}.subref <here> [ | |
296 | - var template t v <here> [ | |
297 | ||
298 | 3.) 1 conflict | |
299 | The sequence identifier.objid can be either the beginning of a module name | |
300 | qualified with a module object identifier (shift) or a reference to an objid | |
301 | value within an entity of type anytype (reduce). | |
302 | ||
303 | Note that the parser implemented by bison always chooses to shift instead of | |
304 | reduce in case of conflicts. This is the desired behaviour in situations 1.) | |
305 | and 2.) since the opposite alternative can be forced by the correct usage | |
306 | of semi-colons. | |
307 | */ | |
308 | ||
309 | %% | |
310 | ||
311 | /* The grammar of TTCN-3 */ | |
312 | ||
313 | /* A.1.6.0 TTCN-3 module */ | |
314 | ||
315 | TTCN3Module: | |
316 | TTCN3ModuleKeyword TTCN3ModuleId | |
317 | '{' | |
318 | optModuleDefinitionsPart | |
319 | optModuleControlPart | |
320 | '}' | |
321 | optWithStatementAndSemiColon | |
322 | ; | |
323 | ||
324 | TTCN3ModuleId: | |
325 | Identifier optDefinitiveIdentifier optLanguageSpec | |
326 | ; | |
327 | ||
328 | ModuleId: | |
329 | GlobalModuleId optLanguageSpec | |
330 | ; | |
331 | ||
332 | GlobalModuleId: | |
333 | Identifier | |
334 | | Identifier ObjectIdentifierValue | |
335 | ; | |
336 | ||
337 | optLanguageSpec: | |
338 | /* empty */ | |
339 | | LanguageKeyword FreeText | |
340 | ; | |
341 | ||
342 | /* A.1.6.1 Module definitions part */ | |
343 | ||
344 | /* A.1.6.1.0 General */ | |
345 | ||
346 | optModuleDefinitionsPart: | |
347 | /* empty */ | |
348 | | ModuleDefinitionsList | |
349 | ; | |
350 | ||
351 | ModuleDefinitionsList: | |
352 | ModuleDefinition optSemiColon | |
353 | | ModuleDefinitionsList ModuleDefinition optSemiColon | |
354 | ; | |
355 | ||
356 | ModuleDefinition: | |
357 | ModuleDef optWithStatement | |
358 | ; | |
359 | ||
360 | ModuleDef: | |
361 | TypeDef | |
362 | | ConstDef | |
363 | | TemplateDef | |
364 | | ModuleParDef | |
365 | | FunctionDef | |
366 | | SignatureDef | |
367 | | TestcaseDef | |
368 | | AltstepDef | |
369 | | ImportDef | |
370 | | GroupDef | |
371 | | ExtFunctionDef | |
372 | | ExtConstDef | |
373 | ; | |
374 | ||
375 | /* A.1.6.1.1 Typedef definitions */ | |
376 | ||
377 | TypeDef: | |
378 | TypeDefKeyword TypeDefBody | |
379 | ; | |
380 | ||
381 | TypeDefBody: | |
382 | StructuredTypeDef | |
383 | | SubTypeDef | |
384 | ; | |
385 | ||
386 | StructuredTypeDef: | |
387 | RecordDef | |
388 | | UnionDef | |
389 | | SetDef | |
390 | | RecordOfDef | |
391 | | SetOfDef | |
392 | | EnumDef | |
393 | | PortDef | |
394 | | ComponentDef | |
395 | ; | |
396 | ||
397 | RecordDef: | |
398 | RecordKeyword StructDefBody | |
399 | ; | |
400 | ||
401 | StructDefBody: | |
402 | Identifier optStructDefFormalParList | |
403 | '{' optStructFieldDefList '}' | |
404 | | AddressKeyword '{' optStructFieldDefList '}' | |
405 | ; | |
406 | ||
407 | optStructDefFormalParList: | |
408 | /* empty */ | |
409 | | '(' StructDefFormalParList ')' | |
410 | ; | |
411 | ||
412 | StructDefFormalParList: | |
413 | StructDefFormalPar | |
414 | | StructDefFormalParList ',' StructDefFormalPar | |
415 | ; | |
416 | ||
417 | StructDefFormalPar: | |
418 | FormalValuePar | |
419 | ; | |
420 | ||
421 | optStructFieldDefList: | |
422 | /* empty */ | |
423 | | StructFieldDefList | |
424 | ; | |
425 | ||
426 | StructFieldDefList: | |
427 | StructFieldDef | |
428 | | StructFieldDefList ',' StructFieldDef | |
429 | ; | |
430 | ||
431 | StructFieldDef: | |
432 | TypeOrNestedTypeDef Identifier optArrayDef optSubTypeSpec | |
433 | | TypeOrNestedTypeDef Identifier optArrayDef optSubTypeSpec | |
434 | OptionalKeyword | |
435 | ; | |
436 | ||
437 | TypeOrNestedTypeDef: | |
438 | Type | |
439 | | NestedTypeDef | |
440 | ; | |
441 | ||
442 | NestedTypeDef: | |
443 | NestedRecordDef | |
444 | | NestedUnionDef | |
445 | | NestedSetDef | |
446 | | NestedRecordOfDef | |
447 | | NestedSetOfDef | |
448 | | NestedEnumDef | |
449 | ; | |
450 | ||
451 | NestedRecordDef: | |
452 | RecordKeyword '{' optStructFieldDefList '}' | |
453 | ; | |
454 | ||
455 | NestedUnionDef: | |
456 | UnionKeyword '{' UnionFieldDefList '}' | |
457 | ; | |
458 | ||
459 | NestedSetDef: | |
460 | SetKeyword '{' optStructFieldDefList '}' | |
461 | ; | |
462 | ||
463 | NestedRecordOfDef: | |
464 | RecordKeyword optStringLength OfKeyword TypeOrNestedTypeDef | |
465 | ; | |
466 | ||
467 | NestedSetOfDef: | |
468 | SetKeyword optStringLength OfKeyword TypeOrNestedTypeDef | |
469 | ; | |
470 | ||
471 | NestedEnumDef: | |
472 | EnumKeyword '{' EnumerationList '}' | |
473 | ; | |
474 | ||
475 | UnionDef: | |
476 | UnionKeyword UnionDefBody | |
477 | ; | |
478 | ||
479 | UnionDefBody: | |
480 | Identifier optStructDefFormalParList '{' UnionFieldDefList '}' | |
481 | | AddressKeyword '{' UnionFieldDefList '}' | |
482 | ||
483 | ; | |
484 | ||
485 | UnionFieldDefList: | |
486 | UnionFieldDef | |
487 | | UnionFieldDefList ',' UnionFieldDef | |
488 | ; | |
489 | ||
490 | UnionFieldDef: | |
491 | TypeOrNestedTypeDef Identifier optArrayDef optSubTypeSpec | |
492 | ; | |
493 | ||
494 | SetDef: | |
495 | SetKeyword StructDefBody | |
496 | ; | |
497 | ||
498 | RecordOfDef: | |
499 | RecordKeyword optStringLength OfKeyword StructOfDefBody | |
500 | ; | |
501 | ||
502 | StructOfDefBody: | |
503 | TypeOrNestedTypeDef Identifier optSubTypeSpec | |
504 | | TypeOrNestedTypeDef AddressKeyword optSubTypeSpec | |
505 | ; | |
506 | ||
507 | SetOfDef: | |
508 | SetKeyword optStringLength OfKeyword StructOfDefBody | |
509 | ; | |
510 | ||
511 | EnumDef: | |
512 | EnumKeyword Identifier '{' EnumerationList '}' | |
513 | | EnumKeyword AddressKeyword '{' EnumerationList '}' | |
514 | ; | |
515 | ||
516 | EnumerationList: | |
517 | Enumeration | |
518 | | EnumerationList ',' Enumeration | |
519 | ; | |
520 | ||
521 | Enumeration: | |
522 | Identifier | |
523 | | Identifier '(' Number ')' | |
524 | | Identifier '(' Minus Number ')' | |
525 | ; | |
526 | ||
527 | SubTypeDef: | |
528 | Type Identifier optArrayDef optSubTypeSpec | |
529 | | Type AddressKeyword optArrayDef optSubTypeSpec | |
530 | ; | |
531 | ||
532 | optSubTypeSpec: | |
533 | /* empty */ | |
534 | | AllowedValues | |
535 | | AllowedValues StringLength | |
536 | | StringLength | |
537 | ; | |
538 | ||
539 | AllowedValues: | |
540 | '(' seqValueOrRange ')' | |
541 | | CharStringMatch | |
542 | ; | |
543 | ||
544 | seqValueOrRange: | |
545 | ValueOrRange | |
546 | | seqValueOrRange ',' ValueOrRange | |
547 | ; | |
548 | ||
549 | ValueOrRange: | |
550 | RangeDef | |
551 | | Expression | |
552 | ; | |
553 | ||
554 | RangeDef: | |
555 | LowerBound DotDot UpperBound | |
556 | ; | |
557 | ||
558 | optStringLength: | |
559 | /* empty */ | |
560 | | StringLength | |
561 | ; | |
562 | ||
563 | StringLength: | |
564 | LengthKeyword '(' SingleExpression ')' | |
565 | | LengthKeyword '(' SingleExpression DotDot UpperBound ')' | |
566 | ; | |
567 | ||
568 | PortType: | |
569 | Identifier | |
570 | | Identifier Dot Identifier | |
571 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
572 | ; | |
573 | ||
574 | PortDef: | |
575 | PortKeyword PortDefBody | |
576 | ; | |
577 | ||
578 | PortDefBody: | |
579 | Identifier PortDefAttribs | |
580 | ; | |
581 | ||
582 | PortDefAttribs: | |
583 | MessageAttribs | |
584 | | ProcedureAttribs | |
585 | | MixedAttribs | |
586 | ; | |
587 | ||
588 | MessageAttribs: | |
589 | MessageKeyword | |
590 | '{' MessageListList '}' | |
591 | ; | |
592 | ||
593 | MessageListList: | |
594 | MessageList optSemiColon | |
595 | | MessageListList MessageList optSemiColon | |
596 | ; | |
597 | ||
598 | MessageList: | |
599 | Direction AllOrTypeList | |
600 | ; | |
601 | ||
602 | Direction: | |
603 | InParKeyword | |
604 | | OutParKeyword | |
605 | | InOutParKeyword | |
606 | ; | |
607 | ||
608 | AllOrTypeList: | |
609 | AllKeyword | |
610 | | TypeList | |
611 | ; | |
612 | ||
613 | TypeList: | |
614 | Type | |
615 | | TypeList ',' Type | |
616 | ; | |
617 | ||
618 | ProcedureAttribs: | |
619 | ProcedureKeyword | |
620 | '{' ProcedureListList '}' | |
621 | ; | |
622 | ||
623 | ProcedureListList: | |
624 | ProcedureList optSemiColon | |
625 | | ProcedureListList ProcedureList optSemiColon | |
626 | ; | |
627 | ||
628 | ProcedureList: | |
629 | Direction AllOrSignatureList | |
630 | ; | |
631 | ||
632 | AllOrSignatureList: | |
633 | AllKeyword | |
634 | | SignatureList | |
635 | ; | |
636 | ||
637 | SignatureList: | |
638 | Signature | |
639 | | SignatureList ',' Signature | |
640 | ; | |
641 | ||
642 | MixedAttribs: | |
643 | MixedKeyword | |
644 | '{' MixedListList '}' | |
645 | ; | |
646 | ||
647 | MixedListList: | |
648 | MixedList optSemiColon | |
649 | | MixedListList MixedList optSemiColon | |
650 | ; | |
651 | ||
652 | MixedList: | |
653 | Direction ProcOrTypeList | |
654 | ; | |
655 | ||
656 | ProcOrTypeList: | |
657 | seqProcOrType | |
658 | | AllKeyword | |
659 | ; | |
660 | ||
661 | seqProcOrType: | |
662 | ProcOrType | |
663 | | seqProcOrType ',' ProcOrType | |
664 | ; | |
665 | ||
666 | ProcOrType: | |
667 | /* Signature -- covered by Type */ | |
668 | Type | |
669 | ; | |
670 | ||
671 | ComponentDef: | |
672 | ComponentKeyword Identifier | |
673 | optExtendsDef | |
674 | '{' ComponentDefList '}' | |
675 | ; | |
676 | ||
677 | optExtendsDef: | |
678 | /* empty */ | |
679 | | ExtendsKeyword ComponentTypeList | |
680 | ; | |
681 | ||
682 | ComponentTypeList: | |
683 | ComponentType | |
684 | | ComponentTypeList ',' ComponentType | |
685 | ; | |
686 | ||
687 | ComponentType: | |
688 | Identifier | |
689 | | Identifier Dot Identifier | |
690 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
691 | ; | |
692 | ||
693 | ComponentDefList: | |
694 | /* empty */ | |
695 | | ComponentDefList ComponentElementDef optSemiColon | |
696 | ; | |
697 | ||
698 | ComponentElementDef: | |
699 | PortInstance | |
700 | | VarInstance | |
701 | | TimerInstance | |
702 | | ConstDef | |
703 | ; | |
704 | ||
705 | PortInstance: | |
706 | PortKeyword PortType PortElementList | |
707 | ; | |
708 | ||
709 | PortElementList: | |
710 | PortElement | |
711 | | PortElementList ',' PortElement | |
712 | ; | |
713 | ||
714 | PortElement: | |
715 | Identifier optArrayDef | |
716 | ; | |
717 | ||
718 | /* A.1.6.1.2 Constant definitions */ | |
719 | ||
720 | ConstDef: | |
721 | ConstKeyword Type ConstList | |
722 | ; | |
723 | ||
724 | ConstList: | |
725 | SingleConstDef | |
726 | | ConstList ',' SingleConstDef | |
727 | ; | |
728 | ||
729 | SingleConstDef: | |
730 | Identifier optArrayDef AssignmentChar Expression | |
731 | ; | |
732 | ||
733 | /* A.1.6.1.3 Template definitions */ | |
734 | ||
735 | TemplateDef: | |
736 | TemplateKeyword BaseTemplate optDerivedDef AssignmentChar TemplateBody | |
737 | ; | |
738 | ||
739 | BaseTemplate: | |
740 | Type Identifier optTemplateFormalParList | |
741 | /* | Signature Identifier optTemplateFormalParList -- covered by | |
742 | the previous rule */ | |
743 | ; | |
744 | ||
745 | optDerivedDef: | |
746 | /* empty */ | |
747 | | ModifiesKeyword TemplateRef | |
748 | ; | |
749 | ||
750 | optTemplateFormalParList: | |
751 | /* empty */ | |
752 | | '(' TemplateFormalParList ')' | |
753 | ; | |
754 | ||
755 | TemplateFormalParList: | |
756 | TemplateFormalPar | |
757 | | TemplateFormalParList ',' TemplateFormalPar | |
758 | ; | |
759 | ||
760 | TemplateFormalPar: | |
761 | FormalValuePar | |
762 | | FormalTemplatePar | |
763 | ; | |
764 | ||
765 | TemplateBody: | |
766 | SimpleSpec optExtraMatchingAttributes | |
767 | | FieldSpecList optExtraMatchingAttributes | |
768 | | ArrayValueOrAttrib optExtraMatchingAttributes | |
769 | ; | |
770 | ||
771 | SimpleSpec: | |
772 | SingleValueOrAttrib | |
773 | ; | |
774 | ||
775 | FieldSpecList: | |
776 | '{' '}' | |
777 | | '{' seqFieldSpec '}' | |
778 | ; | |
779 | ||
780 | seqFieldSpec: | |
781 | FieldSpec | |
782 | | seqFieldSpec ',' FieldSpec | |
783 | ; | |
784 | ||
785 | FieldSpec: | |
786 | FieldReference AssignmentChar TemplateBody | |
787 | ; | |
788 | ||
789 | FieldReference: | |
790 | StructFieldRef | |
791 | | ArrayOrBitRef | |
792 | /* | ParRef -- covered by StructFieldRef */ | |
793 | ; | |
794 | ||
795 | StructFieldRef: | |
796 | Identifier | |
797 | | PredefinedType | |
798 | /* | TypeReference | |
799 | Note: Non-parameterized type references are covered by (StructField)Identifier. | |
800 | Parameterized type references are covered by FunctionInstance */ | |
801 | | FunctionInstance | |
802 | ; | |
803 | ||
804 | ParRef: | |
805 | Identifier | |
806 | ; | |
807 | ||
808 | ArrayOrBitRef: | |
809 | '[' FieldOrBitNumber ']' | |
810 | ; | |
811 | ||
812 | FieldOrBitNumber: | |
813 | SingleExpression | |
814 | ; | |
815 | ||
816 | SingleValueOrAttrib: | |
817 | MatchingSymbol | |
818 | | SingleExpression | |
819 | /* | TemplateRefWithParList -- covered by SingleExpression */ | |
820 | ; | |
821 | ||
822 | ArrayValueOrAttrib: | |
823 | '{' ArrayElementSpecList '}' | |
824 | ; | |
825 | ||
826 | ArrayElementSpecList: | |
827 | ArrayElementSpec | |
828 | | ArrayElementSpecList ',' ArrayElementSpec | |
829 | ; | |
830 | ||
831 | ArrayElementSpec: | |
832 | NotUsedSymbol | |
833 | | PermutationMatch | |
834 | | TemplateBody | |
835 | ; | |
836 | ||
837 | NotUsedSymbol: | |
838 | Dash | |
839 | ; | |
840 | ||
841 | MatchingSymbol: | |
842 | Complement | |
843 | | AnyValue | |
844 | | AnyOrOmit | |
845 | | ValueOrAttribList | |
846 | | Range | |
847 | | BitStringMatch | |
848 | | HexStringMatch | |
849 | | OctetStringMatch | |
850 | | CharStringMatch | |
851 | | SubsetMatch | |
852 | | SupersetMatch | |
853 | ; | |
854 | ||
855 | optExtraMatchingAttributes: | |
856 | /* empty */ | |
857 | | LengthMatch | |
858 | | IfPresentMatch | |
859 | | LengthMatch IfPresentMatch | |
860 | ; | |
861 | ||
862 | CharStringMatch: | |
863 | PatternKeyword Cstring | |
864 | ; | |
865 | ||
866 | Complement: | |
867 | ComplementKeyword ValueList | |
868 | ; | |
869 | ||
870 | ValueList: | |
871 | '(' seqValue ')' | |
872 | ; | |
873 | ||
874 | seqValue: | |
875 | Expression | |
876 | | seqValue ',' Expression | |
877 | ; | |
878 | ||
879 | SubsetMatch: | |
880 | SubsetKeyword ValueList | |
881 | ; | |
882 | ||
883 | SupersetMatch: | |
884 | SupersetKeyword ValueList | |
885 | ; | |
886 | ||
887 | PermutationMatch: | |
888 | PermutationKeyword PermutationList | |
889 | ; | |
890 | ||
891 | PermutationList: | |
892 | '(' seqValueOrAttrib ')' | |
893 | ; | |
894 | ||
895 | AnyValue: | |
896 | '?' | |
897 | ; | |
898 | ||
899 | AnyOrOmit: | |
900 | '*' | |
901 | ; | |
902 | ||
903 | ValueOrAttribList: | |
904 | '(' TemplateBody ',' seqValueOrAttrib ')' | |
905 | ; | |
906 | ||
907 | seqValueOrAttrib: | |
908 | TemplateBody | |
909 | | seqValueOrAttrib ',' TemplateBody | |
910 | ; | |
911 | ||
912 | LengthMatch: | |
913 | StringLength | |
914 | ; | |
915 | ||
916 | IfPresentMatch: | |
917 | IfPresentKeyword | |
918 | ; | |
919 | ||
920 | Range: | |
921 | '(' LowerBound DotDot UpperBound ')' | |
922 | ; | |
923 | ||
924 | LowerBound: | |
925 | SingleExpression | |
926 | | Minus InfinityKeyword | |
927 | ; | |
928 | ||
929 | UpperBound: | |
930 | SingleExpression | |
931 | | InfinityKeyword | |
932 | ; | |
933 | ||
934 | TemplateInstance: | |
935 | InLineTemplate | |
936 | ; | |
937 | ||
938 | TemplateRefWithParList: | |
939 | Identifier optTemplateActualParList | |
940 | | Identifier Dot Identifier optTemplateActualParList | |
941 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
942 | optTemplateActualParList | |
943 | ; | |
944 | ||
945 | TemplateRef: | |
946 | Identifier | |
947 | | Identifier Dot Identifier | |
948 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
949 | ; | |
950 | ||
951 | InLineTemplate: | |
952 | TemplateBody | |
953 | | Type Colon TemplateBody | |
954 | /* | Signature Colon TemplateBody -- covered by the previous rule */ | |
955 | | DerivedRefWithParList AssignmentChar TemplateBody | |
956 | | Type Colon DerivedRefWithParList AssignmentChar TemplateBody | |
957 | /* | Signature Colon DerivedRefWithParList AssignmentChar TemplateBody | |
958 | -- covered by the previous rule */ | |
959 | ; | |
960 | ||
961 | DerivedRefWithParList: | |
962 | ModifiesKeyword TemplateRefWithParList | |
963 | ; | |
964 | ||
965 | optTemplateActualParList: | |
966 | /* empty */ | |
967 | | '(' seqTemplateActualPar ')' | |
968 | ; | |
969 | ||
970 | seqTemplateActualPar: | |
971 | TemplateActualPar | |
972 | | seqTemplateActualPar ',' TemplateActualPar | |
973 | ; | |
974 | ||
975 | TemplateActualPar: | |
976 | TemplateInstance | |
977 | ; | |
978 | ||
979 | TemplateOps: | |
980 | MatchOp | |
981 | | ValueofOp | |
982 | ; | |
983 | ||
984 | MatchOp: | |
985 | MatchKeyword '(' Expression ',' TemplateInstance ')' | |
986 | ; | |
987 | ||
988 | ValueofOp: | |
989 | ValueofKeyword '(' TemplateInstance ')' | |
990 | ; | |
991 | ||
992 | /* A.1.6.1.4 Function definitions */ | |
993 | ||
994 | FunctionDef: | |
995 | FunctionKeyword Identifier | |
996 | '(' optFunctionFormalParList ')' optRunsOnSpec optReturnType | |
997 | StatementBlock | |
998 | ; | |
999 | ||
1000 | optFunctionFormalParList: | |
1001 | /* empty */ | |
1002 | | FunctionFormalParList | |
1003 | ; | |
1004 | ||
1005 | FunctionFormalParList: | |
1006 | FunctionFormalPar | |
1007 | | FunctionFormalParList ',' FunctionFormalPar | |
1008 | ; | |
1009 | ||
1010 | FunctionFormalPar: | |
1011 | FormalValuePar | |
1012 | | FormalTimerPar | |
1013 | | FormalTemplatePar | |
1014 | /* | FormalPortPar -- covered by FormalValuePar */ | |
1015 | ; | |
1016 | ||
1017 | optReturnType: | |
1018 | /* empty */ | |
1019 | | ReturnType | |
1020 | ; | |
1021 | ||
1022 | ReturnType: | |
1023 | ReturnKeyword Type | |
1024 | | ReturnKeyword TemplateKeyword Type | |
1025 | ; | |
1026 | ||
1027 | optRunsOnSpec: | |
1028 | /* empty */ | |
1029 | | RunsOnSpec | |
1030 | ; | |
1031 | ||
1032 | RunsOnSpec: | |
1033 | RunsKeyword OnKeyword ComponentType | |
1034 | ; | |
1035 | ||
1036 | StatementBlock: | |
1037 | '{' optFunctionStatementOrDefList '}' | |
1038 | ; | |
1039 | ||
1040 | optFunctionStatementOrDefList: | |
1041 | /* empty */ | |
1042 | | optFunctionStatementOrDefList FunctionStatementOrDef optSemiColon | |
1043 | ; | |
1044 | ||
1045 | FunctionStatementOrDef: | |
1046 | FunctionLocalDef | |
1047 | | FunctionLocalInst | |
1048 | | FunctionStatement | |
1049 | ; | |
1050 | ||
1051 | FunctionLocalInst: | |
1052 | VarInstance | |
1053 | | TimerInstance | |
1054 | ; | |
1055 | ||
1056 | FunctionLocalDef: | |
1057 | ConstDef | |
1058 | | TemplateDef | |
1059 | ; | |
1060 | ||
1061 | FunctionStatement: | |
1062 | ConfigurationStatements | |
1063 | | TimerStatements | |
1064 | | CommunicationStatements | |
1065 | | BasicStatements | |
1066 | | BehaviourStatements | |
1067 | | VerdictStatements | |
1068 | | SUTStatements | |
1069 | ; | |
1070 | ||
1071 | FunctionInstance: | |
1072 | Identifier '(' optFunctionActualParList ')' | |
1073 | | Identifier Dot Identifier '(' optFunctionActualParList ')' | |
1074 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
1075 | '(' optFunctionActualParList ')' | |
1076 | ; | |
1077 | ||
1078 | optFunctionActualParList: | |
1079 | /* empty */ | |
1080 | | FunctionActualParList | |
1081 | ; | |
1082 | ||
1083 | FunctionActualParList: | |
1084 | FunctionActualPar | |
1085 | | FunctionActualParList ',' FunctionActualPar | |
1086 | ; | |
1087 | ||
1088 | FunctionActualPar: | |
1089 | /* TimerRef */ | |
1090 | TemplateInstance | |
1091 | /* | Port | |
1092 | | ComponentRef -- TemplateInstance covers all the others */ | |
1093 | ; | |
1094 | ||
1095 | /* A.1.6.1.5 Signature definitions */ | |
1096 | ||
1097 | SignatureDef: | |
1098 | SignatureKeyword Identifier | |
1099 | '(' optSignatureFormalParList ')' optReturnTypeOrNoBlockKeyword | |
1100 | optExceptionSpec | |
1101 | ; | |
1102 | ||
1103 | optSignatureFormalParList: | |
1104 | /* empty */ | |
1105 | | SignatureFormalParList | |
1106 | ; | |
1107 | ||
1108 | SignatureFormalParList: | |
1109 | SignatureFormalPar | |
1110 | | SignatureFormalParList ',' SignatureFormalPar | |
1111 | ; | |
1112 | ||
1113 | SignatureFormalPar: | |
1114 | FormalValuePar | |
1115 | ; | |
1116 | ||
1117 | optReturnTypeOrNoBlockKeyword: | |
1118 | /* empty */ | |
1119 | | ReturnType | |
1120 | | NoBlockKeyword | |
1121 | ; | |
1122 | ||
1123 | optExceptionSpec: | |
1124 | /* empty */ | |
1125 | | ExceptionKeyword '(' ExceptionTypeList ')' | |
1126 | ; | |
1127 | ||
1128 | ExceptionTypeList: | |
1129 | Type | |
1130 | | ExceptionTypeList ',' Type | |
1131 | ; | |
1132 | ||
1133 | Signature: | |
1134 | Identifier | |
1135 | | Identifier Dot Identifier | |
1136 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
1137 | ; | |
1138 | ||
1139 | /* A.1.6.1.6 Testcase definitions */ | |
1140 | ||
1141 | TestcaseDef: | |
1142 | TestcaseKeyword Identifier | |
1143 | '(' optTestcaseFormalParList ')' ConfigSpec | |
1144 | StatementBlock | |
1145 | ; | |
1146 | ||
1147 | optTestcaseFormalParList: | |
1148 | /* empty */ | |
1149 | | TestcaseFormalParList | |
1150 | ; | |
1151 | ||
1152 | TestcaseFormalParList: | |
1153 | TestcaseFormalPar | |
1154 | | TestcaseFormalParList ',' TestcaseFormalPar | |
1155 | ; | |
1156 | ||
1157 | TestcaseFormalPar: | |
1158 | FormalValuePar | |
1159 | | FormalTemplatePar | |
1160 | ; | |
1161 | ||
1162 | ConfigSpec: | |
1163 | RunsOnSpec optSystemSpec | |
1164 | ; | |
1165 | ||
1166 | optSystemSpec: | |
1167 | /* empty */ | |
1168 | | SystemKeyword ComponentType | |
1169 | ; | |
1170 | ||
1171 | TestcaseInstance: | |
1172 | ExecuteKeyword '(' TestcaseRef '(' optTestcaseActualParList ')' | |
1173 | optTestcaseTimerValue ')' | |
1174 | ; | |
1175 | ||
1176 | TestcaseRef: | |
1177 | Identifier | |
1178 | | Identifier Dot Identifier | |
1179 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
1180 | ; | |
1181 | ||
1182 | optTestcaseTimerValue: | |
1183 | /* empty */ | |
1184 | | ',' TimerValue | |
1185 | ; | |
1186 | ||
1187 | optTestcaseActualParList: | |
1188 | /* empty */ | |
1189 | | TestcaseActualParList | |
1190 | ; | |
1191 | ||
1192 | TestcaseActualParList: | |
1193 | TestcaseActualPar | |
1194 | | TestcaseActualParList ',' TestcaseActualPar | |
1195 | ; | |
1196 | ||
1197 | TestcaseActualPar: | |
1198 | TemplateInstance | |
1199 | ; | |
1200 | ||
1201 | /* A.1.6.1.7 Altstep definitions */ | |
1202 | ||
1203 | AltstepDef: | |
1204 | AltstepKeyword Identifier | |
1205 | '(' optAltstepFormalParList ')' optRunsOnSpec | |
1206 | '{' AltstepLocalDefList AltGuardList '}' | |
1207 | ; | |
1208 | ||
1209 | optAltstepFormalParList: | |
1210 | /* empty */ | |
1211 | | FunctionFormalParList | |
1212 | ; | |
1213 | ||
1214 | AltstepLocalDefList: | |
1215 | /* empty */ | |
1216 | | AltstepLocalDefList AltstepLocalDef optSemiColon | |
1217 | ; | |
1218 | ||
1219 | AltstepLocalDef: | |
1220 | VarInstance | |
1221 | | TimerInstance | |
1222 | | ConstDef | |
1223 | | TemplateDef | |
1224 | ; | |
1225 | ||
1226 | AltstepInstance: | |
1227 | Identifier '(' optFunctionActualParList ')' | |
1228 | | Identifier Dot Identifier '(' optFunctionActualParList ')' | |
1229 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
1230 | '(' optFunctionActualParList ')' | |
1231 | ; | |
1232 | ||
1233 | AltstepRef: | |
1234 | Identifier | |
1235 | | Identifier Dot Identifier | |
1236 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
1237 | ; | |
1238 | ||
1239 | /* A.1.6.1.8 Import definitions */ | |
1240 | ||
1241 | ImportDef: | |
1242 | ImportKeyword ImportFromSpec AllWithExcepts | |
1243 | | ImportKeyword ImportFromSpec '{' ImportSpec '}' | |
1244 | ; | |
1245 | ||
1246 | AllWithExcepts: | |
1247 | AllKeyword | |
1248 | | AllKeyword ExceptsDef | |
1249 | ; | |
1250 | ||
1251 | ExceptsDef: | |
1252 | ExceptKeyword '{' ExceptSpec '}' | |
1253 | ; | |
1254 | ||
1255 | ExceptSpec: | |
1256 | /* empty */ | |
1257 | | ExceptSpec ExceptElement optSemiColon | |
1258 | ; | |
1259 | ||
1260 | ExceptElement: | |
1261 | ExceptGroupSpec | |
1262 | | ExceptTypeDefSpec | |
1263 | | ExceptTemplateSpec | |
1264 | | ExceptConstSpec | |
1265 | | ExceptTestcaseSpec | |
1266 | | ExceptAltstepSpec | |
1267 | | ExceptFunctionSpec | |
1268 | | ExceptSignatureSpec | |
1269 | | ExceptModuleParSpec | |
1270 | ; | |
1271 | ||
1272 | ExceptGroupSpec: | |
1273 | GroupKeyword ExceptGroupRefList | |
1274 | | GroupKeyword AllKeyword | |
1275 | ; | |
1276 | ||
1277 | ExceptTypeDefSpec: | |
1278 | TypeDefKeyword TypeRefList | |
1279 | | TypeDefKeyword AllKeyword | |
1280 | ; | |
1281 | ||
1282 | ExceptTemplateSpec: | |
1283 | TemplateKeyword TemplateRefList | |
1284 | | TemplateKeyword AllKeyword | |
1285 | ; | |
1286 | ||
1287 | ExceptConstSpec: | |
1288 | ConstKeyword ConstRefList | |
1289 | | ConstKeyword AllKeyword | |
1290 | ; | |
1291 | ||
1292 | ExceptTestcaseSpec: | |
1293 | TestcaseKeyword TestcaseRefList | |
1294 | | TestcaseKeyword AllKeyword | |
1295 | ; | |
1296 | ||
1297 | ExceptAltstepSpec: | |
1298 | AltstepKeyword AltstepRefList | |
1299 | | AltstepKeyword AllKeyword | |
1300 | ; | |
1301 | ||
1302 | ExceptFunctionSpec: | |
1303 | FunctionKeyword FunctionRefList | |
1304 | | FunctionKeyword AllKeyword | |
1305 | ; | |
1306 | ||
1307 | ExceptSignatureSpec: | |
1308 | SignatureKeyword SignatureRefList | |
1309 | | SignatureKeyword AllKeyword | |
1310 | ; | |
1311 | ||
1312 | ExceptModuleParSpec: | |
1313 | ModuleParKeyword ModuleParRefList | |
1314 | | ModuleParKeyword AllKeyword | |
1315 | ; | |
1316 | ||
1317 | ImportSpec: | |
1318 | /* empty */ | |
1319 | | ImportSpec ImportElement optSemiColon | |
1320 | ; | |
1321 | ||
1322 | ImportElement: | |
1323 | ImportGroupSpec | |
1324 | | ImportTypeDefSpec | |
1325 | | ImportTemplateSpec | |
1326 | | ImportConstSpec | |
1327 | | ImportTestcaseSpec | |
1328 | | ImportAltstepSpec | |
1329 | | ImportFunctionSpec | |
1330 | | ImportSignatureSpec | |
1331 | | ImportModuleParSpec | |
1332 | ; | |
1333 | ||
1334 | ImportFromSpec: | |
1335 | FromKeyword ModuleId | |
1336 | | FromKeyword ModuleId RecursiveKeyword | |
1337 | ; | |
1338 | ||
1339 | ImportGroupSpec: | |
1340 | GroupKeyword GroupRefListWithExcept | |
1341 | | GroupKeyword AllGroupsWithExcept | |
1342 | ; | |
1343 | ||
1344 | GroupRefList: | |
1345 | FullGroupIdentifier | |
1346 | | GroupRefList ',' FullGroupIdentifier | |
1347 | ; | |
1348 | ||
1349 | GroupRefListWithExcept: | |
1350 | FullGroupIdentifierWithExcept | |
1351 | | GroupRefListWithExcept ',' FullGroupIdentifierWithExcept | |
1352 | ; | |
1353 | ||
1354 | AllGroupsWithExcept: | |
1355 | AllKeyword | |
1356 | | AllKeyword ExceptKeyword GroupRefList | |
1357 | ; | |
1358 | ||
1359 | FullGroupIdentifier: | |
1360 | Identifier | |
1361 | | FullGroupIdentifier Dot Identifier | |
1362 | ; | |
1363 | ||
1364 | FullGroupIdentifierWithExcept: | |
1365 | FullGroupIdentifier | |
1366 | | FullGroupIdentifier ExceptsDef | |
1367 | ; | |
1368 | ||
1369 | ExceptGroupRefList: | |
1370 | ExceptFullGroupIdentifier | |
1371 | | ExceptGroupRefList ',' ExceptFullGroupIdentifier | |
1372 | ; | |
1373 | ||
1374 | ExceptFullGroupIdentifier: | |
1375 | FullGroupIdentifier | |
1376 | ; | |
1377 | ||
1378 | ImportTypeDefSpec: | |
1379 | TypeDefKeyword TypeRefList | |
1380 | | TypeDefKeyword AllTypesWithExcept | |
1381 | ; | |
1382 | ||
1383 | TypeRefList: | |
1384 | Identifier | |
1385 | | TypeRefList ',' Identifier | |
1386 | ; | |
1387 | ||
1388 | AllTypesWithExcept: | |
1389 | AllKeyword | |
1390 | | AllKeyword ExceptKeyword TypeRefList | |
1391 | ; | |
1392 | ||
1393 | ImportTemplateSpec: | |
1394 | TemplateKeyword TemplateRefList | |
1395 | | TemplateKeyword AllTemplsWithExcept | |
1396 | ; | |
1397 | ||
1398 | TemplateRefList: | |
1399 | Identifier | |
1400 | | TemplateRefList ',' Identifier | |
1401 | ; | |
1402 | ||
1403 | AllTemplsWithExcept: | |
1404 | AllKeyword | |
1405 | | AllKeyword ExceptKeyword TemplateRefList | |
1406 | ; | |
1407 | ||
1408 | ImportConstSpec: | |
1409 | ConstKeyword ConstRefList | |
1410 | | ConstKeyword AllConstsWithExcept | |
1411 | ; | |
1412 | ||
1413 | ConstRefList: | |
1414 | Identifier | |
1415 | | ConstRefList ',' Identifier | |
1416 | ; | |
1417 | ||
1418 | AllConstsWithExcept: | |
1419 | AllKeyword | |
1420 | | AllKeyword ExceptKeyword ConstRefList | |
1421 | ; | |
1422 | ||
1423 | ImportAltstepSpec: | |
1424 | AltstepKeyword AltstepRefList | |
1425 | | AltstepKeyword AllAltstepsWithExcept | |
1426 | ; | |
1427 | ||
1428 | AltstepRefList: | |
1429 | Identifier | |
1430 | | AltstepRefList ',' Identifier | |
1431 | ; | |
1432 | ||
1433 | AllAltstepsWithExcept: | |
1434 | AllKeyword | |
1435 | | AllKeyword ExceptKeyword AltstepRefList | |
1436 | ; | |
1437 | ||
1438 | ImportTestcaseSpec: | |
1439 | TestcaseKeyword TestcaseRefList | |
1440 | | TestcaseKeyword AllTestcasesWithExcept | |
1441 | ; | |
1442 | ||
1443 | TestcaseRefList: | |
1444 | Identifier | |
1445 | | TestcaseRefList ',' Identifier | |
1446 | ; | |
1447 | ||
1448 | AllTestcasesWithExcept: | |
1449 | AllKeyword | |
1450 | | AllKeyword ExceptKeyword TestcaseRefList | |
1451 | ; | |
1452 | ||
1453 | ImportFunctionSpec: | |
1454 | FunctionKeyword FunctionRefList | |
1455 | | FunctionKeyword AllFunctionsWithExcept | |
1456 | ; | |
1457 | ||
1458 | FunctionRefList: | |
1459 | Identifier | |
1460 | | FunctionRefList ',' Identifier | |
1461 | ; | |
1462 | ||
1463 | AllFunctionsWithExcept: | |
1464 | AllKeyword | |
1465 | | AllKeyword ExceptKeyword FunctionRefList | |
1466 | ; | |
1467 | ||
1468 | ImportSignatureSpec: | |
1469 | SignatureKeyword SignatureRefList | |
1470 | | SignatureKeyword AllSignaturesWithExcept | |
1471 | ; | |
1472 | ||
1473 | SignatureRefList: | |
1474 | Identifier | |
1475 | | SignatureRefList ',' Identifier | |
1476 | ; | |
1477 | ||
1478 | AllSignaturesWithExcept: | |
1479 | AllKeyword | |
1480 | | AllKeyword ExceptKeyword SignatureRefList | |
1481 | ; | |
1482 | ||
1483 | ImportModuleParSpec: | |
1484 | ModuleParKeyword ModuleParRefList | |
1485 | | ModuleParKeyword AllModuleParWithExcept | |
1486 | ; | |
1487 | ||
1488 | ModuleParRefList: | |
1489 | Identifier | |
1490 | | ModuleParRefList ',' Identifier | |
1491 | ; | |
1492 | ||
1493 | AllModuleParWithExcept: | |
1494 | AllKeyword | |
1495 | | AllKeyword ExceptKeyword ModuleParRefList | |
1496 | ; | |
1497 | ||
1498 | /* A.1.6.1.9 Group definitions */ | |
1499 | ||
1500 | GroupDef: | |
1501 | GroupKeyword Identifier | |
1502 | '{' optModuleDefinitionsPart '}' | |
1503 | ; | |
1504 | ||
1505 | /* A.1.6.1.10 External function definitions */ | |
1506 | ||
1507 | ExtFunctionDef: | |
1508 | ExtKeyword FunctionKeyword Identifier | |
1509 | '(' optFunctionFormalParList ')' optReturnType | |
1510 | ; | |
1511 | ||
1512 | /* A.1.6.1.11 External constant definitions */ | |
1513 | ||
1514 | ExtConstDef: | |
1515 | ExtKeyword ConstKeyword Type Identifier | |
1516 | ; | |
1517 | ||
1518 | /* A.1.6.1.12 Module parameter definitions */ | |
1519 | ||
1520 | ModuleParDef: | |
1521 | ModuleParKeyword ModulePar | |
1522 | | ModuleParKeyword '{' MultitypedModuleParList '}' | |
1523 | ; | |
1524 | ||
1525 | MultitypedModuleParList: | |
1526 | ModulePar SemiColon | |
1527 | | MultitypedModuleParList ModulePar SemiColon | |
1528 | ; | |
1529 | ||
1530 | ModulePar: | |
1531 | Type ModuleParList | |
1532 | ; | |
1533 | ||
1534 | ModuleParList: | |
1535 | SingleModulePar | |
1536 | | ModuleParList ',' SingleModulePar | |
1537 | ; | |
1538 | ||
1539 | SingleModulePar: | |
1540 | Identifier | |
1541 | | Identifier AssignmentChar Expression | |
1542 | ; | |
1543 | ||
1544 | /* A.1.6.2 Control part */ | |
1545 | ||
1546 | /* A.1.6.2.0 General */ | |
1547 | ||
1548 | optModuleControlPart: | |
1549 | /* empty */ | |
1550 | | ModuleControlPart | |
1551 | ; | |
1552 | ||
1553 | ModuleControlPart: | |
1554 | ControlKeyword | |
1555 | '{' ModuleControlBody '}' | |
1556 | optWithStatementAndSemiColon | |
1557 | ; | |
1558 | ||
1559 | ModuleControlBody: | |
1560 | /* empty */ | |
1561 | | ControlStatementOrDefList | |
1562 | ; | |
1563 | ||
1564 | ControlStatementOrDefList: | |
1565 | ControlStatementOrDef optSemiColon | |
1566 | | ControlStatementOrDefList ControlStatementOrDef optSemiColon | |
1567 | ; | |
1568 | ||
1569 | ControlStatementOrDef: | |
1570 | FunctionLocalDef | |
1571 | | FunctionLocalInst | |
1572 | | ControlStatement | |
1573 | ; | |
1574 | ||
1575 | ControlStatement: | |
1576 | TimerStatements | |
1577 | | BasicStatements | |
1578 | | BehaviourStatements | |
1579 | | SUTStatements | |
1580 | | StopKeyword | |
1581 | ; | |
1582 | ||
1583 | /* A.1.6.2.1 Variable instantiation */ | |
1584 | ||
1585 | VarInstance: | |
1586 | VarKeyword Type VarList | |
1587 | | VarKeyword TemplateKeyword Type TempVarList | |
1588 | ; | |
1589 | ||
1590 | VarList: | |
1591 | SingleVarInstance | |
1592 | | VarList ',' SingleVarInstance | |
1593 | ; | |
1594 | ||
1595 | SingleVarInstance: | |
1596 | Identifier optArrayDef | |
1597 | | Identifier optArrayDef AssignmentChar VarInitialValue | |
1598 | ; | |
1599 | ||
1600 | VarInitialValue: | |
1601 | Expression | |
1602 | ; | |
1603 | ||
1604 | TempVarList: | |
1605 | SingleTempVarInstance | |
1606 | | TempVarList ',' SingleTempVarInstance | |
1607 | ; | |
1608 | ||
1609 | SingleTempVarInstance: | |
1610 | Identifier optArrayDef | |
1611 | | Identifier optArrayDef AssignmentChar TempVarInitialValue | |
1612 | ; | |
1613 | ||
1614 | TempVarInitialValue: | |
1615 | TemplateBody | |
1616 | ; | |
1617 | ||
1618 | VariableRef: | |
1619 | Reference | |
1620 | ; | |
1621 | ||
1622 | /* A.1.6.2.2 Timer instantiation */ | |
1623 | ||
1624 | TimerInstance: | |
1625 | TimerKeyword TimerList | |
1626 | ; | |
1627 | ||
1628 | TimerList: | |
1629 | SingleTimerInstance | |
1630 | | TimerList ',' SingleTimerInstance | |
1631 | ; | |
1632 | ||
1633 | SingleTimerInstance: | |
1634 | Identifier optArrayDef | |
1635 | | Identifier optArrayDef AssignmentChar TimerValue | |
1636 | ; | |
1637 | ||
1638 | TimerValue: | |
1639 | Expression | |
1640 | ; | |
1641 | ||
1642 | TimerRef: | |
1643 | VariableRef | |
1644 | ; | |
1645 | ||
1646 | /* A.1.6.2.3 Component operations */ | |
1647 | ||
1648 | ConfigurationStatements: | |
1649 | ConnectStatement | |
1650 | | MapStatement | |
1651 | | DisconnectStatement | |
1652 | | UnmapStatement | |
1653 | | DoneStatement | |
1654 | | KilledStatement | |
1655 | | StartTCStatement | |
1656 | | StopTCStatement | |
1657 | | KillTCStatement | |
1658 | ; | |
1659 | ||
1660 | ConfigurationOps: | |
1661 | CreateOp | |
1662 | | SelfOp | |
1663 | | SystemOp | |
1664 | | MTCOp | |
1665 | | RunningOp | |
1666 | | AliveOp | |
1667 | ; | |
1668 | ||
1669 | CreateOp: | |
1670 | VariableRef DotCreateKeyword optAliveKeyword | |
1671 | | VariableRef DotCreateKeyword '(' SingleExpression ')' optAliveKeyword | |
1672 | ; | |
1673 | ||
1674 | optAliveKeyword: | |
1675 | /* empty */ | |
1676 | | AliveKeyword | |
1677 | ; | |
1678 | ||
1679 | SystemOp: | |
1680 | SystemKeyword | |
1681 | ; | |
1682 | ||
1683 | MTCOp: | |
1684 | MTCKeyword | |
1685 | ; | |
1686 | ||
1687 | DoneStatement: | |
1688 | ComponentId DotDoneKeyword | |
1689 | ; | |
1690 | ||
1691 | KilledStatement: | |
1692 | ComponentId DotKilledKeyword | |
1693 | ; | |
1694 | ||
1695 | ComponentId: | |
1696 | ComponentOrDefaultReference | |
1697 | | AnyKeyword ComponentKeyword | |
1698 | | AllKeyword ComponentKeyword | |
1699 | ; | |
1700 | ||
1701 | RunningOp: | |
1702 | /* VariableRef DotRunningKeyword -- covered by RunningTimerOp */ | |
1703 | FunctionInstance DotRunningKeyword | |
1704 | | AnyKeyword ComponentKeyword DotRunningKeyword | |
1705 | | AllKeyword ComponentKeyword DotRunningKeyword | |
1706 | ; | |
1707 | ||
1708 | AliveOp: | |
1709 | ComponentId DotAliveKeyword | |
1710 | ; | |
1711 | ||
1712 | ConnectStatement: | |
1713 | ConnectKeyword SingleConnectionSpec | |
1714 | ; | |
1715 | ||
1716 | SingleConnectionSpec: | |
1717 | '(' PortRef ',' PortRef ')' | |
1718 | ; | |
1719 | ||
1720 | PortRef: | |
1721 | ComponentRef Colon Port | |
1722 | ; | |
1723 | ||
1724 | ComponentRef: | |
1725 | ComponentOrDefaultReference | |
1726 | | SystemOp | |
1727 | | SelfOp | |
1728 | | MTCOp | |
1729 | ; | |
1730 | ||
1731 | DisconnectStatement: | |
1732 | DisconnectKeyword optSingleOrMultiConnectionSpec | |
1733 | ; | |
1734 | ||
1735 | optSingleOrMultiConnectionSpec: | |
1736 | /* empty */ | |
1737 | | SingleConnectionSpec | |
1738 | | AllConnectionsSpec | |
1739 | | AllPortsSpec | |
1740 | | AllCompsAllPortsSpec | |
1741 | ; | |
1742 | ||
1743 | AllConnectionsSpec: | |
1744 | '(' PortRef ')' | |
1745 | ; | |
1746 | ||
1747 | AllPortsSpec: | |
1748 | '(' ComponentRef ':' AllKeyword PortKeyword ')' | |
1749 | ; | |
1750 | ||
1751 | AllCompsAllPortsSpec: | |
1752 | '(' AllKeyword ComponentKeyword ':' AllKeyword PortKeyword ')' | |
1753 | ; | |
1754 | ||
1755 | MapStatement: | |
1756 | MapKeyword SingleConnectionSpec | |
1757 | ; | |
1758 | ||
1759 | UnmapStatement: | |
1760 | UnmapKeyword optSingleOrMultiConnectionSpec | |
1761 | ; | |
1762 | ||
1763 | StartTCStatement: | |
1764 | /* VariableRef DotStartKeyword '(' FunctionInstance ')' | |
1765 | -- covered by StartTimerStatement */ | |
1766 | FunctionInstance DotStartKeyword '(' FunctionInstance ')' | |
1767 | ; | |
1768 | ||
1769 | StopTCStatement: | |
1770 | StopKeyword | |
1771 | /* | VariableRef DotStopKeyword -- covered by StopTimerStatement */ | |
1772 | | FunctionInstance DotStopKeyword | |
1773 | | MTCOp DotStopKeyword | |
1774 | | SelfOp DotStopKeyword | |
1775 | | AllKeyword ComponentKeyword DotStopKeyword | |
1776 | ; | |
1777 | ||
1778 | ComponentReferenceOrLiteral: | |
1779 | ComponentOrDefaultReference | |
1780 | | MTCOp | |
1781 | | SelfOp | |
1782 | ; | |
1783 | ||
1784 | KillTCStatement: | |
1785 | KillKeyword | |
1786 | | ComponentReferenceOrLiteral DotKillKeyword | |
1787 | | AllKeyword ComponentKeyword DotKillKeyword | |
1788 | ; | |
1789 | ||
1790 | ComponentOrDefaultReference: | |
1791 | VariableRef | |
1792 | | FunctionInstance | |
1793 | ; | |
1794 | ||
1795 | /* A.1.6.2.4 Port operations */ | |
1796 | ||
1797 | Port: | |
1798 | VariableRef | |
1799 | ; | |
1800 | ||
1801 | CommunicationStatements: | |
1802 | SendStatement | |
1803 | | CallStatement | |
1804 | | ReplyStatement | |
1805 | | RaiseStatement | |
1806 | | ReceiveStatement | |
1807 | | TriggerStatement | |
1808 | | GetCallStatement | |
1809 | | GetReplyStatement | |
1810 | | CatchStatement | |
1811 | | CheckStatement | |
1812 | | ClearStatement | |
1813 | | StartStatement | |
1814 | | StopStatement | |
1815 | ; | |
1816 | ||
1817 | SendStatement: | |
1818 | Port DotSendOpKeyword PortSendOp | |
1819 | ; | |
1820 | ||
1821 | PortSendOp: | |
1822 | '(' SendParameter ')' optToClause | |
1823 | ; | |
1824 | ||
1825 | SendParameter: | |
1826 | TemplateInstance | |
1827 | ; | |
1828 | ||
1829 | optToClause: | |
1830 | /* empty */ | |
1831 | | ToKeyword AddressRef | |
1832 | /* | ToKeyword AddressRefList -- covered by the previous rule | |
1833 | (as ValueOrAttribList) */ | |
1834 | | ToKeyword AllKeyword ComponentKeyword | |
1835 | ; | |
1836 | ||
1837 | AddressRefList: | |
1838 | '(' seqAddressRef ')' | |
1839 | ; | |
1840 | ||
1841 | seqAddressRef: | |
1842 | AddressRef | |
1843 | | seqAddressRef ',' AddressRef | |
1844 | ; | |
1845 | ||
1846 | AddressRef: | |
1847 | TemplateInstance | |
1848 | ; | |
1849 | ||
1850 | CallStatement: | |
1851 | Port DotCallOpKeyword PortCallOp optPortCallBody | |
1852 | ; | |
1853 | ||
1854 | PortCallOp: | |
1855 | '(' CallParameters ')' optToClause | |
1856 | ; | |
1857 | ||
1858 | CallParameters: | |
1859 | TemplateInstance | |
1860 | | TemplateInstance ',' CallTimerValue | |
1861 | ; | |
1862 | ||
1863 | CallTimerValue: | |
1864 | TimerValue | |
1865 | | NowaitKeyword | |
1866 | ; | |
1867 | ||
1868 | optPortCallBody: | |
1869 | /* empty */ | |
1870 | | '{' CallBodyStatementList '}' | |
1871 | ; | |
1872 | ||
1873 | CallBodyStatementList: | |
1874 | CallBodyStatement optSemiColon | |
1875 | | CallBodyStatementList CallBodyStatement optSemiColon | |
1876 | ; | |
1877 | ||
1878 | CallBodyStatement: | |
1879 | CallBodyGuard StatementBlock | |
1880 | ; | |
1881 | ||
1882 | CallBodyGuard: | |
1883 | AltGuardChar CallBodyOps | |
1884 | ; | |
1885 | ||
1886 | CallBodyOps: | |
1887 | GetReplyStatement | |
1888 | | CatchStatement | |
1889 | ; | |
1890 | ||
1891 | ReplyStatement: | |
1892 | Port DotReplyKeyword PortReplyOp | |
1893 | ; | |
1894 | ||
1895 | PortReplyOp: | |
1896 | '(' TemplateInstance optReplyValue ')' optToClause | |
1897 | ; | |
1898 | ||
1899 | optReplyValue: | |
1900 | /* empty */ | |
1901 | | ValueKeyword Expression | |
1902 | ; | |
1903 | ||
1904 | RaiseStatement: | |
1905 | Port DotRaiseKeyword PortRaiseOp | |
1906 | ; | |
1907 | ||
1908 | PortRaiseOp: | |
1909 | '(' Signature ',' TemplateInstance ')' optToClause | |
1910 | ; | |
1911 | ||
1912 | ReceiveStatement: | |
1913 | PortOrAny DotReceiveOpKeyword PortReceiveOp | |
1914 | ; | |
1915 | ||
1916 | PortOrAny: | |
1917 | Port | |
1918 | | AnyKeyword PortKeyword | |
1919 | ; | |
1920 | ||
1921 | PortReceiveOp: | |
1922 | optReceiveParameter optFromClause optPortRedirect | |
1923 | ; | |
1924 | ||
1925 | optReceiveParameter: | |
1926 | /* empty */ | |
1927 | | '(' ReceiveParameter ')' | |
1928 | ; | |
1929 | ||
1930 | ReceiveParameter: | |
1931 | TemplateInstance | |
1932 | ; | |
1933 | ||
1934 | optFromClause: | |
1935 | /* empty */ | |
1936 | | FromClause | |
1937 | ; | |
1938 | ||
1939 | FromClause: | |
1940 | FromKeyword AddressRef | |
1941 | ; | |
1942 | ||
1943 | optPortRedirect: | |
1944 | /* empty */ | |
1945 | | PortRedirectSymbol ValueSpec | |
1946 | | PortRedirectSymbol SenderSpec | |
1947 | | PortRedirectSymbol ValueSpec SenderSpec | |
1948 | ; | |
1949 | ||
1950 | ValueSpec: | |
1951 | ValueKeyword VariableRef | |
1952 | ; | |
1953 | ||
1954 | SenderSpec: | |
1955 | SenderKeyword VariableRef | |
1956 | ; | |
1957 | ||
1958 | TriggerStatement: | |
1959 | PortOrAny DotTriggerOpKeyword PortTriggerOp | |
1960 | ; | |
1961 | ||
1962 | PortTriggerOp: | |
1963 | optReceiveParameter optFromClause optPortRedirect | |
1964 | ; | |
1965 | ||
1966 | GetCallStatement: | |
1967 | PortOrAny DotGetCallOpKeyword PortGetCallOp | |
1968 | ; | |
1969 | ||
1970 | PortGetCallOp: | |
1971 | optReceiveParameter optFromClause optPortRedirectWithParam | |
1972 | ; | |
1973 | ||
1974 | optPortRedirectWithParam: | |
1975 | /* empty */ | |
1976 | | PortRedirectSymbol RedirectWithParamSpec | |
1977 | ; | |
1978 | ||
1979 | RedirectWithParamSpec: | |
1980 | ParamSpec | |
1981 | | ParamSpec SenderSpec | |
1982 | | SenderSpec | |
1983 | ; | |
1984 | ||
1985 | ParamSpec: | |
1986 | ParamKeyword ParamAssignmentList | |
1987 | ; | |
1988 | ||
1989 | ParamAssignmentList: | |
1990 | '(' AssignmentList ')' | |
1991 | | '(' VariableList ')' | |
1992 | ; | |
1993 | ||
1994 | AssignmentList: | |
1995 | VariableAssignment | |
1996 | | AssignmentList ',' VariableAssignment | |
1997 | ; | |
1998 | ||
1999 | VariableAssignment: | |
2000 | VariableRef AssignmentChar Identifier | |
2001 | ; | |
2002 | ||
2003 | VariableList: | |
2004 | VariableEntry | |
2005 | | VariableList ',' VariableEntry | |
2006 | ; | |
2007 | ||
2008 | VariableEntry: | |
2009 | VariableRef | |
2010 | | NotUsedSymbol | |
2011 | ; | |
2012 | ||
2013 | GetReplyStatement: | |
2014 | PortOrAny DotGetReplyOpKeyword PortGetReplyOp | |
2015 | ; | |
2016 | ||
2017 | PortGetReplyOp: | |
2018 | optGetReplyParameter optFromClause | |
2019 | optPortRedirectWithValueAndParam | |
2020 | ; | |
2021 | ||
2022 | optPortRedirectWithValueAndParam: | |
2023 | /* empty */ | |
2024 | | PortRedirectSymbol RedirectWithValueAndParamSpec | |
2025 | ; | |
2026 | ||
2027 | RedirectWithValueAndParamSpec: | |
2028 | ValueSpec | |
2029 | | ValueSpec ParamSpec | |
2030 | | ValueSpec SenderSpec | |
2031 | | ValueSpec ParamSpec SenderSpec | |
2032 | | RedirectWithParamSpec | |
2033 | ; | |
2034 | ||
2035 | optGetReplyParameter: | |
2036 | /* empty */ | |
2037 | | '(' ReceiveParameter ')' | |
2038 | | '(' ReceiveParameter ValueMatchSpec ')' | |
2039 | ; | |
2040 | ||
2041 | ValueMatchSpec: | |
2042 | ValueKeyword TemplateInstance | |
2043 | ; | |
2044 | ||
2045 | CheckStatement: | |
2046 | PortOrAny DotCheckOpKeyword optCheckParameter | |
2047 | ; | |
2048 | ||
2049 | optCheckParameter: | |
2050 | /* empty */ | |
2051 | | '(' CheckParameter ')' | |
2052 | ; | |
2053 | ||
2054 | CheckParameter: | |
2055 | CheckPortOpsPresent | |
2056 | | FromClausePresent | |
2057 | | RedirectPresent | |
2058 | ; | |
2059 | ||
2060 | FromClausePresent: | |
2061 | FromClause | |
2062 | | FromClause PortRedirectSymbol SenderSpec | |
2063 | ; | |
2064 | ||
2065 | RedirectPresent: | |
2066 | PortRedirectSymbol SenderSpec | |
2067 | ; | |
2068 | ||
2069 | CheckPortOpsPresent: | |
2070 | ReceiveOpKeyword PortReceiveOp | |
2071 | | GetCallOpKeyword PortGetCallOp | |
2072 | | GetReplyOpKeyword PortGetReplyOp | |
2073 | | CatchOpKeyword PortCatchOp | |
2074 | ; | |
2075 | ||
2076 | CatchStatement: | |
2077 | PortOrAny DotCatchOpKeyword PortCatchOp | |
2078 | ; | |
2079 | ||
2080 | PortCatchOp: | |
2081 | optCatchOpParameter optFromClause optPortRedirect | |
2082 | ; | |
2083 | ||
2084 | optCatchOpParameter: | |
2085 | /* empty */ | |
2086 | | '(' CatchOpParameter ')' | |
2087 | ; | |
2088 | ||
2089 | CatchOpParameter: | |
2090 | Signature ',' TemplateInstance | |
2091 | | TimeoutKeyword | |
2092 | ; | |
2093 | ||
2094 | ClearStatement: | |
2095 | PortOrAll DotClearOpKeyword | |
2096 | ; | |
2097 | ||
2098 | PortOrAll: | |
2099 | Port | |
2100 | | AllKeyword PortKeyword | |
2101 | ; | |
2102 | ||
2103 | StartStatement: | |
2104 | /* Port DotPortStartKeyword -- covered by StartTimerStatement */ | |
2105 | AllKeyword PortKeyword DotStartKeyword | |
2106 | ; | |
2107 | ||
2108 | StopStatement: | |
2109 | /* Port DotPortStopKeyword -- covered by StopTimerStatement */ | |
2110 | AllKeyword PortKeyword DotStopKeyword | |
2111 | ; | |
2112 | ||
2113 | /* A.1.6.2.5 Timer operations */ | |
2114 | ||
2115 | TimerStatements: | |
2116 | StartTimerStatement | |
2117 | | StopTimerStatement | |
2118 | | TimeoutStatement | |
2119 | ; | |
2120 | ||
2121 | TimerOps: | |
2122 | ReadTimerOp | |
2123 | | RunningTimerOp | |
2124 | ; | |
2125 | ||
2126 | StartTimerStatement: | |
2127 | TimerRef DotStartKeyword optTimerValue | |
2128 | ; | |
2129 | ||
2130 | optTimerValue: | |
2131 | /* empty */ | |
2132 | | '(' TimerValue ')' | |
2133 | ; | |
2134 | ||
2135 | StopTimerStatement: | |
2136 | TimerRefOrAll DotStopKeyword | |
2137 | ; | |
2138 | ||
2139 | TimerRefOrAll: | |
2140 | TimerRef | |
2141 | | AllKeyword TimerKeyword | |
2142 | ; | |
2143 | ||
2144 | ReadTimerOp: | |
2145 | TimerRef DotReadKeyword | |
2146 | ; | |
2147 | ||
2148 | RunningTimerOp: | |
2149 | TimerRefOrAny DotRunningKeyword | |
2150 | ; | |
2151 | ||
2152 | TimeoutStatement: | |
2153 | TimerRefOrAny DotTimeoutKeyword | |
2154 | ; | |
2155 | ||
2156 | TimerRefOrAny: | |
2157 | TimerRef | |
2158 | | AnyKeyword TimerKeyword | |
2159 | ; | |
2160 | ||
2161 | /* A.1.6.3 Type */ | |
2162 | ||
2163 | Type: | |
2164 | PredefinedType | |
2165 | | ReferencedType | |
2166 | ; | |
2167 | ||
2168 | PredefinedType: | |
2169 | BitStringKeyword | |
2170 | | BooleanKeyword | |
2171 | | CharStringKeyword | |
2172 | | UniversalCharString | |
2173 | | IntegerKeyword | |
2174 | | OctetStringKeyword | |
2175 | | HexStringKeyword | |
2176 | | VerdictTypeKeyword | |
2177 | | FloatKeyword | |
2178 | | AddressKeyword | |
2179 | | DefaultKeyword | |
2180 | | AnyTypeKeyword | |
2181 | | ObjectIdentifierKeyword | |
2182 | ; | |
2183 | ||
2184 | UniversalCharString: | |
2185 | UniversalKeyword CharStringKeyword | |
2186 | ; | |
2187 | ||
2188 | ReferencedType: | |
2189 | Reference | |
2190 | | FunctionInstance optExtendedFieldReference | |
2191 | /* covers all parameterized type references */ | |
2192 | ; | |
2193 | ||
2194 | TypeReference: | |
2195 | Identifier | |
2196 | | Identifier TypeActualParList | |
2197 | ; | |
2198 | ||
2199 | TypeActualParList: | |
2200 | '(' seqTypeActualPar ')' | |
2201 | ; | |
2202 | ||
2203 | seqTypeActualPar: | |
2204 | TypeActualPar | |
2205 | | seqTypeActualPar ',' TypeActualPar | |
2206 | ; | |
2207 | ||
2208 | TypeActualPar: | |
2209 | Expression | |
2210 | ; | |
2211 | ||
2212 | optArrayDef: | |
2213 | /* empty */ | |
2214 | | optArrayDef ArrayIndex | |
2215 | ; | |
2216 | ||
2217 | ArrayIndex: | |
2218 | '[' ArrayBounds ']' | |
2219 | | '[' ArrayBounds DotDot ArrayBounds ']' | |
2220 | ; | |
2221 | ||
2222 | ArrayBounds: | |
2223 | SingleExpression | |
2224 | ; | |
2225 | ||
2226 | /* A.1.6.4 Value */ | |
2227 | ||
2228 | Value: | |
2229 | PredefinedValue | |
2230 | | ReferencedValue | |
2231 | ; | |
2232 | ||
2233 | PredefinedValue: | |
2234 | BitStringValue | |
2235 | | BooleanValue | |
2236 | | CharStringValue | |
2237 | | IntegerValue | |
2238 | | OctetStringValue | |
2239 | | HexStringValue | |
2240 | | VerdictTypeValue | |
2241 | /* | EnumeratedValue -- covered by ReferencedValue */ | |
2242 | | FloatValue | |
2243 | | AddressValue | |
2244 | | OmitValue | |
2245 | | ObjectIdentifierValue | |
2246 | ; | |
2247 | ||
2248 | BitStringValue: | |
2249 | Bstring | |
2250 | ; | |
2251 | ||
2252 | BooleanValue: | |
2253 | BooleanConst | |
2254 | ; | |
2255 | ||
2256 | IntegerValue: | |
2257 | Number | |
2258 | ; | |
2259 | ||
2260 | OctetStringValue: | |
2261 | Ostring | |
2262 | ; | |
2263 | ||
2264 | HexStringValue: | |
2265 | Hstring | |
2266 | ; | |
2267 | ||
2268 | VerdictTypeValue: | |
2269 | VerdictConst | |
2270 | ; | |
2271 | ||
2272 | CharStringValue: | |
2273 | Cstring | |
2274 | | Quadruple | |
2275 | ; | |
2276 | ||
2277 | Quadruple: | |
2278 | CharKeyword '(' Group ',' Plane ',' Row ',' Cell ')' | |
2279 | ; | |
2280 | ||
2281 | Group: | |
2282 | Number | |
2283 | ; | |
2284 | ||
2285 | Plane: | |
2286 | Number | |
2287 | ; | |
2288 | ||
2289 | Row: | |
2290 | Number | |
2291 | ; | |
2292 | ||
2293 | Cell: | |
2294 | Number | |
2295 | ; | |
2296 | ||
2297 | ReferencedValue: | |
2298 | Reference | |
2299 | ; | |
2300 | ||
2301 | Reference: | |
2302 | Identifier | |
2303 | | Identifier Dot Identifier optExtendedFieldReference | |
2304 | | Identifier Dot PredefinedType optExtendedFieldReference | |
2305 | | Identifier ArrayOrBitRef optExtendedFieldReference | |
2306 | | Identifier Dot ObjectIdentifierValue Dot Identifier | |
2307 | optExtendedFieldReference | |
2308 | ; | |
2309 | ||
2310 | FreeText: | |
2311 | Cstring | |
2312 | ; | |
2313 | ||
2314 | AddressValue: | |
2315 | NullKeyword | |
2316 | ; | |
2317 | ||
2318 | OmitValue: | |
2319 | OmitKeyword | |
2320 | ; | |
2321 | ||
2322 | /* A.1.6.5 Parameterization */ | |
2323 | ||
2324 | FormalValuePar: | |
2325 | Type Identifier | |
2326 | | InParKeyword Type Identifier | |
2327 | | InOutParKeyword Type Identifier | |
2328 | | OutParKeyword Type Identifier | |
2329 | ; | |
2330 | ||
2331 | FormalPortPar: | |
2332 | Identifier Identifier | |
2333 | | InOutParKeyword Identifier Identifier | |
2334 | ; | |
2335 | ||
2336 | FormalTimerPar: | |
2337 | TimerKeyword Identifier | |
2338 | | InOutParKeyword TimerKeyword Identifier | |
2339 | ; | |
2340 | ||
2341 | FormalTemplatePar: | |
2342 | TemplateKeyword Type Identifier | |
2343 | | InParKeyword TemplateKeyword Type Identifier | |
2344 | | InOutParKeyword TemplateKeyword Type Identifier | |
2345 | | OutParKeyword TemplateKeyword Type Identifier | |
2346 | ; | |
2347 | ||
2348 | /* A.1.6.6 With statement */ | |
2349 | ||
2350 | optWithStatement: | |
2351 | /* empty */ | |
2352 | | WithStatement | |
2353 | ; | |
2354 | ||
2355 | optWithStatementAndSemiColon: | |
2356 | /* empty */ | |
2357 | | WithStatement | |
2358 | | SemiColon | |
2359 | | WithStatement SemiColon | |
2360 | ; | |
2361 | ||
2362 | WithStatement: | |
2363 | WithKeyword WithAttribList | |
2364 | ; | |
2365 | ||
2366 | WithAttribList: | |
2367 | '{' MultiWithAttrib '}' | |
2368 | ; | |
2369 | ||
2370 | MultiWithAttrib: | |
2371 | SingleWithAttrib optSemiColon | |
2372 | | MultiWithAttrib SingleWithAttrib optSemiColon | |
2373 | ; | |
2374 | ||
2375 | SingleWithAttrib: | |
2376 | AttribKeyword optOverrideKeyword optAttribQualifier AttribSpec | |
2377 | ; | |
2378 | ||
2379 | AttribKeyword: | |
2380 | EncodeKeyword | |
2381 | | VariantKeyword | |
2382 | | DisplayKeyword | |
2383 | | ExtensionKeyword | |
2384 | ; | |
2385 | ||
2386 | optOverrideKeyword: | |
2387 | /* empty */ | |
2388 | | OverrideKeyword | |
2389 | ; | |
2390 | ||
2391 | optAttribQualifier: | |
2392 | /* empty */ | |
2393 | | '(' DefOrFieldRefList ')' | |
2394 | ; | |
2395 | ||
2396 | DefOrFieldRefList: | |
2397 | DefOrFieldRef | |
2398 | | DefOrFieldRefList ',' DefOrFieldRef | |
2399 | ; | |
2400 | ||
2401 | DefOrFieldRef: | |
2402 | DefinitionRef | |
2403 | | FieldReference | |
2404 | | AllRef | |
2405 | ; | |
2406 | ||
2407 | DefinitionRef: | |
2408 | /* other alternatives are covered by FieldReference */ | |
2409 | Identifier Dot FullGroupIdentifier | |
2410 | ; | |
2411 | ||
2412 | AllRef: | |
2413 | GroupKeyword AllKeyword | |
2414 | | GroupKeyword AllKeyword ExceptKeyword '{' GroupRefList '}' | |
2415 | | TypeDefKeyword AllKeyword | |
2416 | | TypeDefKeyword AllKeyword ExceptKeyword '{' TypeRefList '}' | |
2417 | | TemplateKeyword AllKeyword | |
2418 | | TemplateKeyword AllKeyword ExceptKeyword '{' TemplateRefList '}' | |
2419 | | ConstKeyword AllKeyword | |
2420 | | ConstKeyword AllKeyword ExceptKeyword '{' ConstRefList '}' | |
2421 | | AltstepKeyword AllKeyword | |
2422 | | AltstepKeyword AllKeyword ExceptKeyword '{' AltstepRefList '}' | |
2423 | | TestcaseKeyword AllKeyword | |
2424 | | TestcaseKeyword AllKeyword ExceptKeyword '{' TestcaseRefList '}' | |
2425 | | FunctionKeyword AllKeyword | |
2426 | | FunctionKeyword AllKeyword ExceptKeyword '{' FunctionRefList '}' | |
2427 | | SignatureKeyword AllKeyword | |
2428 | | SignatureKeyword AllKeyword ExceptKeyword '{' SignatureRefList '}' | |
2429 | | ModuleParKeyword AllKeyword | |
2430 | | ModuleParKeyword AllKeyword ExceptKeyword '{' ModuleParRefList '}' | |
2431 | ; | |
2432 | ||
2433 | AttribSpec: | |
2434 | FreeText | |
2435 | ; | |
2436 | ||
2437 | /* A.1.6.7 Behaviour statements */ | |
2438 | ||
2439 | BehaviourStatements: | |
2440 | TestcaseInstance | |
2441 | | FunctionInstance | |
2442 | | ReturnStatement | |
2443 | | AltConstruct | |
2444 | | InterleavedConstruct | |
2445 | | LabelStatement | |
2446 | | GotoStatement | |
2447 | | RepeatStatement | |
2448 | | DeactivateStatement | |
2449 | /* | AltstepInstance -- covered by FunctionInstance */ | |
2450 | | ActivateOp | |
2451 | ; | |
2452 | ||
2453 | VerdictStatements: | |
2454 | SetLocalVerdict | |
2455 | ; | |
2456 | ||
2457 | VerdictOps: | |
2458 | GetLocalVerdict | |
2459 | ; | |
2460 | ||
2461 | SetLocalVerdict: | |
2462 | SetVerdictKeyword '(' SingleExpression ')' | |
2463 | ; | |
2464 | ||
2465 | GetLocalVerdict: | |
2466 | GetVerdictKeyword | |
2467 | ; | |
2468 | ||
2469 | SUTStatements: | |
2470 | ActionKeyword '(' ')' | |
2471 | | ActionKeyword '(' seqActionText ')' | |
2472 | ; | |
2473 | ||
2474 | seqActionText: | |
2475 | ActionText | |
2476 | /* | seqActionText StringOp ActionText -- covered by the previous rule */ | |
2477 | ; | |
2478 | ||
2479 | ActionText: | |
2480 | /* FreeText -- covered by the next rule */ | |
2481 | Expression | |
2482 | ; | |
2483 | ||
2484 | ReturnStatement: | |
2485 | ReturnKeyword | |
2486 | | ReturnKeyword Expression | |
2487 | ; | |
2488 | ||
2489 | AltConstruct: | |
2490 | AltKeyword '{' AltGuardList '}' | |
2491 | ; | |
2492 | ||
2493 | AltGuardList: | |
2494 | AltGuard | |
2495 | | AltGuardList AltGuard | |
2496 | ; | |
2497 | ||
2498 | AltGuard: | |
2499 | GuardStatement | |
2500 | | ElseStatement optSemiColon | |
2501 | ; | |
2502 | ||
2503 | GuardStatement: | |
2504 | AltGuardChar AltstepInstance | |
2505 | | AltGuardChar AltstepInstance StatementBlock | |
2506 | | AltGuardChar GuardOp StatementBlock | |
2507 | ; | |
2508 | ||
2509 | ElseStatement: | |
2510 | '[' ElseKeyword ']' StatementBlock | |
2511 | ; | |
2512 | ||
2513 | AltGuardChar: | |
2514 | '[' ']' | |
2515 | | '[' BooleanExpression ']' | |
2516 | ; | |
2517 | ||
2518 | GuardOp: | |
2519 | TimeoutStatement | |
2520 | | ReceiveStatement | |
2521 | | TriggerStatement | |
2522 | | GetCallStatement | |
2523 | | CatchStatement | |
2524 | | CheckStatement | |
2525 | | GetReplyStatement | |
2526 | | DoneStatement | |
2527 | | KilledStatement | |
2528 | ; | |
2529 | ||
2530 | InterleavedConstruct: | |
2531 | InterleavedKeyword '{' InterleavedGuardList '}' | |
2532 | ; | |
2533 | ||
2534 | InterleavedGuardList: | |
2535 | InterleavedGuardElement optSemiColon | |
2536 | | InterleavedGuardList InterleavedGuardElement optSemiColon | |
2537 | ; | |
2538 | ||
2539 | InterleavedGuardElement: | |
2540 | InterleavedGuard InterleavedAction | |
2541 | ; | |
2542 | ||
2543 | InterleavedGuard: | |
2544 | '[' ']' GuardOp | |
2545 | ; | |
2546 | ||
2547 | InterleavedAction: | |
2548 | StatementBlock | |
2549 | ; | |
2550 | ||
2551 | LabelStatement: | |
2552 | LabelKeyword Identifier | |
2553 | ; | |
2554 | ||
2555 | GotoStatement: | |
2556 | GotoKeyword Identifier | |
2557 | ; | |
2558 | ||
2559 | RepeatStatement: | |
2560 | RepeatKeyword | |
2561 | ; | |
2562 | ||
2563 | ActivateOp: | |
2564 | ActivateKeyword '(' AltstepInstance ')' | |
2565 | ; | |
2566 | ||
2567 | DeactivateStatement: | |
2568 | DeactivateKeyword | |
2569 | | DeactivateKeyword '(' ComponentOrDefaultReference ')' | |
2570 | ; | |
2571 | ||
2572 | /* A.1.6.8 Basic statements */ | |
2573 | ||
2574 | BasicStatements: | |
2575 | Assignment | |
2576 | | LogStatement | |
2577 | | LoopConstruct | |
2578 | | ConditionalConstruct | |
2579 | | SelectCaseConstruct | |
2580 | ; | |
2581 | ||
2582 | Expression: | |
2583 | SingleExpression | |
2584 | | CompoundExpression | |
2585 | ; | |
2586 | ||
2587 | CompoundExpression: | |
2588 | FieldExpressionList | |
2589 | | ArrayExpression | |
2590 | ; | |
2591 | ||
2592 | FieldExpressionList: | |
2593 | '{' seqFieldExpressionSpec '}' | |
2594 | ; | |
2595 | ||
2596 | seqFieldExpressionSpec: | |
2597 | FieldExpressionSpec | |
2598 | | seqFieldExpressionSpec ',' FieldExpressionSpec | |
2599 | ; | |
2600 | ||
2601 | FieldExpressionSpec: | |
2602 | FieldReference AssignmentChar NotUsedOrExpression | |
2603 | ; | |
2604 | ||
2605 | ArrayExpression: | |
2606 | '{' '}' | |
2607 | | '{' ArrayElementExpressionList '}' | |
2608 | ; | |
2609 | ||
2610 | ArrayElementExpressionList: | |
2611 | NotUsedOrExpression | |
2612 | | ArrayElementExpressionList ',' NotUsedOrExpression | |
2613 | ; | |
2614 | ||
2615 | NotUsedOrExpression: | |
2616 | Expression | |
2617 | | NotUsedSymbol | |
2618 | ; | |
2619 | ||
2620 | BooleanExpression: | |
2621 | SingleExpression | |
2622 | ; | |
2623 | ||
2624 | Assignment: | |
2625 | /* VariableRef AssignmentChar Expression -- covered by the next rule */ | |
2626 | VariableRef AssignmentChar TemplateBody | |
2627 | ; | |
2628 | ||
2629 | SingleExpression: | |
2630 | XorExpression | |
2631 | | SingleExpression Or XorExpression | |
2632 | ; | |
2633 | ||
2634 | XorExpression: | |
2635 | AndExpression | |
2636 | | XorExpression Xor AndExpression | |
2637 | ; | |
2638 | ||
2639 | AndExpression: | |
2640 | NotExpression | |
2641 | | AndExpression And NotExpression | |
2642 | ; | |
2643 | ||
2644 | NotExpression: | |
2645 | EqualExpression | |
2646 | | Not EqualExpression | |
2647 | ; | |
2648 | ||
2649 | EqualExpression: | |
2650 | RelExpression | |
2651 | | EqualExpression EqualOp RelExpression | |
2652 | ; | |
2653 | ||
2654 | RelExpression: | |
2655 | ShiftExpression | |
2656 | | ShiftExpression RelOp ShiftExpression | |
2657 | ; | |
2658 | ||
2659 | ShiftExpression: | |
2660 | BitOrExpression | |
2661 | | ShiftExpression ShiftOp BitOrExpression | |
2662 | ; | |
2663 | ||
2664 | BitOrExpression: | |
2665 | BitXorExpression | |
2666 | | BitOrExpression Or4b BitXorExpression | |
2667 | ; | |
2668 | ||
2669 | BitXorExpression: | |
2670 | BitAndExpression | |
2671 | | BitXorExpression Xor4b BitAndExpression | |
2672 | ; | |
2673 | ||
2674 | BitAndExpression: | |
2675 | BitNotExpression | |
2676 | | BitAndExpression And4b BitNotExpression | |
2677 | ; | |
2678 | ||
2679 | BitNotExpression: | |
2680 | AddExpression | |
2681 | | Not4b AddExpression | |
2682 | ; | |
2683 | ||
2684 | AddExpression: | |
2685 | MulExpression | |
2686 | | AddExpression AddOp MulExpression | |
2687 | ; | |
2688 | ||
2689 | MulExpression: | |
2690 | UnaryExpression | |
2691 | | MulExpression MultiplyOp UnaryExpression | |
2692 | ; | |
2693 | ||
2694 | UnaryExpression: | |
2695 | Primary | |
2696 | | UnaryOp Primary | |
2697 | ; | |
2698 | ||
2699 | Primary: | |
2700 | OpCall | |
2701 | | Value | |
2702 | | '(' SingleExpression ')' | |
2703 | ; | |
2704 | ||
2705 | optExtendedFieldReference: | |
2706 | /* empty */ | |
2707 | | optExtendedFieldReference Dot FieldIdentifier | |
2708 | | optExtendedFieldReference ArrayOrBitRef | |
2709 | ; | |
2710 | ||
2711 | FieldIdentifier: | |
2712 | Identifier | |
2713 | | PredefinedType | |
2714 | | Identifier TypeActualParList | |
2715 | ; | |
2716 | ||
2717 | OpCall: | |
2718 | ConfigurationOps | |
2719 | | VerdictOps | |
2720 | | TimerOps | |
2721 | | TestcaseInstance | |
2722 | | FunctionInstance | |
2723 | | TemplateOps | |
2724 | | ActivateOp | |
2725 | ; | |
2726 | ||
2727 | AddOp: | |
2728 | '+' | |
2729 | | '-' | |
2730 | | StringOp | |
2731 | ; | |
2732 | ||
2733 | MultiplyOp: | |
2734 | '*' | |
2735 | | '/' | |
2736 | | Mod | |
2737 | | Rem | |
2738 | ; | |
2739 | ||
2740 | UnaryOp: | |
2741 | '+' | |
2742 | | '-' | |
2743 | ; | |
2744 | ||
2745 | RelOp: | |
2746 | '<' | |
2747 | | '>' | |
2748 | | GE | |
2749 | | LE | |
2750 | ; | |
2751 | ||
2752 | EqualOp: | |
2753 | EQ | |
2754 | | NE | |
2755 | ; | |
2756 | ||
2757 | StringOp: | |
2758 | '&' | |
2759 | ; | |
2760 | ||
2761 | ShiftOp: | |
2762 | SL | |
2763 | | SR | |
2764 | | RL | |
2765 | | RR | |
2766 | ; | |
2767 | ||
2768 | LogStatement: | |
2769 | LogKeyword '(' seqLogItem ')' | |
2770 | ; | |
2771 | ||
2772 | seqLogItem: | |
2773 | LogItem | |
2774 | | seqLogItem ',' LogItem | |
2775 | ; | |
2776 | ||
2777 | LogItem: | |
2778 | /* FreeText -- covered by the next rule */ | |
2779 | TemplateInstance | |
2780 | ; | |
2781 | ||
2782 | LoopConstruct: | |
2783 | ForStatement | |
2784 | | WhileStatement | |
2785 | | DoWhileStatement | |
2786 | ; | |
2787 | ||
2788 | ForStatement: | |
2789 | ForKeyword '(' Initial SemiColon Final SemiColon Step ')' | |
2790 | StatementBlock | |
2791 | ; | |
2792 | ||
2793 | Initial: | |
2794 | VarInstance | |
2795 | | Assignment | |
2796 | ; | |
2797 | ||
2798 | Final: | |
2799 | BooleanExpression | |
2800 | ; | |
2801 | ||
2802 | Step: | |
2803 | Assignment | |
2804 | ; | |
2805 | ||
2806 | WhileStatement: | |
2807 | WhileKeyword '(' BooleanExpression ')' | |
2808 | StatementBlock | |
2809 | ; | |
2810 | ||
2811 | DoWhileStatement: | |
2812 | DoKeyword StatementBlock | |
2813 | WhileKeyword '(' BooleanExpression ')' | |
2814 | ; | |
2815 | ||
2816 | ConditionalConstruct: | |
2817 | IfKeyword '(' BooleanExpression ')' | |
2818 | StatementBlock | |
2819 | seqElseIfClause optElseClause | |
2820 | ; | |
2821 | ||
2822 | seqElseIfClause: | |
2823 | /* empty */ | |
2824 | | seqElseIfClause ElseIfClause | |
2825 | ; | |
2826 | ||
2827 | ElseIfClause: | |
2828 | ElseKeyword IfKeyword '(' BooleanExpression ')' StatementBlock | |
2829 | ; | |
2830 | ||
2831 | optElseClause: | |
2832 | /* empty */ | |
2833 | | ElseKeyword StatementBlock | |
2834 | ; | |
2835 | ||
2836 | SelectCaseConstruct: | |
2837 | SelectKeyword '(' SingleExpression ')' SelectCaseBody | |
2838 | ; | |
2839 | ||
2840 | SelectCaseBody: | |
2841 | '{' seqSelectCase '}' | |
2842 | ; | |
2843 | ||
2844 | seqSelectCase: | |
2845 | SelectCase | |
2846 | | seqSelectCase SelectCase | |
2847 | ; | |
2848 | ||
2849 | SelectCase: | |
2850 | CaseKeyword '(' seqTemplateInstance ')' StatementBlock | |
2851 | | CaseKeyword ElseKeyword StatementBlock | |
2852 | ; | |
2853 | ||
2854 | seqTemplateInstance: | |
2855 | TemplateInstance | |
2856 | | seqTemplateInstance ',' TemplateInstance | |
2857 | ; | |
2858 | ||
2859 | /* A.1.6.9 Miscellanous productions */ | |
2860 | ||
2861 | Dot: | |
2862 | '.' | |
2863 | ; | |
2864 | ||
2865 | Dash: | |
2866 | '-' | |
2867 | ; | |
2868 | ||
2869 | Minus: | |
2870 | '-' | |
2871 | ; | |
2872 | ||
2873 | SemiColon: | |
2874 | ';' | |
2875 | ; | |
2876 | ||
2877 | optSemiColon: | |
2878 | /* empty */ | |
2879 | | ';' | |
2880 | ; | |
2881 | ||
2882 | Colon: | |
2883 | ':' | |
2884 | ; | |
2885 | ||
2886 | /* A.1 ASN.1 support */ | |
2887 | ||
2888 | optDefinitiveIdentifier: | |
2889 | /* empty */ | |
2890 | | DefinitiveIdentifier | |
2891 | ; | |
2892 | ||
2893 | DefinitiveIdentifier: | |
2894 | Dot ObjectIdentifierKeyword '{' DefinitiveObjIdComponentList '}' | |
2895 | ; | |
2896 | ||
2897 | DefinitiveObjIdComponentList: | |
2898 | DefinitiveObjIdComponent | |
2899 | | DefinitiveObjIdComponentList DefinitiveObjIdComponent | |
2900 | ; | |
2901 | ||
2902 | DefinitiveObjIdComponent: | |
2903 | NameForm | |
2904 | | DefinitiveNumberForm | |
2905 | | DefinitiveNameAndNumberForm | |
2906 | ; | |
2907 | ||
2908 | DefinitiveNumberForm: | |
2909 | Number | |
2910 | ; | |
2911 | ||
2912 | DefinitiveNameAndNumberForm: | |
2913 | Identifier '(' DefinitiveNumberForm ')' | |
2914 | ; | |
2915 | ||
2916 | ObjectIdentifierValue: | |
2917 | ObjectIdentifierKeyword '{' ObjIdComponentList '}' | |
2918 | ; | |
2919 | ||
2920 | ObjIdComponentList: | |
2921 | ObjIdComponent | |
2922 | | ObjIdComponentList ObjIdComponent | |
2923 | ; | |
2924 | ||
2925 | ObjIdComponent: | |
2926 | /* NameForm -- covered by NumberForm (as ReferencedValue) */ | |
2927 | NumberForm | |
2928 | | NameAndNumberForm | |
2929 | ; | |
2930 | ||
2931 | NumberForm: | |
2932 | Number | |
2933 | | ReferencedValue | |
2934 | ; | |
2935 | ||
2936 | NameAndNumberForm: | |
2937 | Identifier '(' NumberForm ')' | |
2938 | ; | |
2939 | ||
2940 | NameForm: | |
2941 | Identifier | |
2942 | ; | |
2943 | ||
2944 | %% | |
2945 | ||
2946 | /* Additional C code */ | |
2947 | ||
2948 | extern int yylineno; | |
2949 | extern char *yytext; | |
2950 | extern FILE *yyin; | |
2951 | ||
2952 | extern int dot_flag; | |
2953 | ||
2954 | void yyerror(char *s) | |
2955 | { | |
2956 | fprintf(stderr, "line %d: syntax error at or near token '%s': " | |
2957 | "%s\n", yylineno, yytext, s); | |
2958 | } | |
2959 | ||
2960 | void parse_input() | |
2961 | { | |
2962 | dot_flag = 0; | |
2963 | if (!yyparse()) fprintf(stderr, "The input was parsed successfully!\n"); | |
2964 | else fprintf(stderr, "Parse error!\n"); | |
2965 | } | |
2966 | ||
2967 | int main(int argc, char *argv[]) | |
2968 | { | |
2969 | puts("TTCN-3 parser. Complies with BNF v3.0.0\n" | |
d44e3c4f | 2970 | "Copyright (c) 2000-2016 Ericsson Telecom AB"); |
970ed795 EL |
2971 | if (argc > 1) { |
2972 | int i; | |
2973 | for (i = 1; i < argc; i++) { | |
2974 | yyin = fopen(argv[i], "r"); | |
2975 | if (yyin == NULL) { | |
2976 | fprintf(stderr, "%s: Cannot open file" | |
2977 | " %s for reading: %s\n", argv[0], argv[i], | |
2978 | strerror(errno)); | |
2979 | return 1; | |
2980 | } | |
2981 | printf("Parsing file %s ...\n", argv[i]); | |
2982 | parse_input(); | |
2983 | fclose(yyin); | |
2984 | } | |
2985 | } else { | |
2986 | puts("Parsing standard input ..."); | |
2987 | parse_input(); | |
2988 | } | |
2989 | return 0; | |
2990 | } |