1 /******************************************************************************
2 * Copyright (c) 2000-2014 Ericsson Telecom AB
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
7 ******************************************************************************/
8 /* Syntax check parser and compiler for TTCN-3 */
10 /* BNF compliance: v3.2.1 with extensions */
21 #include "../../common/dbgnew.hh"
22 #include "../../common/memory.h"
24 #include "../datatypes.h"
25 #include "Attributes.hh"
29 #include "../Identifier.hh"
30 #include "Templatestuff.hh"
31 #include "AST_ttcn3.hh"
33 #include "../CompType.hh"
34 #include "../CompField.hh"
35 #include "../EnumItem.hh"
36 #include "../SigParam.hh"
38 #include "../subtype.hh"
39 #include "../Value.hh"
40 #include "../Valuestuff.hh"
41 #include "../ustring.hh"
42 #include "Ttcnstuff.hh"
43 #include "TtcnTemplate.hh"
44 #include "Templatestuff.hh"
45 #include "ArrayDimensions.hh"
46 #include "PatternString.hh"
47 #include "Statement.hh"
50 using namespace Common;
52 const char *infile = NULL;
54 static Ttcn::Module *act_ttcn3_module = NULL;
55 static Ttcn::ErroneousAttributeSpec *act_ttcn3_erroneous_attr_spec = NULL;
56 bool is_erroneous_parsed = false;
57 static void ttcn3_error(const char *str);
58 static Group* act_group = NULL;
59 extern string anytype_field(const string& type_name);
60 static bool anytype_access = false;
65 static void yyprint(FILE *file, int type, const YYSTYPE& value);
66 #define YYPRINT(f,t,v) yyprint(f,t,v)
70 extern Modules *modules;
72 extern FILE *ttcn3_in;
73 extern char *ttcn3_text;
74 extern int ttcn3_lex();
75 extern void init_ttcn3_lex();
76 extern void free_ttcn3_lex();
77 extern void set_md5_checksum(Ttcn::Module *m);
79 extern void init_erroneous_lex(const char* p_infile, int p_line, int p_column);
80 struct yy_buffer_state;
81 extern int ttcn3_lex_destroy(void);
82 extern yy_buffer_state *ttcn3__scan_string(const char *yy_str);
83 extern void free_dot_flag_stuff();
85 extern string *parse_charstring_value(const char *str, const Location& loc);
86 extern PatternString* parse_pattern(const char *str, const Location& loc);
88 static const string anyname("anytype");
90 /* Various C macros */
92 #define YYERROR_VERBOSE
97 /* Bison declarations */
99 /*********************************************************************
101 *********************************************************************/
104 /* NOTE: the union is written to compiler.tab.hh, which is #included
105 * into compiler.l; therefore all types used here must be declared
106 * in compiler.l (forward declared or #included) */
107 bool bool_val; /* boolean value */
108 char *str; /* simple string value */
109 unsigned char uchar_val;
111 int_val_t *int_val; /* integer value */
112 Real float_val; /* float value */
115 ustring *ustring_val;
117 Type::typetype_t typetype;
118 PortTypeBody::PortOperationMode_t portoperationmode;
119 Value::operationtype_t operationtype;
120 Value::macrotype_t macrotype;
121 SingleWithAttrib::attribtype_t attribtype;
122 ImpMod::imptype_t imptype;
125 AltGuards *altguards;
126 ArrayDimension *arraydimension;
127 AttributeSpec *attributespec;
128 CompField *compfield;
129 CompFieldMap *compfieldmap;
132 Definition *definition;
135 EnumItems *enumitems;
136 FieldOrArrayRef *fieldorarrayref;
137 FormalPar *formalpar;
138 FormalParList *formalparlist;
140 FriendMod *friendMod;
142 IfClauses *ifclauses;
144 LengthRestriction *lenrestr;
146 LogArguments *logargs;
147 NamedTemplate *namedtempl;
148 NamedTemplates *namedtempls;
149 NamedValue *namedvalue;
150 NamedValues *namedvalues;
151 IndexedTemplate *indexedtempl;
152 IndexedTemplates *indexedtempls;
153 IndexedValue *indexedvalue;
154 MultiWithAttrib *multiwithattrib;
156 ParamAssignment *parass;
157 ParamAssignments *parasss;
158 ParamRedirect *parredir;
159 ParsedActualParameters *parsedpar;
160 PatternString *patstr;
161 Qualifier *qualifier;
162 Qualifiers *qualifiers;
163 SelectCase *selectcase;
164 SelectCases *selectcases;
165 SignatureExceptions *signexc;
166 SignatureParam *signparam;
167 SignatureParamList *signparamlist;
168 SingleWithAttrib *singlewithattrib;
170 StatementBlock *statementblock;
171 SubTypeParse *subtypeparse;
173 TemplateInstance *templinst;
174 TemplateInstances *templinsts;
176 Ttcn::Assignment *ass;
177 Ttcn::Ref_base *refbase;
178 Ttcn::Ref_pard *refpard;
179 Ttcn::Reference *reference;
180 ValueRange *valuerange;
185 VariableEntries *variableentries;
186 VariableEntry *variableentry;
187 vector<SubTypeParse> *subtypeparses;
188 CompTypeRefList *comprefs;
189 ComponentTypeBody *compbody;
190 template_restriction_t template_restriction;
194 ErroneousAttributeSpec::indicator_t indicator;
195 } erroneous_indicator;
197 struct arraydimension_list_t {
199 ArrayDimension **elements;
200 } arraydimension_list;
204 FieldOrArrayRef **elements;
205 } fieldorarrayref_list;
209 Ttcn::Definition **elements;
214 Ttcn::FriendMod **elements;
219 Statement **elements;
225 bool lower_exclusive;
227 bool upper_exclusive;
232 bool returns_template;
233 template_restriction_t template_restriction;
239 } returntypeornoblock;
252 Ttcn::Types *in_list, *out_list, *inout_list;
253 bool in_all, out_all, inout_all;
257 Ttcn::Reference *ref;
263 LengthRestriction *len_restr;
264 } extramatchingattrs;
269 FormalParList *fp_list;
278 Ttcn::Ref_pard *ref_pard;
279 Value *derefered_value;
280 ParsedActualParameters *ap_list;
285 Ttcn::Ref_pard *ref_pard;
286 Value *derefered_value;
287 TemplateInstances *ap_list;
291 TemplateInstance *templ_inst;
296 Value *calltimerval; // if NULL: see nowait
301 TemplateInstance *templ_inst;
302 Value *calltimerval; // if NULL: see nowait
304 Value *val; // not used in callparams
308 TemplateInstance *templ_inst;
314 Ttcn::Reference *signature;
315 TemplateInstance *templ_inst;
320 Ttcn::Reference *redirectval;
321 Ttcn::Reference *redirectsender;
325 ParamRedirect *redirectparam;
326 Ttcn::Reference *redirectsender;
327 } portredirectwithparam;
330 Ttcn::Reference *redirectval;
331 ParamRedirect *redirectparam;
332 Ttcn::Reference *redirectsender;
333 } portredirectwithvalueandparam;
336 TemplateInstance *templ_inst;
337 TemplateInstance *valuematch;
341 TemplateInstance *templ_inst;
342 TemplateInstance *fromclause;
343 Ttcn::Reference *redirectval;
344 Ttcn::Reference *redirectsender;
348 TemplateInstance *templ_inst;
349 TemplateInstance *fromclause;
350 ParamRedirect *redirectparam;
351 Ttcn::Reference *redirectsender;
355 TemplateInstance *templ_inst;
356 TemplateInstance *valuematch;
357 TemplateInstance *fromclause;
358 Ttcn::Reference *redirectval;
359 ParamRedirect *redirectparam;
360 Ttcn::Reference *redirectsender;
364 Ttcn::Reference *signature;
365 TemplateInstance *templ_inst;
370 Ttcn::Reference *signature;
371 TemplateInstance *templ_inst;
373 TemplateInstance *fromclause;
374 Ttcn::Reference *redirectval;
375 Ttcn::Reference *redirectsender;
379 Statement::statementtype_t statementtype;
380 Ttcn::Reference *signature;
381 TemplateInstance *templ_inst;
382 TemplateInstance *valuematch;
384 TemplateInstance *fromclause;
385 Ttcn::Reference *redirectval;
386 ParamRedirect *redirectparam;
387 Ttcn::Reference *redirectsender;
392 Ttcn::Reference *portref;
397 Ttcn::Reference *portref1;
399 Ttcn::Reference *portref2;
403 TemplateInstance *donematch;
404 Ttcn::Reference *redirect;
410 Ttcn::Reference *ref;
417 Ttcn::Assignment *ass;
421 Ttcn::Reference *runsonref;
422 Ttcn::Reference *systemref;
432 ParsedActualParameters *ap_list;
436 struct extconstidentifier_t {
439 } extconstidentifier;
443 extconstidentifier_t *elements;
446 struct singlevarinst_t {
448 arraydimension_list_t arrays;
449 Value *initial_value;
453 struct singlevarinst_list_t {
455 struct singlevarinst_t *elements;
456 } singlevarinst_list;
458 struct singletempvarinst_t {
460 arraydimension_list_t arrays;
461 Template *initial_value;
465 struct singletempvarinst_list_t {
467 singletempvarinst_t *elements;
468 } singletempvarinst_list;
470 struct singlemodulepar_t {
476 struct singletemplatemodulepar_t {
480 } singletemplatemodulepar;
482 struct singlemodulepar_list_t {
484 singlemodulepar_t *elements;
485 } singlemodulepar_list;
487 struct singletemplatemodulepar_list_t {
489 singletemplatemodulepar_t *elements;
490 } singletemplatemodulepar_list;
492 struct portelement_t {
494 ArrayDimensions *dims;
498 struct portelement_list_t {
500 portelement_t *elements;
503 struct runs_on_compref_or_self_t {
505 Ttcn::Reference *reference;
506 } runs_on_compref_or_self;
509 visibility_t visibility;
513 /* Tokens of TTCN-3 */
515 /*********************************************************************
516 * Tokens with semantic value
517 *********************************************************************/
519 /* Terminals with semantic value */
521 %token <int_val> Number
522 %token <float_val> FloatValue
523 %token <id> IDentifier "Identifier"
525 %token <string_val> Bstring
532 %token NullValue "ASN.1_NULL_value"
533 %token <macrotype> MacroValue
535 /*********************************************************************
536 * Tokens without semantic value
537 *********************************************************************/
539 /* Terminals without semantic value - keywords, operators, etc. */
541 %token TOK_errval "erroneous_value"
543 /* A number of terminals (including ApplyKeyword, CallOpKeyword, etc)
544 * are listed as unused by Bison. They do not appear in any rule,
545 * because the lexer does some magic to combine them with the preceding dot
546 * and returns a (DotApplyKeyword, DotCallOpKeyword, etc) instead.
547 * This magic requires the presence of the unused keywords.
548 * (It can return an ApplyKeyword if not preceded by a dot) */
549 %token TitanErroneousHackKeyword
551 %token ActivateKeyword
552 %token AddressKeyword
556 %token AltstepKeyword
560 %token AnyTypeKeyword
562 %token BitStringKeyword
563 %token BooleanKeyword
567 %token CatchOpKeyword
569 %token CharStringKeyword
570 %token CheckOpKeyword
571 %token ClearOpKeyword
572 %token ComplementKeyword
573 %token ComponentKeyword
574 %token ConnectKeyword
576 %token ContinueKeyword
577 %token ControlKeyword
579 %token DeactivateKeyword
580 %token DefaultKeyword
581 %token DerefersKeyword
582 %token DisconnectKeyword
583 %token DisplayKeyword
591 %token ExceptionKeyword
592 %token ExecuteKeyword
593 %token ExtendsKeyword
594 %token ExtensionKeyword
602 %token FunctionKeyword
603 %token GetCallOpKeyword
604 %token GetReplyOpKeyword
605 %token GetVerdictKeyword
609 %token HexStringKeyword
611 %token IfPresentKeyword
614 %token InfinityKeyword
615 %token InOutParKeyword
617 %token IntegerKeyword
618 %token InterleavedKeyword
622 %token LanguageKeyword
627 %token MessageKeyword
630 %token ModifiesKeyword
631 %token ModuleParKeyword
634 %token NoBlockKeyword
640 %token ObjectIdentifierKeyword
641 %token OctetStringKeyword
645 %token OptionalKeyword
649 %token OverrideKeyword
652 %token PatternKeyword
653 %token PermutationKeyword
654 %token PresentKeyword
656 %token PrivateKeyword
657 %token ProcedureKeyword
661 %token ReceiveOpKeyword
663 %token RecursiveKeyword
669 %token RunningKeyword
676 %token SetVerdictKeyword
677 %token SignatureKeyword
681 %token SupersetKeyword
683 %token TemplateKeyword
684 %token TestcaseKeyword
685 %token TimeoutKeyword
688 %token TriggerOpKeyword
690 %token TTCN3ModuleKeyword
691 %token TypeDefKeyword
693 %token UniversalKeyword
696 %token ValueofKeyword
698 %token VariantKeyword
699 %token VerdictTypeKeyword
705 /* TITAN specific keywords */
706 %token TitanSpecificTryKeyword
707 %token TitanSpecificCatchKeyword
708 %token TitanSpecificLazyKeyword
709 %token TitanSpecificProfilerKeyword
711 /* Keywords combined with a leading dot */
713 /* If a '.' (dot) character is followed by one of the keywords below the
714 * lexical analyzer shall return one combined token instead of two distinct
715 * tokens. This eliminates the ambiguity that causes additional shift/reduce
716 * conflicts because the dot can be either the part of a field reference or a
717 * built-in operation denoted by a keyword. */
719 %token DotAliveKeyword
720 %token DotApplyKeyword
721 %token DotCallOpKeyword
722 %token DotCatchOpKeyword
723 %token DotCheckOpKeyword
724 %token DotClearOpKeyword
725 %token DotCreateKeyword
726 %token DotDoneKeyword
727 %token DotGetCallOpKeyword
728 %token DotGetReplyOpKeyword
729 %token DotHaltKeyword
730 %token DotKillKeyword
731 %token DotKilledKeyword
732 %token DotRaiseKeyword
733 %token DotReadKeyword
734 %token DotReceiveOpKeyword
735 %token DotReplyKeyword
736 %token DotRunningKeyword
737 %token DotSendOpKeyword
738 %token DotStartKeyword
739 %token DotStopKeyword
740 %token DotTimeoutKeyword
741 %token DotTriggerOpKeyword
743 /* Predefined function identifiers */
745 %token bit2hexKeyword
746 %token bit2intKeyword
747 %token bit2octKeyword
748 %token bit2strKeyword
749 %token char2intKeyword
750 %token char2octKeyword
752 %token float2intKeyword
753 %token hex2bitKeyword
754 %token hex2intKeyword
755 %token hex2octKeyword
756 %token hex2strKeyword
757 %token int2bitKeyword
758 %token int2charKeyword
759 %token int2floatKeyword
760 %token int2hexKeyword
761 %token int2octKeyword
762 %token int2strKeyword
763 %token int2unicharKeyword
764 %token isvalueKeyword
765 %token isboundKeyword
766 %token ischosenKeyword
767 %token ispresentKeyword
768 %token lengthofKeyword
769 %token oct2bitKeyword
770 %token oct2charKeyword
771 %token oct2hexKeyword
772 %token oct2intKeyword
773 %token oct2strKeyword
774 %token oct2unicharKeyword
776 %token replaceKeyword
778 %token testcasenameKeyword
780 %token str2floatKeyword
781 %token str2intKeyword
782 %token str2octKeyword
784 %token unichar2intKeyword
785 %token unichar2charKeyword
786 %token unichar2octKeyword
788 %token float2strKeyword
789 %token str2bitKeyword
790 %token str2hexKeyword
792 %token log2strKeyword
793 %token enum2intKeyword
795 %token encvalueKeyword
796 %token decvalueKeyword
798 %token ttcn2stringKeyword
799 %token string2ttcnKeyword
800 %token remove_bomKeyWord
801 %token get_stringencodingKeyWord
802 %token encode_base64KeyWord
803 %token decode_base64KeyWord
805 /* Multi-character operators */
807 %token AssignmentChar ":="
809 %token PortRedirectSymbol "->"
817 %token _RR "@>" /* Name clash with bn.h:292 */
819 /*********************************************************************
820 * Semantic types of nonterminals
821 *********************************************************************/
823 %type <bool_val> optAliveKeyword optOptionalKeyword optOverrideKeyword
824 optErrValueRaw optAllKeyword optLazyEval
825 %type <str> FreeText optLanguageSpec PatternChunk PatternChunkList
826 %type <uchar_val> Group Plane Row Cell
827 %type <id> FieldIdentifier FieldReference GlobalModuleId
828 IdentifierOrAddressKeyword StructFieldRef PredefOrIdentifier
829 %type <string_val> CstringList
830 %type <ustring_val> Quadruple
832 %type <typetype> PredefinedType
833 %type <portoperationmode> PortOperationMode
834 %type <operationtype> PredefinedOpKeyword1 PredefinedOpKeyword2 PredefinedOpKeyword3
836 %type <activateop> ActivateOp
837 %type <attribtype> AttribKeyword
839 %type <altguard> CallBodyStatement AltGuard ElseStatement GuardStatement
840 InterleavedGuardElement
841 %type <altguards> AltGuardList CallBodyStatementList InterleavedGuardList
843 %type <arraydimension> ArrayIndex
844 %type <attributespec> AttribSpec
845 %type <compbody> optComponentDefList ComponentElementDefList
846 %type <compfield> StructFieldDef UnionFieldDef
847 %type <compfieldmap> StructFieldDefList optStructFieldDefList UnionFieldDefList
848 %type <definition> AltstepDef ExtFunctionDef FunctionDef TemplateDef TestcaseDef
849 %type <deftype> TypeDefBody StructuredTypeDef SubTypeDef RecordDef UnionDef
850 SetDef RecordOfDef SetOfDef EnumDef PortDef PortDefBody ComponentDef
851 TypeDef SignatureDef FunctionTypeDef AltstepTypeDef TestcaseTypeDef
852 %type <deftimer> SingleTimerInstance
853 %type <enumitem> Enumeration
854 %type <enumitems> EnumerationList
855 %type <fieldorarrayref> ArrayOrBitRef ArrayOrBitRefOrDash FieldOrArrayReference
856 %type <formalpar> FormalValuePar FormalTemplatePar FormalTimerPar
857 TemplateFormalPar FunctionFormalPar TestcaseFormalPar
858 %type <formalparlist> optTemplateFormalParList TemplateFormalParList
859 optFunctionFormalParList FunctionFormalParList optTestcaseFormalParList
860 TestcaseFormalParList optAltstepFormalParList
861 %type <group> GroupDef GroupIdentifier
862 %type <friend_list> FriendModuleDef
863 %type <ifclause> ElseIfClause
864 %type <ifclauses> seqElseIfClause
865 %type <impmod> ImportFromSpec ModuleId ImportDef
866 %type <lenrestr> optStringLength LengthMatch StringLength
867 %type <logarg> LogItem
868 %type <logargs> LogItemList
869 %type <multiwithattrib> MultiWithAttrib WithAttribList WithStatement
870 optWithStatement optWithStatementAndSemiColon
871 %type <namedtempl> FieldSpec
872 %type <namedtempls> seqFieldSpec
873 %type <namedvalue> FieldExpressionSpec
874 %type <namedvalues> seqFieldExpressionSpec
875 %type <indexedtempl> ArraySpec
876 %type <indexedtempls> seqArraySpec
877 %type <indexedvalue> ArrayExpressionSpec
878 %type <oidcomp> NumberForm NameAndNumberForm ObjIdComponent
879 %type <parass> VariableAssignment
880 %type <parasss> AssignmentList
881 %type <parredir> ParamAssignmentList ParamSpec
882 %type <patstr> CharStringMatch
883 %type <qualifier> DefOrFieldRef FullGroupIdentifier
884 %type <qualifiers> DefOrFieldRefList optAttribQualifier
885 %type <selectcase> SelectCase
886 %type <selectcases> seqSelectCase SelectCaseBody
887 %type <signexc> ExceptionTypeList optExceptionSpec
888 %type <signparam> SignatureFormalPar
889 %type <signparamlist> SignatureFormalParList optSignatureFormalParList
890 %type <singlewithattrib> SingleWithAttrib
891 %type <stmt> AltConstruct BasicStatements BreakStatement BehaviourStatements
892 CallBodyOps CallStatement CatchStatement CheckStatement ClearStatement
893 CommunicationStatements ConditionalConstruct ConfigurationStatements
894 ConnectStatement ContinueStatement ControlStatement DeactivateStatement
895 DisconnectStatement DoWhileStatement DoneStatement ForStatement
896 FunctionStatement GetCallStatement GetReplyStatement GotoStatement GuardOp
897 HaltStatement InterleavedConstruct KillTCStatement KilledStatement
898 LabelStatement LogStatement LoopConstruct MapStatement RaiseStatement
899 ReceiveStatement RepeatStatement ReplyStatement ReturnStatement SUTStatements
900 SendStatement SetLocalVerdict StartStatement StartTCStatement
901 StartTimerStatement StopExecutionStatement StopStatement StopTCStatement
902 StopTimerStatement TimeoutStatement TimerStatements TriggerStatement
903 UnmapStatement VerdictStatements WhileStatement SelectCaseConstruct
904 StopTestcaseStatement String2TtcnStatement ProfilerStatement
905 %type <statementblock> StatementBlock optElseClause FunctionStatementOrDefList
906 ControlStatementOrDefList ModuleControlBody
907 %type <subtypeparse> ValueOrRange
908 %type <templ> MatchingSymbol SingleValueOrAttrib SimpleSpec TemplateBody
909 ArrayElementSpec ArrayValueOrAttrib FieldSpecList ArraySpecList
910 AllElementsFrom TemplateListElem
911 %type <templinst> AddressRef FromClause FunctionActualPar InLineTemplate
912 ReceiveParameter SendParameter TemplateActualPar TemplateInstance
913 /* TestcaseActualPar */ ValueMatchSpec optFromClause optParDefaultValue
915 %type <parsedpar> FunctionActualParList TestcaseActualParList
916 optFunctionActualParList optTestcaseActualParList
917 NamedPart UnnamedPart
918 %type <templinsts> optTemplateActualParList
919 seqTemplateActualPar seqTemplateInstance
920 %type <templs> ValueOrAttribList seqValueOrAttrib ValueList Complement
921 ArrayElementSpecList SubsetMatch SupersetMatch PermutationMatch
922 %type <ass> Assignment Step
923 %type <refbase> DerivedRefWithParList TemplateRefWithParList DecValueArg
924 %type <refpard> FunctionInstance AltstepInstance
925 %type <reference> PortType optDerivedDef DerivedDef Signature VariableRef
926 TimerRef TimerRefOrAny Port PortOrAny PortOrAll ValueSpec
927 SenderSpec ComponentType optRunsOnSpec RunsOnSpec optSystemSpec
928 %type <valuerange> Range
929 %type <type> NestedEnumDef NestedRecordDef NestedRecordOfDef NestedSetDef
930 NestedSetOfDef NestedTypeDef NestedUnionDef PortDefAttribs ReferencedType
931 Type TypeOrNestedTypeDef NestedFunctionTypeDef NestedAltstepTypeDef
932 NestedTestcaseTypeDef
933 %type <types> TypeList AllOrTypeList
934 %type <value> AddressValue AliveOp AllPortsSpec AltGuardChar ArrayBounds
935 ArrayExpression ArrayExpressionList BitStringValue BooleanExpression
936 BooleanValue CharStringValue ComponentRef ComponentReferenceOrLiteral
937 ComponentOrDefaultReference CompoundExpression ConfigurationOps CreateOp
938 DereferOp Expression FieldExpressionList Final GetLocalVerdict HexStringValue
939 IntegerValue LowerBound MTCOp MatchOp NotUsedOrExpression ObjIdComponentList
940 ObjectIdentifierValue OctetStringValue OmitValue OpCall PredefinedOps
941 PredefinedValue ReadTimerOp ReferOp ReferencedValue RunningOp RunningTimerOp
942 SelfOp SingleExpression SingleLowerBound SystemOp TemplateOps TimerOps
943 TimerValue UpperBound Value ValueofOp VerdictOps VerdictValue optReplyValue
944 optTestcaseTimerValue optToClause ProfilerRunningOp
945 %type <values> ArrayElementExpressionList seqArrayExpressionSpec
946 %type <variableentries> VariableList
947 %type <variableentry> VariableEntry
948 %type <subtypeparses> seqValueOrRange AllowedValues optSubTypeSpec
950 %type <arraydimension_list> optArrayDef
951 %type <fieldorarrayref_list> optExtendedFieldReference
952 %type <def_list> AltstepLocalDef AltstepLocalDefList ComponentElementDef
953 ConstDef ExtConstDef FunctionLocalDef FunctionLocalInst ModuleDef ModulePar
954 ModuleParDef MultiTypedModuleParList PortInstance TimerInstance TimerList
956 %type <stmt_list> FunctionStatementOrDef ControlStatementOrDef
958 %type <rangedef> RangeDef
959 %type <returntype> optReturnType
960 %type <returntypeornoblock> optReturnTypeOrNoBlockKeyword
961 %type <structdefbody> StructDefBody UnionDefBody
962 %type <structofdefbody> StructOfDefBody
963 %type <portdefbody> PortDefList seqPortDefList PortDefLists
964 %type <ischosenarg> IschosenArg
965 %type <extramatchingattrs> optExtraMatchingAttributes
966 %type <basetemplate> BaseTemplate
967 %type <templateref> TemplateRef TestcaseRef FunctionRef
968 %type <testcaseinst> TestcaseInstance
969 %type <portsendop> PortSendOp
970 %type <calltimerval> CallTimerValue
971 %type <portcallop> PortCallOp CallParameters
972 %type <portreplyop> PortReplyOp
973 %type <portraiseop> PortRaiseOp
974 %type <portredirect> optPortRedirect
975 %type <portredirectwithparam> optPortRedirectWithParam
976 %type <portredirectwithvalueandparam> optPortRedirectWithValueAndParam
977 %type <getreplypar> optGetReplyParameter
978 %type <portreceiveop> PortReceiveOp PortTriggerOp
979 %type <portgetcallop> PortGetCallOp
980 %type <portgetreplyop> PortGetReplyOp
981 %type <catchoppar> optCatchOpParameter CatchOpParameter
982 %type <portcatchop> PortCatchOp
983 %type <portcheckop> optCheckParameter CheckParameter CheckPortOpsPresent
984 FromClausePresent RedirectPresent
985 %type <portref> PortRef AllConnectionsSpec
986 %type <connspec> SingleConnectionSpec SingleOrMultiConnectionSpec
987 %type <donepar> optDoneParameter
988 %type <reforid> Reference
989 %type <initial> Initial
990 %type <configspec> ConfigSpec
991 %type <createpar> optCreateParameter
992 %type <applyop> ApplyOp
993 %type <identifier_list> IdentifierList
994 %type <singlevarinst> SingleConstDef SingleVarInstance
995 %type <singlevarinst_list> ConstList VarList
996 %type <singletempvarinst> SingleTempVarInstance
997 %type <singletempvarinst_list> TempVarList
998 %type <singlemodulepar> SingleModulePar
999 %type <singletemplatemodulepar> SingleTemplateModulePar
1000 %type <singlemodulepar_list> ModuleParList
1001 %type <singletemplatemodulepar_list> TemplateModuleParList
1002 %type <portelement> PortElement
1003 %type <portelement_list> PortElementList
1004 %type <comprefs> optExtendsDef ComponentTypeList
1005 %type <runs_on_compref_or_self> optRunsOnComprefOrSelf
1006 %type <template_restriction> TemplateRestriction optTemplateRestriction
1007 TemplateOptRestricted
1008 %type <visbilitytype> optVisibility ComponentElementVisibility
1009 %type <float_val> FloatOrSpecialFloatValue
1010 %type <erroneous_indicator> ErroneousIndicator
1011 %type <imptype> ImportSpec ImportElement
1013 /*********************************************************************
1015 *********************************************************************/
1018 act_group = $$->get_parent_group();
1023 %destructor {Free($$);}
1032 delete $$.derefered_value;
1037 %destructor {delete $$;}
1051 ArrayElementExpressionList
1053 ArrayElementSpecList
1072 CallBodyStatementList
1079 CommunicationStatements
1082 ComponentElementDefList
1083 ComponentOrDefaultReference
1085 ComponentReferenceOrLiteral
1089 ConditionalConstruct
1091 ConfigurationStatements
1095 ControlStatementOrDefList
1102 DerivedRefWithParList
1116 FieldOrArrayReference
1128 FunctionActualParList
1131 FunctionFormalParList
1134 FunctionStatementOrDefList
1148 IdentifierOrAddressKeyword
1152 InterleavedConstruct
1153 InterleavedGuardElement
1154 InterleavedGuardList
1162 String2TtcnStatement
1174 NestedAltstepTypeDef
1176 NestedFunctionTypeDef
1181 NestedTestcaseTypeDef
1189 ObjectIdentifierValue
1237 SignatureFormalParList
1250 StopExecutionStatement
1251 StopTestcaseStatement
1268 TemplateFormalParList
1271 TemplateRefWithParList
1272 /* TestcaseActualPar */
1273 TestcaseActualParList
1276 TestcaseFormalParList
1313 optAltstepFormalParList
1321 optFunctionActualParList
1322 optFunctionFormalParList
1328 optSignatureFormalParList
1330 optStructFieldDefList
1332 optTemplateActualParList
1333 optTemplateFormalParList
1334 optTestcaseActualParList
1335 optTestcaseFormalParList
1336 optTestcaseTimerValue
1339 optWithStatementAndSemiColon
1341 seqFieldExpressionSpec
1343 seqTemplateActualPar
1349 for (size_t i = 0; i < $$->size(); i++) delete (*$$)[i];
1358 for(size_t i=0; i<$$.nElements; i++) delete $$.elements[i];
1365 ControlStatementOrDef
1369 FunctionStatementOrDef
1373 MultiTypedModuleParList
1379 optExtendedFieldReference
1392 optReturnTypeOrNoBlockKeyword
1410 delete $$.inout_list;
1423 delete $$.len_restr;
1425 optExtraMatchingAttributes
1444 delete $$.derefered_value;
1451 delete $$.templ_inst;
1457 delete $$.calltimerval;
1462 delete $$.templ_inst;
1463 delete $$.calltimerval;
1466 PortCallOp CallParameters
1469 delete $$.templ_inst;
1476 delete $$.signature;
1477 delete $$.templ_inst;
1483 delete $$.redirectval;
1484 delete $$.redirectsender;
1489 delete $$.redirectparam;
1490 delete $$.redirectsender;
1492 optPortRedirectWithParam
1495 delete $$.redirectval;
1496 delete $$.redirectparam;
1497 delete $$.redirectsender;
1499 optPortRedirectWithValueAndParam
1502 delete $$.templ_inst;
1503 delete $$.valuematch;
1505 optGetReplyParameter
1508 delete $$.templ_inst;
1509 delete $$.fromclause;
1510 delete $$.redirectval;
1511 delete $$.redirectsender;
1517 delete $$.templ_inst;
1518 delete $$.fromclause;
1519 delete $$.redirectparam;
1520 delete $$.redirectsender;
1525 delete $$.templ_inst;
1526 delete $$.valuematch;
1527 delete $$.fromclause;
1528 delete $$.redirectval;
1529 delete $$.redirectparam;
1530 delete $$.redirectsender;
1535 delete $$.signature;
1536 delete $$.templ_inst;
1542 delete $$.signature;
1543 delete $$.templ_inst;
1544 delete $$.fromclause;
1545 delete $$.redirectval;
1546 delete $$.redirectsender;
1551 delete $$.signature;
1552 delete $$.templ_inst;
1553 delete $$.valuematch;
1554 delete $$.fromclause;
1555 delete $$.redirectval;
1556 delete $$.redirectparam;
1557 delete $$.redirectsender;
1578 SingleConnectionSpec
1579 SingleOrMultiConnectionSpec
1582 delete $$.donematch;
1588 if ($$.is_ref) delete $$.ref;
1600 delete $$.runsonref;
1601 delete $$.systemref;
1618 for (size_t i = 0; i < $$.nElements; i++) delete $$.elements[i].id;
1625 for (size_t i = 0; i < $$.arrays.nElements; i++)
1626 delete $$.arrays.elements[i];
1627 Free($$.arrays.elements);
1628 delete $$.initial_value;
1632 SingleTempVarInstance
1635 for (size_t i = 0; i < $$.nElements; i++) {
1636 delete $$.elements[i].id;
1637 for (size_t j = 0; i < $$.elements[i].arrays.nElements; j++)
1638 delete $$.elements[i].arrays.elements[j];
1639 Free($$.elements[i].arrays.elements);
1640 delete $$.elements[i].initial_value;
1658 SingleTemplateModulePar
1661 for (size_t i = 0; i < $$.nElements; i++) {
1662 delete $$.elements[i].id;
1663 delete $$.elements[i].defval;
1670 for (size_t i = 0; i < $$.nElements; i++) {
1671 delete $$.elements[i].id;
1672 delete $$.elements[i].deftempl;
1676 TemplateModuleParList
1685 for (size_t i = 0; i < $$.nElements; i++) {
1686 delete $$.elements[i].id;
1687 delete $$.elements[i].dims;
1694 delete $$.reference;
1696 optRunsOnComprefOrSelf
1698 /*********************************************************************
1699 * Operator precedences (lowest first)
1700 *********************************************************************/
1707 %nonassoc '<' '>' GE LE
1714 %left '*' '/' ModKeyword RemKeyword
1722 XXX Source of conflicts (25 S/R):
1724 1.) 8 conflicts in one state
1725 The Expression after 'return' keyword is optional in ReturnStatement.
1726 For 8 tokens the parser cannot decide whether the token is a part of
1727 the return expression (shift) or it is the beginning of the next statement
1730 2.) 8 distinct states, each with one conflict caused by token '['
1731 The local definitions in altsteps can be followed immediately by the guard
1732 expression. When the parser sees the '[' token it cannot decide whether it
1733 belongs to the local definition as array dimension or array subreference
1734 (shift) or it is the beginning of the first guard expression (reduce).
1735 The situations are the following:
1736 - var t v := ref <here> [
1737 - var t v := ref[subref] <here> [
1738 - var t v := ref.integer <here> [
1739 - var t v := ref.subref <here> [
1742 - var t v := ref.objid{...}.subref <here> [
1743 - var template t v <here> [
1746 The sequence identifier.objid can be either the beginning of a module name
1747 qualified with a module object identifier (shift) or a reference to an objid
1748 value within an entity of type anytype (reduce).
1751 The '{' token after a call statement can be either the part of the response and
1752 exception handling part (shift) or the beginning of the next statement, which
1753 is a StatementBlock (reduce). Note that StatementBlock as a statement is a
1754 non-standard language extension.
1756 5.) 5 conflicts in in three states, related to named parameters
1758 6.) 1 Conflict due to pattern concatenation
1761 The TitanSpecificProfilerKeyword following the ReturnKeyword in a ReturnStatement
1762 can either be the returned boolean value if followed by the DotRunningKeyword (shift)
1763 or the next statement if followed by the DotStartKeyword or the DotStopKeyword (reduce).
1765 Note that the parser implemented by bison always chooses to shift instead of
1766 reduce in case of conflicts. This is the desired behaviour in situations 1.),
1767 2.), 4.) and 7.) since the opposite alternative can be forced by the correct usage
1768 of semi-colons. Situation 3.) does not cause any problems as anytype is not
1769 supported at the moment.
1774 /*********************************************************************
1776 *********************************************************************/
1778 /* The grammar of TTCN-3 */
1779 /* The numbers correspond to ES 201 873-1 V4.1.2 (2009-07) */
1784 if (is_erroneous_parsed) {
1785 delete act_ttcn3_module;
1786 act_ttcn3_module = NULL;
1787 Location loc(infile, @1);
1788 loc.error("The erroneous attribute cannot be a TTCN-3 module.");
1791 | TitanErroneousHackKeyword ErroneousAttributeSpec
1793 if (!is_erroneous_parsed) {
1794 delete act_ttcn3_erroneous_attr_spec;
1795 act_ttcn3_erroneous_attr_spec = NULL;
1796 Location loc(infile, @$);
1797 loc.error("File `%s' does not contain a TTCN-3 module.", infile);
1803 ErroneousAttributeSpec:
1804 ErroneousIndicator AssignmentChar TemplateInstance optAllKeyword
1806 act_ttcn3_erroneous_attr_spec = new ErroneousAttributeSpec($1.is_raw, $1.indicator, $3, $4);
1811 ValueKeyword optErrValueRaw
1813 $$.indicator = ErroneousAttributeSpec::I_VALUE;
1816 | IDentifier optErrValueRaw
1818 if ($1->get_ttcnname()=="before") $$.indicator = ErroneousAttributeSpec::I_BEFORE;
1819 else if ($1->get_ttcnname()=="after") $$.indicator = ErroneousAttributeSpec::I_AFTER;
1821 Location loc(infile, @1);
1822 loc.error("Invalid indicator. Valid indicators are: "
1823 "`before', `value' and `after'");
1824 $$.indicator = ErroneousAttributeSpec::I_INVALID;
1832 /* empty */ { $$ = false; }
1833 | AllKeyword { $$ = true; }
1837 /* empty */ { $$ = false; }
1838 | '(' IDentifier ')'
1840 if ($2->get_ttcnname()=="raw") $$ = true;
1842 Location loc(infile, @2);
1843 loc.error("Invalid keyword, only the optional `raw' keyword can be used here.");
1851 /* A.1.6.0 TTCN Module */
1854 TTCN3ModuleId ModuleBody optWithStatementAndSemiColon optError
1856 act_ttcn3_module->set_with_attr($3);
1857 if (anytype_access) {
1858 // If there was an attempted access to an anytype field, artificially
1859 // create a type definition as if the following appeared in TTCN-3:
1860 // type union anytype { /* empty, members added later */ }
1861 // NOTE: anything which looks like usage of an anytype field will bring
1862 // the local anytype to life, which trumps any imported anytype
1863 // (when resolving, the local anytype will be found first).
1864 // TODO: just to be safe, anytype should be removed from the exports.
1865 Type *t = new Type(Type::T_ANYTYPE);
1866 Identifier *anytype_id = new Identifier(Identifier::ID_TTCN, anyname);
1867 Def_Type *anytypedef = new Def_Type(anytype_id, t);
1868 anytypedef->set_parent_path(act_ttcn3_module->get_attrib_path());
1869 act_ttcn3_module->add_ass(anytypedef);
1870 // Def_Type is-a Definition is-a Assignment
1876 optError TTCN3ModuleKeyword IDentifier optDefinitiveIdentifier
1877 optLanguageSpec optError
1879 act_ttcn3_module = new Ttcn::Module($3);
1880 act_ttcn3_module->set_scope_name($3->get_dispname());
1881 act_ttcn3_module->set_language_spec($5);
1887 GlobalModuleId optLanguageSpec
1889 $$ = new ImpMod($1);
1890 $$->set_language_spec($2);
1895 GlobalModuleId: // 5
1896 IDentifier { $$ = $1; }
1897 | IDentifier '.' ObjectIdentifierValue
1898 { $$ = $1; delete $3; }
1902 /* empty */ { $$ = NULL; }
1903 | LanguageKeyword FreeText { $$ = $2; } // sort-of 7 LanguageSpec
1907 '{' optErrorBlock '}'
1908 | '{' ModuleDefinitionsList optErrorBlock '}'
1909 | '{' ModuleDefinitionsList ModuleControlPart optErrorBlock '}'
1910 | '{' ModuleControlPart optErrorBlock '}'
1913 /* A.1.6.1 Module definitions part */
1915 /* A.1.6.1.0 General */
1917 ModuleDefinitionsList: // 10
1918 ModuleDefinition optSemiColon
1919 | error ModuleDefinition optSemiColon
1920 | ModuleDefinitionsList optErrorBlock ModuleDefinition optSemiColon
1923 optVisibility: // 12
1924 // /* empty */ { $$.visibility = PUBLIC;}
1925 /* empty */ { $$.visibility = NOCHANGE;}
1926 | PublicKeyword { $$.visibility = PUBLIC;}
1927 | PrivateKeyword { $$.visibility = PRIVATE;}
1928 | FriendKeyword { $$.visibility = FRIEND;}
1931 /* A definition _in_ the module, not a definition _of_ a module */
1932 ModuleDefinition: // 11
1933 optVisibility ModuleDef optWithStatement
1935 for (size_t i = 0; i < $2.nElements; i++) {
1937 if (i == 0) $2.elements[i]->set_with_attr($3);
1938 else $2.elements[i]->set_with_attr($3->clone());
1940 if ($1.visibility != NOCHANGE) {
1941 $2.elements[i]->set_visibility($1.visibility);
1943 act_ttcn3_module->add_ass($2.elements[i]);
1945 $2.elements[i]->set_parent_path(act_group->get_attrib_path());
1946 act_group->add_ass($2.elements[i]);
1948 $2.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
1953 | optVisibility ImportDef optWithStatement
1955 $2->set_with_attr($3);
1956 if ($1.visibility != NOCHANGE) {
1957 $2->set_visibility($1.visibility);
1960 $2->set_parent_path(act_group->get_attrib_path());
1961 act_group->add_impmod($2);
1963 $2->set_parent_path(act_ttcn3_module->get_attrib_path());
1965 act_ttcn3_module->add_impmod($2);
1967 | PublicKeyword GroupDef optWithStatement
1968 { // only public allowed for group, and it's redundant
1969 $2->set_with_attr($3);
1970 act_group = $2->get_parent_group();
1972 | GroupDef optWithStatement
1973 { // same code as above
1974 $1->set_with_attr($2);
1975 act_group = $1->get_parent_group();
1977 | PrivateKeyword FriendModuleDef optWithStatement
1978 { // only private allowed for "friend module", and it's redundant
1979 for (size_t i = 0; i < $2.nElements; i++) {
1981 if (i == 0) $2.elements[i]->set_with_attr($3);
1982 else $2.elements[i]->set_with_attr($3->clone());
1984 act_ttcn3_module->add_friendmod($2.elements[i]);
1986 $2.elements[i]->set_parent_path(act_group->get_attrib_path());
1987 act_group->add_friendmod($2.elements[i]);
1989 $2.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
1994 | FriendModuleDef optWithStatement
1995 { // same code as above
1996 for (size_t i = 0; i < $1.nElements; i++) {
1998 if (i == 0) $1.elements[i]->set_with_attr($2);
1999 else $1.elements[i]->set_with_attr($2->clone());
2001 act_ttcn3_module->add_friendmod($1.elements[i]);
2003 $1.elements[i]->set_parent_path(act_group->get_attrib_path());
2004 act_group->add_friendmod($1.elements[i]);
2006 $1.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
2014 ConstDef { $$ = $1; }
2015 | ModuleParDef { $$ = $1; }
2019 $$.elements = (Ttcn::Definition**)
2020 Malloc(sizeof(*$$.elements));
2021 $$.elements[0] = $1;
2026 $$.elements = (Ttcn::Definition**)
2027 Malloc(sizeof(*$$.elements));
2028 $$.elements[0] = $1;
2033 $$.elements = (Ttcn::Definition**)
2034 Malloc(sizeof(*$$.elements));
2035 $$.elements[0] = $1;
2040 $$.elements = (Ttcn::Definition**)
2041 Malloc(sizeof(*$$.elements));
2042 $$.elements[0] = $1;
2047 $$.elements = (Ttcn::Definition**)
2048 Malloc(sizeof(*$$.elements));
2049 $$.elements[0] = $1;
2054 $$.elements = (Ttcn::Definition**)
2055 Malloc(sizeof(*$$.elements));
2056 $$.elements[0] = $1;
2061 $$.elements = (Ttcn::Definition**)
2062 Malloc(sizeof(*$$.elements));
2063 $$.elements[0] = $1;
2065 | ExtConstDef { $$ = $1; }
2068 /* A.1.6.1.1 Typedef definitions */
2071 TypeDefKeyword TypeDefBody
2074 $$->set_location(infile, @$);
2079 StructuredTypeDef { $$ = $1; }
2080 | SubTypeDef { $$ = $1; }
2083 StructuredTypeDef: // 16
2084 RecordDef { $$ = $1; }
2085 | UnionDef { $$ = $1; }
2086 | SetDef { $$ = $1; }
2087 | RecordOfDef { $$ = $1; }
2088 | SetOfDef { $$ = $1; }
2089 | EnumDef { $$ = $1; }
2090 | PortDef { $$ = $1; }
2091 | ComponentDef { $$ = $1; }
2092 | FunctionTypeDef { $$ = $1; }
2093 | AltstepTypeDef { $$ = $1; }
2094 | TestcaseTypeDef { $$ = $1; }
2098 RecordKeyword StructDefBody
2100 Type *type = new Type(Type::T_SEQ_T, $2.cfm);
2101 type->set_location(infile, @$);
2102 $$ = new Def_Type($2.id, type);
2106 StructDefBody: // 19
2107 IDentifier optStructDefFormalParList
2108 '{' optStructFieldDefList '}'
2113 | AddressKeyword '{' optStructFieldDefList '}'
2115 $$.id = new Identifier(Identifier::ID_TTCN, string("address"));
2120 optStructDefFormalParList:
2121 /* empty */ optError
2122 | '(' StructDefFormalParList optError ')'
2124 Location loc(infile, @$);
2125 loc.error("Type parameterization is not currently supported");
2129 Location loc(infile, @$);
2130 loc.error("Type parameterization is not currently supported");
2134 StructDefFormalParList: // -> 202 784 "Advanced Parameterization", 9
2135 optError StructDefFormalPar
2136 | StructDefFormalParList optError ',' optError StructDefFormalPar
2137 | StructDefFormalParList optError ',' error
2140 StructDefFormalPar: // -> 202 784 "Advanced Parameterization", 10
2141 FormalValuePar { delete $1; }
2144 optStructFieldDefList:
2145 /* empty */ optError { $$ = new CompFieldMap; }
2146 | StructFieldDefList optError { $$ = $1; }
2150 optError StructFieldDef
2152 $$ = new CompFieldMap;
2155 | StructFieldDefList optError ',' optError StructFieldDef
2160 | StructFieldDefList optError ',' error { $$ = $1; }
2163 StructFieldDef: // 21
2164 TypeOrNestedTypeDef IDentifier optArrayDef optSubTypeSpec optOptionalKeyword
2167 /* The subtype constraint belongs to the innermost embedded type of
2168 * possible nested 'record of' or 'set of' constructs. */
2170 while (t->is_seof()) t = t->get_ofType();
2171 t->set_parsed_restrictions($4);
2174 /* creation of array type(s) if necessary (from right to left) */
2175 for (size_t i = $3.nElements; i > 0; i--) {
2176 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2177 type->set_location(*$1);
2180 $$ = new CompField($2, type, $5);
2181 $$->set_location(infile, @$);
2186 /* empty */ { $$ = false; }
2187 | OptionalKeyword { $$ = true; }
2190 TypeOrNestedTypeDef:
2192 | NestedTypeDef { $$ = $1; }
2195 NestedTypeDef: // 22
2196 NestedRecordDef { $$ = $1; }
2197 | NestedUnionDef { $$ = $1; }
2198 | NestedSetDef { $$ = $1; }
2199 | NestedRecordOfDef { $$ = $1; }
2200 | NestedSetOfDef { $$ = $1; }
2201 | NestedEnumDef { $$ = $1; }
2202 | NestedFunctionTypeDef { $$ = $1; }
2203 | NestedAltstepTypeDef { $$ = $1; }
2204 | NestedTestcaseTypeDef { $$ = $1; }
2207 NestedRecordDef: // 23
2208 RecordKeyword '{' optStructFieldDefList '}'
2210 $$ = new Type(Type::T_SEQ_T, $3);
2211 $$->set_location(infile, @$);
2215 NestedUnionDef: // 24
2216 UnionKeyword '{' UnionFieldDefList optError '}'
2218 $$ = new Type(Type::T_CHOICE_T, $3);
2219 $$->set_location(infile, @$);
2224 SetKeyword '{' optStructFieldDefList '}'
2226 $$ = new Type(Type::T_SET_T, $3);
2227 $$->set_location(infile, @$);
2231 NestedRecordOfDef: // 26
2232 RecordKeyword optStringLength OfKeyword TypeOrNestedTypeDef
2234 $$ = new Type(Type::T_SEQOF, $4);
2236 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2237 SubTypeParse *stp = new SubTypeParse($2);
2239 $$->set_parsed_restrictions(vstp);
2241 $$->set_location(infile, @$);
2245 NestedSetOfDef: // 27
2246 SetKeyword optStringLength OfKeyword TypeOrNestedTypeDef
2248 $$ = new Type(Type::T_SETOF, $4);
2250 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2251 SubTypeParse *stp = new SubTypeParse($2);
2253 $$->set_parsed_restrictions(vstp);
2255 $$->set_location(infile, @$);
2259 NestedEnumDef: // 28
2260 EnumKeyword '{' EnumerationList optError '}'
2262 $$ = new Type(Type::T_ENUM_T, $3);
2263 $$->set_location(infile, @$);
2267 NestedFunctionTypeDef:
2268 FunctionKeyword '(' optFunctionFormalParList ')'
2269 optRunsOnComprefOrSelf optReturnType
2271 $3->set_location(infile, @2, @4);
2272 $$ = new Type(Type::T_FUNCTION, $3, $5.reference, $5.self, $6.type,
2273 $6.returns_template, $6.template_restriction);
2274 $$->set_location(infile, @$);
2278 NestedAltstepTypeDef:
2279 AltstepKeyword '(' optAltstepFormalParList ')'
2280 optRunsOnComprefOrSelf
2282 $3->set_location(infile, @2, @4);
2283 $$ = new Type(Type::T_ALTSTEP, $3, $5.reference, $5.self);
2284 $$->set_location(infile, @$);
2288 NestedTestcaseTypeDef:
2289 TestcaseKeyword '(' optTestcaseFormalParList ')'
2292 $3->set_location(infile, @2, @4);
2293 $$ = new Type(Type::T_TESTCASE, $3, $5.runsonref,
2295 $$->set_location(infile, @$);
2300 UnionKeyword UnionDefBody
2302 Type *type = new Type(Type::T_CHOICE_T, $2.cfm);
2303 type->set_location(infile, @$);
2304 $$ = new Def_Type($2.id, type);
2309 IDentifier optStructDefFormalParList
2310 '{' UnionFieldDefList optError '}'
2315 | AddressKeyword '{' UnionFieldDefList optError '}'
2317 $$.id = new Identifier(Identifier::ID_TTCN, string("address"));
2323 optError UnionFieldDef
2325 $$ = new CompFieldMap;
2328 | UnionFieldDefList optError ',' optError UnionFieldDef
2333 | UnionFieldDefList optError ',' error { $$ = $1; }
2334 | error { $$ = new CompFieldMap; }
2337 UnionFieldDef: // 34
2338 TypeOrNestedTypeDef IDentifier optArrayDef optSubTypeSpec
2341 /* The subtype constraint belongs to the innermost embedded type of
2342 * possible nested 'record of' or 'set of' constructs. */
2344 while (t->is_seof()) t = t->get_ofType();
2345 t->set_parsed_restrictions($4);
2348 /* creation of array type(s) if necessary (from right to left) */
2349 for (size_t i = $3.nElements; i > 0; i--) {
2350 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2351 type->set_location(*$1);
2354 $$ = new CompField($2, type, false);
2355 $$->set_location(infile, @$);
2360 SetKeyword StructDefBody
2362 Type *type = new Type(Type::T_SET_T, $2.cfm);
2363 type->set_location(infile, @$);
2364 $$ = new Def_Type($2.id, type);
2369 RecordKeyword optStringLength OfKeyword StructOfDefBody
2371 Type *type = new Type(Type::T_SEQOF, $4.type);
2373 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2374 vstp->add(new SubTypeParse($2));
2375 type->set_parsed_restrictions(vstp);
2377 type->set_location(infile, @$);
2378 $$ = new Def_Type($4.id, type);
2382 StructOfDefBody: // 39
2383 TypeOrNestedTypeDef IdentifierOrAddressKeyword optSubTypeSpec
2386 /* The subtype constraint belongs to the innermost embedded type of
2387 * possible nested 'record of' or 'set of' constructs. */
2389 while (t->is_seof()) t = t->get_ofType();
2390 t->set_parsed_restrictions($3);
2397 IdentifierOrAddressKeyword:
2398 IDentifier { $$ = $1; }
2401 $$ = new Identifier(Identifier::ID_TTCN, string("address"));
2406 SetKeyword optStringLength OfKeyword StructOfDefBody
2408 Type *type = new Type(Type::T_SETOF, $4.type);
2410 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2411 vstp->add(new SubTypeParse($2));
2412 type->set_parsed_restrictions(vstp);
2414 type->set_location(infile, @$);
2415 $$ = new Def_Type($4.id, type);
2420 EnumKeyword IdentifierOrAddressKeyword
2421 '{' EnumerationList optError '}'
2423 Type *type = new Type(Type::T_ENUM_T, $4);
2424 type->set_location(infile, @$);
2425 $$ = new Def_Type($2, type);
2429 EnumerationList: // 44
2430 optError Enumeration
2435 | EnumerationList optError ',' optError Enumeration
2440 | EnumerationList optError ',' error { $$ = $1; }
2441 | error { $$ = new EnumItems; }
2447 $$ = new EnumItem($1, NULL);
2448 $$->set_location(infile, @$);
2450 | IDentifier '(' Number optError ')'
2452 Value *value = new Value(Value::V_INT, $3);
2453 value->set_location(infile, @3);
2454 $$ = new EnumItem($1, value);
2455 $$->set_location(infile, @$);
2457 | IDentifier '(' '-' Number optError ')'
2460 Value *value = new Value(Value::V_INT, $4);
2461 value->set_location(infile, @3, @4);
2462 $$ = new EnumItem($1, value);
2463 $$->set_location(infile, @$);
2465 | IDentifier '(' error ')'
2467 Value *value = new Value(Value::V_ERROR);
2468 value->set_location(infile, @3);
2469 $$ = new EnumItem($1, value);
2470 $$->set_location(infile, @$);
2475 Type IdentifierOrAddressKeyword optArrayDef optSubTypeSpec
2477 /* the subtype constraint belongs to the innermost type */
2478 if ($4) $1->set_parsed_restrictions($4);
2480 /* creation of array type(s) if necessary (from right to left) */
2481 for (size_t i = $3.nElements; i > 0; i--) {
2482 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2483 type->set_location(*$1);
2486 $$ = new Def_Type($2, type);
2490 optSubTypeSpec: // [49]
2491 /* empty */ { $$ = 0; }
2492 | AllowedValues { $$ = $1; }
2493 | AllowedValues StringLength
2496 $$->add(new SubTypeParse($2));
2500 $$ = new vector<SubTypeParse>;
2501 $$->add(new SubTypeParse($1));
2505 AllowedValues: // 50
2506 '(' seqValueOrRange optError ')' { $$ = $2; }
2507 | '(' CharStringMatch optError ')'
2509 $$ = new vector<SubTypeParse>;
2510 $$->add(new SubTypeParse($2));
2512 | '(' error ')' { $$ = new vector<SubTypeParse>; }
2516 optError ValueOrRange
2518 $$ = new vector<SubTypeParse>;
2521 | seqValueOrRange optError ',' optError ValueOrRange
2526 | seqValueOrRange optError ',' error { $$ = $1; }
2530 RangeDef { $$ = new SubTypeParse($1.lower, $1.lower_exclusive, $1.upper, $1.upper_exclusive); }
2531 | Expression { $$ = new SubTypeParse($1); }
2535 LowerBound DotDot UpperBound
2537 $$.lower_exclusive = false;
2539 $$.upper_exclusive = false;
2542 | '!' LowerBound DotDot UpperBound
2544 $$.lower_exclusive = true;
2546 $$.upper_exclusive = false;
2549 | LowerBound DotDot '!' UpperBound
2551 $$.lower_exclusive = false;
2553 $$.upper_exclusive = true;
2556 | '!' LowerBound DotDot '!' UpperBound
2558 $$.lower_exclusive = true;
2560 $$.upper_exclusive = true;
2566 /* empty */ optError { $$ = 0; }
2567 | StringLength { $$ = $1; }
2571 LengthKeyword '(' Expression optError ')'
2573 $$ = new LengthRestriction($3);
2574 $$->set_location(infile, @$);
2576 | LengthKeyword '(' Expression DotDot UpperBound optError ')'
2578 $$ = new LengthRestriction($3, $5);
2579 $$->set_location(infile, @$);
2581 | LengthKeyword '(' error ')'
2583 Value *value = new Value(Value::V_ERROR);
2584 value->set_location(infile, @3);
2585 $$ = new LengthRestriction(value);
2586 $$->set_location(infile, @$);
2593 $$ = new Ttcn::Reference($1);
2594 $$->set_location(infile, @$);
2596 | IDentifier '.' IDentifier
2598 $$ = new Ttcn::Reference($1, $3);
2599 $$->set_location(infile, @$);
2601 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
2603 $$ = new Ttcn::Reference($1, $5);
2604 $$->set_location(infile, @$);
2610 PortKeyword PortDefBody { $$ = $2; }
2614 IDentifier PortDefAttribs
2616 $$ = new Def_Type($1, $2);
2620 PortDefAttribs: // 60
2621 PortOperationMode PortDefLists
2623 PortTypeBody *body = new PortTypeBody($1,
2624 $2.in_list, $2.out_list, $2.inout_list,
2625 $2.in_all, $2.out_all, $2.inout_all);
2626 body->set_location(infile, @$);
2627 $$ = new Type(Type::T_PORT, body);
2628 $$->set_location(infile, @$);
2633 MessageKeyword { $$ = PortTypeBody::PO_MESSAGE; } // 61
2634 | ProcedureKeyword { $$ = PortTypeBody::PO_PROCEDURE; } // 68
2635 | MixedKeyword { $$ = PortTypeBody::PO_MIXED; } // 73
2636 | error { $$ = PortTypeBody::PO_MIXED; }
2640 '{' seqPortDefList '}' { $$ = $2; }
2648 $$.inout_all = false;
2653 optError PortDefList optSemiColon { $$ = $2; }
2654 | seqPortDefList PortDefList optSemiColon
2659 $$.in_list->steal_types($2.in_list);
2661 } else $$.in_list = $2.in_list;
2665 $$.out_list->steal_types($2.out_list);
2667 } else $$.out_list = $2.out_list;
2669 if ($2.inout_list) {
2670 if ($$.inout_list) {
2671 $$.inout_list->steal_types($2.inout_list);
2672 delete $2.inout_list;
2673 } else $$.inout_list = $2.inout_list;
2677 Location loc(infile, @2);
2678 loc.warning("Duplicate directive `in all' in port type definition");
2679 } else $$.in_all = true;
2683 Location loc(infile, @2);
2684 loc.warning("Duplicate directive `out all' in port type definition");
2685 } else $$.out_all = true;
2689 Location loc(infile, @2);
2690 loc.warning("Duplicate directive `inout all' in port type definition");
2691 } else $$.inout_all = true;
2697 InParKeyword AllOrTypeList
2701 $$.in_list->set_location(infile, @$);
2710 $$.inout_all = false;
2712 | OutParKeyword AllOrTypeList
2718 $$.out_list->set_location(infile, @$);
2725 $$.inout_all = false;
2727 | InOutParKeyword AllOrTypeList
2735 $$.inout_list->set_location(infile, @$);
2736 $$.inout_all = false;
2739 $$.inout_all = true;
2742 | InParKeyword error
2749 $$.inout_all = false;
2751 | OutParKeyword error
2758 $$.inout_all = false;
2760 | InOutParKeyword error
2767 $$.inout_all = false;
2771 AllOrTypeList: // 65
2772 AllKeyword { $$ = 0; }
2773 | TypeList { $$ = $1; }
2782 | TypeList optError ',' optError Type
2787 | TypeList optError ',' error { $$ = $1; }
2791 ComponentKeyword IDentifier
2793 '{' optComponentDefList '}'
2796 if ($3) $5->add_extends($3);
2797 $5->set_location(infile, @$);
2798 Type *type = new Type(Type::T_COMPONENT, $5);
2799 type->set_location(infile, @$);
2800 $$ = new Def_Type($2, type);
2805 /* empty */ optError { $$ = 0; }
2806 | ExtendsKeyword ComponentTypeList optError
2809 $$->set_location(infile, @1, @2);
2811 | ExtendsKeyword error { $$ = 0; }
2815 optError ComponentType
2817 $$ = new CompTypeRefList();
2820 | ComponentTypeList optError ',' optError ComponentType
2825 | ComponentTypeList optError ',' error { $$ = $1; }
2828 ComponentType: // 81
2831 $$ = new Ttcn::Reference($1);
2832 $$->set_location(infile, @$);
2834 | IDentifier '.' IDentifier
2836 $$ = new Ttcn::Reference($1, $3);
2837 $$->set_location(infile, @$);
2839 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
2841 $$ = new Ttcn::Reference($1, $5);
2842 $$->set_location(infile, @$);
2847 optComponentDefList:
2848 optError /* empty */ { $$ = new ComponentTypeBody(); }
2849 | ComponentElementDefList optError { $$ = $1; }
2852 ComponentElementDefList:
2853 optError ComponentElementDef optSemiColon
2855 $$ = new ComponentTypeBody();
2856 for (size_t i = 0; i < $2.nElements; i++)
2857 $$->add_ass($2.elements[i]);
2860 | ComponentElementDefList optError ComponentElementDef optSemiColon
2863 for (size_t i = 0; i < $3.nElements; i++)
2864 $$->add_ass($3.elements[i]);
2869 ComponentElementVisibility:
2870 PublicKeyword { $$.visibility = PUBLIC;}
2871 | PrivateKeyword { $$.visibility = PRIVATE;}
2874 ComponentElementDef: // 84
2875 PortInstance { $$ = $1; }
2876 | VarInstance { $$ = $1; }
2877 | TimerInstance { $$ = $1; }
2878 | ConstDef { $$ = $1; }
2879 | ComponentElementVisibility PortInstance
2882 for (size_t i = 0; i < $2.nElements; i++) {
2883 $2.elements[i]->set_visibility($1.visibility);
2886 | ComponentElementVisibility VarInstance
2889 for (size_t i = 0; i < $2.nElements; i++) {
2890 $2.elements[i]->set_visibility($1.visibility);
2893 | ComponentElementVisibility TimerInstance
2896 for (size_t i = 0; i < $2.nElements; i++) {
2897 $2.elements[i]->set_visibility($1.visibility);
2900 | ComponentElementVisibility ConstDef
2903 for (size_t i = 0; i < $2.nElements; i++) {
2904 $2.elements[i]->set_visibility($1.visibility);
2910 PortKeyword PortType PortElementList
2912 $$.nElements = $3.nElements;
2913 $$.elements = (Ttcn::Definition**)
2914 Malloc($$.nElements*sizeof(*$$.elements));
2915 for (size_t i = 0; i < $3.nElements; i++) {
2916 Ttcn::Reference *ref = i > 0 ? $2->clone() : $2;
2917 $$.elements[i] = new Ttcn::Def_Port($3.elements[i].id, ref,
2918 $3.elements[i].dims);
2919 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
2926 optError PortElement
2929 $$.elements = (YYSTYPE::portelement_t*)Malloc(sizeof(*$$.elements));
2930 $$.elements[0] = $2;
2932 | PortElementList ',' optError PortElement
2934 $$.nElements = $1.nElements + 1;
2935 $$.elements = (YYSTYPE::portelement_t*)
2936 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
2937 $$.elements[$$.nElements - 1] = $4;
2939 | PortElementList ',' error { $$ = $1; }
2943 IDentifier optArrayDef
2946 if ($2.nElements > 0) {
2947 $$.dims = new ArrayDimensions;
2948 for (size_t i = 0; i < $2.nElements; i++) $$.dims->add($2.elements[i]);
2955 /* A.1.6.1.2 Constant definitions */
2958 ConstKeyword Type ConstList
2960 $$.nElements = $3.nElements;
2961 $$.elements = (Ttcn::Definition**)
2962 Malloc($$.nElements*sizeof(*$$.elements));
2963 for (size_t i = 0; i < $$.nElements; i++) {
2966 type = new Type(Type::T_REFDSPEC, $2);
2967 type->set_location(*$2);
2969 /* creation of array type(s) if necessary (from right to left) */
2970 for (size_t j = $3.elements[i].arrays.nElements; j > 0; j--) {
2971 type = new Type(Type::T_ARRAY, type,
2972 $3.elements[i].arrays.elements[j - 1], false);
2973 type->set_location(*$2);
2975 Free($3.elements[i].arrays.elements);
2977 /* Create the definition */
2978 $$.elements[i] = new Def_Const($3.elements[i].id,
2979 type, $3.elements[i].initial_value);
2980 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
2987 optError SingleConstDef
2990 $$.elements = (YYSTYPE::singlevarinst_t*)Malloc(sizeof(*$$.elements));
2991 $$.elements[0] = $2;
2993 | ConstList ',' optError SingleConstDef
2995 $$.nElements = $1.nElements + 1;
2996 $$.elements = (YYSTYPE::singlevarinst_t*)
2997 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
2998 $$.elements[$$.nElements - 1] = $4;
3002 SingleConstDef: // 90
3003 IDentifier optArrayDef AssignmentChar Expression
3007 $$.initial_value = $4;
3013 FunctionKeyword IDentifier '(' optFunctionFormalParList ')'
3014 optRunsOnComprefOrSelf optReturnType
3016 $4->set_location(infile, @3, @5);
3017 Type *type = new Type(Type::T_FUNCTION, $4, $6.reference, $6.self, $7.type,
3018 $7.returns_template, $7.template_restriction);
3019 type->set_location(infile, @$);
3020 $$ = new Ttcn::Def_Type($2, type);
3021 $$->set_location(infile, @$);
3026 AltstepKeyword IDentifier '(' optAltstepFormalParList ')'
3027 optRunsOnComprefOrSelf
3029 $4->set_location(infile, @3, @5);
3030 Type *type = new Type(Type::T_ALTSTEP, $4, $6.reference, $6.self);
3031 type->set_location(infile, @$);
3032 $$ = new Ttcn::Def_Type($2, type);
3033 $$->set_location(infile, @$);
3038 TestcaseKeyword IDentifier '(' optTestcaseFormalParList ')'
3041 $4->set_location(infile, @3, @5);
3042 Type *type = new Type(Type::T_TESTCASE, $4, $6.runsonref,
3044 type->set_location(infile, @$);
3045 $$ = new Ttcn::Def_Type($2, type);
3046 $$->set_location(infile, @$);
3050 /* A.1.6.1.3 Template definitions */
3053 TemplateKeyword optTemplateRestriction BaseTemplate
3054 optDerivedDef AssignmentChar TemplateBody
3056 $$ = new Def_Template($2, $3.name, $3.type, $3.fp_list, $4, $6);
3057 $$->set_location(infile, @$);
3062 Type IDentifier optTemplateFormalParList
3068 /* | Signature IDentifier optTemplateFormalParList -- covered by the previous
3073 /* empty */ { $$ = 0; }
3074 | DerivedDef { $$ = $1; }
3078 ModifiesKeyword TemplateRef
3080 $$ = new Ttcn::Reference($2.modid, $2.id);
3081 $$->set_location(infile, @$);
3083 | ModifiesKeyword error { $$ = 0; }
3086 optTemplateFormalParList:
3087 /* empty */ optError { $$ = 0; }
3088 | '(' TemplateFormalParList optError ')'
3091 $$->set_location(infile, @$);
3095 $$ = new FormalParList;
3096 $$->set_location(infile, @$);
3100 TemplateFormalParList: // 99 is a FormalParList*
3101 optError TemplateFormalPar
3103 $$ = new FormalParList;
3106 | TemplateFormalParList optError ',' optError TemplateFormalPar
3111 | TemplateFormalParList optError ',' error { $$ = $1; }
3114 TemplateFormalPar: // 100
3115 FormalValuePar { $$ = $1; }
3116 | FormalTemplatePar { $$ = $1; }
3119 TemplateBody: // 101 is a Template*
3120 SimpleSpec optExtraMatchingAttributes
3123 $$->set_length_restriction($2.len_restr);
3124 $$->set_ifpresent($2.is_ifpresent);
3126 | FieldSpecList optExtraMatchingAttributes
3129 $$->set_length_restriction($2.len_restr);
3130 $$->set_ifpresent($2.is_ifpresent);
3132 | ArraySpecList optExtraMatchingAttributes
3135 $$->set_length_restriction($2.len_restr);
3136 $$->set_ifpresent($2.is_ifpresent);
3138 | ArrayValueOrAttrib optExtraMatchingAttributes
3141 $$->set_length_restriction($2.len_restr);
3142 $$->set_ifpresent($2.is_ifpresent);
3147 SingleValueOrAttrib { $$ = $1; }
3150 FieldSpecList: // 103
3153 $$ = new Template(Template::TEMPLATE_LIST, new Templates());
3154 $$->set_location(infile, @$);
3157 | '{' seqFieldSpec optError '}'
3159 $$ = new Template($2); // NAMED_TEMLATE_LIST
3160 $$->set_location(infile, @$);
3164 $$ = new Template(Template::TEMPLATE_ERROR);
3165 $$->set_location(infile, @$);
3169 /* Sequence of FieldSpec. \note Cannot be empty */
3170 seqFieldSpec: // a NamedTemplates*
3173 $$ = new NamedTemplates();
3178 $$ = new NamedTemplates();
3181 | seqFieldSpec optError ',' optError FieldSpec
3186 | seqFieldSpec optError ',' error { $$ = $1; }
3189 FieldSpec: // 104 a NamedTemplate*
3190 FieldReference AssignmentChar TemplateBody
3192 $$ = new NamedTemplate($1, $3);
3193 $$->set_location(infile, @$);
3195 | FieldReference AssignmentChar NotUsedSymbol
3197 Template* temp = new Template(Template::TEMPLATE_NOTUSED);
3198 temp->set_location(infile, @3);
3199 $$ = new NamedTemplate($1, temp);
3200 $$->set_location(infile, @$);
3204 FieldReference: // 105
3205 StructFieldRef { $$ = $1; }
3206 /* | ArrayOrBitRef -- covered by ArraySpecList */
3207 /* | ParRef -- covered by StructFieldRef */
3210 StructFieldRef: // 106 (and 107. ParRef)
3211 PredefOrIdentifier { $$ = $1; }
3213 Note: Non-parameterized type references are covered by (StructField)Identifier.
3214 Parameterized type references are covered by FunctionInstance */
3217 Location loc(infile, @$);
3218 loc.error("Reference to a parameterized field of type `anytype' is "
3219 "not currently supported");
3221 $$ = new Identifier(Identifier::ID_TTCN, string("<error>"));
3226 '{' seqArraySpec optError '}'
3228 $$ = new Template($2);
3229 $$->set_location(infile, @$);
3236 $$ = new IndexedTemplates();
3239 /* It was optError before. */
3242 $$ = new IndexedTemplates();
3245 | seqArraySpec optError ',' optError ArraySpec
3250 | seqArraySpec optError ',' error { $$ = $1; }
3254 ArrayOrBitRef AssignmentChar TemplateBody
3256 $$ = new IndexedTemplate($1, $3);
3257 $$->set_location(infile, @$);
3261 ArrayOrBitRef: // 109
3264 $$ = new FieldOrArrayRef($2);
3265 $$->set_location(infile, @$);
3269 $$ = new FieldOrArrayRef(new Value(Value::V_ERROR));
3270 $$->set_location(infile, @$);
3274 SingleValueOrAttrib: // 111
3275 MatchingSymbol { $$ = $1; }
3278 if ($1->get_valuetype() == Value::V_OMIT) {
3280 $$ = new Template(Template::OMIT_VALUE);
3281 } else $$ = new Template($1); // SPECIFIC_VALUE; SingleExpr is a Template*
3282 $$->set_location(infile, @$);
3284 /* | TemplateRefWithParList -- covered by SingleExpression */
3287 ArrayValueOrAttrib: // 112
3288 '{' ArrayElementSpecList optError '}'
3290 $$ = new Template(Template::TEMPLATE_LIST, $2);
3291 $$->set_location(infile, @$);
3295 ArrayElementSpecList: // 113
3301 | error ArrayElementSpec
3306 | ArrayElementSpecList optError ',' optError ArrayElementSpec
3311 | ArrayElementSpecList optError ',' error { $$ = $1; }
3314 ArrayElementSpec: // 114 is a Template*
3317 $$ = new Template(Template::TEMPLATE_NOTUSED);
3318 $$->set_location(infile, @$);
3322 $$ = new Template(Template::PERMUTATION_MATCH, $1);
3323 $$->set_location(infile, @$);
3325 | TemplateListElem { $$ = $1; }
3328 NotUsedSymbol: // 115
3332 MatchingSymbol: // 116 is a Template*
3335 $$ = new Template(Template::COMPLEMENTED_LIST, $1);
3336 $$->set_location(infile, @$);
3340 $$ = new Template(Template::ANY_VALUE);
3341 $$->set_location(infile, @$);
3345 $$ = new Template(Template::ANY_OR_OMIT);
3346 $$->set_location(infile, @$);
3350 $$ = new Template(Template::VALUE_LIST, $1);
3351 $$->set_location(infile, @$);
3355 $$ = new Template($1);
3356 $$->set_location(infile, @$);
3360 $$ = new Template(Template::BSTR_PATTERN, $1);
3361 $$->set_location(infile, @$);
3365 $$ = new Template(Template::HSTR_PATTERN, $1);
3366 $$->set_location(infile, @$);
3370 $$ = new Template(Template::OSTR_PATTERN, $1);
3371 $$->set_location(infile, @$);
3375 $$ = new Template($1);
3376 $$->set_location(infile, @$);
3380 $$ = new Template(Template::SUBSET_MATCH, $1);
3381 $$->set_location(infile, @$);
3385 $$ = new Template(Template::SUPERSET_MATCH, $1);
3386 $$->set_location(infile, @$);
3388 | '(' AllElementsFrom ')'
3390 $$ = new Template(Template::VALUE_LIST_ALL_FROM, $2);
3391 $$->set_location(infile, @$);
3395 optExtraMatchingAttributes: // [117]
3398 $$.is_ifpresent = false;
3399 $$.len_restr = NULL;
3404 $$.is_ifpresent = false;
3408 $$.len_restr = NULL;
3409 $$.is_ifpresent = true;
3411 | LengthMatch IfPresentMatch
3414 $$.is_ifpresent = true;
3418 CharStringMatch: // 124
3419 PatternKeyword PatternChunkList
3421 Location loc(infile, @2);
3422 $$ = parse_pattern($2, loc);
3432 | PatternChunkList '&' PatternChunk
3435 $$ = mputstr($$, $3);
3447 switch ($1->get_valuetype()) {
3448 case Value::V_REFD: {
3449 /* Pretend to be a reference. Let pstring_la.l discover the
3451 Common::Reference *ref = $1->get_reference();
3452 $$ = mprintf("{%s}", (ref->get_dispname()).c_str());
3454 case Value::V_UNDEF_LOWERID: {
3455 const Common::Identifier *id = $1->get_val_id();
3456 $$ = mprintf("{%s}", (id->get_dispname()).c_str());
3459 FATAL_ERROR("Internal error.");
3461 /* Forget the Node. */
3466 ustring::universal_char& uc = $1->operator[](0);
3467 $$ = mprintf("\\q{%d,%d,%d,%d}", uc.group, uc.plane, uc.row, uc.cell);
3472 Complement: // 130 is a Templates*
3473 ComplementKeyword ValueList { $$ = $2; }
3476 ValueList: // 132 is a Templates*
3477 '(' seqValueOrAttrib optError ')' { $$ = $2; }
3478 | '(' error ')' { $$ = new Templates; }
3481 seqValueOrAttrib: // is a Templates*
3482 optError TemplateListElem
3487 | seqValueOrAttrib optError ',' optError TemplateListElem
3492 | seqValueOrAttrib optError ',' error { $$ = $1; }
3495 SubsetMatch: // 133 is a Templates*
3496 SubsetKeyword ValueList { $$ = $2; }
3499 SupersetMatch: // 135 is a Templates*
3500 SupersetKeyword ValueList { $$ = $2; }
3503 PermutationMatch: // 137 is a Templates*
3504 PermutationKeyword ValueList { $$ = $2; }
3515 TemplateListElem: // is a Template*
3520 AllElementsFrom: // is a Template*
3521 AllKeyword FromKeyword TemplateBody
3522 { // $3 is a Template*
3523 $$ = new Template($3); // Constructs ALL_FROM
3524 $$->set_location(infile, @$);
3528 ValueOrAttribList: // 142 is a Templates*
3529 /* ValueOrAttribList always has two or more elements
3530 * (there's always a comma) and is reduced through
3531 * ValueOrAttribList -> MatchingSymbol -> SingleValueOrAttrib
3533 * The one-element list is reduced through
3534 * '(' SingleExpression ')' -> SingleExpression -> SingleValueOrAttrib */
3535 '(' TemplateListElem optError ',' seqValueOrAttrib optError ')'
3538 $$->add_front_t($2);
3540 | '(' error TemplateListElem optError ',' seqValueOrAttrib optError ')'
3543 $$->add_front_t($3);
3548 StringLength { $$ = $1; }
3551 IfPresentMatch: // 144
3556 '(' SingleLowerBound DotDot UpperBound optError ')'
3557 { $$ = new ValueRange($2, $4); }
3563 if ($1->is_parsed_infinity()==-1) {
3564 /* the conflicting rule alternative faked here: '-' InfinityKeyword */
3576 if ($1->is_parsed_infinity()==-1) {
3577 /* the conflicting rule alternative faked here: '-' InfinityKeyword */
3589 if ($1->is_parsed_infinity()==1) {
3590 /* the conflicting rule alternative faked here: InfinityKeyword */
3599 TemplateInstance: // 151
3600 InLineTemplate { $$ = $1; }
3603 TemplateRefWithParList: /* refbase */ // 153 ?
3604 TemplateRef optTemplateActualParList
3607 $$ = new Ttcn::Ref_pard($1.modid, $1.id, new ParsedActualParameters($2));
3608 $$->set_location(infile, @$);
3610 $$ = new Ttcn::Reference($1.modid, $1.id);
3611 $$->set_location(infile, @$);
3622 | IDentifier '.' IDentifier
3627 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
3635 InLineTemplate: // 155
3638 $$ = new TemplateInstance(0, 0, $1);
3639 $$->set_location(infile, @$);
3641 | Type ':' TemplateBody
3643 $$ = new TemplateInstance($1, 0, $3);
3644 $$->set_location(infile, @$);
3646 /* | Signature ':' TemplateBody -- covered by the previous rule */
3647 | DerivedRefWithParList AssignmentChar TemplateBody
3649 $$ = new TemplateInstance(0, $1, $3);
3650 $$->set_location(infile, @$);
3652 | Type ':' DerivedRefWithParList AssignmentChar TemplateBody
3654 $$ = new TemplateInstance($1, $3, $5);
3655 $$->set_location(infile, @$);
3657 /* | Signature ':' DerivedRefWithParList AssignmentChar TemplateBody
3658 -- covered by the previous rule */
3661 DerivedRefWithParList: // 156
3662 ModifiesKeyword TemplateRefWithParList { $$ = $2; }
3665 optTemplateActualParList: // [157]
3666 /* empty */ optError { $$ = 0; }
3667 | '(' seqTemplateActualPar optError ')'
3670 $$->set_location(infile, @$);
3674 $$ = new TemplateInstances;
3675 $$->set_location(infile, @$);
3679 seqTemplateActualPar:
3680 optError TemplateActualPar
3682 $$ = new TemplateInstances;
3685 | seqTemplateActualPar optError ',' optError TemplateActualPar
3690 | seqTemplateActualPar optError ',' error { $$ = $1; }
3693 TemplateActualPar: // 158
3694 TemplateInstance { $$ = $1; }
3697 Template *t = new Template(Template::TEMPLATE_NOTUSED);
3698 t->set_location(infile, @$);
3699 $$ = new TemplateInstance(0, 0, t);
3700 $$->set_location(infile, @$);
3705 MatchOp { $$ = $1; }
3706 | ValueofOp { $$ = $1; }
3710 MatchKeyword '(' optError Expression optError ',' optError TemplateInstance
3713 $$ = new Value(Value::OPTYPE_MATCH, $4, $8);
3714 $$->set_location(infile, @$);
3716 | MatchKeyword '(' error ')'
3718 Value *v = new Value(Value::V_ERROR);
3719 v->set_location(infile, @3);
3720 Template *t = new Template(Template::TEMPLATE_ERROR);
3721 t->set_location(infile, @3);
3722 TemplateInstance *ti = new TemplateInstance(0, 0, t);
3723 ti->set_location(infile, @3);
3724 $$ = new Value(Value::OPTYPE_MATCH, v, ti);
3725 $$->set_location(infile, @$);
3730 ValueofKeyword '(' optError TemplateInstance optError ')'
3732 $$ = new Value(Value::OPTYPE_VALUEOF, $4);
3733 $$->set_location(infile, @$);
3735 | ValueofKeyword '(' error ')'
3737 Template *t = new Template(Template::TEMPLATE_ERROR);
3738 t->set_location(infile, @3);
3739 TemplateInstance *ti = new TemplateInstance(0, 0, t);
3740 ti->set_location(infile, @3);
3741 $$ = new Value(Value::OPTYPE_VALUEOF, ti);
3742 $$->set_location(infile, @$);
3746 /* A.1.6.1.4 Function definitions */
3749 FunctionKeyword IDentifier '(' optFunctionFormalParList ')'
3750 optRunsOnSpec optReturnType optError StatementBlock
3752 $4->set_location(infile, @3, @5);
3753 $$ = new Def_Function($2, $4, $6, $7.type, $7.returns_template,
3754 $7.template_restriction, $9);
3755 $$->set_location(infile, @$);
3759 optFunctionFormalParList: // [167]
3760 /* empty */ { $$ = new FormalParList; }
3761 | FunctionFormalParList { $$ = $1; }
3762 | error { $$ = new FormalParList; }
3765 FunctionFormalParList: // 167
3766 optError FunctionFormalPar
3768 $$ = new FormalParList;
3771 | FunctionFormalParList optError ',' optError FunctionFormalPar
3776 | FunctionFormalParList optError ',' error { $$ = $1; }
3779 FunctionFormalPar: // 168
3780 FormalValuePar { $$ = $1; }
3781 | FormalTimerPar { $$ = $1; }
3782 | FormalTemplatePar { $$ = $1; }
3783 /*| FormalPortPar -- covered by FormalValuePar */
3786 optReturnType: // [169]
3790 $$.returns_template = false;
3791 $$.template_restriction = TR_NONE;
3793 | ReturnKeyword Type
3796 $$.returns_template = false;
3797 $$.template_restriction = TR_NONE;
3799 | ReturnKeyword TemplateOptRestricted Type
3802 $$.returns_template = true;
3803 $$.template_restriction = $2;
3805 | ReturnKeyword error
3808 $$.returns_template = false;
3809 $$.template_restriction = TR_NONE;
3813 optRunsOnComprefOrSelf:
3819 | RunsKeyword OnKeyword SelfKeyword
3827 /* empty */ { $$ = 0; }
3828 | RunsOnSpec { $$ = $1; }
3829 | RunsKeyword error { $$ = 0; }
3833 RunsKeyword OnKeyword ComponentType { $$ = $3; }
3836 /* StatementBlock changed in 4.1.2 to explicitly prevent statements
3837 * followed by definitions. TITAN still allows them to be mixed. */
3838 StatementBlock: /* StatementBlock *statementblock */ // 175
3841 $$ = new StatementBlock;
3842 $$->set_location(infile, @$);
3844 | '{' FunctionStatementOrDefList optError '}'
3847 $$->set_location(infile, @$);
3851 FunctionStatementOrDefList: // (171 in 3.2.1)
3852 optError FunctionStatementOrDef optSemiColon
3854 $$ = new StatementBlock;
3855 for(size_t i=0; i<$2.nElements; i++) $$->add_stmt($2.elements[i]);
3858 | FunctionStatementOrDefList optError FunctionStatementOrDef optSemiColon
3861 for(size_t i=0; i<$3.nElements; i++) $$->add_stmt($3.elements[i]);
3866 FunctionStatementOrDef: // (172 in 3.2.1)
3867 FunctionLocalDef // constant or template definition
3869 $$.nElements=$1.nElements;
3870 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3871 for(size_t i=0; i<$1.nElements; i++) {
3872 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
3873 $$.elements[i]->set_location(*$1.elements[i]);
3877 | FunctionLocalInst // variable or timer instance
3879 $$.nElements=$1.nElements;
3880 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3881 for(size_t i=0; i<$1.nElements; i++) {
3882 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
3883 $$.elements[i]->set_location(*$1.elements[i]);
3890 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3895 FunctionLocalInst: // 178
3896 VarInstance { $$=$1; }
3897 | TimerInstance { $$=$1; }
3900 FunctionLocalDef: // 179
3906 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
3907 $$.elements[0] = $1;
3911 FunctionStatement: // 180
3912 ConfigurationStatements {$$=$1;}
3913 | TimerStatements {$$=$1;}
3914 | CommunicationStatements {$$=$1;}
3915 | BasicStatements {$$=$1;}
3916 | BehaviourStatements {$$=$1;}
3917 | VerdictStatements {$$=$1;}
3918 | SUTStatements {$$=$1;}
3919 | StopExecutionStatement { $$ = $1; }
3920 | StopTestcaseStatement { $$ = $1; }
3921 | ProfilerStatement { $$ = $1; }
3924 FunctionInstance: /* refpard */ // 181
3925 FunctionRef '(' optFunctionActualParList ')'
3926 /* templateref templinsts */
3928 $3->set_location(infile, @2, @4);
3929 $$ = new Ttcn::Ref_pard($1.modid, $1.id, $3);
3930 $$->set_location(infile, @$);
3940 | IDentifier '.' IDentifier
3945 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
3953 optFunctionActualParList: /* parsedpar */ // [185]
3954 /* empty */ optError { $$ = new ParsedActualParameters; }
3955 | FunctionActualParList optError { $$ = $1; }
3958 /* ***** this * can * not * be * empty ****************** */
3959 FunctionActualParList: /* parsedpar */ // 184
3962 | UnnamedPart ',' NamedPart
3963 /* Splitting the NamedPart and UnnamedPart ensures that a named parameter
3964 * followed by an unnamed one causes a syntax error */
3966 /* UnnamedPart becomes the value */
3968 /* append the elements from NamedPart */
3969 const size_t n3 = $3->get_nof_nps();
3970 for (size_t i = 0; i < n3; ++i) {
3971 $$->add_np( $3->extract_np_byIndex(i) );
3977 UnnamedPart: /* parsedpar */
3978 /*optError*/ FunctionActualPar
3980 $$ = new ParsedActualParameters;
3983 | UnnamedPart /*optError*/ ',' /*optError*/ FunctionActualPar
3984 /* These optErrors mess up the parsing of actual parameters.
3985 * After only one FunctionActualPar, it is reduced to UnnamedPart
3986 * and the rest is expected to be the NamedPart */
3991 | UnnamedPart optError ',' error { $$ = $1; }
3994 NamedPart: /* parsedpar */
3995 seqFieldSpec /* namedtempls */
3997 $$ = new ParsedActualParameters(0, new NamedParams);
3998 const size_t n1 = $1->get_nof_nts();
3999 for (size_t i = 0; i < n1; ++i) {
4000 NamedTemplate *pnt = $1->get_nt_byIndex(i);
4001 TemplateInstance *pti = new TemplateInstance(0,0,pnt->extract_template());
4002 NamedParam *pnp = new NamedParam(pnt->get_name().clone(), pti);
4003 pnp->set_location(*pnt);
4007 $$->set_location(infile, @$);
4008 // This call to ParsedActualParameters::set_location copies the same
4009 // location info to the named and unnamed part. We cannot copy
4010 // the location info from the NamedTemplates to the named part,
4011 // because NamedTemplates is not a Location.
4015 FunctionActualPar: /* templinst */ // 185
4017 TemplateInstance { $$ = $1; }
4020 Template *t = new Template(Template::TEMPLATE_NOTUSED);
4021 t->set_location(infile, @$);
4022 $$ = new TemplateInstance(0, 0, t);
4023 $$->set_location(infile, @$);
4026 | ComponentRef -- TemplateInstance covers all the others */
4030 Reference DotApplyKeyword '(' optFunctionActualParList ')'
4032 if($1.is_ref) $$.value = new Value(Value::V_REFD, $1.ref);
4034 Ttcn::Reference *t_ref = new Ttcn::Reference($1.id);
4035 t_ref->set_location(infile, @1);
4036 $$.value = new Value(Value::V_REFD, t_ref);
4038 $$.value->set_location(infile, @1);
4040 $$.ap_list->set_location(infile, @3 , @5);
4042 | FunctionInstance DotApplyKeyword '(' optFunctionActualParList ')'
4044 $$.value = new Value(Value::V_REFD, $1);
4045 $$.value->set_location(infile, @1);
4047 $$.ap_list->set_location(infile, @3 , @5);
4049 | ApplyOp DotApplyKeyword '(' optFunctionActualParList ')'
4051 $$.value = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
4052 $$.value->set_location(infile, @1);
4054 $$.ap_list->set_location(infile, @3 , @5);
4059 DerefersKeyword '(' Expression ')' { $$ = $3; }
4062 /* A.1.6.1.5 Signature definitions */
4064 SignatureDef: // 187
4065 SignatureKeyword IDentifier
4066 '(' optSignatureFormalParList ')' optReturnTypeOrNoBlockKeyword
4069 Type *type = new Type(Type::T_SIGNATURE, $4, $6.type, $6.no_block_kw, $7);
4070 type->set_location(infile, @3, @7);
4071 $$ = new Ttcn::Def_Type($2, type);
4072 $$->set_location(infile, @$);
4076 optSignatureFormalParList: // [190]
4077 /* empty */ { $$ = 0; }
4078 | SignatureFormalParList { $$ = $1; }
4082 SignatureFormalParList: // 190
4083 optError SignatureFormalPar
4085 $$ = new SignatureParamList;
4088 | SignatureFormalParList optError ',' optError SignatureFormalPar
4093 | SignatureFormalParList optError ',' error { $$ = $1; }
4096 SignatureFormalPar: // 191
4099 $$ = new SignatureParam(SignatureParam::PARAM_IN, $1, $2);
4100 $$->set_location(infile, @$);
4102 | InParKeyword Type IDentifier
4104 $$ = new SignatureParam(SignatureParam::PARAM_IN, $2, $3);
4105 $$->set_location(infile, @$);
4107 | InOutParKeyword Type IDentifier
4109 $$ = new SignatureParam(SignatureParam::PARAM_INOUT, $2, $3);
4110 $$->set_location(infile, @$);
4112 | OutParKeyword Type IDentifier
4114 $$ = new SignatureParam(SignatureParam::PARAM_OUT, $2, $3);
4115 $$->set_location(infile, @$);
4119 optReturnTypeOrNoBlockKeyword:
4123 $$.no_block_kw = false;
4125 | ReturnKeyword Type
4128 $$.no_block_kw = false;
4133 $$.no_block_kw = true;
4137 optExceptionSpec: // [192]
4138 /* empty */ { $$ = NULL; }
4139 | ExceptionKeyword '(' error ')' { $$ = NULL; }
4140 | ExceptionKeyword '(' ExceptionTypeList optError ')'
4143 $$->set_location(infile, @$);
4147 ExceptionTypeList: // 194
4150 $$ = new SignatureExceptions;
4153 | ExceptionTypeList optError ',' optError Type
4158 | ExceptionTypeList optError ',' error { $$ = $1; }
4164 $$ = new Ttcn::Reference($1);
4165 $$->set_location(infile, @$);
4167 | IDentifier '.' IDentifier
4169 $$ = new Ttcn::Reference($1, $3);
4170 $$->set_location(infile, @$);
4172 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4174 $$ = new Ttcn::Reference($1, $5);
4175 $$->set_location(infile, @$);
4180 /* A.1.6.1.6 Testcase definitions */
4183 TestcaseKeyword IDentifier '(' optTestcaseFormalParList ')'
4184 ConfigSpec optError StatementBlock
4186 $4->set_location(infile, @3, @5);
4187 $$ = new Def_Testcase($2, $4, $6.runsonref, $6.systemref, $8);
4188 $$->set_location(infile, @$);
4192 optTestcaseFormalParList: // [200]
4193 /* empty */ { $$ = new FormalParList; }
4194 | TestcaseFormalParList { $$ = $1; }
4195 | error { $$ = new FormalParList; }
4198 TestcaseFormalParList: // 200
4199 optError TestcaseFormalPar
4201 $$ = new FormalParList;
4204 | TestcaseFormalParList optError ',' optError TestcaseFormalPar
4209 | TestcaseFormalParList optError ',' error { $$ = $1; }
4212 TestcaseFormalPar: // 201
4213 FormalValuePar { $$ = $1; }
4214 | FormalTemplatePar { $$ = $1; }
4218 RunsOnSpec optSystemSpec
4225 optSystemSpec: // [203]
4226 /* empty */ { $$ = 0; }
4227 | SystemKeyword ComponentType { $$ = $2; }
4228 | SystemKeyword error { $$ = 0; }
4231 TestcaseInstance: // 205
4232 ExecuteKeyword '(' TestcaseRef '(' optTestcaseActualParList ')'
4233 optTestcaseTimerValue optError ')'
4235 $5->set_location(infile, @4, @6);
4236 $$.ref_pard = new Ttcn::Ref_pard($3.modid, $3.id, $5);
4237 $$.ref_pard->set_location(infile, @3, @6);
4238 $$.derefered_value = 0;
4242 | ExecuteKeyword '(' DereferOp '(' optTestcaseActualParList ')'
4243 optTestcaseTimerValue optError ')'
4245 $5->set_location(infile, @4, @6);
4247 $$.derefered_value = $3;
4251 | ExecuteKeyword '(' error ')'
4254 $$.derefered_value = 0;
4266 | IDentifier '.' IDentifier
4271 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4279 optTestcaseTimerValue:
4280 /* empty */ { $$ = 0; }
4281 | ',' optError Expression { $$ = $3; }
4284 $$ = new Value(Value::V_ERROR);
4285 $$->set_location(infile, @$);
4289 optTestcaseActualParList: // [202]
4290 /* empty */ optError { $$ = new ParsedActualParameters; }
4291 | TestcaseActualParList optError { $$ = $1; }
4294 TestcaseActualParList: // 208
4297 | UnnamedPart ',' NamedPart
4298 /* Splitting the NamedPart and UnnamedPart ensures that a named parameter
4299 * followed by an unnamed one causes a syntax error */
4301 /* UnnamedPart becomes the value */
4303 /* append the elements from NamedPart */
4304 const size_t n3 = $3->get_nof_nps();
4305 for (size_t i = 0; i < n3; ++i) {
4306 $$->add_np( $3->extract_np_byIndex(i) );
4312 optError TestcaseActualPar
4314 $$ = new TemplateInstances;
4317 | TestcaseActualParList optError ',' optError TestcaseActualPar
4322 | TestcaseActualParList optError ',' error { $$ = $1; }
4328 TemplateInstance { $$ = $1; }
4331 Template *t = new Template(Template::TEMPLATE_NOTUSED);
4332 t->set_location(infile, @$);
4333 $$ = new TemplateInstance(0, 0, t);
4334 $$->set_location(infile, @$);
4339 /* A.1.6.1.7 Altstep definitions */
4342 AltstepKeyword IDentifier '(' optAltstepFormalParList ')' optRunsOnSpec
4343 optError '{' AltstepLocalDefList AltGuardList optError '}'
4345 StatementBlock *sb = new StatementBlock;
4346 for (size_t i = 0; i < $9.nElements; i++) {
4347 Statement *stmt = new Statement(Statement::S_DEF, $9.elements[i]);
4348 stmt->set_location(*$9.elements[i]);
4352 $4->set_location(infile, @4);
4353 $$ = new Def_Altstep($2, $4, $6, sb, $10);
4354 $$->set_location(infile, @$);
4358 optAltstepFormalParList: // [214]
4359 /* empty */ { $$ = new FormalParList; }
4360 | FunctionFormalParList { $$ = $1; }
4361 | error { $$ = new FormalParList; }
4364 AltstepLocalDefList: // 215
4370 | AltstepLocalDefList optError AltstepLocalDef optSemiColon
4372 $$.nElements = $1.nElements + $3.nElements;
4373 $$.elements = (Ttcn::Definition**)
4374 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4375 memcpy($$.elements + $1.nElements, $3.elements,
4376 $3.nElements * sizeof(*$$.elements));
4381 AltstepLocalDef: // 216
4382 VarInstance { $$ = $1; }
4383 | TimerInstance { $$ = $1; }
4384 | ConstDef { $$ = $1; }
4389 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
4390 $$.elements[0] = $1;
4394 AltstepInstance: /* refpard */ // 217
4395 FunctionRef '(' optFunctionActualParList ')'
4397 $3->set_location(infile, @2, @4);
4398 $$ = new Ttcn::Ref_pard($1.modid, $1.id, $3);
4399 $$->set_location(infile, @$);
4403 /* Taken over by FunctionRef
4406 | IDentifier '.' IDentifier
4407 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4411 /* A.1.6.1.8 Import definitions */
4414 ImportKeyword ImportFromSpec AllWithExcepts
4416 $2->set_imptype(ImpMod::I_ALL);
4417 $2->set_location(infile, @$);
4421 | ImportKeyword ImportFromSpec '{' ImportSpec '}'
4423 Location loc(infile, @$);
4424 if ( $4 == ImpMod::I_IMPORTSPEC) {
4425 loc.warning("Unsupported selective import statement was treated as "
4428 $2->set_imptype($4);
4429 $2->set_location(infile, @$);
4435 AllWithExcepts: // 221
4437 | AllKeyword ExceptsDef
4439 Location loc(infile, @$);
4440 loc.warning("Unsupported selective import statement was treated as "
4446 ExceptKeyword '{' ExceptSpec '}'
4450 /* empty */ optError
4451 | ExceptSpec ExceptElement optSemiColon
4454 ExceptElement: // 225
4457 | ExceptTemplateSpec
4459 | ExceptTestcaseSpec
4461 | ExceptFunctionSpec
4462 | ExceptSignatureSpec
4463 | ExceptModuleParSpec
4466 ExceptGroupSpec: // 226
4467 GroupKeyword ExceptGroupRefList
4468 | GroupKeyword AllKeyword
4471 ExceptTypeDefSpec: // 227
4472 TypeDefKeyword TypeRefList
4473 | TypeDefKeyword AllKeyword
4476 ExceptTemplateSpec: // 228
4477 TemplateKeyword TemplateRefList
4478 | TemplateKeyword AllKeyword
4481 ExceptConstSpec: // 229
4482 ConstKeyword ConstRefList
4483 | ConstKeyword AllKeyword
4486 ExceptTestcaseSpec: // 230
4487 TestcaseKeyword TestcaseRefList
4488 | TestcaseKeyword AllKeyword
4491 ExceptAltstepSpec: // 231
4492 AltstepKeyword AltstepRefList
4493 | AltstepKeyword AllKeyword
4496 ExceptFunctionSpec: // 232
4497 FunctionKeyword FunctionRefList
4498 | FunctionKeyword AllKeyword
4501 ExceptSignatureSpec: // 233
4502 SignatureKeyword SignatureRefList
4503 | SignatureKeyword AllKeyword
4506 ExceptModuleParSpec: // 234
4507 ModuleParKeyword ModuleParRefList
4508 | ModuleParKeyword AllKeyword
4512 /* empty */ optError
4513 { $$ = ImpMod::I_ALL; }
4514 | ImportSpec ImportElement optSemiColon
4517 case ImpMod::I_ALL: // it was empty before
4521 case ImpMod::I_IMPORTSPEC:
4523 case ImpMod::I_IMPORTSPEC:
4524 // selective import followed by another selective import: NOP
4526 case ImpMod::I_IMPORTIMPORT:
4527 $$ = $2; // import of import wins over selective import
4529 default: // including I_ALL
4530 FATAL_ERROR("Selective import cannot be followed by import all");
4534 case ImpMod::I_IMPORTIMPORT:
4536 case ImpMod::I_IMPORTSPEC:
4537 // import of import followed by selective import: NOP (import of import wins)
4539 case ImpMod::I_IMPORTIMPORT:
4540 // import of import following another import of import: error
4541 Location(infile, @2).error("Import of imports can only be used once");
4543 default: // including I_ALL
4544 FATAL_ERROR("Import of imports cannot be followed by import all");
4549 FATAL_ERROR("Invalid import type");
4554 ImportElement: // 236
4556 { $$ = ImpMod::I_IMPORTSPEC; }
4558 { $$ = ImpMod::I_IMPORTSPEC; }
4559 | ImportTemplateSpec
4560 { $$ = ImpMod::I_IMPORTSPEC; }
4562 { $$ = ImpMod::I_IMPORTSPEC; }
4563 | ImportTestcaseSpec
4564 { $$ = ImpMod::I_IMPORTSPEC; }
4566 { $$ = ImpMod::I_IMPORTSPEC; }
4567 | ImportFunctionSpec
4568 { $$ = ImpMod::I_IMPORTSPEC; }
4569 | ImportSignatureSpec
4570 { $$ = ImpMod::I_IMPORTSPEC; }
4571 | ImportModuleParSpec
4572 { $$ = ImpMod::I_IMPORTSPEC; }
4574 { $$ = ImpMod::I_IMPORTIMPORT; }
4578 ImportKeyword AllKeyword
4580 ImportFromSpec: // 237
4581 FromKeyword ModuleId { $$ = $2; }
4582 | FromKeyword ModuleId RecursiveKeyword // already deprecated in v3.2.1
4585 $$->set_recursive();
4589 ImportGroupSpec: // 239
4590 GroupKeyword GroupRefListWithExcept
4591 | GroupKeyword AllGroupsWithExcept
4592 | GroupKeyword error
4595 GroupRefList: // 240
4596 optError FullGroupIdentifier { delete $2; }
4597 | GroupRefList optError ',' optError FullGroupIdentifier { delete $5; }
4598 | GroupRefList optError ',' error
4601 GroupRefListWithExcept: // 241
4602 optError FullGroupIdentifierWithExcept
4603 | GroupRefListWithExcept optError ',' optError FullGroupIdentifierWithExcept
4604 | GroupRefListWithExcept optError ',' error
4607 AllGroupsWithExcept: // 242
4610 | AllKeyword ExceptKeyword GroupRefList
4611 | AllKeyword ExceptKeyword error
4614 FullGroupIdentifier: // 243
4617 $$ = new Qualifier();
4618 $$->add(new FieldOrArrayRef($1));
4619 $$->set_location(infile, @$);
4621 | FullGroupIdentifier '.' IDentifier
4624 $$->add(new FieldOrArrayRef($3));
4625 $$->set_location(infile, @$);
4629 FullGroupIdentifierWithExcept: // 244
4630 FullGroupIdentifier { delete $1; }
4631 | FullGroupIdentifier ExceptsDef { delete $1; }
4634 ExceptGroupRefList: // 245
4635 optError ExceptFullGroupIdentifier
4636 | ExceptGroupRefList optError ',' optError ExceptFullGroupIdentifier
4637 | ExceptGroupRefList optError ',' error
4640 ExceptFullGroupIdentifier: // 246
4641 FullGroupIdentifier { delete $1;}
4644 ImportTypeDefSpec: // 247
4645 TypeDefKeyword TypeRefList
4646 | TypeDefKeyword AllTypesWithExcept
4647 | TypeDefKeyword error
4651 optError IDentifier { delete $2; }
4652 | TypeRefList optError ',' optError IDentifier { delete $5; }
4653 | TypeRefList optError ',' error
4656 AllTypesWithExcept: // 249
4659 | AllKeyword ExceptKeyword TypeRefList
4660 | AllKeyword ExceptKeyword error
4663 /* 250. TypeDefIdentifier is replaced by IDentifier */
4665 ImportTemplateSpec: // 251
4666 TemplateKeyword TemplateRefList
4667 | TemplateKeyword AllTemplsWithExcept
4668 | TemplateKeyword error
4671 TemplateRefList: // 252
4672 optError IDentifier { delete $2; }
4673 | TemplateRefList optError ',' optError IDentifier { delete $5; }
4674 | TemplateRefList optError ',' error
4677 AllTemplsWithExcept: // 253
4680 | AllKeyword ExceptKeyword TemplateRefList
4681 | AllKeyword ExceptKeyword error
4684 ImportConstSpec: // 254
4685 ConstKeyword ConstRefList
4686 | ConstKeyword AllConstsWithExcept
4687 | ConstKeyword error
4690 ConstRefList: // 255
4691 optError IDentifier { delete $2; }
4692 | ConstRefList optError ',' optError IDentifier { delete $5; }
4693 | ConstRefList optError ',' error
4696 AllConstsWithExcept: // 256
4699 | AllKeyword ExceptKeyword ConstRefList
4700 | AllKeyword ExceptKeyword error
4703 ImportAltstepSpec: // 257
4704 AltstepKeyword AltstepRefList
4705 | AltstepKeyword AllAltstepsWithExcept
4706 | AltstepKeyword error
4709 AltstepRefList: // 258
4710 optError IDentifier { delete $2; }
4711 | AltstepRefList optError ',' optError IDentifier { delete $5; }
4712 | AltstepRefList optError ',' error
4715 AllAltstepsWithExcept: // 259
4718 | AllKeyword ExceptKeyword AltstepRefList
4719 | AllKeyword ExceptKeyword error
4722 ImportTestcaseSpec: // 260
4723 TestcaseKeyword TestcaseRefList
4724 | TestcaseKeyword AllTestcasesWithExcept
4725 | TestcaseKeyword error
4728 TestcaseRefList: // 261
4729 optError IDentifier { delete $2; }
4730 | TestcaseRefList optError ',' optError IDentifier { delete $5; }
4731 | TestcaseRefList optError ',' error
4734 AllTestcasesWithExcept: // 262
4737 | AllKeyword ExceptKeyword TestcaseRefList
4738 | AllKeyword ExceptKeyword error
4741 ImportFunctionSpec: // 263
4742 FunctionKeyword FunctionRefList
4743 | FunctionKeyword AllFunctionsWithExcept
4744 | FunctionKeyword error
4747 FunctionRefList: // 264
4748 optError IDentifier { delete $2; }
4749 | FunctionRefList optError ',' optError IDentifier { delete $5; }
4750 | FunctionRefList optError ',' error
4753 AllFunctionsWithExcept: // 265
4756 | AllKeyword ExceptKeyword FunctionRefList
4757 | AllKeyword ExceptKeyword error
4760 ImportSignatureSpec: // 266
4761 SignatureKeyword SignatureRefList
4762 | SignatureKeyword AllSignaturesWithExcept
4763 | SignatureKeyword error
4766 SignatureRefList: // 267
4767 optError IDentifier { delete $2; }
4768 | SignatureRefList optError ',' optError IDentifier { delete $5; }
4769 | SignatureRefList optError ',' error
4772 AllSignaturesWithExcept: // 268
4775 | AllKeyword ExceptKeyword SignatureRefList
4776 | AllKeyword ExceptKeyword error
4779 ImportModuleParSpec: // 269
4780 ModuleParKeyword ModuleParRefList
4781 | ModuleParKeyword AllModuleParWithExcept
4782 | ModuleParKeyword error
4785 ModuleParRefList: // 270
4786 optError IDentifier { delete $2; }
4787 | ModuleParRefList optError ',' optError IDentifier { delete $5; }
4788 | ModuleParRefList optError ',' error
4791 AllModuleParWithExcept: // 271
4794 | AllKeyword ExceptKeyword ModuleParRefList
4795 | AllKeyword ExceptKeyword error
4798 // 272 ImportImportSpec: ImportKeyword AllKeyword
4800 /* A.1.6.1.9 Group definitions */
4803 GroupIdentifier '{' optErrorBlock '}'
4806 $$->set_location(infile, @$);
4808 | GroupIdentifier '{' ModuleDefinitionsList optErrorBlock '}'
4811 $$->set_location(infile, @$);
4815 GroupIdentifier: // 274 (followed by) 275.
4816 GroupKeyword IDentifier
4819 $$->set_parent_group(act_group);
4820 $$->set_location(infile, @$);
4822 act_group->add_group($$);
4823 $$->set_parent_path(act_group->get_attrib_path());
4825 act_ttcn3_module->add_group($$);
4826 $$->set_parent_path(act_ttcn3_module->get_attrib_path());
4832 /* A.1.6.1.10 External function definitions */
4834 ExtFunctionDef: // 276
4835 ExtKeyword FunctionKeyword IDentifier
4836 '(' optFunctionFormalParList ')' optReturnType
4838 $5->set_location(infile, @4, @6);
4839 $$ = new Def_ExtFunction($3, $5, $7.type, $7.returns_template,
4840 $7.template_restriction);
4841 $$->set_location(infile, @$);
4845 /* A.1.6.1.11 External constant definitions */
4848 ExtKeyword ConstKeyword Type IdentifierList
4850 $$.nElements = $4.nElements;
4851 $$.elements = (Ttcn::Definition**)
4852 Malloc($$.nElements * sizeof(*$$.elements));
4853 for (size_t i = 0; i < $$.nElements; i++) {
4856 type = new Type(Type::T_REFDSPEC, $3);
4857 type->set_location(*$3);
4859 $$.elements[i] = new Ttcn::Def_ExtConst($4.elements[i].id, type);
4860 $$.elements[i]->set_location(infile, $4.elements[i].yyloc);
4866 IdentifierList: // 280 ExtConstIdentifierList
4870 $$.elements = (YYSTYPE::extconstidentifier_t*)Malloc(sizeof(*$$.elements));
4871 $$.elements[0].id = $2;
4872 $$.elements[0].yyloc = @2;
4874 | IdentifierList ',' optError IDentifier
4876 $$.nElements = $1.nElements + 1;
4877 $$.elements = (YYSTYPE::extconstidentifier_t*)
4878 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4879 $$.elements[$1.nElements].id = $4;
4880 $$.elements[$1.nElements].yyloc = @4;
4882 | IdentifierList ',' error { $$ = $1; }
4885 /* A.1.6.1.12 Module parameter definitions */
4887 ModuleParDef: // 282
4888 ModuleParKeyword ModulePar { $$ = $2; }
4889 | ModuleParKeyword '{' MultiTypedModuleParList optError '}' { $$ = $3; }
4890 | ModuleParKeyword '{' error '}' { $$.nElements = 0; $$.elements = NULL; }
4893 MultiTypedModuleParList: // 284
4894 optError ModulePar optSemiColon { $$ = $2; }
4895 | MultiTypedModuleParList optError ModulePar optSemiColon
4897 $$.nElements = $1.nElements + $3.nElements;
4898 $$.elements = (Ttcn::Definition**)
4899 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4900 memcpy($$.elements + $1.nElements, $3.elements,
4901 $3.nElements * sizeof(*$$.elements));
4909 $$.nElements = $2.nElements;
4910 $$.elements = (Ttcn::Definition**)
4911 Malloc($$.nElements * sizeof(*$$.elements));
4912 for(size_t i = 0; i < $2.nElements; i++) {
4915 type = new Type(Type::T_REFDSPEC, $1);
4916 type->set_location(*$1);
4918 $$.elements[i] = new Def_Modulepar($2.elements[i].id, type,
4919 $2.elements[i].defval);
4920 $$.elements[i]->set_location(infile, $2.elements[i].yyloc);
4924 | TemplateKeyword Type TemplateModuleParList
4926 $$.nElements = $3.nElements;
4927 $$.elements = (Ttcn::Definition**)Malloc($$.nElements * sizeof(*$$.elements));
4928 for(size_t i = 0; i < $3.nElements; i++) {
4931 type = new Type(Type::T_REFDSPEC, $2);
4932 type->set_location(*$2);
4934 $$.elements[i] = new Def_Modulepar_Template($3.elements[i].id, type, $3.elements[i].deftempl);
4935 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
4941 ModuleParList: // 287
4942 optError SingleModulePar
4945 $$.elements = (YYSTYPE::singlemodulepar_t*)Malloc(sizeof(*$$.elements));
4946 $$.elements[0] = $2;
4948 | ModuleParList ',' optError SingleModulePar
4950 $$.nElements = $1.nElements + 1;
4951 $$.elements = (YYSTYPE::singlemodulepar_t*)
4952 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4953 $$.elements[$$.nElements - 1] = $4;
4957 TemplateModuleParList: // 287
4958 optError SingleTemplateModulePar
4961 $$.elements = (YYSTYPE::singletemplatemodulepar_t*)Malloc(sizeof(*$$.elements));
4962 $$.elements[0] = $2;
4964 | TemplateModuleParList ',' optError SingleTemplateModulePar
4966 $$.nElements = $1.nElements + 1;
4967 $$.elements = (YYSTYPE::singletemplatemodulepar_t*)
4968 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4969 $$.elements[$$.nElements - 1] = $4;
4980 | IDentifier AssignmentChar Expression
4988 SingleTemplateModulePar:
4995 | IDentifier AssignmentChar TemplateBody
5004 FriendModuleDef: // 289
5005 FriendKeyword TTCN3ModuleKeyword IdentifierList optSemiColon
5007 $$.nElements = $3.nElements;
5008 $$.elements = (Ttcn::FriendMod**)
5009 Malloc($$.nElements*sizeof(*$$.elements));
5010 for (size_t i = 0; i < $$.nElements; i++) {
5011 $$.elements[i] = new FriendMod($3.elements[i].id);
5012 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
5018 /* A.1.6.2 Control part */
5020 /* A.1.6.2.0 General */
5022 ModuleControlPart: // 290
5023 optError ControlKeyword
5024 '{' ModuleControlBody '}'
5025 optWithStatementAndSemiColon
5027 ControlPart* controlpart = new ControlPart($4);
5028 controlpart->set_location(infile, @2, @6);
5029 controlpart->set_with_attr($6);
5030 controlpart->set_parent_path(act_ttcn3_module->get_attrib_path());
5031 act_ttcn3_module->add_controlpart(controlpart);
5035 ModuleControlBody: // 292
5036 /* empty */ optError { $$=new StatementBlock(); }
5037 | ControlStatementOrDefList { $$ = $1; }
5040 ControlStatementOrDefList: // 293
5041 optError ControlStatementOrDef optSemiColon
5043 $$=new StatementBlock();
5044 for(size_t i=0; i<$2.nElements; i++) $$->add_stmt($2.elements[i]);
5047 | ControlStatementOrDefList optError ControlStatementOrDef optSemiColon
5050 for(size_t i=0; i<$3.nElements; i++) $$->add_stmt($3.elements[i]);
5055 ControlStatementOrDef: // 294
5058 $$.nElements=$1.nElements;
5059 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5060 for(size_t i=0; i<$1.nElements; i++) {
5061 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
5062 $$.elements[i]->set_location(*$1.elements[i]);
5068 $$.nElements=$1.nElements;
5069 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5070 for(size_t i=0; i<$1.nElements; i++) {
5071 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
5072 $$.elements[i]->set_location(*$1.elements[i]);
5079 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5084 ControlStatement: /* Statement *stmt */ // 295
5085 TimerStatements { $$ = $1; }
5086 | BasicStatements { $$ = $1; }
5087 | BehaviourStatements { $$ = $1; }
5088 | SUTStatements { $$ = $1; }
5089 | StopExecutionStatement { $$ = $1; }
5090 | ProfilerStatement { $$ = $1; }
5093 /* A.1.6.2.1 Variable instantiation */
5096 VarKeyword Type VarList
5098 $$.nElements = $3.nElements;
5099 $$.elements = (Ttcn::Definition**)
5100 Malloc($$.nElements*sizeof(*$$.elements));
5101 for (size_t i = 0; i < $$.nElements; i++) {
5104 type = new Type(Type::T_REFDSPEC, $2);
5105 type->set_location(*$2);
5107 /* creation of array type(s) if necessary (from right to left) */
5108 for (size_t j = $3.elements[i].arrays.nElements; j > 0; j--) {
5109 type = new Type(Type::T_ARRAY, type,
5110 $3.elements[i].arrays.elements[j - 1], false);
5111 type->set_location(*$2);
5113 Free($3.elements[i].arrays.elements);
5115 /* Create the definition */
5116 $$.elements[i] = new Def_Var($3.elements[i].id,
5117 type, $3.elements[i].initial_value);
5118 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
5122 | VarKeyword TemplateOptRestricted Type TempVarList
5124 $$.nElements = $4.nElements;
5125 $$.elements = (Ttcn::Definition**)
5126 Malloc($$.nElements * sizeof(*$$.elements));
5127 for (size_t i = 0; i < $$.nElements; i++) {
5130 type = new Type(Type::T_REFDSPEC, $3);
5131 type->set_location(*$3);
5133 /* creation of array type(s) if necessary (from right to left) */
5134 for (size_t j = $4.elements[i].arrays.nElements; j > 0; j--) {
5135 type = new Type(Type::T_ARRAY, type,
5136 $4.elements[i].arrays.elements[j - 1], false);
5137 type->set_location(*$3);
5139 Free($4.elements[i].arrays.elements);
5141 /* Create the definition */
5142 $$.elements[i] = new Def_Var_Template($4.elements[i].id, type,
5143 $4.elements[i].initial_value, $2);
5144 $$.elements[i]->set_location(infile, $4.elements[i].yyloc);
5152 optError SingleVarInstance
5155 $$.elements = (YYSTYPE::singlevarinst_t*)Malloc(sizeof(*$$.elements));
5156 $$.elements[0] = $2;
5158 | VarList ',' optError SingleVarInstance
5160 $$.nElements = $1.nElements + 1;
5161 $$.elements = (YYSTYPE::singlevarinst_t*)
5162 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5163 $$.elements[$$.nElements - 1] = $4;
5167 SingleVarInstance: // 298
5168 IDentifier optArrayDef
5172 $$.initial_value = 0;
5175 | IDentifier optArrayDef AssignmentChar Expression
5179 $$.initial_value = $4;
5185 optError SingleTempVarInstance
5188 $$.elements = (YYSTYPE::singletempvarinst_t*)Malloc(sizeof(*$$.elements));
5189 $$.elements[0] = $2;
5191 | TempVarList ',' optError SingleTempVarInstance
5193 $$.nElements = $1.nElements + 1;
5194 $$.elements = (YYSTYPE::singletempvarinst_t*)
5195 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5196 $$.elements[$$.nElements - 1] = $4;
5200 SingleTempVarInstance: // 303
5201 IDentifier optArrayDef
5205 $$.initial_value = NULL;
5208 | IDentifier optArrayDef AssignmentChar TemplateBody
5212 $$.initial_value = $4;
5220 if ($1.is_ref) $$ = $1.ref;
5222 $$ = new Ttcn::Reference($1.id);
5223 $$->set_location(infile, @$);
5228 /* A.1.6.2.2 Timer instantiation */
5230 TimerInstance: // 306
5231 TimerKeyword TimerList { $$ = $2; }
5235 optError SingleTimerInstance
5238 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
5239 $$.elements[0] = $2;
5241 | TimerList ',' optError SingleTimerInstance
5243 $$.nElements = $1.nElements + 1;
5244 $$.elements = (Ttcn::Definition**)
5245 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5246 $$.elements[$$.nElements - 1] = $4;
5250 SingleTimerInstance: // 308
5251 IDentifier optArrayDef
5253 ArrayDimensions *dims;
5254 if ($2.nElements > 0) {
5255 dims = new ArrayDimensions;
5256 for (size_t i = 0; i < $2.nElements; i++) dims->add($2.elements[i]);
5259 $$ = new Ttcn::Def_Timer($1, dims, 0);
5260 $$->set_location(infile, @$);
5262 | IDentifier optArrayDef AssignmentChar TimerValue
5264 ArrayDimensions *dims;
5265 if ($2.nElements > 0) {
5266 dims = new ArrayDimensions;
5267 for (size_t i = 0; i < $2.nElements; i++) dims->add($2.elements[i]);
5270 $$ = new Ttcn::Def_Timer($1, dims, $4);
5271 $$->set_location(infile, @$);
5276 Expression { $$ = $1; }
5280 VariableRef { $$ = $1; }
5283 /* A.1.6.2.3 Component operations */
5285 ConfigurationStatements: // 313
5286 ConnectStatement { $$ = $1; }
5287 | MapStatement { $$ = $1; }
5288 | DisconnectStatement { $$ = $1; }
5289 | UnmapStatement { $$ = $1; }
5290 | DoneStatement { $$ = $1; }
5291 | KilledStatement { $$ = $1; }
5292 | StartTCStatement { $$ = $1; }
5293 | StopTCStatement { $$ = $1; }
5294 | KillTCStatement { $$ = $1; }
5297 ConfigurationOps: // 314
5302 | RunningOp {$$=$1;}
5303 | AliveOp { $$ = $1; }
5307 VariableRef DotCreateKeyword optCreateParameter optAliveKeyword
5309 $$ = new Value(Value::OPTYPE_COMP_CREATE, $1, $3.name, $3.loc, $4);
5310 $$->set_location(infile, @$);
5320 | '(' optError Expression optError ')'
5325 | '(' optError Expression optError ',' optError Expression optError ')'
5330 | '(' optError NotUsedSymbol optError ',' optError Expression optError ')'
5342 optAliveKeyword: // [328]
5343 /* empty */ { $$ = false; }
5344 | AliveKeyword { $$ = true; }
5350 $$=new Value(Value::OPTYPE_COMP_SYSTEM);
5351 $$->set_location(infile, @$);
5358 $$=new Value(Value::OPTYPE_COMP_SELF);
5359 $$->set_location(infile, @$);
5366 $$=new Value(Value::OPTYPE_COMP_MTC);
5367 $$->set_location(infile, @$);
5371 DoneStatement: // 319
5372 ComponentOrDefaultReference DotDoneKeyword optDoneParameter
5374 $$ = new Statement(Statement::S_DONE, $1, $3.donematch, $3.redirect);
5375 $$->set_location(infile, @$);
5377 | AnyKeyword ComponentKeyword DotDoneKeyword
5379 $$ = new Statement(Statement::S_DONE, Statement::C_ANY);
5380 $$->set_location(infile, @$);
5382 | AllKeyword ComponentKeyword DotDoneKeyword
5384 $$ = new Statement(Statement::S_DONE, Statement::C_ALL);
5385 $$->set_location(infile, @$);
5395 | optReceiveParameter PortRedirectSymbol ValueSpec
5402 KilledStatement: // 320
5403 ComponentOrDefaultReference DotKilledKeyword
5405 $$ = new Statement(Statement::S_KILLED, $1);
5406 $$->set_location(infile, @$);
5408 | AnyKeyword ComponentKeyword DotKilledKeyword
5410 $$ = new Statement(Statement::S_KILLED, Statement::C_ANY);
5411 $$->set_location(infile, @$);
5413 | AllKeyword ComponentKeyword DotKilledKeyword
5415 $$ = new Statement(Statement::S_KILLED, Statement::C_ALL);
5416 $$->set_location(infile, @$);
5422 ComponentOrDefaultReference
5423 | AnyKeyword ComponentKeyword
5424 | AllKeyword ComponentKeyword
5429 /* VariableRef DotRunningKeyword -- covered by RunningTimerOp */
5430 FunctionInstance DotRunningKeyword
5432 Value *t_val = new Value(Value::V_REFD, $1);
5433 t_val->set_location(infile, @1);
5434 $$ = new Value(Value::OPTYPE_COMP_RUNNING, t_val);
5435 $$->set_location(infile, @$);
5437 | ApplyOp DotRunningKeyword
5439 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5440 t_val->set_location(infile, @1);
5441 $$ = new Value(Value::OPTYPE_COMP_RUNNING, t_val);
5442 $$->set_location(infile, @$);
5444 | AnyKeyword ComponentKeyword DotRunningKeyword
5446 $$ = new Value(Value::OPTYPE_COMP_RUNNING_ANY);
5447 $$->set_location(infile, @$);
5449 | AllKeyword ComponentKeyword DotRunningKeyword
5451 $$ = new Value(Value::OPTYPE_COMP_RUNNING_ALL);
5452 $$->set_location(infile, @$);
5457 ComponentOrDefaultReference DotAliveKeyword
5459 $$ = new Value(Value::OPTYPE_COMP_ALIVE, $1);
5460 $$->set_location(infile, @$);
5462 | AnyKeyword ComponentKeyword DotAliveKeyword
5464 $$ = new Value(Value::OPTYPE_COMP_ALIVE_ANY);
5465 $$->set_location(infile, @$);
5467 | AllKeyword ComponentKeyword DotAliveKeyword
5469 $$ = new Value(Value::OPTYPE_COMP_ALIVE_ALL);
5470 $$->set_location(infile, @$);
5474 ConnectStatement: // 329
5475 ConnectKeyword SingleConnectionSpec
5477 $$=new Statement(Statement::S_CONNECT,
5478 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5479 $$->set_location(infile, @$);
5483 SingleConnectionSpec: // 331
5484 '(' PortRef optError ',' optError PortRef optError ')'
5486 $$.compref1 = $2.compref;
5487 $$.portref1 = $2.portref;
5488 $$.compref2 = $6.compref;
5489 $$.portref2 = $6.portref;
5494 ComponentRef ':' Port
5501 ComponentRef: // 333
5502 ComponentOrDefaultReference { $$ = $1; }
5503 | SystemOp { $$ = $1; }
5504 | SelfOp { $$ = $1; }
5505 | MTCOp { $$ = $1; }
5508 DisconnectStatement: // 335
5511 Location loc(infile, @$);
5512 loc.error("Disconnect operation on multiple connections is "
5513 "not currently supported");
5514 $$ = new Statement(Statement::S_ERROR);
5515 $$->set_location(infile, @$);
5517 | DisconnectKeyword SingleOrMultiConnectionSpec
5519 if ($2.compref1 && $2.portref1 && $2.compref1 && $2.compref2) {
5520 $$ = new Statement(Statement::S_DISCONNECT,
5521 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5523 Location loc(infile, @$);
5524 loc.error("Disconnect operation on multiple connections is "
5525 "not currently supported");
5530 $$ = new Statement(Statement::S_ERROR);
5532 $$->set_location(infile, @$);
5536 SingleOrMultiConnectionSpec: // 336
5537 SingleConnectionSpec { $$ = $1; }
5538 | AllConnectionsSpec
5540 $$.compref1 = $1.compref;
5541 $$.portref1 = $1.portref;
5552 | AllCompsAllPortsSpec
5561 AllConnectionsSpec: // 337
5562 '(' PortRef optError ')' { $$ = $2; }
5565 AllPortsSpec: // 338
5566 '(' ComponentRef ':' AllKeyword PortKeyword optError ')' { $$ = $2; }
5569 AllCompsAllPortsSpec: // 339
5570 '(' AllKeyword ComponentKeyword ':' AllKeyword PortKeyword optError ')'
5573 MapStatement: // 341
5574 MapKeyword SingleConnectionSpec
5576 $$=new Statement(Statement::S_MAP,
5577 $2.compref1, $2.portref1,
5578 $2.compref2, $2.portref2);
5579 $$->set_location(infile, @$);
5583 UnmapStatement: // 343
5586 $$ = new Statement(Statement::S_ERROR);
5587 $$->set_location(infile, @$);
5588 Location loc(infile, @$);
5589 loc.error("Unmap operation on multiple mappings is "
5590 "not currently supported");
5592 | UnmapKeyword SingleOrMultiConnectionSpec
5594 if ($2.compref1 && $2.portref1 && $2.compref1 && $2.compref2) {
5595 $$ = new Statement(Statement::S_UNMAP,
5596 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5598 Location loc(infile, @$);
5599 loc.error("Unmap operation on multiple mappings is "
5600 "not currently supported");
5605 $$ = new Statement(Statement::S_ERROR);
5607 $$->set_location(infile, @$);
5611 StartTCStatement: // 345
5612 /* VariableRef DotStartKeyword '(' FunctionInstance ')'
5613 -- covered by StartTimerStatement */
5614 VariableRef DotStartKeyword '(' DereferOp '(' optFunctionActualParList ')'
5617 Value *t_val = new Value(Value::V_REFD, $1);
5618 t_val->set_location(infile, @1);
5619 $6->set_location(infile, @5, @7);
5620 //ParsedActualParameters *pap = new ParsedActualParameters($6);
5621 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5622 $$->set_location(infile, @$);
5624 | FunctionInstance DotStartKeyword '(' FunctionInstance optError ')'
5626 Value *t_val = new Value(Value::V_REFD, $1);
5627 t_val->set_location(infile, @1);
5628 $$ = new Statement(Statement::S_START_COMP, t_val, $4);
5629 $$->set_location(infile, @$);
5631 | FunctionInstance DotStartKeyword '(' DereferOp '('
5632 optFunctionActualParList ')' optError ')'
5634 Value *t_val = new Value(Value::V_REFD, $1);
5635 t_val->set_location(infile, @1);
5636 $6->set_location(infile, @5 , @7);
5637 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5638 $$->set_location(infile, @$);
5640 | FunctionInstance DotStartKeyword '(' error ')'
5643 $$ = new Statement(Statement::S_ERROR);
5644 $$->set_location(infile, @$);
5646 | ApplyOp DotStartKeyword '(' FunctionInstance ')'
5648 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5649 t_val->set_location(infile, @1);
5650 $$ = new Statement(Statement::S_START_COMP, t_val, $4);
5651 $$->set_location(infile, @$);
5653 | ApplyOp DotStartKeyword '(' DereferOp '(' optFunctionActualParList ')'
5656 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5657 t_val->set_location(infile, @1);
5658 $6->set_location(infile, @5 , @7);
5659 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5660 $$->set_location(infile, @$);
5662 | ApplyOp DotStartKeyword '(' error ')'
5666 $$ = new Statement(Statement::S_ERROR);
5667 $$->set_location(infile, @$);
5671 StopTCStatement: // 337
5672 /* VariableRef DotStopKeyword -- covered by StopTimerStatement */
5673 FunctionInstance DotStopKeyword
5675 Value *t_val = new Value(Value::V_REFD, $1);
5676 t_val->set_location(infile, @1);
5677 $$ = new Statement(Statement::S_STOP_COMP, t_val);
5678 $$->set_location(infile, @$);
5680 | ApplyOp DotStopKeyword
5682 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5683 t_val->set_location(infile, @1);
5684 $$ = new Statement(Statement::S_STOP_COMP, t_val);
5685 $$->set_location(infile, @$);
5687 | MTCOp DotStopKeyword
5689 $$ = new Statement(Statement::S_STOP_COMP, $1);
5690 $$->set_location(infile, @$);
5692 | SelfOp DotStopKeyword
5694 $$ = new Statement(Statement::S_STOP_COMP, $1);
5695 $$->set_location(infile, @$);
5697 | AllKeyword ComponentKeyword DotStopKeyword
5699 $$ = new Statement(Statement::S_STOP_COMP, (Value*)0);
5700 $$->set_location(infile, @$);
5704 ComponentReferenceOrLiteral: // 348
5705 ComponentOrDefaultReference { $$ = $1; }
5706 | MTCOp { $$ = $1; }
5707 | SelfOp { $$ = $1; }
5710 KillTCStatement: // 349
5713 Value *self = new Value(Value::OPTYPE_COMP_SELF);
5714 self->set_location(infile, @1);
5715 $$ = new Statement(Statement::S_KILL, self);
5716 $$->set_location(infile, @$);
5718 | ComponentReferenceOrLiteral DotKillKeyword
5720 $$ = new Statement(Statement::S_KILL, $1);
5721 $$->set_location(infile, @$);
5723 | AllKeyword ComponentKeyword DotKillKeyword
5725 $$ = new Statement(Statement::S_KILL, (Value*)0);
5726 $$->set_location(infile, @$);
5730 ComponentOrDefaultReference: // 350
5733 $$ = new Value(Value::V_REFD, $1);
5734 $$->set_location(infile, @$);
5738 $$ = new Value(Value::V_REFD, $1);
5739 $$->set_location(infile, @$);
5743 $$ = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5744 $$->set_location(infile, @$);
5748 /* A.1.6.2.4 Port operations */
5751 VariableRef { $$ = $1; }
5754 CommunicationStatements: // 353
5755 SendStatement {$$ = $1;}
5756 | CallStatement {$$ = $1;}
5757 | ReplyStatement {$$ = $1;}
5758 | RaiseStatement {$$ = $1;}
5759 | ReceiveStatement {$$ = $1;}
5760 | TriggerStatement {$$ = $1;}
5761 | GetCallStatement {$$ = $1;}
5762 | GetReplyStatement {$$ = $1;}
5763 | CatchStatement {$$ = $1;}
5764 | CheckStatement {$$ = $1;}
5765 | ClearStatement {$$ = $1;}
5766 | StartStatement {$$ = $1;}
5767 | StopStatement {$$ = $1;}
5768 | HaltStatement { $$ = $1; }
5771 SendStatement: // 354
5772 Port DotSendOpKeyword PortSendOp
5774 $$ = new Statement(Statement::S_SEND, $1, $3.templ_inst, $3.val);
5775 $$->set_location(infile, @$);
5780 '(' SendParameter optError ')' optToClause
5785 | '(' error ')' optToClause
5787 Template *t = new Template(Template::TEMPLATE_ERROR);
5788 t->set_location(infile, @2);
5789 $$.templ_inst = new TemplateInstance(0, 0, t);
5790 $$.templ_inst->set_location(infile, @2);
5795 SendParameter: // 357
5796 TemplateInstance { $$=$1; }
5799 optToClause: // [3583]
5800 /* empty */ { $$ = 0; }
5801 | ToKeyword AddressRef
5803 Template *templ = $2->get_Template();
5804 if (!$2->get_Type() && !$2->get_DerivedRef() && templ->is_Value()) {
5805 $$ = templ->get_Value();
5807 Location loc(infile, @$);
5808 loc.error("Multicast communication is not currently supported");
5813 /* | ToKeyword AddressRefList -- covered by the previous rule
5814 (as ValueOrAttribList) */
5815 | ToKeyword AllKeyword ComponentKeyword
5817 Location loc(infile, @$);
5818 loc.error("Broadcast communication is not currently supported");
5821 | ToKeyword error { $$ = 0; }
5825 AddressRefList: // 359
5826 '(' seqAddressRef ')'
5831 | seqAddressRef ',' AddressRef
5836 TemplateInstance { $$ = $1; }
5839 CallStatement: // 362
5840 Port DotCallOpKeyword PortCallOp optPortCallBody
5842 $$ = new Statement(Statement::S_CALL, $1, $3.templ_inst,
5843 $3.calltimerval, $3.nowait, $3.val, $4);
5844 $$->set_location(infile, @$);
5849 '(' CallParameters optError ')' optToClause
5851 $$.templ_inst = $2.templ_inst;
5852 $$.calltimerval = $2.calltimerval;
5853 $$.nowait = $2.nowait;
5856 | '(' error ')' optToClause
5858 Template *t = new Template(Template::TEMPLATE_ERROR);
5859 t->set_location(infile, @2);
5860 $$.templ_inst = new TemplateInstance(0, 0, t);
5861 $$.templ_inst->set_location(infile, @2);
5862 $$.calltimerval = 0;
5868 CallParameters: // 365
5875 | TemplateInstance ',' optError CallTimerValue
5878 $$.calltimerval=$4.calltimerval;
5879 $$.nowait=$4.nowait;
5883 CallTimerValue: // 366
5896 optPortCallBody: // [368]
5897 /* empty */ { $$=0; }
5898 | '{' CallBodyStatementList optError '}' { $$=$2; }
5899 | '{' error '}' { $$ = new AltGuards; }
5902 CallBodyStatementList: // 369
5903 optError CallBodyStatement
5908 | CallBodyStatementList optError CallBodyStatement
5915 CallBodyStatement: // 370 and 371. rolled into one.
5916 AltGuardChar CallBodyOps ';' // This alternative is a TITAN extension
5918 $$=new AltGuard($1, $2, new StatementBlock());
5919 $$->set_location(infile, @$);
5921 | AltGuardChar CallBodyOps optSemiColon StatementBlock optSemiColon
5923 $$=new AltGuard($1, $2, $4);
5924 $$->set_location(infile, @$);
5929 GetReplyStatement {$$=$1;}
5930 | CatchStatement {$$=$1;}
5933 ReplyStatement: // 373
5934 Port DotReplyKeyword PortReplyOp
5936 $$ = new Statement(Statement::S_REPLY, $1, $3.templ_inst,
5937 $3.replyval, $3.toclause);
5938 $$->set_location(infile, @$);
5943 '(' TemplateInstance optReplyValue optError ')' optToClause
5949 | '(' error ')' optToClause
5951 Template *t = new Template(Template::TEMPLATE_ERROR);
5952 t->set_location(infile, @2);
5953 $$.templ_inst = new TemplateInstance(0, 0, t);
5954 $$.templ_inst->set_location(infile, @2);
5960 optReplyValue: // [376]
5961 /* empty */ { $$=0; }
5962 | ValueKeyword Expression { $$=$2; }
5963 | ValueKeyword error { $$ = 0; }
5966 RaiseStatement: // 377
5967 Port DotRaiseKeyword PortRaiseOp
5969 if ($3.signature) $$ = new Statement(Statement::S_RAISE, $1,
5970 $3.signature, $3.templ_inst, $3.toclause);
5972 $$ = new Statement(Statement::S_ERROR);
5974 delete $3.signature;
5975 delete $3.templ_inst;
5978 $$->set_location(infile, @$);
5983 '(' Signature optError ',' optError TemplateInstance optError ')' optToClause
5989 | '(' error ')' optToClause
5998 ReceiveStatement: // 380
5999 PortOrAny DotReceiveOpKeyword PortReceiveOp
6001 $$ = new Statement(Statement::S_RECEIVE, $1, $3.templ_inst,
6002 $3.fromclause, $3.redirectval, $3.redirectsender);
6003 $$->set_location(infile, @$);
6009 | AnyKeyword PortKeyword { $$ = 0; }
6012 PortReceiveOp: // 382
6013 optReceiveParameter optFromClause optPortRedirect
6017 $$.redirectval = $3.redirectval;
6018 $$.redirectsender = $3.redirectsender;
6022 optReceiveParameter: // [384]
6023 /* empty */ { $$ = 0; }
6024 | '(' ReceiveParameter optError ')' { $$ = $2; }
6027 Template *t = new Template(Template::TEMPLATE_ERROR);
6028 t->set_location(infile, @2);
6029 $$ = new TemplateInstance(0, 0, t);
6030 $$->set_location(infile, @$);
6034 ReceiveParameter: // 384
6035 TemplateInstance { $$ = $1; }
6038 optFromClause: // [385]
6039 /* empty */ { $$=0; }
6040 | FromClause { $$=$1; }
6044 FromKeyword AddressRef { $$=$2; }
6045 | FromKeyword error { $$ = 0; }
6048 optPortRedirect: // [387]
6052 $$.redirectsender=0;
6054 | PortRedirectSymbol ValueSpec
6057 $$.redirectsender=0;
6059 | PortRedirectSymbol SenderSpec
6062 $$.redirectsender=$2;
6064 | PortRedirectSymbol ValueSpec SenderSpec
6067 $$.redirectsender=$3;
6069 | PortRedirectSymbol error
6072 $$.redirectsender=0;
6077 ValueKeyword VariableRef { $$ = $2; }
6078 | ValueKeyword error { $$ = 0; }
6082 SenderKeyword VariableRef { $$ = $2; }
6083 | SenderKeyword error { $$ = 0; }
6086 TriggerStatement: // 393
6087 PortOrAny DotTriggerOpKeyword PortTriggerOp
6089 $$ = new Statement(Statement::S_TRIGGER, $1, $3.templ_inst,
6090 $3.fromclause, $3.redirectval, $3.redirectsender);
6091 $$->set_location(infile, @$);
6095 PortTriggerOp: // 394
6096 optReceiveParameter optFromClause optPortRedirect
6100 $$.redirectval = $3.redirectval;
6101 $$.redirectsender = $3.redirectsender;
6105 GetCallStatement: // 396
6106 PortOrAny DotGetCallOpKeyword PortGetCallOp
6108 $$ = new Statement(Statement::S_GETCALL, $1, $3.templ_inst,
6109 $3.fromclause, $3.redirectparam, $3.redirectsender);
6110 $$->set_location(infile, @$);
6114 PortGetCallOp: // 397
6115 optReceiveParameter optFromClause optPortRedirectWithParam
6119 $$.redirectparam = $3.redirectparam;
6120 $$.redirectsender = $3.redirectsender;
6124 optPortRedirectWithParam: // [399]
6128 $$.redirectsender=0;
6130 | PortRedirectSymbol ParamSpec
6132 $$.redirectparam=$2;
6133 $$.redirectsender=0;
6135 | PortRedirectSymbol ParamSpec SenderSpec
6137 $$.redirectparam=$2;
6138 $$.redirectsender=$3;
6140 | PortRedirectSymbol SenderSpec
6143 $$.redirectsender=$2;
6145 | PortRedirectSymbol error
6148 $$.redirectsender=0;
6153 ParamKeyword ParamAssignmentList { $$ = $2; }
6154 | ParamKeyword error { $$ = 0; }
6157 ParamAssignmentList: // 403
6158 '(' AssignmentList optError ')'
6160 $$=new ParamRedirect($2);
6161 $$->set_location(infile, @$);
6163 | '(' VariableList optError ')'
6165 $$=new ParamRedirect($2);
6166 $$->set_location(infile, @$);
6170 $$=new ParamRedirect(new ParamAssignments());
6171 $$->set_location(infile, @$);
6175 AssignmentList: // 404
6178 $$ = new ParamAssignments();
6181 | error VariableAssignment
6183 $$ = new ParamAssignments();
6186 | AssignmentList optError ',' optError VariableAssignment
6191 | AssignmentList optError ',' error { $$ = $1; }
6194 VariableAssignment: // 405
6195 VariableRef AssignmentChar IDentifier
6197 $$ = new ParamAssignment($3, $1);
6198 $$->set_location(infile, @$);
6202 VariableList: // 407
6205 $$ = new VariableEntries();
6208 | error VariableEntry
6210 $$ = new VariableEntries();
6213 | VariableList optError ',' optError VariableEntry
6218 | VariableList optError ',' error { $$ = $1; }
6221 VariableEntry: // 408
6224 $$ = new VariableEntry($1);
6225 $$->set_location(infile, @$);
6229 $$ = new VariableEntry;
6230 $$->set_location(infile, @$);
6234 GetReplyStatement: // 409
6235 PortOrAny DotGetReplyOpKeyword PortGetReplyOp
6237 $$ = new Statement(Statement::S_GETREPLY, $1, $3.templ_inst,
6238 $3.valuematch, $3.fromclause, $3.redirectval,
6239 $3.redirectparam, $3.redirectsender);
6240 $$->set_location(infile, @$);
6244 PortGetReplyOp: // 410
6245 optGetReplyParameter optFromClause optPortRedirectWithValueAndParam
6247 $$.templ_inst = $1.templ_inst;
6248 $$.valuematch = $1.valuematch;
6250 $$.redirectval = $3.redirectval;
6251 $$.redirectparam = $3.redirectparam;
6252 $$.redirectsender = $3.redirectsender;
6256 optPortRedirectWithValueAndParam: // [411]
6261 $$.redirectsender=0;
6263 | PortRedirectSymbol ValueSpec
6267 $$.redirectsender=0;
6269 | PortRedirectSymbol ValueSpec ParamSpec
6272 $$.redirectparam=$3;
6273 $$.redirectsender=0;
6275 | PortRedirectSymbol ValueSpec SenderSpec
6279 $$.redirectsender=$3;
6281 | PortRedirectSymbol ValueSpec ParamSpec SenderSpec
6284 $$.redirectparam=$3;
6285 $$.redirectsender=$4;
6287 | PortRedirectSymbol ParamSpec
6290 $$.redirectparam=$2;
6291 $$.redirectsender=0;
6293 | PortRedirectSymbol SenderSpec
6297 $$.redirectsender=$2;
6299 | PortRedirectSymbol ParamSpec SenderSpec
6302 $$.redirectparam=$2;
6303 $$.redirectsender=$3;
6305 | PortRedirectSymbol error
6309 $$.redirectsender=0;
6313 optGetReplyParameter:
6319 | '(' ReceiveParameter optError ')'
6324 | '(' ReceiveParameter ValueMatchSpec optError ')'
6331 Template *t = new Template(Template::TEMPLATE_ERROR);
6332 t->set_location(infile, @2);
6333 $$.templ_inst = new TemplateInstance(0, 0, t);
6334 $$.templ_inst->set_location(infile, @2);
6339 ValueMatchSpec: // 414
6340 ValueKeyword TemplateInstance { $$=$2; }
6341 | ValueKeyword error { $$ = 0; }
6344 CheckStatement: // 415
6345 PortOrAny DotCheckOpKeyword optCheckParameter
6347 switch ($3.statementtype) {
6348 case Statement::S_CHECK:
6349 $$ = new Statement(Statement::S_CHECK, $1, $3.templ_inst,
6352 case Statement::S_CHECK_RECEIVE:
6353 $$ = new Statement(Statement::S_CHECK_RECEIVE, $1, $3.templ_inst,
6354 $3.fromclause, $3.redirectval, $3.redirectsender);
6356 case Statement::S_CHECK_GETCALL:
6357 $$ = new Statement(Statement::S_CHECK_GETCALL, $1, $3.templ_inst,
6358 $3.fromclause, $3.redirectparam, $3.redirectsender);
6360 case Statement::S_CHECK_GETREPLY:
6361 $$ = new Statement(Statement::S_CHECK_GETREPLY, $1, $3.templ_inst,
6362 $3.valuematch, $3.fromclause, $3.redirectval,
6363 $3.redirectparam, $3.redirectsender);
6365 case Statement::S_CHECK_CATCH:
6366 $$ = new Statement(Statement::S_CHECK_CATCH, $1, $3.signature,
6367 $3.templ_inst, $3.timeout, $3.fromclause,
6368 $3.redirectval, $3.redirectsender);
6371 FATAL_ERROR("Internal error.");
6373 $$->set_location(infile, @$);
6377 optCheckParameter: // [418]
6380 $$.statementtype = Statement::S_CHECK;
6387 $$.redirectparam = 0;
6388 $$.redirectsender = 0;
6390 | '(' CheckParameter optError ')' { $$ = $2; }
6393 $$.statementtype = Statement::S_CHECK;
6400 $$.redirectparam = 0;
6401 $$.redirectsender = 0;
6405 CheckParameter: // 418
6406 CheckPortOpsPresent { $$ = $1; }
6407 | FromClausePresent { $$ = $1; }
6408 | RedirectPresent { $$ = $1; }
6411 FromClausePresent: // 419
6414 $$.statementtype = Statement::S_CHECK;
6421 $$.redirectparam = 0;
6422 $$.redirectsender = 0;
6424 | FromClause PortRedirectSymbol SenderSpec
6426 $$.statementtype = Statement::S_CHECK;
6433 $$.redirectparam = 0;
6434 $$.redirectsender = $3;
6438 RedirectPresent: // 420
6439 PortRedirectSymbol SenderSpec
6441 $$.statementtype = Statement::S_CHECK;
6448 $$.redirectparam = 0;
6449 $$.redirectsender = $2;
6453 CheckPortOpsPresent: // 421
6454 ReceiveOpKeyword PortReceiveOp
6456 $$.statementtype = Statement::S_CHECK_RECEIVE;
6458 $$.templ_inst = $2.templ_inst;
6461 $$.fromclause = $2.fromclause;
6462 $$.redirectval = $2.redirectval;
6463 $$.redirectparam = 0;
6464 $$.redirectsender = $2.redirectsender;
6466 | GetCallOpKeyword PortGetCallOp
6468 $$.statementtype = Statement::S_CHECK_GETCALL;
6470 $$.templ_inst = $2.templ_inst;
6473 $$.fromclause = $2.fromclause;
6475 $$.redirectparam = $2.redirectparam;
6476 $$.redirectsender = $2.redirectsender;
6478 | GetReplyOpKeyword PortGetReplyOp
6480 $$.statementtype = Statement::S_CHECK_GETREPLY;
6482 $$.templ_inst = $2.templ_inst;
6483 $$.valuematch = $2.valuematch;
6485 $$.fromclause = $2.fromclause;
6486 $$.redirectval = $2.redirectval;
6487 $$.redirectparam = $2.redirectparam;
6488 $$.redirectsender = $2.redirectsender;
6490 | CatchOpKeyword PortCatchOp
6492 $$.statementtype = Statement::S_CHECK_CATCH;
6493 $$.signature = $2.signature;
6494 $$.templ_inst = $2.templ_inst;
6496 $$.timeout = $2.timeout;
6497 $$.fromclause = $2.fromclause;
6498 $$.redirectval = $2.redirectval;
6499 $$.redirectparam = 0;
6500 $$.redirectsender = $2.redirectsender;
6504 CatchStatement: // 422
6505 PortOrAny DotCatchOpKeyword PortCatchOp
6507 $$ = new Statement(Statement::S_CATCH, $1, $3.signature, $3.templ_inst,
6508 $3.timeout, $3.fromclause, $3.redirectval,
6510 $$->set_location(infile, @$);
6515 optCatchOpParameter optFromClause optPortRedirect
6517 $$.signature = $1.signature;
6518 $$.templ_inst = $1.templ_inst;
6519 $$.timeout = $1.timeout;
6521 $$.redirectval = $3.redirectval;
6522 $$.redirectsender = $3.redirectsender;
6526 optCatchOpParameter: // [425]
6533 | '(' CatchOpParameter optError ')' { $$ = $2; }
6542 CatchOpParameter: // 425
6543 Signature optError ',' optError TemplateInstance
6557 ClearStatement: // 426
6558 PortOrAll DotClearOpKeyword
6560 $$ = new Statement(Statement::S_CLEAR, $1);
6561 $$->set_location(infile, @$);
6567 | AllKeyword PortKeyword { $$ = 0; }
6570 StartStatement: // 430
6571 /* Port DotPortStartKeyword -- covered by StartTimerStatement */
6572 AllKeyword PortKeyword DotStartKeyword
6574 $$=new Statement(Statement::S_START_PORT, (Ttcn::Reference*)0);
6575 $$->set_location(infile, @$);
6579 StopStatement: // 432
6580 /* Port DotPortStopKeyword -- covered by StopTimerStatement */
6581 AllKeyword PortKeyword DotStopKeyword
6583 $$=new Statement(Statement::S_STOP_PORT, (Ttcn::Reference*)0);
6584 $$->set_location(infile, @$);
6588 HaltStatement: // 435
6589 PortOrAll DotHaltKeyword
6591 $$ = new Statement(Statement::S_HALT, $1);
6592 $$->set_location(infile, @$);
6596 /* A.1.6.2.5 Timer operations */
6598 TimerStatements: // 439
6599 StartTimerStatement { $$ = $1; }
6600 | StopTimerStatement { $$ = $1; }
6601 | TimeoutStatement { $$ = $1; }
6605 ReadTimerOp { $$ = $1; }
6606 | RunningTimerOp { $$ = $1; }
6609 StartTimerStatement: // 441
6610 VariableRef DotStartKeyword
6612 $$ = new Statement(Statement::S_START_UNDEF, $1, (Value*)0);
6613 $$->set_location(infile, @$);
6615 | VariableRef DotStartKeyword '(' Expression optError ')'
6617 $$ = new Statement(Statement::S_START_UNDEF, $1, $4);
6618 $$->set_location(infile, @$);
6620 | VariableRef DotStartKeyword '(' error ')'
6622 Value *v = new Value(Value::V_ERROR);
6623 v->set_location(infile, @4);
6624 $$ = new Statement(Statement::S_START_UNDEF, $1, v);
6625 $$->set_location(infile, @$);
6629 StopTimerStatement: // 442
6630 TimerRef DotStopKeyword
6632 $$ = new Statement(Statement::S_STOP_UNDEF, $1, (Value*)0);
6633 $$->set_location(infile, @$);
6635 | AllKeyword TimerKeyword DotStopKeyword
6637 $$ = new Statement(Statement::S_STOP_TIMER, (Ttcn::Reference*)0);
6638 $$->set_location(infile, @$);
6642 /* no separate rule, folded into StopTimerStatement
6643 TimerRefOrAll: // 443
6645 | AllKeyword TimerKeyword
6650 TimerRef DotReadKeyword
6652 $$ = new Value(Value::OPTYPE_TMR_READ, $1);
6653 $$->set_location(infile, @$);
6657 RunningTimerOp: // 446
6658 TimerRef DotRunningKeyword
6660 $$ = new Value(Value::OPTYPE_UNDEF_RUNNING, $1);
6661 $$->set_location(infile, @$);
6663 | AnyKeyword TimerKeyword DotRunningKeyword
6665 $$ = new Value(Value::OPTYPE_TMR_RUNNING_ANY);
6666 $$->set_location(infile, @$);
6670 TimeoutStatement: // 447
6671 TimerRefOrAny DotTimeoutKeyword
6673 $$ = new Statement(Statement::S_TIMEOUT, $1);
6674 $$->set_location(infile, @$);
6678 TimerRefOrAny: // 448
6679 TimerRef { $$ = $1; }
6680 | AnyKeyword TimerKeyword { $$ = 0; }
6689 $$->set_location(infile, @$);
6691 | AnyTypeKeyword /* a predefined type with special treatment */
6693 anytype_access = true;
6694 Identifier *id = new Identifier(Identifier::ID_TTCN, string("anytype"));
6695 Ttcn::Reference *ref = new Ttcn::Reference(id);
6696 ref->set_location(infile, @1);
6697 $$ = new Type(Type::T_REFD, ref);
6699 | ReferencedType { $$ = $1; }
6703 PredefinedType: // 451, but see below
6704 BitStringKeyword { $$ = Type::T_BSTR; }
6705 | BooleanKeyword { $$ = Type::T_BOOL; }
6706 | CharStringKeyword { $$ = Type::T_CSTR; }
6707 | UniversalCharString { $$ = Type::T_USTR; }
6708 | CharKeyword // not in the standard anymore
6710 Location loc(infile, @$);
6711 loc.warning("Obsolete type `char' was substituted with `charstring'");
6714 | UniversalChar // not in the standard anymore
6716 Location loc(infile, @$);
6717 loc.warning("Obsolete type `universal char' was substituted with "
6718 "`universal charstring'");
6721 | IntegerKeyword { $$ = Type::T_INT; }
6722 | OctetStringKeyword { $$ = Type::T_OSTR; }
6723 | HexStringKeyword { $$ = Type::T_HSTR; }
6724 | VerdictTypeKeyword { $$ = Type::T_VERDICT; }
6725 | FloatKeyword { $$ = Type::T_REAL; }
6726 | AddressKeyword { $$ = Type::T_ADDRESS; }
6727 | DefaultKeyword { $$ = Type::T_DEFAULT; }
6728 | ObjectIdentifierKeyword { $$ = Type::T_OID; }
6730 * AnyTypeKeyword is not part of PredefinedType (this differs from the BNF
6731 * in the TTCN-3 standard).
6732 * PredefinedType is used in two contexts:
6733 * - as a RHS for Type, above (where AnyTypeKeyword needs special treatment,
6734 * and it's easier to appear as an alternative to PredefinedType)
6735 * - as field name for the anytype (where anytype is not permitted)
6739 UniversalCharString: // 463
6740 UniversalKeyword CharStringKeyword
6744 UniversalKeyword CharKeyword
6747 ReferencedType: // 465
6750 if ($1.is_ref) $$ = new Type(Type::T_REFD, $1.ref);
6752 Ttcn::Reference *ref = new Ttcn::Reference($1.id);
6753 ref->set_location(infile, @1);
6754 $$ = new Type(Type::T_REFD, ref);
6756 $$->set_location(infile, @$);
6758 | FunctionInstance optExtendedFieldReference
6759 /* covers all parameterized type references */
6761 Location loc(infile, @1);
6762 loc.error("Reference to parameterized type is not currently supported");
6764 for (size_t i = 0; i < $2.nElements; i++) delete $2.elements[i];
6766 $$ = new Type(Type::T_ERROR);
6767 $$->set_location(infile, @$);
6772 TypeReference: // 466
6774 | IDentifier TypeActualParList
6778 TypeActualParList: // -> 202 784 "Advanced Parameterization"
6779 '(' seqTypeActualPar optError ')'
6783 seqTypeActualPar: // -> 202 784 "Advanced Parameterization"
6784 optError TypeActualPar
6785 | seqTypeActualPar optError ',' optError TypeActualPar
6786 | seqTypeActualPar optError ',' error
6789 TypeActualPar: // -> 202 784 "Advanced Parameterization"
6790 Expression { delete $1; }
6793 optArrayDef: // [467]
6799 | optArrayDef ArrayIndex
6801 $$.nElements = $1.nElements + 1;
6802 $$.elements = (ArrayDimension**)
6803 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
6804 $$.elements[$1.nElements] = $2;
6811 $$ = new ArrayDimension($2);
6812 $$->set_location(infile, @$);
6814 | '[' ArrayBounds DotDot ArrayBounds ']'
6816 $$ = new ArrayDimension($2, $4);
6817 $$->set_location(infile, @$);
6821 Value *v = new Value(Value::V_ERROR);
6822 v->set_location(infile, @2);
6823 $$ = new ArrayDimension(v);
6824 $$->set_location(infile, @$);
6829 Expression { $$ = $1; }
6835 PredefinedValue { $$ = $1; }
6836 | ReferencedValue { $$ = $1; }
6839 PredefinedValue: // 470
6840 BitStringValue { $$ = $1; }
6841 | BooleanValue { $$ = $1; }
6842 | CharStringValue { $$ = $1; }
6843 | IntegerValue { $$ = $1; }
6844 | OctetStringValue { $$ = $1; }
6845 | HexStringValue { $$ = $1; }
6846 | VerdictValue { $$ = $1; }
6847 /* | EnumeratedValue -- covered by ReferencedValue */
6848 | FloatOrSpecialFloatValue
6850 $$ = new Value(Value::V_REAL, $1);
6851 $$->set_location(infile, @$);
6853 | AddressValue { $$ = $1; }
6854 | OmitValue { $$ = $1; }
6857 $$ = new Value(Value::V_NULL);
6858 $$->set_location(infile, @$);
6862 $$ = new Value(Value::V_MACRO, $1);
6863 $$->set_location(infile, @$);
6865 | ObjectIdentifierValue { $$ = $1; }
6868 $$=new Value(Value::V_ERROR);
6869 $$->set_location(infile, @$);
6873 BitStringValue: // 471
6876 $$ = new Value(Value::V_BSTR, $1);
6877 $$->set_location(infile, @$);
6881 BooleanValue: // 472
6884 $$ = new Value(Value::V_BOOL, true);
6885 $$->set_location(infile, @$);
6889 $$ = new Value(Value::V_BOOL, false);
6890 $$->set_location(infile, @$);
6894 /* TTCN-3 core language V4.2.1 */
6895 FloatOrSpecialFloatValue:
6910 IntegerValue: // 473
6913 $$ = new Value(Value::V_INT, $1);
6914 $$->set_location(infile, @$);
6918 OctetStringValue: // 474
6921 $$ = new Value(Value::V_OSTR, $1);
6922 $$->set_location(infile, @$);
6926 HexStringValue: // 475
6929 $$ = new Value(Value::V_HSTR, $1);
6930 $$->set_location(infile, @$);
6934 VerdictValue: // 476 VerdictTypeValue
6937 $$ = new Value(Value::V_VERDICT, Value::Verdict_NONE);
6938 $$->set_location(infile, @$);
6942 $$ = new Value(Value::V_VERDICT, Value::Verdict_PASS);
6943 $$->set_location(infile, @$);
6947 $$ = new Value(Value::V_VERDICT, Value::Verdict_INCONC);
6948 $$->set_location(infile, @$);
6952 $$ = new Value(Value::V_VERDICT, Value::Verdict_FAIL);
6953 $$->set_location(infile, @$);
6957 $$ = new Value(Value::V_VERDICT, Value::Verdict_ERROR);
6958 $$->set_location(infile, @$);
6962 CharStringValue: // 478
6965 if ($1->is_cstr()) $$ = new Value(Value::V_CSTR, $1);
6967 $$ = new Value(Value::V_USTR, new ustring(*$1));
6970 $$->set_location(infile, @$);
6974 $$ = new Value(Value::V_USTR, new ustring(*$1));
6976 $$->set_location(infile, @$);
6983 Location loc(infile, @1);
6984 $$ = parse_charstring_value($1, loc);
6990 CharKeyword '(' optError Group optError ',' optError Plane optError ','
6991 optError Row optError ',' optError Cell optError ')'
6992 { $$ = new ustring($4, $8, $12, $16); }
6993 | CharKeyword '(' error ')' { $$ = new ustring; }
6999 if (*$1 < 0 || *$1 > 127) {
7000 Location loc(infile, @1);
7001 loc.error("The first number of quadruple (group) must be within the "
7002 "range 0 .. 127 instead of %s", $1->t_str().c_str());
7003 $$ = *$1 < 0 ? 0 : 127;
7014 if (*$1 < 0 || *$1 > 255) {
7015 Location loc(infile, @1);
7016 loc.error("The second number of quadruple (plane) must be within the "
7017 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7018 $$ = *$1 < 0 ? 0 : 255;
7029 if (*$1 < 0 || *$1 > 255) {
7030 Location loc(infile, @1);
7031 loc.error("The third number of quadruple (row) must be within the "
7032 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7033 $$ = *$1 < 0 ? 0 : 255;
7044 if (*$1 < 0 || *$1 > 255) {
7045 Location loc(infile, @1);
7046 loc.error("The fourth number of quadruple (cell) must be within the "
7047 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7048 $$ = *$1 < 0 ? 0 : 255;
7057 Cstring { $$ = $1; }
7060 $$ = mputstr($1, $2);
7065 AddressValue: // 510
7068 $$ = new Value(Value::V_TTCN3_NULL);
7069 $$->set_location(infile, @$);
7076 $$ = new Value(Value::V_OMIT);
7077 $$->set_location(infile, @$);
7081 ReferencedValue: // 489
7084 if ($1.is_ref) $$ = new Value(Value::V_REFD, $1.ref);
7085 else $$ = new Value(Value::V_UNDEF_LOWERID, $1.id);
7086 $$->set_location(infile, @$);
7089 Reference: // 490 ValueReference
7095 | IDentifier '.' PredefOrIdentifier optExtendedFieldReference
7098 $$.ref = new Ttcn::Reference($1);
7099 FieldOrArrayRef *fieldref = new FieldOrArrayRef($3);
7100 fieldref->set_location(infile, @3);
7101 $$.ref->add(fieldref);
7102 for (size_t i = 0; i < $4.nElements; i++) $$.ref->add($4.elements[i]);
7104 $$.ref->set_location(infile, @$);
7106 | IDentifier ArrayOrBitRef optExtendedFieldReference
7109 $$.ref = new Ttcn::Reference($1);
7111 for (size_t i = 0; i < $3.nElements; i++) $$.ref->add($3.elements[i]);
7113 $$.ref->set_location(infile, @$);
7115 | IDentifier '[' NotUsedSymbol ']'
7118 $$.ref = new Ttcn::Reference($1);
7119 Value* novalue = new Value(Value::V_NOTUSED);
7120 novalue->set_location(infile, @3);
7121 $$.ref->add(new FieldOrArrayRef(novalue));
7122 $$.ref->set_location(infile, @$);
7124 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
7125 optExtendedFieldReference
7128 $$.ref = new Ttcn::Reference($1, $5);
7130 for (size_t i = 0; i < $6.nElements; i++) $$.ref->add($6.elements[i]);
7132 $$.ref->set_location(infile, @$);
7136 /* A.1.6.5 Parameterization */
7139 /* empty */ { $$ = false; }
7140 | TitanSpecificLazyKeyword { $$ = true; }
7143 FormalValuePar: // 516
7144 optLazyEval Type IDentifier optParDefaultValue
7146 $$ = new FormalPar(Common::Assignment::A_PAR_VAL, $2, $3, $4, $1);
7147 $$->set_location(infile, @$);
7149 | InParKeyword optLazyEval Type IDentifier optParDefaultValue
7151 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_IN, $3, $4, $5, $2);
7152 $$->set_location(infile, @$);
7154 | InOutParKeyword Type IDentifier optParDefaultValue
7156 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_INOUT, $2, $3, $4);
7157 $$->set_location(infile, @$);
7159 | OutParKeyword Type IDentifier optParDefaultValue
7161 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_OUT, $2, $3, $4);
7162 $$->set_location(infile, @$);
7167 FormalPortPar: // 518
7168 IDentifier IDentifier
7169 | InOutParKeyword IDentifier IDentifier
7173 FormalTimerPar: // 520
7174 TimerKeyword IDentifier optParDefaultValue
7176 $$ = new FormalPar(Common::Assignment::A_PAR_TIMER, $2, $3);
7177 $$->set_location(infile, @$);
7179 | InOutParKeyword TimerKeyword IDentifier optParDefaultValue
7181 $$ = new FormalPar(Common::Assignment::A_PAR_TIMER, $3, $4);
7182 $$->set_location(infile, @$);
7186 FormalTemplatePar: // 522
7187 TemplateOptRestricted optLazyEval Type IDentifier optParDefaultValue
7189 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_IN, $1, $3, $4, $5, $2);
7190 $$->set_location(infile, @$);
7192 | InParKeyword TemplateOptRestricted optLazyEval Type IDentifier optParDefaultValue
7194 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_IN, $2, $4, $5, $6, $3);
7195 $$->set_location(infile, @$);
7197 | InOutParKeyword TemplateOptRestricted Type IDentifier optParDefaultValue
7199 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_INOUT, $2, $3, $4, $5);
7200 $$->set_location(infile, @$);
7202 | OutParKeyword TemplateOptRestricted Type IDentifier optParDefaultValue
7204 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_OUT, $2, $3, $4, $5);
7205 $$->set_location(infile, @$);
7209 /* template with optional restriction */
7210 TemplateOptRestricted:
7211 TemplateKeyword optTemplateRestriction
7221 optTemplateRestriction:
7222 /* none */ { $$ = TR_NONE; }
7223 | TemplateRestriction { $$ = $1; }
7225 TemplateRestriction:
7226 '(' OmitKeyword ')' { $$ = TR_OMIT; }
7227 | '(' ValueKeyword ')' { $$ = TR_VALUE; }
7228 | '(' PresentKeyword ')' { $$ = TR_PRESENT; }
7232 /* empty */ { $$ = NULL; }
7233 | AssignmentChar TemplateInstance { $$ = $2; }
7234 | AssignmentChar NotUsedSymbol
7236 Template *t = new Template(Template::TEMPLATE_NOTUSED);
7237 t->set_location(infile, @$);
7238 $$ = new TemplateInstance(0, 0, t);
7239 $$->set_location(infile, @$);
7243 /* A.1.6.6 With statement */
7245 optWithStatement: // [526]
7246 /* empty */ { $$ = NULL; }
7247 | WithStatement { $$ = $1; }
7250 optWithStatementAndSemiColon:
7251 /* empty */ { $$ = NULL; }
7252 | WithStatement { $$ = $1; }
7253 | ';' { $$ = NULL; }
7254 | WithStatement ';' { $$ = $1; }
7257 WithStatement: // 526
7258 WithKeyword WithAttribList { $$ = $2; }
7261 WithAttribList: // 528
7262 '{' MultiWithAttrib optError '}' { $$ = $2; }
7263 | '{' error '}' { $$ = NULL; }
7266 MultiWithAttrib: // 529
7267 optError SingleWithAttrib optSemiColon
7269 $$ = new MultiWithAttrib;
7270 $$->set_location(infile, @$);
7271 $$->add_element($2);
7273 | MultiWithAttrib optError SingleWithAttrib optSemiColon
7276 $$->add_element($3);
7280 SingleWithAttrib: // 530
7281 AttribKeyword optOverrideKeyword optAttribQualifier AttribSpec
7283 $$ = new SingleWithAttrib($1,$2,$3,$4);
7284 $$->set_location(infile, @$);
7288 AttribKeyword: // 531
7289 EncodeKeyword { $$ = SingleWithAttrib::AT_ENCODE; }
7290 | VariantKeyword { $$ = SingleWithAttrib::AT_VARIANT; }
7291 | DisplayKeyword { $$ = SingleWithAttrib::AT_DISPLAY; }
7292 | ExtensionKeyword { $$ = SingleWithAttrib::AT_EXTENSION; }
7293 | OptionalKeyword { $$ = SingleWithAttrib::AT_OPTIONAL; }
7296 /* workaround to get rid of ErroneousKeyword which would clash with
7297 * existing TTCN-3 source code */
7298 if ($1->get_ttcnname()=="erroneous") $$ = SingleWithAttrib::AT_ERRONEOUS;
7300 Location loc(infile, @1);
7301 loc.error("Invalid attribute. Valid attributes are: "
7302 "`encode', `variant' , `display' , `extension', `optional' and `erroneous'");
7303 if ($1->get_ttcnname()=="titan")
7305 " ________ _____ ________ ____ __ _ \n"
7306 "(___ ___) (_ _) (___ ___) ( ) / \\ / ) \n"
7307 " ) ) | | ) ) / /\\ \\ / /\\ \\ / / \n"
7308 " ( ( | | ( ( ( (__) ) ) ) ) ) ) ) \n"
7309 " ) ) | | ) ) ) ( ( ( ( ( ( ( \n"
7310 " ( ( _| |__ ( ( / /\\ \\ / / \\ \\/ / \n"
7311 " /__\\ /_____( /__\\ /__( )__\\ (_/ \\__/ \n");
7312 $$ = SingleWithAttrib::AT_INVALID;
7318 optOverrideKeyword: // [536]
7319 /* empty */ { $$ = false; }
7320 | OverrideKeyword { $$ = true; }
7323 optAttribQualifier: // [537]
7324 /* empty */ { $$ = NULL; }
7325 | '(' DefOrFieldRefList optError ')' { $$ = $2; }
7326 | '(' error ')' { $$ = NULL; }
7329 DefOrFieldRefList: // 538
7330 optError DefOrFieldRef
7332 $$ = new Qualifiers();
7333 if ($2) $$->add_qualifier($2);
7335 | DefOrFieldRefList optError ',' optError DefOrFieldRef
7338 if ($5) $$->add_qualifier($5);
7340 | DefOrFieldRefList optError ',' error { $$ = $1; }
7343 ArrayOrBitRefOrDash:
7344 ArrayOrBitRef { $$ = $1; }
7345 | '[' NotUsedSymbol ']'
7347 Value* novalue = new Value(Value::V_NOTUSED);
7348 novalue->set_location(infile, @2);
7349 $$ = new FieldOrArrayRef(novalue);
7350 $$->set_location(infile, @$);
7353 DefOrFieldRef: // 539
7356 $$ = new Qualifier();
7357 $$->add(new FieldOrArrayRef($1));
7358 $$->set_location(infile, @1);
7360 | IDentifier '.' IDentifier optExtendedFieldReference
7362 $$ = new Qualifier();
7363 $$->add(new FieldOrArrayRef($1));
7364 $$->add(new FieldOrArrayRef($3));
7365 for(size_t i=0; i<$4.nElements; i++) {
7366 $$->add($4.elements[i]);
7369 $$->set_location(infile, @$);
7371 | IDentifier ArrayOrBitRefOrDash optExtendedFieldReference
7373 $$ = new Qualifier();
7374 $$->add(new FieldOrArrayRef($1));
7376 for(size_t i=0; i<$3.nElements; i++) {
7377 $$->add($3.elements[i]);
7380 $$->set_location(infile, @$);
7382 | ArrayOrBitRefOrDash optExtendedFieldReference
7384 $$ = new Qualifier();
7386 for(size_t i=0; i<$2.nElements; i++) {
7387 $$->add($2.elements[i]);
7390 $$->set_location(infile, @$);
7394 Location loc(infile, @$);
7395 loc.error("Reference to multiple definitions in attribute qualifiers is "
7396 "not currently supported");
7402 GroupKeyword AllKeyword
7403 | GroupKeyword AllKeyword ExceptKeyword '{' GroupRefList optError '}'
7404 | TypeDefKeyword AllKeyword
7405 | TypeDefKeyword AllKeyword ExceptKeyword '{' TypeRefList optError '}'
7406 | TemplateKeyword AllKeyword
7407 | TemplateKeyword AllKeyword ExceptKeyword '{' TemplateRefList optError '}'
7408 | ConstKeyword AllKeyword
7409 | ConstKeyword AllKeyword ExceptKeyword '{' ConstRefList optError '}'
7410 | AltstepKeyword AllKeyword
7411 | AltstepKeyword AllKeyword ExceptKeyword '{' AltstepRefList optError '}'
7412 | TestcaseKeyword AllKeyword
7413 | TestcaseKeyword AllKeyword ExceptKeyword '{' TestcaseRefList optError '}'
7414 | FunctionKeyword AllKeyword
7415 | FunctionKeyword AllKeyword ExceptKeyword '{' FunctionRefList optError '}'
7416 | SignatureKeyword AllKeyword
7417 | SignatureKeyword AllKeyword ExceptKeyword '{' SignatureRefList optError '}'
7418 | ModuleParKeyword AllKeyword
7419 | ModuleParKeyword AllKeyword ExceptKeyword '{' ModuleParRefList optError '}'
7425 $$ = new AttributeSpec(string($1));
7426 $$->set_location(infile, @$);
7431 /* A.1.6.7 Behaviour statements */
7433 BehaviourStatements: // 543
7436 if ($1.ref_pard) $$ = new Statement(Statement::S_TESTCASE_INSTANCE,
7437 $1.ref_pard, $1.value);
7438 else if($1.derefered_value) {
7439 $$ = new Statement(Statement::S_TESTCASE_INSTANCE_REFD,
7440 $1.derefered_value, $1.ap_list->steal_tis(), $1. value);
7443 else $$ = new Statement(Statement::S_ERROR);
7444 $$->set_location(infile, @$);
7448 $$ = new Statement(Statement::S_UNKNOWN_INSTANCE, $1);
7449 $$->set_location(infile, @$);
7453 $$ = new Statement(Statement::S_UNKNOWN_INVOKED, $1.value, $1.ap_list);
7454 $$->set_location(infile, @$);
7456 | ReturnStatement { $$ = $1; }
7457 | AltConstruct { $$ = $1; }
7458 | InterleavedConstruct { $$ = $1; }
7459 | LabelStatement { $$ = $1; }
7460 | GotoStatement { $$=$1; }
7461 | RepeatStatement { $$ = $1; }
7462 | BreakStatement { $$ = $1; }
7463 | ContinueStatement { $$ = $1; }
7464 | DeactivateStatement { $$ = $1; }
7465 /* | AltstepInstance -- covered by FunctionInstance */
7468 if ($1.ref_pard) $$ = new Statement(Statement::S_ACTIVATE, $1.ref_pard);
7469 else if($1.derefered_value) $$ = new Statement(Statement::S_ACTIVATE_REFD,
7470 $1.derefered_value, new ParsedActualParameters($1.ap_list));
7471 else $$ = new Statement(Statement::S_ERROR);
7472 $$->set_location(infile, @$);
7476 VerdictStatements: // 544
7477 SetLocalVerdict { $$ = $1; }
7481 GetLocalVerdict { $$ = $1; }
7484 SetLocalVerdict: // 546
7485 SetVerdictKeyword '(' Expression optError ',' LogItemList optError ')'
7487 $$=new Statement(Statement::S_SETVERDICT, $3, $6);
7488 $$->set_location(infile, @$);
7490 | SetVerdictKeyword '(' Expression optError ')'
7492 $$=new Statement(Statement::S_SETVERDICT, $3, (LogArguments*)0);
7493 $$->set_location(infile, @$);
7495 | SetVerdictKeyword '(' error ')'
7497 Value *v = new Value(Value::V_ERROR);
7498 v->set_location(infile, @3);
7499 $$ = new Statement(Statement::S_SETVERDICT, v);
7500 $$->set_location(infile, @$);
7504 GetLocalVerdict: // 548
7507 $$=new Value(Value::OPTYPE_GETVERDICT);
7508 $$->set_location(infile, @$);
7512 SUTStatements: // 549
7513 ActionKeyword '(' ')'
7515 $$=new Statement(Statement::S_ACTION, (LogArguments*)0);
7516 $$->set_location(infile, @$);
7518 | ActionKeyword '(' LogItemList optError ')'
7520 $$=new Statement(Statement::S_ACTION, $3);
7521 $$->set_location(infile, @$);
7523 | ActionKeyword '(' error ')'
7525 $$=new Statement(Statement::S_ACTION, new LogArguments());
7526 $$->set_location(infile, @$);
7530 StopExecutionStatement:
7533 $$=new Statement(Statement::S_STOP_EXEC);
7534 $$->set_location(infile, @$);
7538 StopTestcaseStatement:
7539 TestcaseKeyword DotStopKeyword
7541 $$ = new Statement(Statement::S_STOP_TESTCASE, (LogArguments*)0);
7542 $$->set_location(infile, @$);
7544 | TestcaseKeyword DotStopKeyword '(' LogItemList optError ')'
7546 $$ = new Statement(Statement::S_STOP_TESTCASE, $4);
7547 $$->set_location(infile, @$);
7551 /* these deliberately don't have their locations set */
7553 TitanSpecificProfilerKeyword DotStartKeyword
7555 $$ = new Statement(Statement::S_START_PROFILER);
7557 | TitanSpecificProfilerKeyword DotStopKeyword
7559 $$ = new Statement(Statement::S_STOP_PROFILER);
7564 TitanSpecificProfilerKeyword DotRunningKeyword
7566 $$ = new Value(Value::OPTYPE_PROF_RUNNING);
7567 $$->set_location(infile, @$);
7571 ReturnStatement: // 552
7574 $$=new Statement(Statement::S_RETURN, (Template*)0);
7575 $$->set_location(infile, @$);
7577 | ReturnKeyword TemplateBody
7579 $$=new Statement(Statement::S_RETURN, $2);
7580 $$->set_location(infile, @$);
7584 AltConstruct: // 553
7585 AltKeyword '{' AltGuardList optError '}'
7587 $$=new Statement(Statement::S_ALT, $3);
7588 $$->set_location(infile, @$);
7590 | AltKeyword '{' error '}'
7592 $$=new Statement(Statement::S_ALT, new AltGuards());
7593 $$->set_location(infile, @$);
7597 AltGuardList: // 555
7603 | AltGuardList optError AltGuard
7611 GuardStatement { $$ = $1; }
7612 | ElseStatement { $$ = $1; }
7615 GuardStatement: // 556
7616 AltGuardChar AltstepInstance optSemiColon
7618 $$=new AltGuard($1, $2, 0);
7619 $$->set_location(infile, @$);
7621 | AltGuardChar ApplyOp optSemiColon
7623 $$=new AltGuard($1, $2.value, $2.ap_list->steal_tis(), 0);
7624 $$->set_location(infile, @$);
7627 | AltGuardChar AltstepInstance optSemiColon StatementBlock optSemiColon
7629 $$=new AltGuard($1, $2, $4);
7630 $$->set_location(infile, @$);
7632 | AltGuardChar ApplyOp optSemiColon StatementBlock optSemiColon
7634 $$= new AltGuard($1, $2.value, $2.ap_list->steal_tis(), $4);
7635 $$->set_location(infile, @$);
7638 | AltGuardChar GuardOp ';'
7640 $$=new AltGuard($1, $2, new StatementBlock());
7641 $$->set_location(infile, @$);
7643 | AltGuardChar GuardOp optSemiColon StatementBlock optSemiColon
7645 $$=new AltGuard($1, $2, $4);
7646 $$->set_location(infile, @$);
7650 ElseStatement: // 557
7651 '[' ElseKeyword ']' StatementBlock optSemiColon
7653 $$=new AltGuard($4);
7654 $$->set_location(infile, @$);
7658 AltGuardChar: // 558
7660 | '[' BooleanExpression ']' { $$ = $2; }
7664 TimeoutStatement { $$=$1; }
7665 | ReceiveStatement { $$=$1; }
7666 | TriggerStatement { $$=$1; }
7667 | GetCallStatement { $$=$1; }
7668 | CatchStatement { $$=$1; }
7669 | CheckStatement { $$=$1; }
7670 | GetReplyStatement { $$=$1; }
7671 | DoneStatement { $$=$1; }
7672 | KilledStatement { $$ = $1; }
7675 InterleavedConstruct: // 560
7676 InterleavedKeyword '{' InterleavedGuardList optError '}'
7678 $$ = new Statement(Statement::S_INTERLEAVE, $3);
7679 $$->set_location(infile, @$);
7681 | InterleavedKeyword '{' error '}'
7683 $$ = new Statement(Statement::S_INTERLEAVE, new AltGuards());
7684 $$->set_location(infile, @$);
7688 InterleavedGuardList: // 562
7689 optError InterleavedGuardElement
7691 $$ = new AltGuards();
7694 | InterleavedGuardList optError InterleavedGuardElement
7695 { $$ = $1; $$->add_ag($3); }
7698 InterleavedGuardElement: // 563
7699 '[' optError ']' GuardOp ';'
7701 $$ = new AltGuard(0, $4, new StatementBlock());
7702 $$->set_location(infile, @$);
7704 | '[' optError ']' GuardOp optSemiColon StatementBlock optSemiColon
7706 $$ = new AltGuard(0, $4, $6);
7707 $$->set_location(infile, @$);
7711 /* The following were folded into the above rule:
7713 InterleavedGuardElement: // 563
7714 InterleavedGuard InterleavedAction
7717 InterleavedGuard: // 564
7721 InterleavedAction: // 565
7726 LabelStatement: // 566
7727 LabelKeyword IDentifier
7729 $$=new Statement(Statement::S_LABEL, $2);
7730 $$->set_location(infile, @$);
7734 GotoStatement: // 569
7735 GotoKeyword IDentifier
7737 $$=new Statement(Statement::S_GOTO, $2);
7738 $$->set_location(infile, @$);
7740 | GotoKeyword AltKeyword
7742 Location loc(infile, @$);
7743 loc.warning("Obsolete statement `goto alt' was substituted with `repeat'");
7744 $$=new Statement(Statement::S_REPEAT);
7745 $$->set_location(infile, @$);
7749 RepeatStatement: // 571
7752 $$=new Statement(Statement::S_REPEAT);
7753 $$->set_location(infile, @$);
7758 ActivateKeyword '(' AltstepInstance optError ')'
7761 $$.derefered_value = 0;
7764 | ActivateKeyword '(' DereferOp '(' optFunctionActualParList ')' optError ')'
7766 $5->set_location(infile, @4, @6);
7768 $$.derefered_value = $3;
7769 $$.ap_list = $5->steal_tis(); /* XXX perhaps propagate the datatype instead ? */
7772 | ActivateKeyword '(' error ')'
7775 $$.derefered_value = 0;
7781 RefersKeyword '(' FunctionRef ')'
7783 Ttcn::Reference* t_ref = new Ttcn::Reference($3.modid, $3.id);
7784 t_ref->set_location(infile, @3);
7785 $$ = new Value(Value::V_REFER, t_ref);
7786 $$->set_location(infile, @$);
7790 DeactivateStatement: // 574
7793 $$=new Statement(Statement::S_DEACTIVATE, (Value*)0);
7794 $$->set_location(infile, @$);
7796 | DeactivateKeyword '(' Expression optError ')'
7798 $$=new Statement(Statement::S_DEACTIVATE, $3);
7799 $$->set_location(infile, @$);
7801 | DeactivateKeyword '(' error ')'
7803 Value *v = new Value(Value::V_ERROR);
7804 v->set_location(infile, @3);
7805 $$ = new Statement(Statement::S_DEACTIVATE, v);
7806 $$->set_location(infile, @$);
7810 BreakStatement: // 576
7813 $$=new Statement(Statement::S_BREAK);
7814 $$->set_location(infile, @$);
7818 ContinueStatement: // 577
7821 $$=new Statement(Statement::S_CONTINUE);
7822 $$->set_location(infile, @$);
7826 /* A.1.6.8 Basic statements */
7828 BasicStatements: // 578
7831 $$=new Statement(Statement::S_ASSIGNMENT, $1);
7832 $$->set_location(infile, @$);
7834 | LogStatement { $$ = $1; }
7835 | String2TtcnStatement { $$ = $1; }
7838 $$ = new Statement(Statement::S_BLOCK, $1);
7839 $$->set_location(infile, @$);
7841 | TitanSpecificTryKeyword StatementBlock
7843 $$ = new Statement(Statement::S_BLOCK, $2);
7844 $2->set_exception_handling(StatementBlock::EH_TRY);
7845 $$->set_location(infile, @$);
7847 | TitanSpecificCatchKeyword '(' IDentifier ')' StatementBlock
7849 $$ = new Statement(Statement::S_BLOCK, $5);
7850 $5->set_exception_handling(StatementBlock::EH_CATCH);
7851 /* add a newly constructed first statement which will contain the error message,
7852 same as: 'var charstring IDentifier;' */
7853 Type* str_type = new Type(Type::T_CSTR);
7854 str_type->set_location(infile, @3);
7855 Def_Var* str_def = new Def_Var($3, str_type, 0);
7856 str_def->set_location(infile, @3);
7857 Statement* str_stmt = new Statement(Statement::S_DEF, str_def);
7858 str_stmt->set_location(infile, @3);
7859 $5->add_stmt(str_stmt, true);
7860 $$->set_location(infile, @$);
7862 | LoopConstruct { $$ = $1; }
7863 | ConditionalConstruct { $$ = $1; }
7864 | SelectCaseConstruct { $$ = $1; }
7868 '(' optError Expression optError ')' { $$ = $3; }
7871 $$ = new Value(Value::V_ERROR);
7872 $$->set_location(infile, @$);
7874 | '+' Expression %prec UnarySign
7876 $$ = new Value(Value::OPTYPE_UNARYPLUS, $2);
7877 $$->set_location(infile, @$);
7879 | '-' Expression %prec UnarySign
7881 $$ = new Value(Value::OPTYPE_UNARYMINUS, $2);
7882 $$->set_location(infile, @$);
7884 | Expression '*' Expression
7886 $$ = new Value(Value::OPTYPE_MULTIPLY, $1, $3);
7887 $$->set_location(infile, @$);
7889 | Expression '/' Expression
7891 $$ = new Value(Value::OPTYPE_DIVIDE, $1, $3);
7892 $$->set_location(infile, @$);
7894 | Expression ModKeyword Expression
7896 $$ = new Value(Value::OPTYPE_MOD, $1, $3);
7897 $$->set_location(infile, @$);
7899 | Expression RemKeyword Expression
7901 $$ = new Value(Value::OPTYPE_REM, $1, $3);
7902 $$->set_location(infile, @$);
7904 | Expression '+' Expression
7906 $$ = new Value(Value::OPTYPE_ADD, $1, $3);
7907 $$->set_location(infile, @$);
7909 | Expression '-' Expression
7911 $$ = new Value(Value::OPTYPE_SUBTRACT, $1, $3);
7912 $$->set_location(infile, @$);
7914 | Expression '&' Expression
7916 $$ = new Value(Value::OPTYPE_CONCAT, $1, $3);
7917 $$->set_location(infile, @$);
7919 | Not4bKeyword Expression
7921 $$ = new Value(Value::OPTYPE_NOT4B, $2);
7922 $$->set_location(infile, @$);
7924 | Expression And4bKeyword Expression
7926 $$ = new Value(Value::OPTYPE_AND4B, $1, $3);
7927 $$->set_location(infile, @$);
7929 | Expression Xor4bKeyword Expression
7931 $$ = new Value(Value::OPTYPE_XOR4B, $1, $3);
7932 $$->set_location(infile, @$);
7934 | Expression Or4bKeyword Expression
7936 $$ = new Value(Value::OPTYPE_OR4B, $1, $3);
7937 $$->set_location(infile, @$);
7939 | Expression SL Expression
7941 $$ = new Value(Value::OPTYPE_SHL, $1, $3);
7942 $$->set_location(infile, @$);
7944 | Expression SR Expression
7946 $$ = new Value(Value::OPTYPE_SHR, $1, $3);
7947 $$->set_location(infile, @$);
7949 | Expression RL Expression
7951 $$ = new Value(Value::OPTYPE_ROTL, $1, $3);
7952 $$->set_location(infile, @$);
7954 | Expression _RR Expression
7956 $$ = new Value(Value::OPTYPE_ROTR, $1, $3);
7957 $$->set_location(infile, @$);
7959 | Expression '<' Expression
7961 $$ = new Value(Value::OPTYPE_LT, $1, $3);
7962 $$->set_location(infile, @$);
7964 | Expression '>' Expression
7966 $$ = new Value(Value::OPTYPE_GT, $1, $3);
7967 $$->set_location(infile, @$);
7969 | Expression LE Expression
7971 $$ = new Value(Value::OPTYPE_LE, $1, $3);
7972 $$->set_location(infile, @$);
7974 | Expression GE Expression
7976 $$ = new Value(Value::OPTYPE_GE, $1, $3);
7977 $$->set_location(infile, @$);
7979 | Expression EQ Expression
7981 $$ = new Value(Value::OPTYPE_EQ, $1, $3);
7982 $$->set_location(infile, @$);
7984 | Expression NE Expression
7986 $$ = new Value(Value::OPTYPE_NE, $1, $3);
7987 $$->set_location(infile, @$);
7989 | NotKeyword Expression
7991 $$ = new Value(Value::OPTYPE_NOT, $2);
7992 $$->set_location(infile, @$);
7994 | Expression AndKeyword Expression
7996 $$ = new Value(Value::OPTYPE_AND, $1, $3);
7997 $$->set_location(infile, @$);
7999 | Expression XorKeyword Expression
8001 $$ = new Value(Value::OPTYPE_XOR, $1, $3);
8002 $$->set_location(infile, @$);
8004 | Expression OrKeyword Expression
8006 $$ = new Value(Value::OPTYPE_OR, $1, $3);
8007 $$->set_location(infile, @$);
8009 | OpCall { $$ = $1; }
8010 | Value { $$ = $1; }
8011 | CompoundExpression { $$ = $1; }
8014 CompoundExpression: // 565
8015 FieldExpressionList { $$ = $1; }
8016 | ArrayExpressionList { $$ = $1; }
8017 | ArrayExpression { $$ = $1; }
8020 FieldExpressionList: // 581
8021 '{' seqFieldExpressionSpec optError '}'
8023 $$ = new Value(Value::V_SEQ, $2);
8024 $$->set_location(infile, @$);
8028 seqFieldExpressionSpec:
8031 $$ = new NamedValues();
8034 | error FieldExpressionSpec
8036 $$ = new NamedValues();
8039 | seqFieldExpressionSpec optError ',' optError FieldExpressionSpec
8044 | seqFieldExpressionSpec optError ',' error { $$ = $1; }
8047 FieldExpressionSpec: // 582
8048 FieldReference AssignmentChar NotUsedOrExpression
8050 $$ = new NamedValue($1, $3);
8051 $$->set_location(infile, @$);
8055 ArrayExpressionList:
8056 '{' seqArrayExpressionSpec optError '}'
8058 $$ = new Value(Value::V_SEQOF, $2);
8059 $$->set_location(infile, @$);
8063 seqArrayExpressionSpec:
8064 optError ArrayExpressionSpec
8066 // The only place for indexed-list notation.
8067 $$ = new Values(true);
8070 | seqArrayExpressionSpec optError ',' optError ArrayExpressionSpec
8075 | seqArrayExpressionSpec optError ',' error { $$ = $1; }
8078 ArrayExpressionSpec:
8079 ArrayOrBitRef AssignmentChar Expression
8081 $$ = new IndexedValue($1, $3);
8082 $$->set_location(infile, @$);
8086 ArrayExpression: // 583
8089 $$ = new Value(Value::V_SEQOF, new Values);
8090 $$->set_location(infile, @$);
8092 | '{' ArrayElementExpressionList optError '}'
8094 $$ = new Value(Value::V_SEQOF, $2);
8095 $$->set_location(infile, @$);
8099 $$ = new Value(Value::V_ERROR);
8100 $$->set_location(infile, @$);
8104 ArrayElementExpressionList: // 584
8110 | error NotUsedOrExpression
8115 | ArrayElementExpressionList optError ',' optError NotUsedOrExpression
8120 | ArrayElementExpressionList optError ',' error { $$ = $1; }
8123 NotUsedOrExpression: // 585
8124 Expression { $$ = $1; }
8127 $$ = new Value(Value::V_NOTUSED);
8128 $$->set_location(infile, @$);
8132 BooleanExpression: // 588
8133 Expression { $$ = $1; }
8136 $$ = new Value(Value::V_ERROR);
8137 $$->set_location(infile, @$);
8142 VariableRef AssignmentChar TemplateBody
8144 $$ = new Ttcn::Assignment($1, $3);
8145 $$->set_location(infile, @$);
8149 /* This can not be a single CompoundExpression (as opposed to Expression) */
8150 SingleExpression: // 595
8151 '(' SingleExpression ')' { $$ = $2; }
8152 | '(' error SingleExpression ')' { $$ = $3; }
8155 $$ = new Value(Value::V_ERROR);
8156 $$->set_location(infile, @$);
8158 | '+' Expression %prec UnarySign
8160 $$ = new Value(Value::OPTYPE_UNARYPLUS, $2);
8161 $$->set_location(infile, @$);
8163 | '-' Expression %prec UnarySign
8165 $$ = new Value(Value::OPTYPE_UNARYMINUS, $2);
8166 $$->set_location(infile, @$);
8168 | SingleExpression '*' Expression
8170 $$ = new Value(Value::OPTYPE_MULTIPLY, $1, $3);
8171 $$->set_location(infile, @$);
8173 | SingleExpression '/' Expression
8175 $$ = new Value(Value::OPTYPE_DIVIDE, $1, $3);
8176 $$->set_location(infile, @$);
8178 | SingleExpression ModKeyword Expression
8180 $$ = new Value(Value::OPTYPE_MOD, $1, $3);
8181 $$->set_location(infile, @$);
8183 | SingleExpression RemKeyword Expression
8185 $$ = new Value(Value::OPTYPE_REM, $1, $3);
8186 $$->set_location(infile, @$);
8188 | SingleExpression '+' Expression
8190 $$ = new Value(Value::OPTYPE_ADD, $1, $3);
8191 $$->set_location(infile, @$);
8193 | SingleExpression '-' Expression
8195 $$ = new Value(Value::OPTYPE_SUBTRACT, $1, $3);
8196 $$->set_location(infile, @$);
8198 | SingleExpression '&' Expression
8200 $$ = new Value(Value::OPTYPE_CONCAT, $1, $3);
8201 $$->set_location(infile, @$);
8203 | Not4bKeyword Expression
8205 $$ = new Value(Value::OPTYPE_NOT4B, $2);
8206 $$->set_location(infile, @$);
8208 | SingleExpression And4bKeyword Expression
8210 $$ = new Value(Value::OPTYPE_AND4B, $1, $3);
8211 $$->set_location(infile, @$);
8213 | SingleExpression Xor4bKeyword Expression
8215 $$ = new Value(Value::OPTYPE_XOR4B, $1, $3);
8216 $$->set_location(infile, @$);
8218 | SingleExpression Or4bKeyword Expression
8220 $$ = new Value(Value::OPTYPE_OR4B, $1, $3);
8221 $$->set_location(infile, @$);
8223 | SingleExpression SL Expression
8225 $$ = new Value(Value::OPTYPE_SHL, $1, $3);
8226 $$->set_location(infile, @$);
8228 | SingleExpression SR Expression
8230 $$ = new Value(Value::OPTYPE_SHR, $1, $3);
8231 $$->set_location(infile, @$);
8233 | SingleExpression RL Expression
8235 $$ = new Value(Value::OPTYPE_ROTL, $1, $3);
8236 $$->set_location(infile, @$);
8238 | SingleExpression _RR Expression
8240 $$ = new Value(Value::OPTYPE_ROTR, $1, $3);
8241 $$->set_location(infile, @$);
8243 | SingleExpression '<' Expression
8245 $$ = new Value(Value::OPTYPE_LT, $1, $3);
8246 $$->set_location(infile, @$);
8248 | SingleExpression '>' Expression
8250 $$ = new Value(Value::OPTYPE_GT, $1, $3);
8251 $$->set_location(infile, @$);
8253 | SingleExpression LE Expression
8255 $$ = new Value(Value::OPTYPE_LE, $1, $3);
8256 $$->set_location(infile, @$);
8258 | SingleExpression GE Expression
8260 $$ = new Value(Value::OPTYPE_GE, $1, $3);
8261 $$->set_location(infile, @$);
8263 | SingleExpression EQ Expression
8265 $$ = new Value(Value::OPTYPE_EQ, $1, $3);
8266 $$->set_location(infile, @$);
8268 | SingleExpression NE Expression
8270 $$ = new Value(Value::OPTYPE_NE, $1, $3);
8271 $$->set_location(infile, @$);
8273 | NotKeyword Expression
8275 $$ = new Value(Value::OPTYPE_NOT, $2);
8276 $$->set_location(infile, @$);
8278 | SingleExpression AndKeyword Expression
8280 $$ = new Value(Value::OPTYPE_AND, $1, $3);
8281 $$->set_location(infile, @$);
8283 | SingleExpression XorKeyword Expression
8285 $$ = new Value(Value::OPTYPE_XOR, $1, $3);
8286 $$->set_location(infile, @$);
8288 | SingleExpression OrKeyword Expression
8290 $$ = new Value(Value::OPTYPE_OR, $1, $3);
8291 $$->set_location(infile, @$);
8293 | OpCall { $$ = $1; }
8294 | Value { $$ = $1; }
8297 optExtendedFieldReference:
8298 // perhaps this should be called seqExtendedFieldReference,
8299 // but the convention appears to be that seq... can not be empty
8305 | optExtendedFieldReference FieldOrArrayReference
8307 $$.nElements = $1.nElements + 1;
8308 $$.elements = (FieldOrArrayRef**)
8309 Realloc($1.elements, ($$.nElements) * sizeof(*$$.elements));
8310 $$.elements[$1.nElements] = $2;
8314 FieldOrArrayReference:
8317 $$ = new FieldOrArrayRef($2);
8318 $$->set_location(infile, @$);
8320 | ArrayOrBitRefOrDash { $$ = $1; }
8324 PredefOrIdentifier { $$ = $1; }
8325 | IDentifier /* maybe PredefOrIdentifier here too */ TypeActualParList
8327 Location loc(infile, @$);
8328 loc.error("Reference to a parameterized field of type `anytype' is "
8329 "not currently supported");
8335 ConfigurationOps { $$ = $1; }
8336 | VerdictOps { $$ = $1; }
8337 | TimerOps { $$ = $1; }
8340 if ($1.ref_pard) $$ = new Value(Value::OPTYPE_EXECUTE, $1.ref_pard,
8342 else if($1.derefered_value)
8343 $$ = new Value(Value::OPTYPE_EXECUTE_REFD, $1.derefered_value, $1.ap_list,
8345 else $$ = new Value(Value::V_ERROR);
8346 $$->set_location(infile, @$);
8350 $$ = new Value(Value::V_REFD, $1);
8351 $$->set_location(infile, @$);
8355 $$ = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
8356 $$->set_location(infile, @$);
8358 | TemplateOps { $$ = $1; }
8359 | PredefinedOps { $$ = $1; }
8360 | ReferOp { $$ = $1; }
8363 if ($1.ref_pard) $$ = new Value(Value::OPTYPE_ACTIVATE, $1.ref_pard);
8364 else if($1.derefered_value) $$ = new Value(Value::OPTYPE_ACTIVATE_REFD,
8365 $1.derefered_value, new ParsedActualParameters($1.ap_list));
8366 else $$ = new Value(Value::V_ERROR);
8367 $$->set_location(infile, @$);
8369 | ProfilerRunningOp { $$ = $1; }
8373 PredefinedOpKeyword1 '(' optError Expression optError ')'
8375 $$ = new Value($1, $4);
8376 $$->set_location(infile, @$);
8378 | PredefinedOpKeyword1 '(' error ')'
8380 Value *v1 = new Value(Value::V_ERROR);
8381 v1->set_location(infile, @3);
8382 $$ = new Value($1, v1);
8383 $$->set_location(infile, @$);
8385 | PredefinedOpKeyword2 '(' optError Expression optError ',' optError
8386 Expression optError ')'
8388 $$ = new Value($1, $4, $8);
8389 $$->set_location(infile, @$);
8391 | PredefinedOpKeyword2 '(' error ')'
8393 Value *v1 = new Value(Value::V_ERROR);
8394 v1->set_location(infile, @3);
8395 Value *v2 = new Value(Value::V_ERROR);
8396 v2->set_location(infile, @3);
8397 $$ = new Value($1, v1, v2);
8398 $$->set_location(infile, @$);
8400 | PredefinedOpKeyword3 '(' optError Expression optError ',' optError
8401 Expression optError ')'
8403 $$ = new Value($1, $4, $8);
8404 $$->set_location(infile, @$);
8406 | PredefinedOpKeyword3 '(' optError Expression optError ')'
8408 $$ = new Value($1, $4, (Common::Value*)NULL);
8409 $$->set_location(infile, @$);
8411 | PredefinedOpKeyword3 '(' error ')'
8413 Value *v1 = new Value(Value::V_ERROR);
8414 v1->set_location(infile, @3);
8415 Value *v2 = new Value(Value::V_ERROR);
8416 v2->set_location(infile, @3);
8417 $$ = new Value($1, v1, v2);
8418 $$->set_location(infile, @$);
8420 | decompKeyword '(' optError Expression optError ',' optError
8421 Expression optError ',' optError Expression optError ')'
8423 $$ = new Value(Value::OPTYPE_DECOMP, $4, $8, $12);
8424 $$->set_location(infile, @$);
8426 | decompKeyword '(' error ')'
8428 Value *v1 = new Value(Value::V_ERROR);
8429 v1->set_location(infile, @3);
8430 Value *v2 = new Value(Value::V_ERROR);
8431 v2->set_location(infile, @3);
8432 Value *v3 = new Value(Value::V_ERROR);
8433 v3->set_location(infile, @3);
8434 $$ = new Value(Value::OPTYPE_DECOMP, v1, v2, v3);
8435 $$->set_location(infile, @$);
8437 | regexpKeyword '(' optError TemplateInstance optError ',' optError
8438 TemplateInstance optError ',' optError Expression optError ')'
8440 $$ = new Value(Value::OPTYPE_REGEXP, $4, $8, $12);
8441 $$->set_location(infile, @$);
8443 | regexpKeyword '(' error ')'
8445 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8446 t1->set_location(infile, @3);
8447 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8448 ti1->set_location(infile, @3);
8449 Template *t2 = new Template(Template::TEMPLATE_ERROR);
8450 t2->set_location(infile, @3);
8451 TemplateInstance *ti2 = new TemplateInstance(0, 0, t2);
8452 ti2->set_location(infile, @3);
8453 Value *v3 = new Value(Value::V_ERROR);
8454 v3->set_location(infile, @3);
8455 $$ = new Value(Value::OPTYPE_REGEXP, ti1, ti2, v3);
8456 $$->set_location(infile, @$);
8458 | encvalueKeyword '(' optError TemplateInstance optError ')'
8460 $$ = new Value(Value::OPTYPE_ENCODE, $4);
8461 $$->set_location(infile, @$);
8463 | encvalueKeyword '(' error ')'
8465 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8466 t1->set_location(infile, @3);
8467 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8468 ti1->set_location(infile, @3);
8469 $$ = new Value(Value::OPTYPE_ENCODE, ti1);
8470 $$->set_location(infile, @$);
8472 | substrKeyword '(' optError TemplateInstance optError ',' optError
8473 Expression optError ',' optError Expression optError ')'
8475 $$ = new Value(Value::OPTYPE_SUBSTR, $4, $8, $12);
8476 $$->set_location(infile, @$);
8478 | substrKeyword '(' error ')'
8480 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8481 t1->set_location(infile, @3);
8482 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8483 ti1->set_location(infile, @3);
8484 Value *v2 = new Value(Value::V_ERROR);
8485 v2->set_location(infile, @3);
8486 Value *v3 = new Value(Value::V_ERROR);
8487 v3->set_location(infile, @3);
8488 $$ = new Value(Value::OPTYPE_SUBSTR, ti1, v2, v3);
8489 $$->set_location(infile, @$);
8491 | replaceKeyword '(' optError TemplateInstance optError ',' optError
8492 Expression optError ',' optError Expression optError ',' optError
8493 TemplateInstance optError ')'
8495 $$ = new Value(Value::OPTYPE_REPLACE, $4, $8, $12, $16);
8496 $$->set_location(infile, @$);
8498 | replaceKeyword '(' error ')'
8500 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8501 t1->set_location(infile, @3);
8502 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8503 ti1->set_location(infile, @3);
8504 Value *v2 = new Value(Value::V_ERROR);
8505 v2->set_location(infile, @3);
8506 Value *v3 = new Value(Value::V_ERROR);
8507 v3->set_location(infile, @3);
8508 Template *t4 = new Template(Template::TEMPLATE_ERROR);
8509 t4->set_location(infile, @3);
8510 TemplateInstance *ti4 = new TemplateInstance(0, 0, t4);
8511 ti4->set_location(infile, @3);
8512 $$ = new Value(Value::OPTYPE_REPLACE, ti1, v2, v3, ti4);
8513 $$->set_location(infile, @$);
8515 | decvalueKeyword '(' optError DecValueArg optError ',' optError DecValueArg optError ')'
8517 $$ = new Value(Value::OPTYPE_DECODE, $4, $8);
8518 $$->set_location(infile, @$);
8520 | decvalueKeyword '(' error ')'
8522 /*Value *v1 = new Value(Value::V_ERROR);
8523 v1->set_location(infile, @3);
8524 TemplateInstance *t2 = new TemplateInstance(Type::T_ERROR);*/
8525 $$ = new Value(Value::V_ERROR);
8526 $$->set_location(infile, @$);
8528 | isvalueKeyword '(' optError TemplateInstance optError ')'
8530 $$ = new Value(Value::OPTYPE_ISVALUE, $4);
8531 $$->set_location(infile, @$);
8533 | isvalueKeyword '(' error ')'
8535 $$ = new Value(Value::V_ERROR);
8536 $$->set_location(infile, @$);
8538 | isboundKeyword '(' optError TemplateInstance optError ')'
8540 $$ = new Value(Value::OPTYPE_ISBOUND, $4);
8541 $$->set_location(infile, @$);
8543 | isboundKeyword '(' error ')'
8545 $$ = new Value(Value::V_ERROR);
8546 $$->set_location(infile, @$);
8548 | ischosenKeyword '(' optError IschosenArg optError ')'
8550 $$ = new Value(Value::OPTYPE_ISCHOSEN, $4.ref, $4.id);
8551 $$->set_location(infile, @$);
8553 | ischosenKeyword '(' error ')'
8555 $$ = new Value(Value::V_ERROR);
8556 $$->set_location(infile, @$);
8558 | ispresentKeyword '(' optError TemplateInstance optError ')'
8560 $$ = new Value(Value::OPTYPE_ISPRESENT, $4);
8561 $$->set_location(infile, @$);
8563 | ispresentKeyword '(' error ')'
8565 $$ = new Value(Value::V_ERROR);
8566 $$->set_location(infile, @$);
8568 | lengthofKeyword '(' optError TemplateInstance optError ')'
8570 $$ = new Value(Value::OPTYPE_LENGTHOF, $4);
8571 $$->set_location(infile, @$);
8573 | lengthofKeyword '(' error ')'
8575 $$ = new Value(Value::V_ERROR);
8576 $$->set_location(infile, @$);
8578 | rndKeyword '(' ')'
8580 $$ = new Value(Value::OPTYPE_RND);
8581 $$->set_location(infile, @$);
8583 | rndKeyword '(' optError Expression optError ')'
8585 $$ = new Value(Value::OPTYPE_RNDWITHVAL, $4);
8586 $$->set_location(infile, @$);
8588 | rndKeyword '(' error ')'
8590 Value *v = new Value(Value::V_ERROR);
8591 v->set_location(infile, @3);
8592 $$ = new Value(Value::OPTYPE_RNDWITHVAL, v);
8593 $$->set_location(infile, @$);
8595 | sizeofKeyword '(' optError TemplateInstance optError ')'
8597 $$ = new Value(Value::OPTYPE_SIZEOF, $4);
8598 $$->set_location(infile, @$);
8600 | sizeofKeyword '(' error ')'
8602 $$ = new Value(Value::V_ERROR);
8603 $$->set_location(infile, @$);
8605 | log2strKeyword '(' ')'
8607 $$ = new Value(Value::OPTYPE_LOG2STR, new LogArguments());
8608 $$->set_location(infile, @$);
8610 | log2strKeyword '(' LogItemList optError ')'
8612 $$ = new Value(Value::OPTYPE_LOG2STR, $3);
8613 $$->set_location(infile, @$);
8615 | log2strKeyword '(' error ')'
8617 $$ = new Value(Value::OPTYPE_LOG2STR, new LogArguments());
8618 $$->set_location(infile, @$);
8620 | testcasenameKeyword '(' ')'
8622 $$ = new Value(Value::OPTYPE_TESTCASENAME);
8623 $$->set_location(infile, @$);
8625 | ttcn2stringKeyword '(' optError TemplateInstance optError ')'
8627 $$ = new Value(Value::OPTYPE_TTCN2STRING, $4);
8628 $$->set_location(infile, @$);
8630 | ttcn2stringKeyword '(' error ')'
8632 $$ = new Value(Value::V_ERROR);
8633 $$->set_location(infile, @$);
8640 if ($1.is_ref) $$ = $1.ref;
8642 $$ = new Ttcn::Reference($1.id);
8643 $$->set_location(infile, @$);
8646 | FunctionInstance { $$ = $1; }
8650 IDentifier { $$ = $1; }
8651 | PredefinedType /* shall not be "anytype" */
8653 // Construct an identifier "on the fly" ($1 here is just a typetype_t)
8654 const char* builtin_typename = Type::get_typename_builtin($1);
8655 if (0 == builtin_typename) FATAL_ERROR("Unexpected type %d", $1);
8656 const string& at_field = anytype_field(string(builtin_typename));
8658 $$ = new Identifier(Identifier::ID_TTCN, at_field);
8661 IschosenArg: /* see also Reference... */
8662 IDentifier '.' PredefOrIdentifier
8664 $$.ref = new Ttcn::Reference($1);
8665 $$.ref->set_location(infile, @1);
8668 | IDentifier '.' PredefOrIdentifier optExtendedFieldReference '.' PredefOrIdentifier
8670 $$.ref = new Ttcn::Reference($1);
8671 FieldOrArrayRef *fieldref = new FieldOrArrayRef($3);
8672 fieldref->set_location(infile, @3);
8673 $$.ref->add(fieldref);
8674 for(size_t i=0; i<$4.nElements; i++) $$.ref->add($4.elements[i]);
8676 $$.ref->set_location(infile, @1, @4);
8679 | IDentifier ArrayOrBitRef optExtendedFieldReference '.' PredefOrIdentifier
8681 $$.ref = new Ttcn::Reference($1);
8683 for(size_t i=0; i<$3.nElements; i++) $$.ref->add($3.elements[i]);
8685 $$.ref->set_location(infile, @1, @3);
8688 | IDentifier '.' ObjectIdentifierValue '.' IDentifier optExtendedFieldReference
8689 '.' PredefOrIdentifier
8691 $$.ref = new Ttcn::Reference($1, $5);
8693 for(size_t i=0; i<$6.nElements; i++) $$.ref->add($6.elements[i]);
8695 $$.ref->set_location(infile, @1, @6);
8700 PredefinedOpKeyword1:
8701 bit2hexKeyword { $$ = Value::OPTYPE_BIT2HEX; }
8702 | bit2intKeyword { $$ = Value::OPTYPE_BIT2INT; }
8703 | bit2octKeyword { $$ = Value::OPTYPE_BIT2OCT; }
8704 | bit2strKeyword { $$ = Value::OPTYPE_BIT2STR; }
8705 | char2intKeyword { $$ = Value::OPTYPE_CHAR2INT; }
8706 | char2octKeyword { $$ = Value::OPTYPE_CHAR2OCT; }
8707 | float2intKeyword { $$ = Value::OPTYPE_FLOAT2INT; }
8708 | float2strKeyword { $$ = Value::OPTYPE_FLOAT2STR; }
8709 | hex2bitKeyword { $$ = Value::OPTYPE_HEX2BIT; }
8710 | hex2intKeyword { $$ = Value::OPTYPE_HEX2INT; }
8711 | hex2octKeyword { $$ = Value::OPTYPE_HEX2OCT; }
8712 | hex2strKeyword { $$ = Value::OPTYPE_HEX2STR; }
8713 | int2charKeyword { $$ = Value::OPTYPE_INT2CHAR; }
8714 | int2floatKeyword { $$ = Value::OPTYPE_INT2FLOAT; }
8715 | int2strKeyword { $$ = Value::OPTYPE_INT2STR; }
8716 | int2unicharKeyword { $$ = Value::OPTYPE_INT2UNICHAR; }
8717 | oct2bitKeyword { $$ = Value::OPTYPE_OCT2BIT; }
8718 | oct2charKeyword { $$ = Value::OPTYPE_OCT2CHAR; }
8719 | oct2hexKeyword { $$ = Value::OPTYPE_OCT2HEX; }
8720 | oct2intKeyword { $$ = Value::OPTYPE_OCT2INT; }
8721 | oct2strKeyword { $$ = Value::OPTYPE_OCT2STR; }
8722 | str2bitKeyword { $$ = Value::OPTYPE_STR2BIT; }
8723 | str2floatKeyword { $$ = Value::OPTYPE_STR2FLOAT; }
8724 | str2hexKeyword { $$ = Value::OPTYPE_STR2HEX; }
8725 | str2intKeyword { $$ = Value::OPTYPE_STR2INT; }
8726 | str2octKeyword { $$ = Value::OPTYPE_STR2OCT; }
8727 | unichar2intKeyword { $$ = Value::OPTYPE_UNICHAR2INT; }
8728 | unichar2charKeyword { $$ = Value::OPTYPE_UNICHAR2CHAR; }
8729 | enum2intKeyword { $$ = Value::OPTYPE_ENUM2INT; }
8730 | remove_bomKeyWord { $$ = Value::OPTYPE_REMOVE_BOM; }
8731 | get_stringencodingKeyWord { $$ = Value::OPTYPE_GET_STRINGENCODING; }
8732 | decode_base64KeyWord { $$ = Value::OPTYPE_DECODE_BASE64; }
8735 PredefinedOpKeyword2:
8736 int2bitKeyword { $$ = Value::OPTYPE_INT2BIT; }
8737 | int2hexKeyword { $$ = Value::OPTYPE_INT2HEX; }
8738 | int2octKeyword { $$ = Value::OPTYPE_INT2OCT; }
8741 PredefinedOpKeyword3:
8742 unichar2octKeyword { $$ = Value::OPTYPE_UNICHAR2OCT; }
8743 | oct2unicharKeyword { $$ = Value::OPTYPE_OCT2UNICHAR; }
8744 | encode_base64KeyWord { $$ = Value::OPTYPE_ENCODE_BASE64; }
8747 String2TtcnStatement:
8748 string2ttcnKeyword '(' optError Expression optError ',' optError Reference optError ')'
8750 Ttcn::Reference* out_ref;
8751 if ($8.is_ref) out_ref = $8.ref;
8753 out_ref = new Ttcn::Reference($8.id);
8754 out_ref->set_location(infile, @8);
8756 $$ = new Statement(Statement::S_STRING2TTCN, $4, out_ref);
8757 $$->set_location(infile, @$);
8761 LogStatement: // 619
8764 $$=new Statement(Statement::S_LOG, (LogArguments*)0);
8765 $$->set_location(infile, @$);
8767 | LogKeyword '(' LogItemList optError ')'
8769 $$=new Statement(Statement::S_LOG, $3);
8770 $$->set_location(infile, @$);
8772 | LogKeyword '(' error ')'
8774 $$=new Statement(Statement::S_LOG, new LogArguments());
8775 $$->set_location(infile, @$);
8782 $$ = new LogArguments();
8785 | LogItemList optError ',' optError LogItem
8790 | LogItemList optError ',' error { $$ = $1; }
8796 $$ = new LogArgument($1);
8797 $$->set_location(infile, @$);
8801 LoopConstruct: // 622
8802 ForStatement { $$ = $1; }
8803 | WhileStatement { $$ = $1; }
8804 | DoWhileStatement { $$ = $1; }
8807 ForStatement: // 623
8808 ForKeyword '(' Initial ';' Final ';' Step optError ')'
8811 $$ = new Statement(Statement::S_FOR, $3.defs, $3.ass, $5, $7, $10);
8812 $$->set_location(infile, @$);
8819 $$.defs = new Definitions;
8820 for (size_t i = 0; i < $1.nElements; i++) $$.defs->add_ass($1.elements[i]);
8831 $$.defs = new Definitions;
8837 BooleanExpression { $$ = $1; }
8841 Assignment { $$ = $1; }
8842 /** \todo for-ban nem lehet null a step
8843 | error { $$=NULL; }
8847 WhileStatement: // 628
8848 WhileKeyword '(' BooleanExpression ')' StatementBlock
8850 $$=new Statement(Statement::S_WHILE, $3, $5);
8851 $$->set_location(infile, @$);
8855 DoWhileStatement: // 630
8856 DoKeyword StatementBlock
8857 WhileKeyword '(' BooleanExpression ')'
8859 $$=new Statement(Statement::S_DOWHILE, $5, $2);
8860 $$->set_location(infile, @$);
8864 ConditionalConstruct: // 632
8865 IfKeyword '(' BooleanExpression ')'
8867 seqElseIfClause optElseClause
8869 IfClause *ic=new IfClause($3, $5);
8870 ic->set_location(infile, @1, @5);
8871 $6->add_front_ic(ic);
8872 $$=new Statement(Statement::S_IF, $6, $7,
8873 $7 ? new Location(infile, @7) : 0);
8874 $$->set_location(infile, @$);
8879 /* empty */ { $$=new IfClauses(); }
8880 | seqElseIfClause ElseIfClause
8887 ElseIfClause: // 634
8888 ElseKeyword IfKeyword '(' BooleanExpression ')' StatementBlock
8890 $$=new IfClause($4, $6);
8891 $$->set_location(infile, @$);
8895 optElseClause: // [636]
8896 /* empty */ { $$=0; }
8897 | ElseKeyword StatementBlock { $$=$2; }
8900 SelectCaseConstruct: // 637
8901 SelectKeyword '(' Expression optError ')' SelectCaseBody
8903 $$=new Statement(Statement::S_SELECT, $3, $6);
8904 $$->set_location(infile, @$);
8906 | SelectKeyword '(' error ')' SelectCaseBody
8908 Value *v = new Value(Value::V_ERROR);
8909 v->set_location(infile, @3);
8910 $$=new Statement(Statement::S_SELECT, v, $5);
8911 $$->set_location(infile, @$);
8915 SelectCaseBody: // 639
8916 '{' seqSelectCase optError '}' {$$=$2;}
8917 | '{' error '}' {$$=new SelectCases;}
8926 | seqSelectCase optError SelectCase
8934 CaseKeyword '(' seqTemplateInstance optError ')' StatementBlock optSemiColon
8936 $3->set_location(infile, @2, @5);
8937 $$=new SelectCase($3, $6);
8938 $$->set_location(infile, @$);
8940 | CaseKeyword '(' error ')' StatementBlock optSemiColon
8942 TemplateInstances *tis = new TemplateInstances;
8943 tis->set_location(infile, @2, @4);
8944 $$ = new SelectCase(tis, $5);
8945 $$->set_location(infile, @$);
8947 | CaseKeyword ElseKeyword StatementBlock optSemiColon
8949 $$=new SelectCase(0, $3);
8950 $$->set_location(infile, @$);
8954 seqTemplateInstance:
8955 optError TemplateInstance
8957 $$ = new TemplateInstances;
8960 | seqTemplateInstance optError ',' optError TemplateInstance
8965 | seqTemplateInstance optError ',' error { $$ = $1; }
8968 /* A.1.6.9 Miscellaneous productions */
8970 optSemiColon: // [645]
8975 /* A.1 ASN.1 support, from ES 201 873-7 V3.1.1 (2005-06) */
8977 optDefinitiveIdentifier:
8979 | DefinitiveIdentifier
8982 DefinitiveIdentifier:
8983 '.' ObjectIdentifierKeyword '{' DefinitiveObjIdComponentList optError '}'
8984 | '.' ObjectIdentifierKeyword '{' error '}'
8987 DefinitiveObjIdComponentList:
8988 optError DefinitiveObjIdComponent
8989 | DefinitiveObjIdComponentList optError DefinitiveObjIdComponent
8992 DefinitiveObjIdComponent:
8994 | DefinitiveNumberForm
8995 | DefinitiveNameAndNumberForm
8998 DefinitiveNumberForm:
8999 Number { delete $1; }
9002 DefinitiveNameAndNumberForm:
9003 IDentifier '(' Number optError ')' { delete $1; delete $3; }
9004 | IDentifier '(' error ')' { delete $1; }
9007 ObjectIdentifierValue:
9008 ObjectIdentifierKeyword '{' ObjIdComponentList optError '}'
9011 $$->set_location(infile, @$);
9013 | ObjectIdentifierKeyword '{' error '}'
9015 $$ = new Value(Value::V_ERROR);
9016 $$->set_location(infile, @$);
9021 optError ObjIdComponent
9023 $$ = new Value(Value::V_OID);
9024 $$->add_oid_comp($2);
9026 | ObjIdComponentList optError ObjIdComponent
9029 $$->add_oid_comp($3);
9034 /* NameForm -- covered by NumberForm (as ReferencedValue) */
9035 NumberForm { $$ = $1; }
9036 | NameAndNumberForm { $$ = $1; }
9042 Value *v = new Value(Value::V_INT, $1);
9043 v->set_location(infile, @1);
9044 $$ = new OID_comp(0, v);
9045 $$->set_location(infile, @$);
9050 /* it can be only a referenced value */
9051 Value *v = new Value(Value::V_REFD, $1.ref);
9052 v->set_location(infile, @1);
9053 $$ = new OID_comp(v);
9055 /* it can be either a name form or a referenced value */
9056 $$ = new OID_comp($1.id, 0);
9058 $$->set_location(infile, @$);
9063 IDentifier '(' Number optError ')'
9065 Value *v = new Value(Value::V_INT, $3);
9066 v->set_location(infile, @3);
9067 $$ = new OID_comp($1, v);
9068 $$->set_location(infile, @$);
9070 | IDentifier '(' ReferencedValue optError ')'
9072 $$ = new OID_comp($1, $3);
9073 $$->set_location(infile, @$);
9075 | IDentifier '(' error ')'
9077 Value *v = new Value(Value::V_ERROR);
9078 v->set_location(infile, @3);
9079 $$ = new OID_comp($1, v);
9080 $$->set_location(infile, @$);
9085 IDentifier { delete $1; }
9088 /* Rules for error recovery */
9097 | optErrorBlock ErrorBlock optError
9102 | '{' optError ErrorBlock optError '}'
9107 static void ttcn3_error(const char *str)
9109 Location loc(infile, ttcn3_lloc);
9111 // the most recently parsed token is known
9112 loc.error("at or before token `%s': %s", ttcn3_text, str);
9114 // the most recently parsed token is unknown
9115 loc.error("%s", str);
9119 int ttcn3_parse_file(const char* filename, boolean generate_code)
9121 anytype_access = false;
9122 ttcn3_in = fopen(filename, "r");
9123 if (ttcn3_in == NULL) {
9124 ERROR("Cannot open input file `%s': %s", filename, strerror(errno));
9130 is_erroneous_parsed = false;
9131 NOTIFY("Parsing TTCN-3 module `%s'...", filename);
9133 int retval = ttcn3_parse();
9135 free_ttcn3_lex(); // does fclose(ttcn3_in);
9137 if (act_ttcn3_module) {
9138 act_ttcn3_module->set_location(filename);
9139 set_md5_checksum(act_ttcn3_module);
9140 if (generate_code) act_ttcn3_module->set_gen_code();
9141 modules->add_mod(act_ttcn3_module);
9142 act_ttcn3_module = 0;
9150 Ttcn::ErroneousAttributeSpec* ttcn3_parse_erroneous_attr_spec_string(
9151 const char* p_str, const Common::Location& str_loc)
9153 is_erroneous_parsed = true;
9154 act_ttcn3_erroneous_attr_spec = NULL;
9155 string titan_err_str("$#&&&(#TITANERRONEOUS$#&&^#% ");
9156 int hack_str_len = (int)titan_err_str.size();
9157 string *parsed_string = parse_charstring_value(p_str, str_loc);
9158 titan_err_str += *parsed_string;
9159 delete parsed_string;
9160 init_erroneous_lex(str_loc.get_filename(), str_loc.get_first_line(), str_loc.get_first_column()-hack_str_len+1);
9161 yy_buffer_state *flex_buffer = ttcn3__scan_string(titan_err_str.c_str());
9162 if (flex_buffer == NULL) {
9163 ERROR("Flex buffer creation failed.");
9167 ttcn3_lex_destroy();
9168 free_dot_flag_stuff();
9170 return act_ttcn3_erroneous_attr_spec;
9174 static void yyprint(FILE *file, int type, const YYSTYPE& value)
9178 fprintf(file, "``%s''", value.id->get_name().c_str());
9181 fprintf(file, "%s", value.int_val->t_str().c_str());
9184 fprintf(file, "%f", value.float_val);
9189 case BitStringMatch:
9190 case HexStringMatch:
9191 case OctetStringMatch:
9192 fprintf(file, "``%s''", value.string_val->c_str());
9195 fprintf(file, "``%s''", value.str);