1 /******************************************************************************
2 * Copyright (c) 2000-2016 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
25 * Szabo, Janos Zoltan – initial implementation
28 * Zalanyi, Balazs Andor
30 ******************************************************************************/
31 /* Syntax check parser and compiler for TTCN-3 */
33 /* BNF compliance: v3.2.1 with extensions */
44 #include "../../common/dbgnew.hh"
45 #include "../../common/memory.h"
47 #include "../datatypes.h"
48 #include "Attributes.hh"
52 #include "../Identifier.hh"
53 #include "Templatestuff.hh"
54 #include "AST_ttcn3.hh"
56 #include "../CompType.hh"
57 #include "../CompField.hh"
58 #include "../EnumItem.hh"
59 #include "../SigParam.hh"
61 #include "../subtype.hh"
62 #include "../Value.hh"
63 #include "../Valuestuff.hh"
64 #include "../ustring.hh"
65 #include "Ttcnstuff.hh"
66 #include "TtcnTemplate.hh"
67 #include "Templatestuff.hh"
68 #include "ArrayDimensions.hh"
69 #include "PatternString.hh"
70 #include "Statement.hh"
73 using namespace Common;
75 const char *infile = NULL;
77 static Ttcn::Module *act_ttcn3_module = NULL;
78 static Ttcn::ErroneousAttributeSpec *act_ttcn3_erroneous_attr_spec = NULL;
79 bool is_erroneous_parsed = false;
80 static void ttcn3_error(const char *str);
81 static Group* act_group = NULL;
82 extern string anytype_field(const string& type_name);
83 static bool anytype_access = false;
88 static void yyprint(FILE *file, int type, const YYSTYPE& value);
89 #define YYPRINT(f,t,v) yyprint(f,t,v)
93 extern Modules *modules;
95 extern FILE *ttcn3_in;
96 extern char *ttcn3_text;
97 extern int ttcn3_lex();
98 extern void init_ttcn3_lex();
99 extern void free_ttcn3_lex();
100 extern void set_md5_checksum(Ttcn::Module *m);
102 extern void init_erroneous_lex(const char* p_infile, int p_line, int p_column);
103 struct yy_buffer_state;
104 extern int ttcn3_lex_destroy(void);
105 extern yy_buffer_state *ttcn3__scan_string(const char *yy_str);
106 extern void free_dot_flag_stuff();
108 extern string *parse_charstring_value(const char *str, const Location& loc);
109 extern PatternString* parse_pattern(const char *str, const Location& loc);
111 static const string anyname("anytype");
113 /* Various C macros */
115 #define YYERROR_VERBOSE
120 /* Bison declarations */
122 /*********************************************************************
124 *********************************************************************/
127 /* NOTE: the union is written to compiler.tab.hh, which is #included
128 * into compiler.l; therefore all types used here must be declared
129 * in compiler.l (forward declared or #included) */
130 bool bool_val; /* boolean value */
131 char *str; /* simple string value */
132 unsigned char uchar_val;
134 int_val_t *int_val; /* integer value */
135 Real float_val; /* float value */
138 ustring *ustring_val;
140 Type::typetype_t typetype;
141 PortTypeBody::PortOperationMode_t portoperationmode;
142 Value::operationtype_t operationtype;
143 Value::macrotype_t macrotype;
144 SingleWithAttrib::attribtype_t attribtype;
145 ImpMod::imptype_t imptype;
148 AltGuards *altguards;
149 ArrayDimension *arraydimension;
150 AttributeSpec *attributespec;
151 CompField *compfield;
152 CompFieldMap *compfieldmap;
155 Definition *definition;
158 EnumItems *enumitems;
159 FieldOrArrayRef *fieldorarrayref;
160 FormalPar *formalpar;
161 FormalParList *formalparlist;
163 FriendMod *friendMod;
165 IfClauses *ifclauses;
167 LengthRestriction *lenrestr;
169 LogArguments *logargs;
170 NamedTemplate *namedtempl;
171 NamedTemplates *namedtempls;
172 NamedValue *namedvalue;
173 NamedValues *namedvalues;
174 IndexedTemplate *indexedtempl;
175 IndexedTemplates *indexedtempls;
176 IndexedValue *indexedvalue;
177 MultiWithAttrib *multiwithattrib;
179 ParamAssignment *parass;
180 ParamAssignments *parasss;
181 ParamRedirect *parredir;
182 ParsedActualParameters *parsedpar;
183 PatternString *patstr;
184 Qualifier *qualifier;
185 Qualifiers *qualifiers;
186 SelectCase *selectcase;
187 SelectCases *selectcases;
188 SignatureExceptions *signexc;
189 SignatureParam *signparam;
190 SignatureParamList *signparamlist;
191 SingleWithAttrib *singlewithattrib;
193 StatementBlock *statementblock;
194 SubTypeParse *subtypeparse;
196 TemplateInstance *templinst;
197 TemplateInstances *templinsts;
199 Ttcn::Assignment *ass;
200 Ttcn::Ref_base *refbase;
201 Ttcn::Ref_pard *refpard;
202 Ttcn::Reference *reference;
203 ValueRange *valuerange;
208 VariableEntries *variableentries;
209 VariableEntry *variableentry;
210 vector<SubTypeParse> *subtypeparses;
211 CompTypeRefList *comprefs;
212 ComponentTypeBody *compbody;
213 template_restriction_t template_restriction;
217 ErroneousAttributeSpec::indicator_t indicator;
218 } erroneous_indicator;
220 struct arraydimension_list_t {
222 ArrayDimension **elements;
223 } arraydimension_list;
227 FieldOrArrayRef **elements;
228 } fieldorarrayref_list;
232 Ttcn::Definition **elements;
237 Ttcn::FriendMod **elements;
242 Statement **elements;
247 const char **elements;
252 bool lower_exclusive;
254 bool upper_exclusive;
259 bool returns_template;
260 template_restriction_t template_restriction;
266 } returntypeornoblock;
279 Ttcn::Types *in_list, *out_list, *inout_list;
280 bool in_all, out_all, inout_all;
284 Ttcn::Reference *ref;
290 LengthRestriction *len_restr;
291 } extramatchingattrs;
296 FormalParList *fp_list;
305 Ttcn::Ref_pard *ref_pard;
306 Value *derefered_value;
307 ParsedActualParameters *ap_list;
312 Ttcn::Ref_pard *ref_pard;
313 Value *derefered_value;
314 TemplateInstances *ap_list;
318 TemplateInstance *templ_inst;
323 Value *calltimerval; // if NULL: see nowait
328 TemplateInstance *templ_inst;
329 Value *calltimerval; // if NULL: see nowait
331 Value *val; // not used in callparams
335 TemplateInstance *templ_inst;
341 Ttcn::Reference *signature;
342 TemplateInstance *templ_inst;
347 Ttcn::Reference *redirectval;
348 Ttcn::Reference *redirectsender;
352 ParamRedirect *redirectparam;
353 Ttcn::Reference *redirectsender;
354 } portredirectwithparam;
357 Ttcn::Reference *redirectval;
358 ParamRedirect *redirectparam;
359 Ttcn::Reference *redirectsender;
360 } portredirectwithvalueandparam;
363 TemplateInstance *templ_inst;
364 TemplateInstance *valuematch;
368 TemplateInstance *templ_inst;
369 TemplateInstance *fromclause;
370 Ttcn::Reference *redirectval;
371 Ttcn::Reference *redirectsender;
375 TemplateInstance *templ_inst;
376 TemplateInstance *fromclause;
377 ParamRedirect *redirectparam;
378 Ttcn::Reference *redirectsender;
382 TemplateInstance *templ_inst;
383 TemplateInstance *valuematch;
384 TemplateInstance *fromclause;
385 Ttcn::Reference *redirectval;
386 ParamRedirect *redirectparam;
387 Ttcn::Reference *redirectsender;
391 Ttcn::Reference *signature;
392 TemplateInstance *templ_inst;
397 Ttcn::Reference *signature;
398 TemplateInstance *templ_inst;
400 TemplateInstance *fromclause;
401 Ttcn::Reference *redirectval;
402 Ttcn::Reference *redirectsender;
406 Statement::statementtype_t statementtype;
407 Ttcn::Reference *signature;
408 TemplateInstance *templ_inst;
409 TemplateInstance *valuematch;
411 TemplateInstance *fromclause;
412 Ttcn::Reference *redirectval;
413 ParamRedirect *redirectparam;
414 Ttcn::Reference *redirectsender;
419 Ttcn::Reference *portref;
424 Ttcn::Reference *portref1;
426 Ttcn::Reference *portref2;
430 TemplateInstance *donematch;
431 Ttcn::Reference *redirect;
437 Ttcn::Reference *ref;
444 Ttcn::Assignment *ass;
448 Ttcn::Reference *runsonref;
449 Ttcn::Reference *systemref;
459 ParsedActualParameters *ap_list;
463 struct extconstidentifier_t {
466 } extconstidentifier;
470 extconstidentifier_t *elements;
473 struct singlevarinst_t {
475 arraydimension_list_t arrays;
476 Value *initial_value;
480 struct singlevarinst_list_t {
482 struct singlevarinst_t *elements;
483 } singlevarinst_list;
485 struct singletempvarinst_t {
487 arraydimension_list_t arrays;
488 Template *initial_value;
492 struct singletempvarinst_list_t {
494 singletempvarinst_t *elements;
495 } singletempvarinst_list;
497 struct singlemodulepar_t {
503 struct singletemplatemodulepar_t {
507 } singletemplatemodulepar;
509 struct singlemodulepar_list_t {
511 singlemodulepar_t *elements;
512 } singlemodulepar_list;
514 struct singletemplatemodulepar_list_t {
516 singletemplatemodulepar_t *elements;
517 } singletemplatemodulepar_list;
519 struct portelement_t {
521 ArrayDimensions *dims;
525 struct portelement_list_t {
527 portelement_t *elements;
530 struct runs_on_compref_or_self_t {
532 Ttcn::Reference *reference;
533 } runs_on_compref_or_self;
536 visibility_t visibility;
540 /* Tokens of TTCN-3 */
542 /*********************************************************************
543 * Tokens with semantic value
544 *********************************************************************/
546 /* Terminals with semantic value */
548 %token <int_val> Number
549 %token <float_val> FloatValue
550 %token <id> IDentifier "Identifier"
552 %token <string_val> Bstring
559 %token NullValue "ASN.1_NULL_value"
560 %token <macrotype> MacroValue
562 /*********************************************************************
563 * Tokens without semantic value
564 *********************************************************************/
566 /* Terminals without semantic value - keywords, operators, etc. */
568 %token TOK_errval "erroneous_value"
570 /* A number of terminals (including ApplyKeyword, CallOpKeyword, etc)
571 * are listed as unused by Bison. They do not appear in any rule,
572 * because the lexer does some magic to combine them with the preceding dot
573 * and returns a (DotApplyKeyword, DotCallOpKeyword, etc) instead.
574 * This magic requires the presence of the unused keywords.
575 * (It can return an ApplyKeyword if not preceded by a dot) */
576 %token TitanErroneousHackKeyword
578 %token ActivateKeyword
579 %token AddressKeyword
583 %token AltstepKeyword
587 %token AnyTypeKeyword
589 %token BitStringKeyword
590 %token BooleanKeyword
594 %token CatchOpKeyword
596 %token CharStringKeyword
597 %token CheckOpKeyword
598 %token ClearOpKeyword
599 %token ComplementKeyword
600 %token ComponentKeyword
601 %token ConnectKeyword
603 %token ContinueKeyword
604 %token ControlKeyword
606 %token DeactivateKeyword
607 %token DefaultKeyword
608 %token DerefersKeyword
609 %token DisconnectKeyword
610 %token DisplayKeyword
618 %token ExceptionKeyword
619 %token ExecuteKeyword
620 %token ExtendsKeyword
621 %token ExtensionKeyword
629 %token FunctionKeyword
630 %token GetCallOpKeyword
631 %token GetReplyOpKeyword
632 %token GetVerdictKeyword
636 %token HexStringKeyword
638 %token IfPresentKeyword
641 %token InfinityKeyword
642 %token InOutParKeyword
644 %token IntegerKeyword
645 %token InterleavedKeyword
649 %token LanguageKeyword
654 %token MessageKeyword
657 %token ModifiesKeyword
658 %token ModuleParKeyword
661 %token NoBlockKeyword
667 %token ObjectIdentifierKeyword
668 %token OctetStringKeyword
672 %token OptionalKeyword
676 %token OverrideKeyword
679 %token PatternKeyword
680 %token PermutationKeyword
681 %token PresentKeyword
683 %token PrivateKeyword
684 %token ProcedureKeyword
688 %token ReceiveOpKeyword
690 %token RecursiveKeyword
696 %token RunningKeyword
703 %token SetVerdictKeyword
704 %token SignatureKeyword
708 %token SupersetKeyword
710 %token TemplateKeyword
711 %token TestcaseKeyword
712 %token TimeoutKeyword
715 %token TriggerOpKeyword
717 %token TTCN3ModuleKeyword
718 %token TypeDefKeyword
720 %token UniversalKeyword
723 %token ValueofKeyword
725 %token VariantKeyword
726 %token VerdictTypeKeyword
732 /* modifier keywords */
736 /* TITAN specific keywords */
737 %token TitanSpecificTryKeyword
738 %token TitanSpecificCatchKeyword
739 %token TitanSpecificProfilerKeyword
741 /* Keywords combined with a leading dot */
743 /* If a '.' (dot) character is followed by one of the keywords below the
744 * lexical analyzer shall return one combined token instead of two distinct
745 * tokens. This eliminates the ambiguity that causes additional shift/reduce
746 * conflicts because the dot can be either the part of a field reference or a
747 * built-in operation denoted by a keyword. */
749 %token DotAliveKeyword
750 %token DotApplyKeyword
751 %token DotCallOpKeyword
752 %token DotCatchOpKeyword
753 %token DotCheckOpKeyword
754 %token DotClearOpKeyword
755 %token DotCreateKeyword
756 %token DotDoneKeyword
757 %token DotGetCallOpKeyword
758 %token DotGetReplyOpKeyword
759 %token DotHaltKeyword
760 %token DotKillKeyword
761 %token DotKilledKeyword
762 %token DotRaiseKeyword
763 %token DotReadKeyword
764 %token DotReceiveOpKeyword
765 %token DotReplyKeyword
766 %token DotRunningKeyword
767 %token DotSendOpKeyword
768 %token DotStartKeyword
769 %token DotStopKeyword
770 %token DotTimeoutKeyword
771 %token DotTriggerOpKeyword
773 /* Predefined function identifiers */
775 %token bit2hexKeyword
776 %token bit2intKeyword
777 %token bit2octKeyword
778 %token bit2strKeyword
779 %token char2intKeyword
780 %token char2octKeyword
782 %token float2intKeyword
783 %token hex2bitKeyword
784 %token hex2intKeyword
785 %token hex2octKeyword
786 %token hex2strKeyword
787 %token int2bitKeyword
788 %token int2charKeyword
789 %token int2enumKeyword
790 %token int2floatKeyword
791 %token int2hexKeyword
792 %token int2octKeyword
793 %token int2strKeyword
794 %token int2unicharKeyword
795 %token isvalueKeyword
796 %token isboundKeyword
797 %token ischosenKeyword
798 %token ispresentKeyword
799 %token lengthofKeyword
800 %token oct2bitKeyword
801 %token oct2charKeyword
802 %token oct2hexKeyword
803 %token oct2intKeyword
804 %token oct2strKeyword
805 %token oct2unicharKeyword
807 %token replaceKeyword
809 %token testcasenameKeyword
811 %token str2floatKeyword
812 %token str2intKeyword
813 %token str2octKeyword
815 %token unichar2intKeyword
816 %token unichar2charKeyword
817 %token unichar2octKeyword
819 %token float2strKeyword
820 %token str2bitKeyword
821 %token str2hexKeyword
823 %token log2strKeyword
824 %token enum2intKeyword
826 %token encvalueKeyword
827 %token decvalueKeyword
829 %token ttcn2stringKeyword
830 %token string2ttcnKeyword
831 %token remove_bomKeyWord
832 %token get_stringencodingKeyWord
833 %token encode_base64KeyWord
834 %token decode_base64KeyWord
835 %token encvalue_unicharKeyWord
836 %token decvalue_unicharKeyWord
837 %token any2unistrKeyWord
839 /* Multi-character operators */
841 %token AssignmentChar ":="
843 %token PortRedirectSymbol "->"
851 %token _RR "@>" /* Name clash with bn.h:292 */
853 /*********************************************************************
854 * Semantic types of nonterminals
855 *********************************************************************/
857 %type <bool_val> optAliveKeyword optOptionalKeyword optOverrideKeyword
858 optErrValueRaw optAllKeyword optLazyEval
859 %type <str> FreeText optLanguageSpec PatternChunk PatternChunkList
860 %type <uchar_val> Group Plane Row Cell
861 %type <id> FieldIdentifier FieldReference GlobalModuleId
862 IdentifierOrAddressKeyword StructFieldRef PredefOrIdentifier
863 %type <string_val> CstringList
864 %type <ustring_val> Quadruple
865 %type <uid_list> USI UIDlike
867 %type <typetype> PredefinedType
868 %type <portoperationmode> PortOperationMode
869 %type <operationtype> PredefinedOpKeyword1 PredefinedOpKeyword2 PredefinedOpKeyword3
871 %type <activateop> ActivateOp
872 %type <attribtype> AttribKeyword
874 %type <altguard> CallBodyStatement AltGuard ElseStatement GuardStatement
875 InterleavedGuardElement
876 %type <altguards> AltGuardList CallBodyStatementList InterleavedGuardList
878 %type <arraydimension> ArrayIndex
879 %type <attributespec> AttribSpec
880 %type <compbody> optComponentDefList ComponentElementDefList
881 %type <compfield> StructFieldDef UnionFieldDef
882 %type <compfieldmap> StructFieldDefList optStructFieldDefList UnionFieldDefList
883 %type <definition> AltstepDef ExtFunctionDef FunctionDef TemplateDef TestcaseDef
884 %type <deftype> TypeDefBody StructuredTypeDef SubTypeDef RecordDef UnionDef
885 SetDef RecordOfDef SetOfDef EnumDef PortDef PortDefBody ComponentDef
886 TypeDef SignatureDef FunctionTypeDef AltstepTypeDef TestcaseTypeDef
887 %type <deftimer> SingleTimerInstance
888 %type <enumitem> Enumeration
889 %type <enumitems> EnumerationList
890 %type <fieldorarrayref> ArrayOrBitRef ArrayOrBitRefOrDash FieldOrArrayReference
891 %type <formalpar> FormalValuePar FormalTemplatePar FormalTimerPar
892 TemplateFormalPar FunctionFormalPar TestcaseFormalPar
893 %type <formalparlist> optTemplateFormalParList TemplateFormalParList
894 optFunctionFormalParList FunctionFormalParList optTestcaseFormalParList
895 TestcaseFormalParList optAltstepFormalParList
896 %type <group> GroupDef GroupIdentifier
897 %type <friend_list> FriendModuleDef
898 %type <ifclause> ElseIfClause
899 %type <ifclauses> seqElseIfClause
900 %type <impmod> ImportFromSpec ModuleId ImportDef
901 %type <lenrestr> optStringLength LengthMatch StringLength
902 %type <logarg> LogItem
903 %type <logargs> LogItemList
904 %type <multiwithattrib> MultiWithAttrib WithAttribList WithStatement
905 optWithStatement optWithStatementAndSemiColon
906 %type <namedtempl> FieldSpec
907 %type <namedtempls> seqFieldSpec
908 %type <namedvalue> FieldExpressionSpec
909 %type <namedvalues> seqFieldExpressionSpec
910 %type <indexedtempl> ArraySpec
911 %type <indexedtempls> seqArraySpec
912 %type <indexedvalue> ArrayExpressionSpec
913 %type <oidcomp> NumberForm NameAndNumberForm ObjIdComponent
914 %type <parass> VariableAssignment
915 %type <parasss> AssignmentList
916 %type <parredir> ParamAssignmentList ParamSpec
917 %type <patstr> CharStringMatch
918 %type <qualifier> DefOrFieldRef FullGroupIdentifier
919 %type <qualifiers> DefOrFieldRefList optAttribQualifier
920 %type <selectcase> SelectCase
921 %type <selectcases> seqSelectCase SelectCaseBody
922 %type <signexc> ExceptionTypeList optExceptionSpec
923 %type <signparam> SignatureFormalPar
924 %type <signparamlist> SignatureFormalParList optSignatureFormalParList
925 %type <singlewithattrib> SingleWithAttrib
926 %type <stmt> AltConstruct BasicStatements BreakStatement BehaviourStatements
927 CallBodyOps CallStatement CatchStatement CheckStatement ClearStatement
928 CommunicationStatements ConditionalConstruct ConfigurationStatements
929 ConnectStatement ContinueStatement ControlStatement DeactivateStatement
930 DisconnectStatement DoWhileStatement DoneStatement ForStatement
931 FunctionStatement GetCallStatement GetReplyStatement GotoStatement GuardOp
932 HaltStatement InterleavedConstruct KillTCStatement KilledStatement
933 LabelStatement LogStatement LoopConstruct MapStatement RaiseStatement
934 ReceiveStatement RepeatStatement ReplyStatement ReturnStatement SUTStatements
935 SendStatement SetLocalVerdict StartStatement StartTCStatement
936 StartTimerStatement StopExecutionStatement StopStatement StopTCStatement
937 StopTimerStatement TimeoutStatement TimerStatements TriggerStatement
938 UnmapStatement VerdictStatements WhileStatement SelectCaseConstruct
939 StopTestcaseStatement String2TtcnStatement ProfilerStatement int2enumStatement
940 %type <statementblock> StatementBlock optElseClause FunctionStatementOrDefList
941 ControlStatementOrDefList ModuleControlBody
942 %type <subtypeparse> ValueOrRange
943 %type <templ> MatchingSymbol SingleValueOrAttrib SimpleSpec TemplateBody
944 ArrayElementSpec ArrayValueOrAttrib FieldSpecList ArraySpecList
945 AllElementsFrom TemplateListElem
946 %type <templinst> AddressRef FromClause FunctionActualPar InLineTemplate
947 ReceiveParameter SendParameter TemplateActualPar TemplateInstance
948 /* TestcaseActualPar */ ValueMatchSpec optFromClause optParDefaultValue
950 %type <parsedpar> FunctionActualParList TestcaseActualParList
951 optFunctionActualParList optTestcaseActualParList
952 NamedPart UnnamedPart
953 %type <templinsts> optTemplateActualParList
954 seqTemplateActualPar seqTemplateInstance
955 %type <templs> ValueOrAttribList seqValueOrAttrib ValueList Complement
956 ArrayElementSpecList SubsetMatch SupersetMatch PermutationMatch
957 %type <ass> Assignment Step
958 %type <refbase> DerivedRefWithParList TemplateRefWithParList DecValueArg
959 %type <refpard> FunctionInstance AltstepInstance
960 %type <reference> PortType optDerivedDef DerivedDef Signature VariableRef
961 TimerRef TimerRefOrAny Port PortOrAny PortOrAll ValueSpec
962 SenderSpec ComponentType optRunsOnSpec RunsOnSpec optSystemSpec
963 %type <valuerange> Range
964 %type <type> NestedEnumDef NestedRecordDef NestedRecordOfDef NestedSetDef
965 NestedSetOfDef NestedTypeDef NestedUnionDef PortDefAttribs ReferencedType
966 Type TypeOrNestedTypeDef NestedFunctionTypeDef NestedAltstepTypeDef
967 NestedTestcaseTypeDef
968 %type <types> TypeList AllOrTypeList
969 %type <value> AddressValue AliveOp AllPortsSpec AltGuardChar ArrayBounds
970 ArrayExpression ArrayExpressionList BitStringValue BooleanExpression
971 BooleanValue CharStringValue ComponentRef ComponentReferenceOrLiteral
972 ComponentOrDefaultReference CompoundExpression ConfigurationOps CreateOp
973 DereferOp Expression FieldExpressionList Final GetLocalVerdict HexStringValue
974 IntegerValue LowerBound MTCOp MatchOp NotUsedOrExpression ObjIdComponentList
975 ObjectIdentifierValue OctetStringValue OmitValue OpCall PredefinedOps
976 PredefinedValue ReadTimerOp ReferOp ReferencedValue RunningOp RunningTimerOp
977 SelfOp SingleExpression SingleLowerBound SystemOp TemplateOps TimerOps
978 TimerValue UpperBound Value ValueofOp VerdictOps VerdictValue optReplyValue
979 optTestcaseTimerValue optToClause ProfilerRunningOp
980 %type <values> ArrayElementExpressionList seqArrayExpressionSpec
981 %type <variableentries> VariableList
982 %type <variableentry> VariableEntry
983 %type <subtypeparses> seqValueOrRange AllowedValues optSubTypeSpec
985 %type <arraydimension_list> optArrayDef
986 %type <fieldorarrayref_list> optExtendedFieldReference
987 %type <def_list> AltstepLocalDef AltstepLocalDefList ComponentElementDef
988 ConstDef ExtConstDef FunctionLocalDef FunctionLocalInst ModuleDef ModulePar
989 ModuleParDef MultiTypedModuleParList PortInstance TimerInstance TimerList
991 %type <stmt_list> FunctionStatementOrDef ControlStatementOrDef
993 %type <rangedef> RangeDef
994 %type <returntype> optReturnType
995 %type <returntypeornoblock> optReturnTypeOrNoBlockKeyword
996 %type <structdefbody> StructDefBody UnionDefBody
997 %type <structofdefbody> StructOfDefBody
998 %type <portdefbody> PortDefList seqPortDefList PortDefLists
999 %type <ischosenarg> IschosenArg
1000 %type <extramatchingattrs> optExtraMatchingAttributes
1001 %type <basetemplate> BaseTemplate
1002 %type <templateref> TemplateRef TestcaseRef FunctionRef
1003 %type <testcaseinst> TestcaseInstance
1004 %type <portsendop> PortSendOp
1005 %type <calltimerval> CallTimerValue
1006 %type <portcallop> PortCallOp CallParameters
1007 %type <portreplyop> PortReplyOp
1008 %type <portraiseop> PortRaiseOp
1009 %type <portredirect> optPortRedirect
1010 %type <portredirectwithparam> optPortRedirectWithParam
1011 %type <portredirectwithvalueandparam> optPortRedirectWithValueAndParam
1012 %type <getreplypar> optGetReplyParameter
1013 %type <portreceiveop> PortReceiveOp PortTriggerOp
1014 %type <portgetcallop> PortGetCallOp
1015 %type <portgetreplyop> PortGetReplyOp
1016 %type <catchoppar> optCatchOpParameter CatchOpParameter
1017 %type <portcatchop> PortCatchOp
1018 %type <portcheckop> optCheckParameter CheckParameter CheckPortOpsPresent
1019 FromClausePresent RedirectPresent
1020 %type <portref> PortRef AllConnectionsSpec
1021 %type <connspec> SingleConnectionSpec SingleOrMultiConnectionSpec
1022 %type <donepar> optDoneParameter
1023 %type <reforid> Reference
1024 %type <initial> Initial
1025 %type <configspec> ConfigSpec
1026 %type <createpar> optCreateParameter
1027 %type <applyop> ApplyOp
1028 %type <identifier_list> IdentifierList
1029 %type <singlevarinst> SingleConstDef SingleVarInstance
1030 %type <singlevarinst_list> ConstList VarList
1031 %type <singletempvarinst> SingleTempVarInstance
1032 %type <singletempvarinst_list> TempVarList
1033 %type <singlemodulepar> SingleModulePar
1034 %type <singletemplatemodulepar> SingleTemplateModulePar
1035 %type <singlemodulepar_list> ModuleParList
1036 %type <singletemplatemodulepar_list> TemplateModuleParList
1037 %type <portelement> PortElement
1038 %type <portelement_list> PortElementList
1039 %type <comprefs> optExtendsDef ComponentTypeList
1040 %type <runs_on_compref_or_self> optRunsOnComprefOrSelf
1041 %type <template_restriction> TemplateRestriction optTemplateRestriction
1042 TemplateOptRestricted
1043 %type <visbilitytype> optVisibility ComponentElementVisibility
1044 %type <float_val> FloatOrSpecialFloatValue
1045 %type <erroneous_indicator> ErroneousIndicator
1046 %type <imptype> ImportSpec ImportElement
1048 /*********************************************************************
1050 *********************************************************************/
1053 act_group = $$->get_parent_group();
1058 %destructor {Free($$);}
1067 delete $$.derefered_value;
1072 %destructor {delete $$;}
1086 ArrayElementExpressionList
1088 ArrayElementSpecList
1107 CallBodyStatementList
1114 CommunicationStatements
1117 ComponentElementDefList
1118 ComponentOrDefaultReference
1120 ComponentReferenceOrLiteral
1124 ConditionalConstruct
1126 ConfigurationStatements
1130 ControlStatementOrDefList
1137 DerivedRefWithParList
1151 FieldOrArrayReference
1163 FunctionActualParList
1166 FunctionFormalParList
1169 FunctionStatementOrDefList
1183 IdentifierOrAddressKeyword
1188 InterleavedConstruct
1189 InterleavedGuardElement
1190 InterleavedGuardList
1198 String2TtcnStatement
1210 NestedAltstepTypeDef
1212 NestedFunctionTypeDef
1217 NestedTestcaseTypeDef
1225 ObjectIdentifierValue
1273 SignatureFormalParList
1286 StopExecutionStatement
1287 StopTestcaseStatement
1304 TemplateFormalParList
1307 TemplateRefWithParList
1308 /* TestcaseActualPar */
1309 TestcaseActualParList
1312 TestcaseFormalParList
1349 optAltstepFormalParList
1357 optFunctionActualParList
1358 optFunctionFormalParList
1364 optSignatureFormalParList
1366 optStructFieldDefList
1368 optTemplateActualParList
1369 optTemplateFormalParList
1370 optTestcaseActualParList
1371 optTestcaseFormalParList
1372 optTestcaseTimerValue
1375 optWithStatementAndSemiColon
1377 seqFieldExpressionSpec
1379 seqTemplateActualPar
1385 for (size_t i = 0; i < $$->size(); i++) delete (*$$)[i];
1394 for(size_t i=0; i<$$.nElements; i++) delete $$.elements[i];
1401 ControlStatementOrDef
1405 FunctionStatementOrDef
1409 MultiTypedModuleParList
1415 optExtendedFieldReference
1431 optReturnTypeOrNoBlockKeyword
1449 delete $$.inout_list;
1462 delete $$.len_restr;
1464 optExtraMatchingAttributes
1483 delete $$.derefered_value;
1490 delete $$.templ_inst;
1496 delete $$.calltimerval;
1501 delete $$.templ_inst;
1502 delete $$.calltimerval;
1505 PortCallOp CallParameters
1508 delete $$.templ_inst;
1515 delete $$.signature;
1516 delete $$.templ_inst;
1522 delete $$.redirectval;
1523 delete $$.redirectsender;
1528 delete $$.redirectparam;
1529 delete $$.redirectsender;
1531 optPortRedirectWithParam
1534 delete $$.redirectval;
1535 delete $$.redirectparam;
1536 delete $$.redirectsender;
1538 optPortRedirectWithValueAndParam
1541 delete $$.templ_inst;
1542 delete $$.valuematch;
1544 optGetReplyParameter
1547 delete $$.templ_inst;
1548 delete $$.fromclause;
1549 delete $$.redirectval;
1550 delete $$.redirectsender;
1556 delete $$.templ_inst;
1557 delete $$.fromclause;
1558 delete $$.redirectparam;
1559 delete $$.redirectsender;
1564 delete $$.templ_inst;
1565 delete $$.valuematch;
1566 delete $$.fromclause;
1567 delete $$.redirectval;
1568 delete $$.redirectparam;
1569 delete $$.redirectsender;
1574 delete $$.signature;
1575 delete $$.templ_inst;
1581 delete $$.signature;
1582 delete $$.templ_inst;
1583 delete $$.fromclause;
1584 delete $$.redirectval;
1585 delete $$.redirectsender;
1590 delete $$.signature;
1591 delete $$.templ_inst;
1592 delete $$.valuematch;
1593 delete $$.fromclause;
1594 delete $$.redirectval;
1595 delete $$.redirectparam;
1596 delete $$.redirectsender;
1617 SingleConnectionSpec
1618 SingleOrMultiConnectionSpec
1621 delete $$.donematch;
1627 if ($$.is_ref) delete $$.ref;
1639 delete $$.runsonref;
1640 delete $$.systemref;
1657 for (size_t i = 0; i < $$.nElements; i++) delete $$.elements[i].id;
1664 for (size_t i = 0; i < $$.arrays.nElements; i++)
1665 delete $$.arrays.elements[i];
1666 Free($$.arrays.elements);
1667 delete $$.initial_value;
1671 SingleTempVarInstance
1674 for (size_t i = 0; i < $$.nElements; i++) {
1675 delete $$.elements[i].id;
1676 for (size_t j = 0; i < $$.elements[i].arrays.nElements; j++)
1677 delete $$.elements[i].arrays.elements[j];
1678 Free($$.elements[i].arrays.elements);
1679 delete $$.elements[i].initial_value;
1697 SingleTemplateModulePar
1700 for (size_t i = 0; i < $$.nElements; i++) {
1701 delete $$.elements[i].id;
1702 delete $$.elements[i].defval;
1709 for (size_t i = 0; i < $$.nElements; i++) {
1710 delete $$.elements[i].id;
1711 delete $$.elements[i].deftempl;
1715 TemplateModuleParList
1724 for (size_t i = 0; i < $$.nElements; i++) {
1725 delete $$.elements[i].id;
1726 delete $$.elements[i].dims;
1733 delete $$.reference;
1735 optRunsOnComprefOrSelf
1737 /*********************************************************************
1738 * Operator precedences (lowest first)
1739 *********************************************************************/
1746 %nonassoc '<' '>' GE LE
1753 %left '*' '/' ModKeyword RemKeyword
1761 XXX Source of conflicts (26 S/R):
1763 1.) 9 conflicts in one state
1764 The Expression after 'return' keyword is optional in ReturnStatement.
1765 For 9 tokens the parser cannot decide whether the token is a part of
1766 the return expression (shift) or it is the beginning of the next statement
1769 2.) 9 distinct states, each with one conflict caused by token '['
1770 The local definitions in altsteps can be followed immediately by the guard
1771 expression. When the parser sees the '[' token it cannot decide whether it
1772 belongs to the local definition as array dimension or array subreference
1773 (shift) or it is the beginning of the first guard expression (reduce).
1774 The situations are the following:
1775 - var t v := ref <here> [
1776 - var t v := ref[subref] <here> [
1777 - var t v := ref.integer <here> [
1778 - var t v := ref.subref <here> [
1781 - var t v := ref.objid{...}.subref <here> [
1782 - var template t v <here> [
1783 - var t v := function(...)<subrefs> <here> [
1786 The sequence identifier.objid can be either the beginning of a module name
1787 qualified with a module object identifier (shift) or a reference to an objid
1788 value within an entity of type anytype (reduce).
1791 The '{' token after a call statement can be either the part of the response and
1792 exception handling part (shift) or the beginning of the next statement, which
1793 is a StatementBlock (reduce). Note that StatementBlock as a statement is a
1794 non-standard language extension.
1796 5.) 5 conflicts in in three states, related to named parameters
1798 6.) 1 Conflict due to pattern concatenation
1800 Note that the parser implemented by bison always chooses to shift instead of
1801 reduce in case of conflicts.
1806 /*********************************************************************
1808 *********************************************************************/
1810 /* The grammar of TTCN-3 */
1811 /* The numbers correspond to ES 201 873-1 V4.1.2 (2009-07) */
1816 if (is_erroneous_parsed) {
1817 delete act_ttcn3_module;
1818 act_ttcn3_module = NULL;
1819 Location loc(infile, @1);
1820 loc.error("The erroneous attribute cannot be a TTCN-3 module.");
1823 | TitanErroneousHackKeyword ErroneousAttributeSpec
1825 if (!is_erroneous_parsed) {
1826 delete act_ttcn3_erroneous_attr_spec;
1827 act_ttcn3_erroneous_attr_spec = NULL;
1828 Location loc(infile, @$);
1829 loc.error("File `%s' does not contain a TTCN-3 module.", infile);
1835 ErroneousAttributeSpec:
1836 ErroneousIndicator AssignmentChar TemplateInstance optAllKeyword
1838 act_ttcn3_erroneous_attr_spec = new ErroneousAttributeSpec($1.is_raw, $1.indicator, $3, $4);
1843 ValueKeyword optErrValueRaw
1845 $$.indicator = ErroneousAttributeSpec::I_VALUE;
1848 | IDentifier optErrValueRaw
1850 if ($1->get_ttcnname()=="before") $$.indicator = ErroneousAttributeSpec::I_BEFORE;
1851 else if ($1->get_ttcnname()=="after") $$.indicator = ErroneousAttributeSpec::I_AFTER;
1853 Location loc(infile, @1);
1854 loc.error("Invalid indicator. Valid indicators are: "
1855 "`before', `value' and `after'");
1856 $$.indicator = ErroneousAttributeSpec::I_INVALID;
1864 /* empty */ { $$ = false; }
1865 | AllKeyword { $$ = true; }
1869 /* empty */ { $$ = false; }
1870 | '(' IDentifier ')'
1872 if ($2->get_ttcnname()=="raw") $$ = true;
1874 Location loc(infile, @2);
1875 loc.error("Invalid keyword, only the optional `raw' keyword can be used here.");
1883 /* A.1.6.0 TTCN Module */
1886 TTCN3ModuleId ModuleBody optWithStatementAndSemiColon optError
1888 act_ttcn3_module->set_with_attr($3);
1889 if (anytype_access) {
1890 // If there was an attempted access to an anytype field, artificially
1891 // create a type definition as if the following appeared in TTCN-3:
1892 // type union anytype { /* empty, members added later */ }
1893 // NOTE: anything which looks like usage of an anytype field will bring
1894 // the local anytype to life, which trumps any imported anytype
1895 // (when resolving, the local anytype will be found first).
1896 // TODO: just to be safe, anytype should be removed from the exports.
1897 Type *t = new Type(Type::T_ANYTYPE);
1898 Identifier *anytype_id = new Identifier(Identifier::ID_TTCN, anyname);
1899 Def_Type *anytypedef = new Def_Type(anytype_id, t);
1900 anytypedef->set_parent_path(act_ttcn3_module->get_attrib_path());
1901 act_ttcn3_module->add_ass(anytypedef);
1902 // Def_Type is-a Definition is-a Assignment
1908 optError TTCN3ModuleKeyword IDentifier optDefinitiveIdentifier
1909 optLanguageSpec optError
1911 act_ttcn3_module = new Ttcn::Module($3);
1912 act_ttcn3_module->set_scope_name($3->get_dispname());
1913 act_ttcn3_module->set_language_spec($5);
1919 GlobalModuleId optLanguageSpec
1921 $$ = new ImpMod($1);
1922 $$->set_language_spec($2);
1927 GlobalModuleId: // 5
1928 IDentifier { $$ = $1; }
1929 | IDentifier '.' ObjectIdentifierValue
1930 { $$ = $1; delete $3; }
1934 /* empty */ { $$ = NULL; }
1935 | LanguageKeyword FreeText { $$ = $2; } // sort-of 7 LanguageSpec
1939 '{' optErrorBlock '}'
1940 | '{' ModuleDefinitionsList optErrorBlock '}'
1941 | '{' ModuleDefinitionsList ModuleControlPart optErrorBlock '}'
1942 | '{' ModuleControlPart optErrorBlock '}'
1945 /* A.1.6.1 Module definitions part */
1947 /* A.1.6.1.0 General */
1949 ModuleDefinitionsList: // 10
1950 ModuleDefinition optSemiColon
1951 | error ModuleDefinition optSemiColon
1952 | ModuleDefinitionsList optErrorBlock ModuleDefinition optSemiColon
1955 optVisibility: // 12
1956 // /* empty */ { $$.visibility = PUBLIC;}
1957 /* empty */ { $$.visibility = NOCHANGE;}
1958 | PublicKeyword { $$.visibility = PUBLIC;}
1959 | PrivateKeyword { $$.visibility = PRIVATE;}
1960 | FriendKeyword { $$.visibility = FRIEND;}
1963 /* A definition _in_ the module, not a definition _of_ a module */
1964 ModuleDefinition: // 11
1965 optVisibility ModuleDef optWithStatement
1967 for (size_t i = 0; i < $2.nElements; i++) {
1969 if (i == 0) $2.elements[i]->set_with_attr($3);
1970 else $2.elements[i]->set_with_attr($3->clone());
1972 if ($1.visibility != NOCHANGE) {
1973 $2.elements[i]->set_visibility($1.visibility);
1975 act_ttcn3_module->add_ass($2.elements[i]);
1977 $2.elements[i]->set_parent_path(act_group->get_attrib_path());
1978 act_group->add_ass($2.elements[i]);
1980 $2.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
1985 | optVisibility ImportDef optWithStatement
1987 $2->set_with_attr($3);
1988 if ($1.visibility != NOCHANGE) {
1989 $2->set_visibility($1.visibility);
1992 $2->set_parent_path(act_group->get_attrib_path());
1993 act_group->add_impmod($2);
1995 $2->set_parent_path(act_ttcn3_module->get_attrib_path());
1997 act_ttcn3_module->add_impmod($2);
1999 | PublicKeyword GroupDef optWithStatement
2000 { // only public allowed for group, and it's redundant
2001 $2->set_with_attr($3);
2002 act_group = $2->get_parent_group();
2004 | GroupDef optWithStatement
2005 { // same code as above
2006 $1->set_with_attr($2);
2007 act_group = $1->get_parent_group();
2009 | PrivateKeyword FriendModuleDef optWithStatement
2010 { // only private allowed for "friend module", and it's redundant
2011 for (size_t i = 0; i < $2.nElements; i++) {
2013 if (i == 0) $2.elements[i]->set_with_attr($3);
2014 else $2.elements[i]->set_with_attr($3->clone());
2016 act_ttcn3_module->add_friendmod($2.elements[i]);
2018 $2.elements[i]->set_parent_path(act_group->get_attrib_path());
2019 act_group->add_friendmod($2.elements[i]);
2021 $2.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
2026 | FriendModuleDef optWithStatement
2027 { // same code as above
2028 for (size_t i = 0; i < $1.nElements; i++) {
2030 if (i == 0) $1.elements[i]->set_with_attr($2);
2031 else $1.elements[i]->set_with_attr($2->clone());
2033 act_ttcn3_module->add_friendmod($1.elements[i]);
2035 $1.elements[i]->set_parent_path(act_group->get_attrib_path());
2036 act_group->add_friendmod($1.elements[i]);
2038 $1.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
2046 ConstDef { $$ = $1; }
2047 | ModuleParDef { $$ = $1; }
2051 $$.elements = (Ttcn::Definition**)
2052 Malloc(sizeof(*$$.elements));
2053 $$.elements[0] = $1;
2058 $$.elements = (Ttcn::Definition**)
2059 Malloc(sizeof(*$$.elements));
2060 $$.elements[0] = $1;
2065 $$.elements = (Ttcn::Definition**)
2066 Malloc(sizeof(*$$.elements));
2067 $$.elements[0] = $1;
2072 $$.elements = (Ttcn::Definition**)
2073 Malloc(sizeof(*$$.elements));
2074 $$.elements[0] = $1;
2079 $$.elements = (Ttcn::Definition**)
2080 Malloc(sizeof(*$$.elements));
2081 $$.elements[0] = $1;
2086 $$.elements = (Ttcn::Definition**)
2087 Malloc(sizeof(*$$.elements));
2088 $$.elements[0] = $1;
2093 $$.elements = (Ttcn::Definition**)
2094 Malloc(sizeof(*$$.elements));
2095 $$.elements[0] = $1;
2097 | ExtConstDef { $$ = $1; }
2100 /* A.1.6.1.1 Typedef definitions */
2103 TypeDefKeyword TypeDefBody
2106 $$->set_location(infile, @$);
2111 StructuredTypeDef { $$ = $1; }
2112 | SubTypeDef { $$ = $1; }
2115 StructuredTypeDef: // 16
2116 RecordDef { $$ = $1; }
2117 | UnionDef { $$ = $1; }
2118 | SetDef { $$ = $1; }
2119 | RecordOfDef { $$ = $1; }
2120 | SetOfDef { $$ = $1; }
2121 | EnumDef { $$ = $1; }
2122 | PortDef { $$ = $1; }
2123 | ComponentDef { $$ = $1; }
2124 | FunctionTypeDef { $$ = $1; }
2125 | AltstepTypeDef { $$ = $1; }
2126 | TestcaseTypeDef { $$ = $1; }
2130 RecordKeyword StructDefBody
2132 Type *type = new Type(Type::T_SEQ_T, $2.cfm);
2133 type->set_location(infile, @$);
2134 $$ = new Def_Type($2.id, type);
2138 StructDefBody: // 19
2139 IDentifier optStructDefFormalParList
2140 '{' optStructFieldDefList '}'
2145 | AddressKeyword '{' optStructFieldDefList '}'
2147 $$.id = new Identifier(Identifier::ID_TTCN, string("address"));
2152 optStructDefFormalParList:
2153 /* empty */ optError
2154 | '(' StructDefFormalParList optError ')'
2156 Location loc(infile, @$);
2157 loc.error("Type parameterization is not currently supported");
2161 Location loc(infile, @$);
2162 loc.error("Type parameterization is not currently supported");
2166 StructDefFormalParList: // -> 202 784 "Advanced Parameterization", 9
2167 optError StructDefFormalPar
2168 | StructDefFormalParList optError ',' optError StructDefFormalPar
2169 | StructDefFormalParList optError ',' error
2172 StructDefFormalPar: // -> 202 784 "Advanced Parameterization", 10
2173 FormalValuePar { delete $1; }
2176 optStructFieldDefList:
2177 /* empty */ optError { $$ = new CompFieldMap; }
2178 | StructFieldDefList optError { $$ = $1; }
2182 optError StructFieldDef
2184 $$ = new CompFieldMap;
2187 | StructFieldDefList optError ',' optError StructFieldDef
2192 | StructFieldDefList optError ',' error { $$ = $1; }
2195 StructFieldDef: // 21
2196 TypeOrNestedTypeDef IDentifier optArrayDef optSubTypeSpec optOptionalKeyword
2199 /* The subtype constraint belongs to the innermost embedded type of
2200 * possible nested 'record of' or 'set of' constructs. */
2202 while (t->is_seof()) t = t->get_ofType();
2203 t->set_parsed_restrictions($4);
2206 /* creation of array type(s) if necessary (from right to left) */
2207 for (size_t i = $3.nElements; i > 0; i--) {
2208 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2209 type->set_location(*$1);
2212 $$ = new CompField($2, type, $5);
2213 $$->set_location(infile, @$);
2218 /* empty */ { $$ = false; }
2219 | OptionalKeyword { $$ = true; }
2222 TypeOrNestedTypeDef:
2224 | NestedTypeDef { $$ = $1; }
2227 NestedTypeDef: // 22
2228 NestedRecordDef { $$ = $1; }
2229 | NestedUnionDef { $$ = $1; }
2230 | NestedSetDef { $$ = $1; }
2231 | NestedRecordOfDef { $$ = $1; }
2232 | NestedSetOfDef { $$ = $1; }
2233 | NestedEnumDef { $$ = $1; }
2234 | NestedFunctionTypeDef { $$ = $1; }
2235 | NestedAltstepTypeDef { $$ = $1; }
2236 | NestedTestcaseTypeDef { $$ = $1; }
2239 NestedRecordDef: // 23
2240 RecordKeyword '{' optStructFieldDefList '}'
2242 $$ = new Type(Type::T_SEQ_T, $3);
2243 $$->set_location(infile, @$);
2247 NestedUnionDef: // 24
2248 UnionKeyword '{' UnionFieldDefList optError '}'
2250 $$ = new Type(Type::T_CHOICE_T, $3);
2251 $$->set_location(infile, @$);
2256 SetKeyword '{' optStructFieldDefList '}'
2258 $$ = new Type(Type::T_SET_T, $3);
2259 $$->set_location(infile, @$);
2263 NestedRecordOfDef: // 26
2264 RecordKeyword optStringLength OfKeyword TypeOrNestedTypeDef
2266 $$ = new Type(Type::T_SEQOF, $4);
2268 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2269 SubTypeParse *stp = new SubTypeParse($2);
2271 $$->set_parsed_restrictions(vstp);
2273 $$->set_location(infile, @$);
2277 NestedSetOfDef: // 27
2278 SetKeyword optStringLength OfKeyword TypeOrNestedTypeDef
2280 $$ = new Type(Type::T_SETOF, $4);
2282 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2283 SubTypeParse *stp = new SubTypeParse($2);
2285 $$->set_parsed_restrictions(vstp);
2287 $$->set_location(infile, @$);
2291 NestedEnumDef: // 28
2292 EnumKeyword '{' EnumerationList optError '}'
2294 $$ = new Type(Type::T_ENUM_T, $3);
2295 $$->set_location(infile, @$);
2299 NestedFunctionTypeDef:
2300 FunctionKeyword '(' optFunctionFormalParList ')'
2301 optRunsOnComprefOrSelf optReturnType
2303 $3->set_location(infile, @2, @4);
2304 $$ = new Type(Type::T_FUNCTION, $3, $5.reference, $5.self, $6.type,
2305 $6.returns_template, $6.template_restriction);
2306 $$->set_location(infile, @$);
2310 NestedAltstepTypeDef:
2311 AltstepKeyword '(' optAltstepFormalParList ')'
2312 optRunsOnComprefOrSelf
2314 $3->set_location(infile, @2, @4);
2315 $$ = new Type(Type::T_ALTSTEP, $3, $5.reference, $5.self);
2316 $$->set_location(infile, @$);
2320 NestedTestcaseTypeDef:
2321 TestcaseKeyword '(' optTestcaseFormalParList ')'
2324 $3->set_location(infile, @2, @4);
2325 $$ = new Type(Type::T_TESTCASE, $3, $5.runsonref,
2327 $$->set_location(infile, @$);
2332 UnionKeyword UnionDefBody
2334 Type *type = new Type(Type::T_CHOICE_T, $2.cfm);
2335 type->set_location(infile, @$);
2336 $$ = new Def_Type($2.id, type);
2341 IDentifier optStructDefFormalParList
2342 '{' UnionFieldDefList optError '}'
2347 | AddressKeyword '{' UnionFieldDefList optError '}'
2349 $$.id = new Identifier(Identifier::ID_TTCN, string("address"));
2355 optError UnionFieldDef
2357 $$ = new CompFieldMap;
2360 | UnionFieldDefList optError ',' optError UnionFieldDef
2365 | UnionFieldDefList optError ',' error { $$ = $1; }
2366 | error { $$ = new CompFieldMap; }
2369 UnionFieldDef: // 34
2370 TypeOrNestedTypeDef IDentifier optArrayDef optSubTypeSpec
2373 /* The subtype constraint belongs to the innermost embedded type of
2374 * possible nested 'record of' or 'set of' constructs. */
2376 while (t->is_seof()) t = t->get_ofType();
2377 t->set_parsed_restrictions($4);
2380 /* creation of array type(s) if necessary (from right to left) */
2381 for (size_t i = $3.nElements; i > 0; i--) {
2382 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2383 type->set_location(*$1);
2386 $$ = new CompField($2, type, false);
2387 $$->set_location(infile, @$);
2392 SetKeyword StructDefBody
2394 Type *type = new Type(Type::T_SET_T, $2.cfm);
2395 type->set_location(infile, @$);
2396 $$ = new Def_Type($2.id, type);
2401 RecordKeyword optStringLength OfKeyword StructOfDefBody
2403 Type *type = new Type(Type::T_SEQOF, $4.type);
2405 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2406 vstp->add(new SubTypeParse($2));
2407 type->set_parsed_restrictions(vstp);
2409 type->set_location(infile, @$);
2410 $$ = new Def_Type($4.id, type);
2414 StructOfDefBody: // 39
2415 TypeOrNestedTypeDef IdentifierOrAddressKeyword optSubTypeSpec
2418 /* The subtype constraint belongs to the innermost embedded type of
2419 * possible nested 'record of' or 'set of' constructs. */
2421 while (t->is_seof()) t = t->get_ofType();
2422 t->set_parsed_restrictions($3);
2429 IdentifierOrAddressKeyword:
2430 IDentifier { $$ = $1; }
2433 $$ = new Identifier(Identifier::ID_TTCN, string("address"));
2438 SetKeyword optStringLength OfKeyword StructOfDefBody
2440 Type *type = new Type(Type::T_SETOF, $4.type);
2442 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2443 vstp->add(new SubTypeParse($2));
2444 type->set_parsed_restrictions(vstp);
2446 type->set_location(infile, @$);
2447 $$ = new Def_Type($4.id, type);
2452 EnumKeyword IdentifierOrAddressKeyword
2453 '{' EnumerationList optError '}'
2455 Type *type = new Type(Type::T_ENUM_T, $4);
2456 type->set_location(infile, @$);
2457 $$ = new Def_Type($2, type);
2461 EnumerationList: // 44
2462 optError Enumeration
2467 | EnumerationList optError ',' optError Enumeration
2472 | EnumerationList optError ',' error { $$ = $1; }
2473 | error { $$ = new EnumItems; }
2479 $$ = new EnumItem($1, NULL);
2480 $$->set_location(infile, @$);
2482 | IDentifier '(' Number optError ')'
2484 Value *value = new Value(Value::V_INT, $3);
2485 value->set_location(infile, @3);
2486 $$ = new EnumItem($1, value);
2487 $$->set_location(infile, @$);
2489 | IDentifier '(' '-' Number optError ')'
2492 Value *value = new Value(Value::V_INT, $4);
2493 value->set_location(infile, @3, @4);
2494 $$ = new EnumItem($1, value);
2495 $$->set_location(infile, @$);
2497 | IDentifier '(' error ')'
2499 Value *value = new Value(Value::V_ERROR);
2500 value->set_location(infile, @3);
2501 $$ = new EnumItem($1, value);
2502 $$->set_location(infile, @$);
2507 Type IdentifierOrAddressKeyword optArrayDef optSubTypeSpec
2509 /* the subtype constraint belongs to the innermost type */
2510 if ($4) $1->set_parsed_restrictions($4);
2512 /* creation of array type(s) if necessary (from right to left) */
2513 for (size_t i = $3.nElements; i > 0; i--) {
2514 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2515 type->set_location(*$1);
2518 $$ = new Def_Type($2, type);
2522 optSubTypeSpec: // [49]
2523 /* empty */ { $$ = 0; }
2524 | AllowedValues { $$ = $1; }
2525 | AllowedValues StringLength
2528 $$->add(new SubTypeParse($2));
2532 $$ = new vector<SubTypeParse>;
2533 $$->add(new SubTypeParse($1));
2537 AllowedValues: // 50
2538 '(' seqValueOrRange optError ')' { $$ = $2; }
2539 | '(' CharStringMatch optError ')'
2541 $$ = new vector<SubTypeParse>;
2542 $$->add(new SubTypeParse($2));
2544 | '(' error ')' { $$ = new vector<SubTypeParse>; }
2548 optError ValueOrRange
2550 $$ = new vector<SubTypeParse>;
2553 | seqValueOrRange optError ',' optError ValueOrRange
2558 | seqValueOrRange optError ',' error { $$ = $1; }
2562 RangeDef { $$ = new SubTypeParse($1.lower, $1.lower_exclusive, $1.upper, $1.upper_exclusive); }
2563 | Expression { $$ = new SubTypeParse($1); }
2567 LowerBound DotDot UpperBound
2569 $$.lower_exclusive = false;
2571 $$.upper_exclusive = false;
2574 | '!' LowerBound DotDot UpperBound
2576 $$.lower_exclusive = true;
2578 $$.upper_exclusive = false;
2581 | LowerBound DotDot '!' UpperBound
2583 $$.lower_exclusive = false;
2585 $$.upper_exclusive = true;
2588 | '!' LowerBound DotDot '!' UpperBound
2590 $$.lower_exclusive = true;
2592 $$.upper_exclusive = true;
2598 /* empty */ optError { $$ = 0; }
2599 | StringLength { $$ = $1; }
2603 LengthKeyword '(' Expression optError ')'
2605 $$ = new LengthRestriction($3);
2606 $$->set_location(infile, @$);
2608 | LengthKeyword '(' Expression DotDot UpperBound optError ')'
2610 $$ = new LengthRestriction($3, $5);
2611 $$->set_location(infile, @$);
2613 | LengthKeyword '(' error ')'
2615 Value *value = new Value(Value::V_ERROR);
2616 value->set_location(infile, @3);
2617 $$ = new LengthRestriction(value);
2618 $$->set_location(infile, @$);
2625 $$ = new Ttcn::Reference($1);
2626 $$->set_location(infile, @$);
2628 | IDentifier '.' IDentifier
2630 $$ = new Ttcn::Reference($1, $3);
2631 $$->set_location(infile, @$);
2633 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
2635 $$ = new Ttcn::Reference($1, $5);
2636 $$->set_location(infile, @$);
2642 PortKeyword PortDefBody { $$ = $2; }
2646 IDentifier PortDefAttribs
2648 $$ = new Def_Type($1, $2);
2652 PortDefAttribs: // 60
2653 PortOperationMode PortDefLists
2655 PortTypeBody *body = new PortTypeBody($1,
2656 $2.in_list, $2.out_list, $2.inout_list,
2657 $2.in_all, $2.out_all, $2.inout_all);
2658 body->set_location(infile, @$);
2659 $$ = new Type(Type::T_PORT, body);
2660 $$->set_location(infile, @$);
2665 MessageKeyword { $$ = PortTypeBody::PO_MESSAGE; } // 61
2666 | ProcedureKeyword { $$ = PortTypeBody::PO_PROCEDURE; } // 68
2667 | MixedKeyword { $$ = PortTypeBody::PO_MIXED; } // 73
2668 | error { $$ = PortTypeBody::PO_MIXED; }
2672 '{' seqPortDefList '}' { $$ = $2; }
2680 $$.inout_all = false;
2685 optError PortDefList optSemiColon { $$ = $2; }
2686 | seqPortDefList PortDefList optSemiColon
2691 $$.in_list->steal_types($2.in_list);
2693 } else $$.in_list = $2.in_list;
2697 $$.out_list->steal_types($2.out_list);
2699 } else $$.out_list = $2.out_list;
2701 if ($2.inout_list) {
2702 if ($$.inout_list) {
2703 $$.inout_list->steal_types($2.inout_list);
2704 delete $2.inout_list;
2705 } else $$.inout_list = $2.inout_list;
2709 Location loc(infile, @2);
2710 loc.warning("Duplicate directive `in all' in port type definition");
2711 } else $$.in_all = true;
2715 Location loc(infile, @2);
2716 loc.warning("Duplicate directive `out all' in port type definition");
2717 } else $$.out_all = true;
2721 Location loc(infile, @2);
2722 loc.warning("Duplicate directive `inout all' in port type definition");
2723 } else $$.inout_all = true;
2729 InParKeyword AllOrTypeList
2733 $$.in_list->set_location(infile, @$);
2742 $$.inout_all = false;
2744 | OutParKeyword AllOrTypeList
2750 $$.out_list->set_location(infile, @$);
2757 $$.inout_all = false;
2759 | InOutParKeyword AllOrTypeList
2767 $$.inout_list->set_location(infile, @$);
2768 $$.inout_all = false;
2771 $$.inout_all = true;
2774 | InParKeyword error
2781 $$.inout_all = false;
2783 | OutParKeyword error
2790 $$.inout_all = false;
2792 | InOutParKeyword error
2799 $$.inout_all = false;
2803 AllOrTypeList: // 65
2804 AllKeyword { $$ = 0; }
2805 | TypeList { $$ = $1; }
2814 | TypeList optError ',' optError Type
2819 | TypeList optError ',' error { $$ = $1; }
2823 ComponentKeyword IDentifier
2825 '{' optComponentDefList '}'
2828 if ($3) $5->add_extends($3);
2829 $5->set_location(infile, @$);
2830 Type *type = new Type(Type::T_COMPONENT, $5);
2831 type->set_location(infile, @$);
2832 $$ = new Def_Type($2, type);
2837 /* empty */ optError { $$ = 0; }
2838 | ExtendsKeyword ComponentTypeList optError
2841 $$->set_location(infile, @1, @2);
2843 | ExtendsKeyword error { $$ = 0; }
2847 optError ComponentType
2849 $$ = new CompTypeRefList();
2852 | ComponentTypeList optError ',' optError ComponentType
2857 | ComponentTypeList optError ',' error { $$ = $1; }
2860 ComponentType: // 81
2863 $$ = new Ttcn::Reference($1);
2864 $$->set_location(infile, @$);
2866 | IDentifier '.' IDentifier
2868 $$ = new Ttcn::Reference($1, $3);
2869 $$->set_location(infile, @$);
2871 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
2873 $$ = new Ttcn::Reference($1, $5);
2874 $$->set_location(infile, @$);
2879 optComponentDefList:
2880 optError /* empty */ { $$ = new ComponentTypeBody(); }
2881 | ComponentElementDefList optError { $$ = $1; }
2884 ComponentElementDefList:
2885 optError ComponentElementDef optSemiColon
2887 $$ = new ComponentTypeBody();
2888 for (size_t i = 0; i < $2.nElements; i++)
2889 $$->add_ass($2.elements[i]);
2892 | ComponentElementDefList optError ComponentElementDef optSemiColon
2895 for (size_t i = 0; i < $3.nElements; i++)
2896 $$->add_ass($3.elements[i]);
2901 ComponentElementVisibility:
2902 PublicKeyword { $$.visibility = PUBLIC;}
2903 | PrivateKeyword { $$.visibility = PRIVATE;}
2906 ComponentElementDef: // 84
2907 PortInstance { $$ = $1; }
2908 | VarInstance { $$ = $1; }
2909 | TimerInstance { $$ = $1; }
2910 | ConstDef { $$ = $1; }
2911 | ComponentElementVisibility PortInstance
2914 for (size_t i = 0; i < $2.nElements; i++) {
2915 $2.elements[i]->set_visibility($1.visibility);
2918 | ComponentElementVisibility VarInstance
2921 for (size_t i = 0; i < $2.nElements; i++) {
2922 $2.elements[i]->set_visibility($1.visibility);
2925 | ComponentElementVisibility TimerInstance
2928 for (size_t i = 0; i < $2.nElements; i++) {
2929 $2.elements[i]->set_visibility($1.visibility);
2932 | ComponentElementVisibility ConstDef
2935 for (size_t i = 0; i < $2.nElements; i++) {
2936 $2.elements[i]->set_visibility($1.visibility);
2942 PortKeyword PortType PortElementList
2944 $$.nElements = $3.nElements;
2945 $$.elements = (Ttcn::Definition**)
2946 Malloc($$.nElements*sizeof(*$$.elements));
2947 for (size_t i = 0; i < $3.nElements; i++) {
2948 Ttcn::Reference *ref = i > 0 ? $2->clone() : $2;
2949 $$.elements[i] = new Ttcn::Def_Port($3.elements[i].id, ref,
2950 $3.elements[i].dims);
2951 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
2958 optError PortElement
2961 $$.elements = (YYSTYPE::portelement_t*)Malloc(sizeof(*$$.elements));
2962 $$.elements[0] = $2;
2964 | PortElementList ',' optError PortElement
2966 $$.nElements = $1.nElements + 1;
2967 $$.elements = (YYSTYPE::portelement_t*)
2968 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
2969 $$.elements[$$.nElements - 1] = $4;
2971 | PortElementList ',' error { $$ = $1; }
2975 IDentifier optArrayDef
2978 if ($2.nElements > 0) {
2979 $$.dims = new ArrayDimensions;
2980 for (size_t i = 0; i < $2.nElements; i++) $$.dims->add($2.elements[i]);
2987 /* A.1.6.1.2 Constant definitions */
2990 ConstKeyword Type ConstList
2992 $$.nElements = $3.nElements;
2993 $$.elements = (Ttcn::Definition**)
2994 Malloc($$.nElements*sizeof(*$$.elements));
2995 for (size_t i = 0; i < $$.nElements; i++) {
2998 type = new Type(Type::T_REFDSPEC, $2);
2999 type->set_location(*$2);
3001 /* creation of array type(s) if necessary (from right to left) */
3002 for (size_t j = $3.elements[i].arrays.nElements; j > 0; j--) {
3003 type = new Type(Type::T_ARRAY, type,
3004 $3.elements[i].arrays.elements[j - 1], false);
3005 type->set_location(*$2);
3007 Free($3.elements[i].arrays.elements);
3009 /* Create the definition */
3010 $$.elements[i] = new Def_Const($3.elements[i].id,
3011 type, $3.elements[i].initial_value);
3012 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
3019 optError SingleConstDef
3022 $$.elements = (YYSTYPE::singlevarinst_t*)Malloc(sizeof(*$$.elements));
3023 $$.elements[0] = $2;
3025 | ConstList ',' optError SingleConstDef
3027 $$.nElements = $1.nElements + 1;
3028 $$.elements = (YYSTYPE::singlevarinst_t*)
3029 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
3030 $$.elements[$$.nElements - 1] = $4;
3034 SingleConstDef: // 90
3035 IDentifier optArrayDef AssignmentChar Expression
3039 $$.initial_value = $4;
3045 FunctionKeyword IDentifier '(' optFunctionFormalParList ')'
3046 optRunsOnComprefOrSelf optReturnType
3048 $4->set_location(infile, @3, @5);
3049 Type *type = new Type(Type::T_FUNCTION, $4, $6.reference, $6.self, $7.type,
3050 $7.returns_template, $7.template_restriction);
3051 type->set_location(infile, @$);
3052 $$ = new Ttcn::Def_Type($2, type);
3053 $$->set_location(infile, @$);
3058 AltstepKeyword IDentifier '(' optAltstepFormalParList ')'
3059 optRunsOnComprefOrSelf
3061 $4->set_location(infile, @3, @5);
3062 Type *type = new Type(Type::T_ALTSTEP, $4, $6.reference, $6.self);
3063 type->set_location(infile, @$);
3064 $$ = new Ttcn::Def_Type($2, type);
3065 $$->set_location(infile, @$);
3070 TestcaseKeyword IDentifier '(' optTestcaseFormalParList ')'
3073 $4->set_location(infile, @3, @5);
3074 Type *type = new Type(Type::T_TESTCASE, $4, $6.runsonref,
3076 type->set_location(infile, @$);
3077 $$ = new Ttcn::Def_Type($2, type);
3078 $$->set_location(infile, @$);
3082 /* A.1.6.1.3 Template definitions */
3085 TemplateKeyword optTemplateRestriction BaseTemplate
3086 optDerivedDef AssignmentChar TemplateBody
3088 $$ = new Def_Template($2, $3.name, $3.type, $3.fp_list, $4, $6);
3089 $$->set_location(infile, @$);
3094 Type IDentifier optTemplateFormalParList
3100 /* | Signature IDentifier optTemplateFormalParList -- covered by the previous
3105 /* empty */ { $$ = 0; }
3106 | DerivedDef { $$ = $1; }
3110 ModifiesKeyword TemplateRef
3112 $$ = new Ttcn::Reference($2.modid, $2.id);
3113 $$->set_location(infile, @$);
3115 | ModifiesKeyword error { $$ = 0; }
3118 optTemplateFormalParList:
3119 /* empty */ optError { $$ = 0; }
3120 | '(' TemplateFormalParList optError ')'
3123 $$->set_location(infile, @$);
3127 $$ = new FormalParList;
3128 $$->set_location(infile, @$);
3132 TemplateFormalParList: // 99 is a FormalParList*
3133 optError TemplateFormalPar
3135 $$ = new FormalParList;
3138 | TemplateFormalParList optError ',' optError TemplateFormalPar
3143 | TemplateFormalParList optError ',' error { $$ = $1; }
3146 TemplateFormalPar: // 100
3147 FormalValuePar { $$ = $1; }
3148 | FormalTemplatePar { $$ = $1; }
3151 TemplateBody: // 101 is a Template*
3152 SimpleSpec optExtraMatchingAttributes
3155 $$->set_length_restriction($2.len_restr);
3156 $$->set_ifpresent($2.is_ifpresent);
3158 | FieldSpecList optExtraMatchingAttributes
3161 $$->set_length_restriction($2.len_restr);
3162 $$->set_ifpresent($2.is_ifpresent);
3164 | ArraySpecList optExtraMatchingAttributes
3167 $$->set_length_restriction($2.len_restr);
3168 $$->set_ifpresent($2.is_ifpresent);
3170 | ArrayValueOrAttrib optExtraMatchingAttributes
3173 $$->set_length_restriction($2.len_restr);
3174 $$->set_ifpresent($2.is_ifpresent);
3179 SingleValueOrAttrib { $$ = $1; }
3182 FieldSpecList: // 103
3185 $$ = new Template(Template::TEMPLATE_LIST, new Templates());
3186 $$->set_location(infile, @$);
3189 | '{' seqFieldSpec optError '}'
3191 $$ = new Template($2); // NAMED_TEMLATE_LIST
3192 $$->set_location(infile, @$);
3196 $$ = new Template(Template::TEMPLATE_ERROR);
3197 $$->set_location(infile, @$);
3201 /* Sequence of FieldSpec. \note Cannot be empty */
3202 seqFieldSpec: // a NamedTemplates*
3205 $$ = new NamedTemplates();
3210 $$ = new NamedTemplates();
3213 | seqFieldSpec optError ',' optError FieldSpec
3218 | seqFieldSpec optError ',' error { $$ = $1; }
3221 FieldSpec: // 104 a NamedTemplate*
3222 FieldReference AssignmentChar TemplateBody
3224 $$ = new NamedTemplate($1, $3);
3225 $$->set_location(infile, @$);
3227 | FieldReference AssignmentChar NotUsedSymbol
3229 Template* temp = new Template(Template::TEMPLATE_NOTUSED);
3230 temp->set_location(infile, @3);
3231 $$ = new NamedTemplate($1, temp);
3232 $$->set_location(infile, @$);
3236 FieldReference: // 105
3237 StructFieldRef { $$ = $1; }
3238 /* | ArrayOrBitRef -- covered by ArraySpecList */
3239 /* | ParRef -- covered by StructFieldRef */
3242 StructFieldRef: // 106 (and 107. ParRef)
3243 PredefOrIdentifier { $$ = $1; }
3245 Note: Non-parameterized type references are covered by (StructField)Identifier.
3246 Parameterized type references are covered by FunctionInstance */
3249 Location loc(infile, @$);
3250 loc.error("Reference to a parameterized field of type `anytype' is "
3251 "not currently supported");
3253 $$ = new Identifier(Identifier::ID_TTCN, string("<error>"));
3258 '{' seqArraySpec optError '}'
3260 $$ = new Template($2);
3261 $$->set_location(infile, @$);
3268 $$ = new IndexedTemplates();
3271 /* It was optError before. */
3274 $$ = new IndexedTemplates();
3277 | seqArraySpec optError ',' optError ArraySpec
3282 | seqArraySpec optError ',' error { $$ = $1; }
3286 ArrayOrBitRef AssignmentChar TemplateBody
3288 $$ = new IndexedTemplate($1, $3);
3289 $$->set_location(infile, @$);
3293 ArrayOrBitRef: // 109
3296 $$ = new FieldOrArrayRef($2);
3297 $$->set_location(infile, @$);
3301 $$ = new FieldOrArrayRef(new Value(Value::V_ERROR));
3302 $$->set_location(infile, @$);
3306 SingleValueOrAttrib: // 111
3307 MatchingSymbol { $$ = $1; }
3310 if ($1->get_valuetype() == Value::V_OMIT) {
3312 $$ = new Template(Template::OMIT_VALUE);
3313 } else $$ = new Template($1); // SPECIFIC_VALUE; SingleExpr is a Template*
3314 $$->set_location(infile, @$);
3316 /* | TemplateRefWithParList -- covered by SingleExpression */
3319 ArrayValueOrAttrib: // 112
3320 '{' ArrayElementSpecList optError '}'
3322 $$ = new Template(Template::TEMPLATE_LIST, $2);
3323 $$->set_location(infile, @$);
3327 ArrayElementSpecList: // 113
3333 | error ArrayElementSpec
3338 | ArrayElementSpecList optError ',' optError ArrayElementSpec
3343 | ArrayElementSpecList optError ',' error { $$ = $1; }
3346 ArrayElementSpec: // 114 is a Template*
3349 $$ = new Template(Template::TEMPLATE_NOTUSED);
3350 $$->set_location(infile, @$);
3354 $$ = new Template(Template::PERMUTATION_MATCH, $1);
3355 $$->set_location(infile, @$);
3357 | TemplateListElem { $$ = $1; }
3360 NotUsedSymbol: // 115
3364 MatchingSymbol: // 116 is a Template*
3367 $$ = new Template(Template::COMPLEMENTED_LIST, $1);
3368 $$->set_location(infile, @$);
3372 $$ = new Template(Template::ANY_VALUE);
3373 $$->set_location(infile, @$);
3377 $$ = new Template(Template::ANY_OR_OMIT);
3378 $$->set_location(infile, @$);
3382 $$ = new Template(Template::VALUE_LIST, $1);
3383 $$->set_location(infile, @$);
3387 $$ = new Template($1);
3388 $$->set_location(infile, @$);
3392 $$ = new Template(Template::BSTR_PATTERN, $1);
3393 $$->set_location(infile, @$);
3397 $$ = new Template(Template::HSTR_PATTERN, $1);
3398 $$->set_location(infile, @$);
3402 $$ = new Template(Template::OSTR_PATTERN, $1);
3403 $$->set_location(infile, @$);
3407 $$ = new Template($1);
3408 $$->set_location(infile, @$);
3412 $$ = new Template(Template::SUBSET_MATCH, $1);
3413 $$->set_location(infile, @$);
3417 $$ = new Template(Template::SUPERSET_MATCH, $1);
3418 $$->set_location(infile, @$);
3420 | '(' AllElementsFrom ')'
3422 $$ = new Template(Template::VALUE_LIST_ALL_FROM, $2);
3423 $$->set_location(infile, @$);
3427 optExtraMatchingAttributes: // [117]
3430 $$.is_ifpresent = false;
3431 $$.len_restr = NULL;
3436 $$.is_ifpresent = false;
3440 $$.len_restr = NULL;
3441 $$.is_ifpresent = true;
3443 | LengthMatch IfPresentMatch
3446 $$.is_ifpresent = true;
3450 CharStringMatch: // 124
3451 PatternKeyword PatternChunkList
3453 Location loc(infile, @2);
3454 $$ = parse_pattern($2, loc);
3457 | PatternKeyword NocaseKeyword PatternChunkList
3459 // @nocase is ignored for now
3460 Location loc(infile, @3);
3461 $$ = parse_pattern($3, loc);
3471 | PatternChunkList '&' PatternChunk
3474 $$ = mputstr($$, $3);
3486 switch ($1->get_valuetype()) {
3487 case Value::V_REFD: {
3488 /* Pretend to be a reference. Let pstring_la.l discover the
3490 Common::Reference *ref = $1->get_reference();
3491 $$ = mprintf("{%s}", (ref->get_dispname()).c_str());
3493 case Value::V_UNDEF_LOWERID: {
3494 const Common::Identifier *id = $1->get_val_id();
3495 $$ = mprintf("{%s}", (id->get_dispname()).c_str());
3498 FATAL_ERROR("Internal error.");
3500 /* Forget the Node. */
3505 ustring::universal_char& uc = $1->operator[](0);
3506 $$ = mprintf("\\q{%d,%d,%d,%d}", uc.group, uc.plane, uc.row, uc.cell);
3511 Complement: // 130 is a Templates*
3512 ComplementKeyword ValueList { $$ = $2; }
3515 ValueList: // 132 is a Templates*
3516 '(' seqValueOrAttrib optError ')' { $$ = $2; }
3517 | '(' error ')' { $$ = new Templates; }
3520 seqValueOrAttrib: // is a Templates*
3521 optError TemplateListElem
3526 | seqValueOrAttrib optError ',' optError TemplateListElem
3531 | seqValueOrAttrib optError ',' error { $$ = $1; }
3534 SubsetMatch: // 133 is a Templates*
3535 SubsetKeyword ValueList { $$ = $2; }
3538 SupersetMatch: // 135 is a Templates*
3539 SupersetKeyword ValueList { $$ = $2; }
3542 PermutationMatch: // 137 is a Templates*
3543 PermutationKeyword ValueList { $$ = $2; }
3554 TemplateListElem: // is a Template*
3559 AllElementsFrom: // is a Template*
3560 AllKeyword FromKeyword TemplateBody
3561 { // $3 is a Template*
3562 $$ = new Template($3); // Constructs ALL_FROM
3563 $$->set_location(infile, @$);
3567 ValueOrAttribList: // 142 is a Templates*
3568 /* ValueOrAttribList always has two or more elements
3569 * (there's always a comma) and is reduced through
3570 * ValueOrAttribList -> MatchingSymbol -> SingleValueOrAttrib
3572 * The one-element list is reduced through
3573 * '(' SingleExpression ')' -> SingleExpression -> SingleValueOrAttrib */
3574 '(' TemplateListElem optError ',' seqValueOrAttrib optError ')'
3577 $$->add_front_t($2);
3579 | '(' error TemplateListElem optError ',' seqValueOrAttrib optError ')'
3582 $$->add_front_t($3);
3587 StringLength { $$ = $1; }
3590 IfPresentMatch: // 144
3595 '(' SingleLowerBound DotDot UpperBound optError ')'
3596 { $$ = new ValueRange($2, $4); }
3602 if ($1->is_parsed_infinity()==-1) {
3603 /* the conflicting rule alternative faked here: '-' InfinityKeyword */
3615 if ($1->is_parsed_infinity()==-1) {
3616 /* the conflicting rule alternative faked here: '-' InfinityKeyword */
3628 if ($1->is_parsed_infinity()==1) {
3629 /* the conflicting rule alternative faked here: InfinityKeyword */
3638 TemplateInstance: // 151
3639 InLineTemplate { $$ = $1; }
3642 TemplateRefWithParList: /* refbase */ // 153 ?
3643 TemplateRef optTemplateActualParList
3646 $$ = new Ttcn::Ref_pard($1.modid, $1.id, new ParsedActualParameters($2));
3647 $$->set_location(infile, @$);
3649 $$ = new Ttcn::Reference($1.modid, $1.id);
3650 $$->set_location(infile, @$);
3661 | IDentifier '.' IDentifier
3666 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
3674 InLineTemplate: // 155
3677 $$ = new TemplateInstance(0, 0, $1);
3678 $$->set_location(infile, @$);
3680 | Type ':' TemplateBody
3682 $$ = new TemplateInstance($1, 0, $3);
3683 $$->set_location(infile, @$);
3685 /* | Signature ':' TemplateBody -- covered by the previous rule */
3686 | DerivedRefWithParList AssignmentChar TemplateBody
3688 $$ = new TemplateInstance(0, $1, $3);
3689 $$->set_location(infile, @$);
3691 | Type ':' DerivedRefWithParList AssignmentChar TemplateBody
3693 $$ = new TemplateInstance($1, $3, $5);
3694 $$->set_location(infile, @$);
3696 /* | Signature ':' DerivedRefWithParList AssignmentChar TemplateBody
3697 -- covered by the previous rule */
3700 DerivedRefWithParList: // 156
3701 ModifiesKeyword TemplateRefWithParList { $$ = $2; }
3704 optTemplateActualParList: // [157]
3705 /* empty */ optError { $$ = 0; }
3706 | '(' seqTemplateActualPar optError ')'
3709 $$->set_location(infile, @$);
3713 $$ = new TemplateInstances;
3714 $$->set_location(infile, @$);
3718 seqTemplateActualPar:
3719 optError TemplateActualPar
3721 $$ = new TemplateInstances;
3724 | seqTemplateActualPar optError ',' optError TemplateActualPar
3729 | seqTemplateActualPar optError ',' error { $$ = $1; }
3732 TemplateActualPar: // 158
3733 TemplateInstance { $$ = $1; }
3736 Template *t = new Template(Template::TEMPLATE_NOTUSED);
3737 t->set_location(infile, @$);
3738 $$ = new TemplateInstance(0, 0, t);
3739 $$->set_location(infile, @$);
3744 MatchOp { $$ = $1; }
3745 | ValueofOp { $$ = $1; }
3749 MatchKeyword '(' optError Expression optError ',' optError TemplateInstance
3752 $$ = new Value(Value::OPTYPE_MATCH, $4, $8);
3753 $$->set_location(infile, @$);
3755 | MatchKeyword '(' error ')'
3757 Value *v = new Value(Value::V_ERROR);
3758 v->set_location(infile, @3);
3759 Template *t = new Template(Template::TEMPLATE_ERROR);
3760 t->set_location(infile, @3);
3761 TemplateInstance *ti = new TemplateInstance(0, 0, t);
3762 ti->set_location(infile, @3);
3763 $$ = new Value(Value::OPTYPE_MATCH, v, ti);
3764 $$->set_location(infile, @$);
3769 ValueofKeyword '(' optError TemplateInstance optError ')'
3771 $$ = new Value(Value::OPTYPE_VALUEOF, $4);
3772 $$->set_location(infile, @$);
3774 | ValueofKeyword '(' error ')'
3776 Template *t = new Template(Template::TEMPLATE_ERROR);
3777 t->set_location(infile, @3);
3778 TemplateInstance *ti = new TemplateInstance(0, 0, t);
3779 ti->set_location(infile, @3);
3780 $$ = new Value(Value::OPTYPE_VALUEOF, ti);
3781 $$->set_location(infile, @$);
3785 /* A.1.6.1.4 Function definitions */
3788 FunctionKeyword IDentifier '(' optFunctionFormalParList ')'
3789 optRunsOnSpec optReturnType optError StatementBlock
3791 $4->set_location(infile, @3, @5);
3792 $$ = new Def_Function($2, $4, $6, $7.type, $7.returns_template,
3793 $7.template_restriction, $9);
3794 $$->set_location(infile, @$);
3798 optFunctionFormalParList: // [167]
3799 /* empty */ { $$ = new FormalParList; }
3800 | FunctionFormalParList { $$ = $1; }
3801 | error { $$ = new FormalParList; }
3804 FunctionFormalParList: // 167
3805 optError FunctionFormalPar
3807 $$ = new FormalParList;
3810 | FunctionFormalParList optError ',' optError FunctionFormalPar
3815 | FunctionFormalParList optError ',' error { $$ = $1; }
3818 FunctionFormalPar: // 168
3819 FormalValuePar { $$ = $1; }
3820 | FormalTimerPar { $$ = $1; }
3821 | FormalTemplatePar { $$ = $1; }
3822 /*| FormalPortPar -- covered by FormalValuePar */
3825 optReturnType: // [169]
3829 $$.returns_template = false;
3830 $$.template_restriction = TR_NONE;
3832 | ReturnKeyword Type
3835 $$.returns_template = false;
3836 $$.template_restriction = TR_NONE;
3838 | ReturnKeyword TemplateOptRestricted Type
3841 $$.returns_template = true;
3842 $$.template_restriction = $2;
3844 | ReturnKeyword error
3847 $$.returns_template = false;
3848 $$.template_restriction = TR_NONE;
3852 optRunsOnComprefOrSelf:
3858 | RunsKeyword OnKeyword SelfKeyword
3866 /* empty */ { $$ = 0; }
3867 | RunsOnSpec { $$ = $1; }
3868 | RunsKeyword error { $$ = 0; }
3872 RunsKeyword OnKeyword ComponentType { $$ = $3; }
3875 /* StatementBlock changed in 4.1.2 to explicitly prevent statements
3876 * followed by definitions. TITAN still allows them to be mixed. */
3877 StatementBlock: /* StatementBlock *statementblock */ // 175
3880 $$ = new StatementBlock;
3881 $$->set_location(infile, @$);
3883 | '{' FunctionStatementOrDefList optError '}'
3886 $$->set_location(infile, @$);
3890 FunctionStatementOrDefList: // (171 in 3.2.1)
3891 optError FunctionStatementOrDef optSemiColon
3893 $$ = new StatementBlock;
3894 for(size_t i=0; i<$2.nElements; i++) $$->add_stmt($2.elements[i]);
3897 | FunctionStatementOrDefList optError FunctionStatementOrDef optSemiColon
3900 for(size_t i=0; i<$3.nElements; i++) $$->add_stmt($3.elements[i]);
3905 FunctionStatementOrDef: // (172 in 3.2.1)
3906 FunctionLocalDef // constant or template definition
3908 $$.nElements=$1.nElements;
3909 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3910 for(size_t i=0; i<$1.nElements; i++) {
3911 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
3912 $$.elements[i]->set_location(*$1.elements[i]);
3916 | FunctionLocalInst // variable or timer instance
3918 $$.nElements=$1.nElements;
3919 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3920 for(size_t i=0; i<$1.nElements; i++) {
3921 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
3922 $$.elements[i]->set_location(*$1.elements[i]);
3929 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3934 FunctionLocalInst: // 178
3935 VarInstance { $$=$1; }
3936 | TimerInstance { $$=$1; }
3939 FunctionLocalDef: // 179
3945 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
3946 $$.elements[0] = $1;
3950 FunctionStatement: // 180
3951 ConfigurationStatements {$$=$1;}
3952 | TimerStatements {$$=$1;}
3953 | CommunicationStatements {$$=$1;}
3954 | BasicStatements {$$=$1;}
3955 | BehaviourStatements {$$=$1;}
3956 | VerdictStatements {$$=$1;}
3957 | SUTStatements {$$=$1;}
3958 | StopExecutionStatement { $$ = $1; }
3959 | StopTestcaseStatement { $$ = $1; }
3960 | ProfilerStatement { $$ = $1; }
3961 | int2enumStatement { $$ = $1; }
3964 FunctionInstance: /* refpard */ // 181
3965 FunctionRef '(' optFunctionActualParList ')'
3966 /* templateref templinsts */
3968 $3->set_location(infile, @2, @4);
3969 $$ = new Ttcn::Ref_pard($1.modid, $1.id, $3);
3970 $$->set_location(infile, @$);
3980 | IDentifier '.' IDentifier
3985 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
3993 optFunctionActualParList: /* parsedpar */ // [185]
3994 /* empty */ optError { $$ = new ParsedActualParameters; }
3995 | FunctionActualParList optError { $$ = $1; }
3998 /* ***** this * can * not * be * empty ****************** */
3999 FunctionActualParList: /* parsedpar */ // 184
4002 | UnnamedPart ',' NamedPart
4003 /* Splitting the NamedPart and UnnamedPart ensures that a named parameter
4004 * followed by an unnamed one causes a syntax error */
4006 /* UnnamedPart becomes the value */
4008 /* append the elements from NamedPart */
4009 const size_t n3 = $3->get_nof_nps();
4010 for (size_t i = 0; i < n3; ++i) {
4011 $$->add_np( $3->extract_np_byIndex(i) );
4017 UnnamedPart: /* parsedpar */
4018 /*optError*/ FunctionActualPar
4020 $$ = new ParsedActualParameters;
4023 | UnnamedPart /*optError*/ ',' /*optError*/ FunctionActualPar
4024 /* These optErrors mess up the parsing of actual parameters.
4025 * After only one FunctionActualPar, it is reduced to UnnamedPart
4026 * and the rest is expected to be the NamedPart */
4031 | UnnamedPart optError ',' error { $$ = $1; }
4034 NamedPart: /* parsedpar */
4035 seqFieldSpec /* namedtempls */
4037 $$ = new ParsedActualParameters(0, new NamedParams);
4038 const size_t n1 = $1->get_nof_nts();
4039 for (size_t i = 0; i < n1; ++i) {
4040 NamedTemplate *pnt = $1->get_nt_byIndex(i);
4041 TemplateInstance *pti = new TemplateInstance(0,0,pnt->extract_template());
4042 NamedParam *pnp = new NamedParam(pnt->get_name().clone(), pti);
4043 pnp->set_location(*pnt);
4047 $$->set_location(infile, @$);
4048 // This call to ParsedActualParameters::set_location copies the same
4049 // location info to the named and unnamed part. We cannot copy
4050 // the location info from the NamedTemplates to the named part,
4051 // because NamedTemplates is not a Location.
4055 FunctionActualPar: /* templinst */ // 185
4057 TemplateInstance { $$ = $1; }
4060 Template *t = new Template(Template::TEMPLATE_NOTUSED);
4061 t->set_location(infile, @$);
4062 $$ = new TemplateInstance(0, 0, t);
4063 $$->set_location(infile, @$);
4066 | ComponentRef -- TemplateInstance covers all the others */
4070 Reference DotApplyKeyword '(' optFunctionActualParList ')'
4072 if($1.is_ref) $$.value = new Value(Value::V_REFD, $1.ref);
4074 Ttcn::Reference *t_ref = new Ttcn::Reference($1.id);
4075 t_ref->set_location(infile, @1);
4076 $$.value = new Value(Value::V_REFD, t_ref);
4078 $$.value->set_location(infile, @1);
4080 $$.ap_list->set_location(infile, @3 , @5);
4082 | FunctionInstance DotApplyKeyword '(' optFunctionActualParList ')'
4084 $$.value = new Value(Value::V_REFD, $1);
4085 $$.value->set_location(infile, @1);
4087 $$.ap_list->set_location(infile, @3 , @5);
4089 | ApplyOp DotApplyKeyword '(' optFunctionActualParList ')'
4091 $$.value = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
4092 $$.value->set_location(infile, @1);
4094 $$.ap_list->set_location(infile, @3 , @5);
4099 DerefersKeyword '(' Expression ')' { $$ = $3; }
4102 /* A.1.6.1.5 Signature definitions */
4104 SignatureDef: // 187
4105 SignatureKeyword IDentifier
4106 '(' optSignatureFormalParList ')' optReturnTypeOrNoBlockKeyword
4109 Type *type = new Type(Type::T_SIGNATURE, $4, $6.type, $6.no_block_kw, $7);
4110 type->set_location(infile, @3, @7);
4111 $$ = new Ttcn::Def_Type($2, type);
4112 $$->set_location(infile, @$);
4116 optSignatureFormalParList: // [190]
4117 /* empty */ { $$ = 0; }
4118 | SignatureFormalParList { $$ = $1; }
4122 SignatureFormalParList: // 190
4123 optError SignatureFormalPar
4125 $$ = new SignatureParamList;
4128 | SignatureFormalParList optError ',' optError SignatureFormalPar
4133 | SignatureFormalParList optError ',' error { $$ = $1; }
4136 SignatureFormalPar: // 191
4139 $$ = new SignatureParam(SignatureParam::PARAM_IN, $1, $2);
4140 $$->set_location(infile, @$);
4142 | InParKeyword Type IDentifier
4144 $$ = new SignatureParam(SignatureParam::PARAM_IN, $2, $3);
4145 $$->set_location(infile, @$);
4147 | InOutParKeyword Type IDentifier
4149 $$ = new SignatureParam(SignatureParam::PARAM_INOUT, $2, $3);
4150 $$->set_location(infile, @$);
4152 | OutParKeyword Type IDentifier
4154 $$ = new SignatureParam(SignatureParam::PARAM_OUT, $2, $3);
4155 $$->set_location(infile, @$);
4159 optReturnTypeOrNoBlockKeyword:
4163 $$.no_block_kw = false;
4165 | ReturnKeyword Type
4168 $$.no_block_kw = false;
4173 $$.no_block_kw = true;
4177 optExceptionSpec: // [192]
4178 /* empty */ { $$ = NULL; }
4179 | ExceptionKeyword '(' error ')' { $$ = NULL; }
4180 | ExceptionKeyword '(' ExceptionTypeList optError ')'
4183 $$->set_location(infile, @$);
4187 ExceptionTypeList: // 194
4190 $$ = new SignatureExceptions;
4193 | ExceptionTypeList optError ',' optError Type
4198 | ExceptionTypeList optError ',' error { $$ = $1; }
4204 $$ = new Ttcn::Reference($1);
4205 $$->set_location(infile, @$);
4207 | IDentifier '.' IDentifier
4209 $$ = new Ttcn::Reference($1, $3);
4210 $$->set_location(infile, @$);
4212 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4214 $$ = new Ttcn::Reference($1, $5);
4215 $$->set_location(infile, @$);
4220 /* A.1.6.1.6 Testcase definitions */
4223 TestcaseKeyword IDentifier '(' optTestcaseFormalParList ')'
4224 ConfigSpec optError StatementBlock
4226 $4->set_location(infile, @3, @5);
4227 $$ = new Def_Testcase($2, $4, $6.runsonref, $6.systemref, $8);
4228 $$->set_location(infile, @$);
4232 optTestcaseFormalParList: // [200]
4233 /* empty */ { $$ = new FormalParList; }
4234 | TestcaseFormalParList { $$ = $1; }
4235 | error { $$ = new FormalParList; }
4238 TestcaseFormalParList: // 200
4239 optError TestcaseFormalPar
4241 $$ = new FormalParList;
4244 | TestcaseFormalParList optError ',' optError TestcaseFormalPar
4249 | TestcaseFormalParList optError ',' error { $$ = $1; }
4252 TestcaseFormalPar: // 201
4253 FormalValuePar { $$ = $1; }
4254 | FormalTemplatePar { $$ = $1; }
4258 RunsOnSpec optSystemSpec
4265 optSystemSpec: // [203]
4266 /* empty */ { $$ = 0; }
4267 | SystemKeyword ComponentType { $$ = $2; }
4268 | SystemKeyword error { $$ = 0; }
4271 TestcaseInstance: // 205
4272 ExecuteKeyword '(' TestcaseRef '(' optTestcaseActualParList ')'
4273 optTestcaseTimerValue optError ')'
4275 $5->set_location(infile, @4, @6);
4276 $$.ref_pard = new Ttcn::Ref_pard($3.modid, $3.id, $5);
4277 $$.ref_pard->set_location(infile, @3, @6);
4278 $$.derefered_value = 0;
4282 | ExecuteKeyword '(' DereferOp '(' optTestcaseActualParList ')'
4283 optTestcaseTimerValue optError ')'
4285 $5->set_location(infile, @4, @6);
4287 $$.derefered_value = $3;
4291 | ExecuteKeyword '(' error ')'
4294 $$.derefered_value = 0;
4306 | IDentifier '.' IDentifier
4311 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4319 optTestcaseTimerValue:
4320 /* empty */ { $$ = 0; }
4321 | ',' optError Expression { $$ = $3; }
4324 $$ = new Value(Value::V_ERROR);
4325 $$->set_location(infile, @$);
4329 optTestcaseActualParList: // [202]
4330 /* empty */ optError { $$ = new ParsedActualParameters; }
4331 | TestcaseActualParList optError { $$ = $1; }
4334 TestcaseActualParList: // 208
4337 | UnnamedPart ',' NamedPart
4338 /* Splitting the NamedPart and UnnamedPart ensures that a named parameter
4339 * followed by an unnamed one causes a syntax error */
4341 /* UnnamedPart becomes the value */
4343 /* append the elements from NamedPart */
4344 const size_t n3 = $3->get_nof_nps();
4345 for (size_t i = 0; i < n3; ++i) {
4346 $$->add_np( $3->extract_np_byIndex(i) );
4352 optError TestcaseActualPar
4354 $$ = new TemplateInstances;
4357 | TestcaseActualParList optError ',' optError TestcaseActualPar
4362 | TestcaseActualParList optError ',' error { $$ = $1; }
4368 TemplateInstance { $$ = $1; }
4371 Template *t = new Template(Template::TEMPLATE_NOTUSED);
4372 t->set_location(infile, @$);
4373 $$ = new TemplateInstance(0, 0, t);
4374 $$->set_location(infile, @$);
4379 /* A.1.6.1.7 Altstep definitions */
4382 AltstepKeyword IDentifier '(' optAltstepFormalParList ')' optRunsOnSpec
4383 optError '{' AltstepLocalDefList AltGuardList optError '}'
4385 StatementBlock *sb = new StatementBlock;
4386 for (size_t i = 0; i < $9.nElements; i++) {
4387 Statement *stmt = new Statement(Statement::S_DEF, $9.elements[i]);
4388 stmt->set_location(*$9.elements[i]);
4392 $4->set_location(infile, @4);
4393 $$ = new Def_Altstep($2, $4, $6, sb, $10);
4394 $$->set_location(infile, @$);
4398 optAltstepFormalParList: // [214]
4399 /* empty */ { $$ = new FormalParList; }
4400 | FunctionFormalParList { $$ = $1; }
4401 | error { $$ = new FormalParList; }
4404 AltstepLocalDefList: // 215
4410 | AltstepLocalDefList optError AltstepLocalDef optSemiColon
4412 $$.nElements = $1.nElements + $3.nElements;
4413 $$.elements = (Ttcn::Definition**)
4414 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4415 memcpy($$.elements + $1.nElements, $3.elements,
4416 $3.nElements * sizeof(*$$.elements));
4421 AltstepLocalDef: // 216
4422 VarInstance { $$ = $1; }
4423 | TimerInstance { $$ = $1; }
4424 | ConstDef { $$ = $1; }
4429 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
4430 $$.elements[0] = $1;
4434 AltstepInstance: /* refpard */ // 217
4435 FunctionRef '(' optFunctionActualParList ')'
4437 $3->set_location(infile, @2, @4);
4438 $$ = new Ttcn::Ref_pard($1.modid, $1.id, $3);
4439 $$->set_location(infile, @$);
4443 /* Taken over by FunctionRef
4446 | IDentifier '.' IDentifier
4447 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4451 /* A.1.6.1.8 Import definitions */
4454 ImportKeyword ImportFromSpec AllWithExcepts
4456 $2->set_imptype(ImpMod::I_ALL);
4457 $2->set_location(infile, @$);
4461 | ImportKeyword ImportFromSpec '{' ImportSpec '}'
4463 Location loc(infile, @$);
4464 if ( $4 == ImpMod::I_IMPORTSPEC) {
4465 loc.warning("Unsupported selective import statement was treated as "
4468 $2->set_imptype($4);
4469 $2->set_location(infile, @$);
4475 AllWithExcepts: // 221
4477 | AllKeyword ExceptsDef
4479 Location loc(infile, @$);
4480 loc.warning("Unsupported selective import statement was treated as "
4486 ExceptKeyword '{' ExceptSpec '}'
4490 /* empty */ optError
4491 | ExceptSpec ExceptElement optSemiColon
4494 ExceptElement: // 225
4497 | ExceptTemplateSpec
4499 | ExceptTestcaseSpec
4501 | ExceptFunctionSpec
4502 | ExceptSignatureSpec
4503 | ExceptModuleParSpec
4506 ExceptGroupSpec: // 226
4507 GroupKeyword ExceptGroupRefList
4508 | GroupKeyword AllKeyword
4511 ExceptTypeDefSpec: // 227
4512 TypeDefKeyword TypeRefList
4513 | TypeDefKeyword AllKeyword
4516 ExceptTemplateSpec: // 228
4517 TemplateKeyword TemplateRefList
4518 | TemplateKeyword AllKeyword
4521 ExceptConstSpec: // 229
4522 ConstKeyword ConstRefList
4523 | ConstKeyword AllKeyword
4526 ExceptTestcaseSpec: // 230
4527 TestcaseKeyword TestcaseRefList
4528 | TestcaseKeyword AllKeyword
4531 ExceptAltstepSpec: // 231
4532 AltstepKeyword AltstepRefList
4533 | AltstepKeyword AllKeyword
4536 ExceptFunctionSpec: // 232
4537 FunctionKeyword FunctionRefList
4538 | FunctionKeyword AllKeyword
4541 ExceptSignatureSpec: // 233
4542 SignatureKeyword SignatureRefList
4543 | SignatureKeyword AllKeyword
4546 ExceptModuleParSpec: // 234
4547 ModuleParKeyword ModuleParRefList
4548 | ModuleParKeyword AllKeyword
4552 /* empty */ optError
4553 { $$ = ImpMod::I_ALL; }
4554 | ImportSpec ImportElement optSemiColon
4557 case ImpMod::I_ALL: // it was empty before
4561 case ImpMod::I_IMPORTSPEC:
4563 case ImpMod::I_IMPORTSPEC:
4564 // selective import followed by another selective import: NOP
4566 case ImpMod::I_IMPORTIMPORT:
4567 $$ = $2; // import of import wins over selective import
4569 default: // including I_ALL
4570 FATAL_ERROR("Selective import cannot be followed by import all");
4574 case ImpMod::I_IMPORTIMPORT:
4576 case ImpMod::I_IMPORTSPEC:
4577 // import of import followed by selective import: NOP (import of import wins)
4579 case ImpMod::I_IMPORTIMPORT:
4580 // import of import following another import of import: error
4581 Location(infile, @2).error("Import of imports can only be used once");
4583 default: // including I_ALL
4584 FATAL_ERROR("Import of imports cannot be followed by import all");
4589 FATAL_ERROR("Invalid import type");
4594 ImportElement: // 236
4596 { $$ = ImpMod::I_IMPORTSPEC; }
4598 { $$ = ImpMod::I_IMPORTSPEC; }
4599 | ImportTemplateSpec
4600 { $$ = ImpMod::I_IMPORTSPEC; }
4602 { $$ = ImpMod::I_IMPORTSPEC; }
4603 | ImportTestcaseSpec
4604 { $$ = ImpMod::I_IMPORTSPEC; }
4606 { $$ = ImpMod::I_IMPORTSPEC; }
4607 | ImportFunctionSpec
4608 { $$ = ImpMod::I_IMPORTSPEC; }
4609 | ImportSignatureSpec
4610 { $$ = ImpMod::I_IMPORTSPEC; }
4611 | ImportModuleParSpec
4612 { $$ = ImpMod::I_IMPORTSPEC; }
4614 { $$ = ImpMod::I_IMPORTIMPORT; }
4618 ImportKeyword AllKeyword
4620 ImportFromSpec: // 237
4621 FromKeyword ModuleId { $$ = $2; }
4622 | FromKeyword ModuleId RecursiveKeyword // already deprecated in v3.2.1
4625 $$->set_recursive();
4629 ImportGroupSpec: // 239
4630 GroupKeyword GroupRefListWithExcept
4631 | GroupKeyword AllGroupsWithExcept
4632 | GroupKeyword error
4635 GroupRefList: // 240
4636 optError FullGroupIdentifier { delete $2; }
4637 | GroupRefList optError ',' optError FullGroupIdentifier { delete $5; }
4638 | GroupRefList optError ',' error
4641 GroupRefListWithExcept: // 241
4642 optError FullGroupIdentifierWithExcept
4643 | GroupRefListWithExcept optError ',' optError FullGroupIdentifierWithExcept
4644 | GroupRefListWithExcept optError ',' error
4647 AllGroupsWithExcept: // 242
4650 | AllKeyword ExceptKeyword GroupRefList
4651 | AllKeyword ExceptKeyword error
4654 FullGroupIdentifier: // 243
4657 $$ = new Qualifier();
4658 $$->add(new FieldOrArrayRef($1));
4659 $$->set_location(infile, @$);
4661 | FullGroupIdentifier '.' IDentifier
4664 $$->add(new FieldOrArrayRef($3));
4665 $$->set_location(infile, @$);
4669 FullGroupIdentifierWithExcept: // 244
4670 FullGroupIdentifier { delete $1; }
4671 | FullGroupIdentifier ExceptsDef { delete $1; }
4674 ExceptGroupRefList: // 245
4675 optError ExceptFullGroupIdentifier
4676 | ExceptGroupRefList optError ',' optError ExceptFullGroupIdentifier
4677 | ExceptGroupRefList optError ',' error
4680 ExceptFullGroupIdentifier: // 246
4681 FullGroupIdentifier { delete $1;}
4684 ImportTypeDefSpec: // 247
4685 TypeDefKeyword TypeRefList
4686 | TypeDefKeyword AllTypesWithExcept
4687 | TypeDefKeyword error
4691 optError IDentifier { delete $2; }
4692 | TypeRefList optError ',' optError IDentifier { delete $5; }
4693 | TypeRefList optError ',' error
4696 AllTypesWithExcept: // 249
4699 | AllKeyword ExceptKeyword TypeRefList
4700 | AllKeyword ExceptKeyword error
4703 /* 250. TypeDefIdentifier is replaced by IDentifier */
4705 ImportTemplateSpec: // 251
4706 TemplateKeyword TemplateRefList
4707 | TemplateKeyword AllTemplsWithExcept
4708 | TemplateKeyword error
4711 TemplateRefList: // 252
4712 optError IDentifier { delete $2; }
4713 | TemplateRefList optError ',' optError IDentifier { delete $5; }
4714 | TemplateRefList optError ',' error
4717 AllTemplsWithExcept: // 253
4720 | AllKeyword ExceptKeyword TemplateRefList
4721 | AllKeyword ExceptKeyword error
4724 ImportConstSpec: // 254
4725 ConstKeyword ConstRefList
4726 | ConstKeyword AllConstsWithExcept
4727 | ConstKeyword error
4730 ConstRefList: // 255
4731 optError IDentifier { delete $2; }
4732 | ConstRefList optError ',' optError IDentifier { delete $5; }
4733 | ConstRefList optError ',' error
4736 AllConstsWithExcept: // 256
4739 | AllKeyword ExceptKeyword ConstRefList
4740 | AllKeyword ExceptKeyword error
4743 ImportAltstepSpec: // 257
4744 AltstepKeyword AltstepRefList
4745 | AltstepKeyword AllAltstepsWithExcept
4746 | AltstepKeyword error
4749 AltstepRefList: // 258
4750 optError IDentifier { delete $2; }
4751 | AltstepRefList optError ',' optError IDentifier { delete $5; }
4752 | AltstepRefList optError ',' error
4755 AllAltstepsWithExcept: // 259
4758 | AllKeyword ExceptKeyword AltstepRefList
4759 | AllKeyword ExceptKeyword error
4762 ImportTestcaseSpec: // 260
4763 TestcaseKeyword TestcaseRefList
4764 | TestcaseKeyword AllTestcasesWithExcept
4765 | TestcaseKeyword error
4768 TestcaseRefList: // 261
4769 optError IDentifier { delete $2; }
4770 | TestcaseRefList optError ',' optError IDentifier { delete $5; }
4771 | TestcaseRefList optError ',' error
4774 AllTestcasesWithExcept: // 262
4777 | AllKeyword ExceptKeyword TestcaseRefList
4778 | AllKeyword ExceptKeyword error
4781 ImportFunctionSpec: // 263
4782 FunctionKeyword FunctionRefList
4783 | FunctionKeyword AllFunctionsWithExcept
4784 | FunctionKeyword error
4787 FunctionRefList: // 264
4788 optError IDentifier { delete $2; }
4789 | FunctionRefList optError ',' optError IDentifier { delete $5; }
4790 | FunctionRefList optError ',' error
4793 AllFunctionsWithExcept: // 265
4796 | AllKeyword ExceptKeyword FunctionRefList
4797 | AllKeyword ExceptKeyword error
4800 ImportSignatureSpec: // 266
4801 SignatureKeyword SignatureRefList
4802 | SignatureKeyword AllSignaturesWithExcept
4803 | SignatureKeyword error
4806 SignatureRefList: // 267
4807 optError IDentifier { delete $2; }
4808 | SignatureRefList optError ',' optError IDentifier { delete $5; }
4809 | SignatureRefList optError ',' error
4812 AllSignaturesWithExcept: // 268
4815 | AllKeyword ExceptKeyword SignatureRefList
4816 | AllKeyword ExceptKeyword error
4819 ImportModuleParSpec: // 269
4820 ModuleParKeyword ModuleParRefList
4821 | ModuleParKeyword AllModuleParWithExcept
4822 | ModuleParKeyword error
4825 ModuleParRefList: // 270
4826 optError IDentifier { delete $2; }
4827 | ModuleParRefList optError ',' optError IDentifier { delete $5; }
4828 | ModuleParRefList optError ',' error
4831 AllModuleParWithExcept: // 271
4834 | AllKeyword ExceptKeyword ModuleParRefList
4835 | AllKeyword ExceptKeyword error
4838 // 272 ImportImportSpec: ImportKeyword AllKeyword
4840 /* A.1.6.1.9 Group definitions */
4843 GroupIdentifier '{' optErrorBlock '}'
4846 $$->set_location(infile, @$);
4848 | GroupIdentifier '{' ModuleDefinitionsList optErrorBlock '}'
4851 $$->set_location(infile, @$);
4855 GroupIdentifier: // 274 (followed by) 275.
4856 GroupKeyword IDentifier
4859 $$->set_parent_group(act_group);
4860 $$->set_location(infile, @$);
4862 act_group->add_group($$);
4863 $$->set_parent_path(act_group->get_attrib_path());
4865 act_ttcn3_module->add_group($$);
4866 $$->set_parent_path(act_ttcn3_module->get_attrib_path());
4872 /* A.1.6.1.10 External function definitions */
4874 ExtFunctionDef: // 276
4875 ExtKeyword FunctionKeyword IDentifier
4876 '(' optFunctionFormalParList ')' optReturnType
4878 $5->set_location(infile, @4, @6);
4879 $$ = new Def_ExtFunction($3, $5, $7.type, $7.returns_template,
4880 $7.template_restriction);
4881 $$->set_location(infile, @$);
4885 /* A.1.6.1.11 External constant definitions */
4888 ExtKeyword ConstKeyword Type IdentifierList
4890 $$.nElements = $4.nElements;
4891 $$.elements = (Ttcn::Definition**)
4892 Malloc($$.nElements * sizeof(*$$.elements));
4893 for (size_t i = 0; i < $$.nElements; i++) {
4896 type = new Type(Type::T_REFDSPEC, $3);
4897 type->set_location(*$3);
4899 $$.elements[i] = new Ttcn::Def_ExtConst($4.elements[i].id, type);
4900 $$.elements[i]->set_location(infile, $4.elements[i].yyloc);
4906 IdentifierList: // 280 ExtConstIdentifierList
4910 $$.elements = (YYSTYPE::extconstidentifier_t*)Malloc(sizeof(*$$.elements));
4911 $$.elements[0].id = $2;
4912 $$.elements[0].yyloc = @2;
4914 | IdentifierList ',' optError IDentifier
4916 $$.nElements = $1.nElements + 1;
4917 $$.elements = (YYSTYPE::extconstidentifier_t*)
4918 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4919 $$.elements[$1.nElements].id = $4;
4920 $$.elements[$1.nElements].yyloc = @4;
4922 | IdentifierList ',' error { $$ = $1; }
4925 /* A.1.6.1.12 Module parameter definitions */
4927 ModuleParDef: // 282
4928 ModuleParKeyword ModulePar { $$ = $2; }
4929 | ModuleParKeyword '{' MultiTypedModuleParList optError '}' { $$ = $3; }
4930 | ModuleParKeyword '{' error '}' { $$.nElements = 0; $$.elements = NULL; }
4933 MultiTypedModuleParList: // 284
4934 optError ModulePar optSemiColon { $$ = $2; }
4935 | MultiTypedModuleParList optError ModulePar optSemiColon
4937 $$.nElements = $1.nElements + $3.nElements;
4938 $$.elements = (Ttcn::Definition**)
4939 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4940 memcpy($$.elements + $1.nElements, $3.elements,
4941 $3.nElements * sizeof(*$$.elements));
4949 $$.nElements = $2.nElements;
4950 $$.elements = (Ttcn::Definition**)
4951 Malloc($$.nElements * sizeof(*$$.elements));
4952 for(size_t i = 0; i < $2.nElements; i++) {
4955 type = new Type(Type::T_REFDSPEC, $1);
4956 type->set_location(*$1);
4958 $$.elements[i] = new Def_Modulepar($2.elements[i].id, type,
4959 $2.elements[i].defval);
4960 $$.elements[i]->set_location(infile, $2.elements[i].yyloc);
4964 | TemplateKeyword Type TemplateModuleParList
4966 $$.nElements = $3.nElements;
4967 $$.elements = (Ttcn::Definition**)Malloc($$.nElements * sizeof(*$$.elements));
4968 for(size_t i = 0; i < $3.nElements; i++) {
4971 type = new Type(Type::T_REFDSPEC, $2);
4972 type->set_location(*$2);
4974 $$.elements[i] = new Def_Modulepar_Template($3.elements[i].id, type, $3.elements[i].deftempl);
4975 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
4981 ModuleParList: // 287
4982 optError SingleModulePar
4985 $$.elements = (YYSTYPE::singlemodulepar_t*)Malloc(sizeof(*$$.elements));
4986 $$.elements[0] = $2;
4988 | ModuleParList ',' optError SingleModulePar
4990 $$.nElements = $1.nElements + 1;
4991 $$.elements = (YYSTYPE::singlemodulepar_t*)
4992 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4993 $$.elements[$$.nElements - 1] = $4;
4997 TemplateModuleParList: // 287
4998 optError SingleTemplateModulePar
5001 $$.elements = (YYSTYPE::singletemplatemodulepar_t*)Malloc(sizeof(*$$.elements));
5002 $$.elements[0] = $2;
5004 | TemplateModuleParList ',' optError SingleTemplateModulePar
5006 $$.nElements = $1.nElements + 1;
5007 $$.elements = (YYSTYPE::singletemplatemodulepar_t*)
5008 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5009 $$.elements[$$.nElements - 1] = $4;
5020 | IDentifier AssignmentChar Expression
5028 SingleTemplateModulePar:
5035 | IDentifier AssignmentChar TemplateBody
5044 FriendModuleDef: // 289
5045 FriendKeyword TTCN3ModuleKeyword IdentifierList optSemiColon
5047 $$.nElements = $3.nElements;
5048 $$.elements = (Ttcn::FriendMod**)
5049 Malloc($$.nElements*sizeof(*$$.elements));
5050 for (size_t i = 0; i < $$.nElements; i++) {
5051 $$.elements[i] = new FriendMod($3.elements[i].id);
5052 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
5058 /* A.1.6.2 Control part */
5060 /* A.1.6.2.0 General */
5062 ModuleControlPart: // 290
5063 optError ControlKeyword
5064 '{' ModuleControlBody '}'
5065 optWithStatementAndSemiColon
5067 ControlPart* controlpart = new ControlPart($4);
5068 controlpart->set_location(infile, @2, @6);
5069 controlpart->set_with_attr($6);
5070 controlpart->set_parent_path(act_ttcn3_module->get_attrib_path());
5071 act_ttcn3_module->add_controlpart(controlpart);
5075 ModuleControlBody: // 292
5076 /* empty */ optError { $$=new StatementBlock(); }
5077 | ControlStatementOrDefList { $$ = $1; }
5080 ControlStatementOrDefList: // 293
5081 optError ControlStatementOrDef optSemiColon
5083 $$=new StatementBlock();
5084 for(size_t i=0; i<$2.nElements; i++) $$->add_stmt($2.elements[i]);
5087 | ControlStatementOrDefList optError ControlStatementOrDef optSemiColon
5090 for(size_t i=0; i<$3.nElements; i++) $$->add_stmt($3.elements[i]);
5095 ControlStatementOrDef: // 294
5098 $$.nElements=$1.nElements;
5099 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5100 for(size_t i=0; i<$1.nElements; i++) {
5101 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
5102 $$.elements[i]->set_location(*$1.elements[i]);
5108 $$.nElements=$1.nElements;
5109 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5110 for(size_t i=0; i<$1.nElements; i++) {
5111 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
5112 $$.elements[i]->set_location(*$1.elements[i]);
5119 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5124 ControlStatement: /* Statement *stmt */ // 295
5125 TimerStatements { $$ = $1; }
5126 | BasicStatements { $$ = $1; }
5127 | BehaviourStatements { $$ = $1; }
5128 | SUTStatements { $$ = $1; }
5129 | StopExecutionStatement { $$ = $1; }
5130 | ProfilerStatement { $$ = $1; }
5131 | int2enumStatement { $$ = $1; }
5134 /* A.1.6.2.1 Variable instantiation */
5137 VarKeyword Type VarList
5139 $$.nElements = $3.nElements;
5140 $$.elements = (Ttcn::Definition**)
5141 Malloc($$.nElements*sizeof(*$$.elements));
5142 for (size_t i = 0; i < $$.nElements; i++) {
5145 type = new Type(Type::T_REFDSPEC, $2);
5146 type->set_location(*$2);
5148 /* creation of array type(s) if necessary (from right to left) */
5149 for (size_t j = $3.elements[i].arrays.nElements; j > 0; j--) {
5150 type = new Type(Type::T_ARRAY, type,
5151 $3.elements[i].arrays.elements[j - 1], false);
5152 type->set_location(*$2);
5154 Free($3.elements[i].arrays.elements);
5156 /* Create the definition */
5157 $$.elements[i] = new Def_Var($3.elements[i].id,
5158 type, $3.elements[i].initial_value);
5159 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
5163 | VarKeyword TemplateOptRestricted Type TempVarList
5165 $$.nElements = $4.nElements;
5166 $$.elements = (Ttcn::Definition**)
5167 Malloc($$.nElements * sizeof(*$$.elements));
5168 for (size_t i = 0; i < $$.nElements; i++) {
5171 type = new Type(Type::T_REFDSPEC, $3);
5172 type->set_location(*$3);
5174 /* creation of array type(s) if necessary (from right to left) */
5175 for (size_t j = $4.elements[i].arrays.nElements; j > 0; j--) {
5176 type = new Type(Type::T_ARRAY, type,
5177 $4.elements[i].arrays.elements[j - 1], false);
5178 type->set_location(*$3);
5180 Free($4.elements[i].arrays.elements);
5182 /* Create the definition */
5183 $$.elements[i] = new Def_Var_Template($4.elements[i].id, type,
5184 $4.elements[i].initial_value, $2);
5185 $$.elements[i]->set_location(infile, $4.elements[i].yyloc);
5193 optError SingleVarInstance
5196 $$.elements = (YYSTYPE::singlevarinst_t*)Malloc(sizeof(*$$.elements));
5197 $$.elements[0] = $2;
5199 | VarList ',' optError SingleVarInstance
5201 $$.nElements = $1.nElements + 1;
5202 $$.elements = (YYSTYPE::singlevarinst_t*)
5203 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5204 $$.elements[$$.nElements - 1] = $4;
5208 SingleVarInstance: // 298
5209 IDentifier optArrayDef
5213 $$.initial_value = 0;
5216 | IDentifier optArrayDef AssignmentChar Expression
5220 $$.initial_value = $4;
5226 optError SingleTempVarInstance
5229 $$.elements = (YYSTYPE::singletempvarinst_t*)Malloc(sizeof(*$$.elements));
5230 $$.elements[0] = $2;
5232 | TempVarList ',' optError SingleTempVarInstance
5234 $$.nElements = $1.nElements + 1;
5235 $$.elements = (YYSTYPE::singletempvarinst_t*)
5236 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5237 $$.elements[$$.nElements - 1] = $4;
5241 SingleTempVarInstance: // 303
5242 IDentifier optArrayDef
5246 $$.initial_value = NULL;
5249 | IDentifier optArrayDef AssignmentChar TemplateBody
5253 $$.initial_value = $4;
5261 if ($1.is_ref) $$ = $1.ref;
5263 $$ = new Ttcn::Reference($1.id);
5264 $$->set_location(infile, @$);
5269 /* A.1.6.2.2 Timer instantiation */
5271 TimerInstance: // 306
5272 TimerKeyword TimerList { $$ = $2; }
5276 optError SingleTimerInstance
5279 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
5280 $$.elements[0] = $2;
5282 | TimerList ',' optError SingleTimerInstance
5284 $$.nElements = $1.nElements + 1;
5285 $$.elements = (Ttcn::Definition**)
5286 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5287 $$.elements[$$.nElements - 1] = $4;
5291 SingleTimerInstance: // 308
5292 IDentifier optArrayDef
5294 ArrayDimensions *dims;
5295 if ($2.nElements > 0) {
5296 dims = new ArrayDimensions;
5297 for (size_t i = 0; i < $2.nElements; i++) dims->add($2.elements[i]);
5300 $$ = new Ttcn::Def_Timer($1, dims, 0);
5301 $$->set_location(infile, @$);
5303 | IDentifier optArrayDef AssignmentChar TimerValue
5305 ArrayDimensions *dims;
5306 if ($2.nElements > 0) {
5307 dims = new ArrayDimensions;
5308 for (size_t i = 0; i < $2.nElements; i++) dims->add($2.elements[i]);
5311 $$ = new Ttcn::Def_Timer($1, dims, $4);
5312 $$->set_location(infile, @$);
5317 Expression { $$ = $1; }
5321 VariableRef { $$ = $1; }
5324 /* A.1.6.2.3 Component operations */
5326 ConfigurationStatements: // 313
5327 ConnectStatement { $$ = $1; }
5328 | MapStatement { $$ = $1; }
5329 | DisconnectStatement { $$ = $1; }
5330 | UnmapStatement { $$ = $1; }
5331 | DoneStatement { $$ = $1; }
5332 | KilledStatement { $$ = $1; }
5333 | StartTCStatement { $$ = $1; }
5334 | StopTCStatement { $$ = $1; }
5335 | KillTCStatement { $$ = $1; }
5338 ConfigurationOps: // 314
5343 | RunningOp {$$=$1;}
5344 | AliveOp { $$ = $1; }
5348 VariableRef DotCreateKeyword optCreateParameter optAliveKeyword
5350 $$ = new Value(Value::OPTYPE_COMP_CREATE, $1, $3.name, $3.loc, $4);
5351 $$->set_location(infile, @$);
5361 | '(' optError Expression optError ')'
5366 | '(' optError Expression optError ',' optError Expression optError ')'
5371 | '(' optError NotUsedSymbol optError ',' optError Expression optError ')'
5383 optAliveKeyword: // [328]
5384 /* empty */ { $$ = false; }
5385 | AliveKeyword { $$ = true; }
5391 $$=new Value(Value::OPTYPE_COMP_SYSTEM);
5392 $$->set_location(infile, @$);
5399 $$=new Value(Value::OPTYPE_COMP_SELF);
5400 $$->set_location(infile, @$);
5407 $$=new Value(Value::OPTYPE_COMP_MTC);
5408 $$->set_location(infile, @$);
5412 DoneStatement: // 319
5413 ComponentOrDefaultReference DotDoneKeyword optDoneParameter
5415 $$ = new Statement(Statement::S_DONE, $1, $3.donematch, $3.redirect);
5416 $$->set_location(infile, @$);
5418 | AnyKeyword ComponentKeyword DotDoneKeyword
5420 $$ = new Statement(Statement::S_DONE, Statement::C_ANY);
5421 $$->set_location(infile, @$);
5423 | AllKeyword ComponentKeyword DotDoneKeyword
5425 $$ = new Statement(Statement::S_DONE, Statement::C_ALL);
5426 $$->set_location(infile, @$);
5436 | optReceiveParameter PortRedirectSymbol ValueSpec
5443 KilledStatement: // 320
5444 ComponentOrDefaultReference DotKilledKeyword
5446 $$ = new Statement(Statement::S_KILLED, $1);
5447 $$->set_location(infile, @$);
5449 | AnyKeyword ComponentKeyword DotKilledKeyword
5451 $$ = new Statement(Statement::S_KILLED, Statement::C_ANY);
5452 $$->set_location(infile, @$);
5454 | AllKeyword ComponentKeyword DotKilledKeyword
5456 $$ = new Statement(Statement::S_KILLED, Statement::C_ALL);
5457 $$->set_location(infile, @$);
5463 ComponentOrDefaultReference
5464 | AnyKeyword ComponentKeyword
5465 | AllKeyword ComponentKeyword
5470 /* VariableRef DotRunningKeyword -- covered by RunningTimerOp */
5471 FunctionInstance DotRunningKeyword
5473 Value *t_val = new Value(Value::V_REFD, $1);
5474 t_val->set_location(infile, @1);
5475 $$ = new Value(Value::OPTYPE_COMP_RUNNING, t_val);
5476 $$->set_location(infile, @$);
5478 | ApplyOp DotRunningKeyword
5480 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5481 t_val->set_location(infile, @1);
5482 $$ = new Value(Value::OPTYPE_COMP_RUNNING, t_val);
5483 $$->set_location(infile, @$);
5485 | AnyKeyword ComponentKeyword DotRunningKeyword
5487 $$ = new Value(Value::OPTYPE_COMP_RUNNING_ANY);
5488 $$->set_location(infile, @$);
5490 | AllKeyword ComponentKeyword DotRunningKeyword
5492 $$ = new Value(Value::OPTYPE_COMP_RUNNING_ALL);
5493 $$->set_location(infile, @$);
5498 ComponentOrDefaultReference DotAliveKeyword
5500 $$ = new Value(Value::OPTYPE_COMP_ALIVE, $1);
5501 $$->set_location(infile, @$);
5503 | AnyKeyword ComponentKeyword DotAliveKeyword
5505 $$ = new Value(Value::OPTYPE_COMP_ALIVE_ANY);
5506 $$->set_location(infile, @$);
5508 | AllKeyword ComponentKeyword DotAliveKeyword
5510 $$ = new Value(Value::OPTYPE_COMP_ALIVE_ALL);
5511 $$->set_location(infile, @$);
5515 ConnectStatement: // 329
5516 ConnectKeyword SingleConnectionSpec
5518 $$=new Statement(Statement::S_CONNECT,
5519 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5520 $$->set_location(infile, @$);
5524 SingleConnectionSpec: // 331
5525 '(' PortRef optError ',' optError PortRef optError ')'
5527 $$.compref1 = $2.compref;
5528 $$.portref1 = $2.portref;
5529 $$.compref2 = $6.compref;
5530 $$.portref2 = $6.portref;
5535 ComponentRef ':' Port
5542 ComponentRef: // 333
5543 ComponentOrDefaultReference { $$ = $1; }
5544 | SystemOp { $$ = $1; }
5545 | SelfOp { $$ = $1; }
5546 | MTCOp { $$ = $1; }
5549 DisconnectStatement: // 335
5552 Location loc(infile, @$);
5553 loc.error("Disconnect operation on multiple connections is "
5554 "not currently supported");
5555 $$ = new Statement(Statement::S_ERROR);
5556 $$->set_location(infile, @$);
5558 | DisconnectKeyword SingleOrMultiConnectionSpec
5560 if ($2.portref1 && $2.portref2 && $2.compref1 && $2.compref2) {
5561 $$ = new Statement(Statement::S_DISCONNECT,
5562 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5564 Location loc(infile, @$);
5565 loc.error("Disconnect operation on multiple connections is "
5566 "not currently supported");
5571 $$ = new Statement(Statement::S_ERROR);
5573 $$->set_location(infile, @$);
5577 SingleOrMultiConnectionSpec: // 336
5578 SingleConnectionSpec { $$ = $1; }
5579 | AllConnectionsSpec
5581 $$.compref1 = $1.compref;
5582 $$.portref1 = $1.portref;
5593 | AllCompsAllPortsSpec
5602 AllConnectionsSpec: // 337
5603 '(' PortRef optError ')' { $$ = $2; }
5606 AllPortsSpec: // 338
5607 '(' ComponentRef ':' AllKeyword PortKeyword optError ')' { $$ = $2; }
5610 AllCompsAllPortsSpec: // 339
5611 '(' AllKeyword ComponentKeyword ':' AllKeyword PortKeyword optError ')'
5614 MapStatement: // 341
5615 MapKeyword SingleConnectionSpec
5617 $$=new Statement(Statement::S_MAP,
5618 $2.compref1, $2.portref1,
5619 $2.compref2, $2.portref2);
5620 $$->set_location(infile, @$);
5624 UnmapStatement: // 343
5627 $$ = new Statement(Statement::S_ERROR);
5628 $$->set_location(infile, @$);
5629 Location loc(infile, @$);
5630 loc.error("Unmap operation on multiple mappings is "
5631 "not currently supported");
5633 | UnmapKeyword SingleOrMultiConnectionSpec
5635 if ($2.compref1 && $2.portref1 && $2.compref1 && $2.compref2) {
5636 $$ = new Statement(Statement::S_UNMAP,
5637 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5639 Location loc(infile, @$);
5640 loc.error("Unmap operation on multiple mappings is "
5641 "not currently supported");
5646 $$ = new Statement(Statement::S_ERROR);
5648 $$->set_location(infile, @$);
5652 StartTCStatement: // 345
5653 /* VariableRef DotStartKeyword '(' FunctionInstance ')'
5654 -- covered by StartTimerStatement */
5655 VariableRef DotStartKeyword '(' DereferOp '(' optFunctionActualParList ')'
5658 Value *t_val = new Value(Value::V_REFD, $1);
5659 t_val->set_location(infile, @1);
5660 $6->set_location(infile, @5, @7);
5661 //ParsedActualParameters *pap = new ParsedActualParameters($6);
5662 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5663 $$->set_location(infile, @$);
5665 | FunctionInstance DotStartKeyword '(' FunctionInstance optError ')'
5667 Value *t_val = new Value(Value::V_REFD, $1);
5668 t_val->set_location(infile, @1);
5669 $$ = new Statement(Statement::S_START_COMP, t_val, $4);
5670 $$->set_location(infile, @$);
5672 | FunctionInstance DotStartKeyword '(' DereferOp '('
5673 optFunctionActualParList ')' optError ')'
5675 Value *t_val = new Value(Value::V_REFD, $1);
5676 t_val->set_location(infile, @1);
5677 $6->set_location(infile, @5 , @7);
5678 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5679 $$->set_location(infile, @$);
5681 | FunctionInstance DotStartKeyword '(' error ')'
5684 $$ = new Statement(Statement::S_ERROR);
5685 $$->set_location(infile, @$);
5687 | ApplyOp DotStartKeyword '(' FunctionInstance ')'
5689 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5690 t_val->set_location(infile, @1);
5691 $$ = new Statement(Statement::S_START_COMP, t_val, $4);
5692 $$->set_location(infile, @$);
5694 | ApplyOp DotStartKeyword '(' DereferOp '(' optFunctionActualParList ')'
5697 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5698 t_val->set_location(infile, @1);
5699 $6->set_location(infile, @5 , @7);
5700 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5701 $$->set_location(infile, @$);
5703 | ApplyOp DotStartKeyword '(' error ')'
5707 $$ = new Statement(Statement::S_ERROR);
5708 $$->set_location(infile, @$);
5712 StopTCStatement: // 337
5713 /* VariableRef DotStopKeyword -- covered by StopTimerStatement */
5714 FunctionInstance DotStopKeyword
5716 Value *t_val = new Value(Value::V_REFD, $1);
5717 t_val->set_location(infile, @1);
5718 $$ = new Statement(Statement::S_STOP_COMP, t_val);
5719 $$->set_location(infile, @$);
5721 | ApplyOp DotStopKeyword
5723 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5724 t_val->set_location(infile, @1);
5725 $$ = new Statement(Statement::S_STOP_COMP, t_val);
5726 $$->set_location(infile, @$);
5728 | MTCOp DotStopKeyword
5730 $$ = new Statement(Statement::S_STOP_COMP, $1);
5731 $$->set_location(infile, @$);
5733 | SelfOp DotStopKeyword
5735 $$ = new Statement(Statement::S_STOP_COMP, $1);
5736 $$->set_location(infile, @$);
5738 | AllKeyword ComponentKeyword DotStopKeyword
5740 $$ = new Statement(Statement::S_STOP_COMP, (Value*)0);
5741 $$->set_location(infile, @$);
5745 ComponentReferenceOrLiteral: // 348
5746 ComponentOrDefaultReference { $$ = $1; }
5747 | MTCOp { $$ = $1; }
5748 | SelfOp { $$ = $1; }
5751 KillTCStatement: // 349
5754 Value *self = new Value(Value::OPTYPE_COMP_SELF);
5755 self->set_location(infile, @1);
5756 $$ = new Statement(Statement::S_KILL, self);
5757 $$->set_location(infile, @$);
5759 | ComponentReferenceOrLiteral DotKillKeyword
5761 $$ = new Statement(Statement::S_KILL, $1);
5762 $$->set_location(infile, @$);
5764 | AllKeyword ComponentKeyword DotKillKeyword
5766 $$ = new Statement(Statement::S_KILL, (Value*)0);
5767 $$->set_location(infile, @$);
5771 ComponentOrDefaultReference: // 350
5774 $$ = new Value(Value::V_REFD, $1);
5775 $$->set_location(infile, @$);
5779 $$ = new Value(Value::V_REFD, $1);
5780 $$->set_location(infile, @$);
5784 $$ = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5785 $$->set_location(infile, @$);
5789 /* A.1.6.2.4 Port operations */
5792 VariableRef { $$ = $1; }
5795 CommunicationStatements: // 353
5796 SendStatement {$$ = $1;}
5797 | CallStatement {$$ = $1;}
5798 | ReplyStatement {$$ = $1;}
5799 | RaiseStatement {$$ = $1;}
5800 | ReceiveStatement {$$ = $1;}
5801 | TriggerStatement {$$ = $1;}
5802 | GetCallStatement {$$ = $1;}
5803 | GetReplyStatement {$$ = $1;}
5804 | CatchStatement {$$ = $1;}
5805 | CheckStatement {$$ = $1;}
5806 | ClearStatement {$$ = $1;}
5807 | StartStatement {$$ = $1;}
5808 | StopStatement {$$ = $1;}
5809 | HaltStatement { $$ = $1; }
5812 SendStatement: // 354
5813 Port DotSendOpKeyword PortSendOp
5815 $$ = new Statement(Statement::S_SEND, $1, $3.templ_inst, $3.val);
5816 $$->set_location(infile, @$);
5821 '(' SendParameter optError ')' optToClause
5826 | '(' error ')' optToClause
5828 Template *t = new Template(Template::TEMPLATE_ERROR);
5829 t->set_location(infile, @2);
5830 $$.templ_inst = new TemplateInstance(0, 0, t);
5831 $$.templ_inst->set_location(infile, @2);
5836 SendParameter: // 357
5837 TemplateInstance { $$=$1; }
5840 optToClause: // [3583]
5841 /* empty */ { $$ = 0; }
5842 | ToKeyword AddressRef
5844 Template *templ = $2->get_Template();
5845 if (!$2->get_Type() && !$2->get_DerivedRef() && templ->is_Value()) {
5846 $$ = templ->get_Value();
5848 Location loc(infile, @$);
5849 loc.error("Multicast communication is not currently supported");
5854 /* | ToKeyword AddressRefList -- covered by the previous rule
5855 (as ValueOrAttribList) */
5856 | ToKeyword AllKeyword ComponentKeyword
5858 Location loc(infile, @$);
5859 loc.error("Broadcast communication is not currently supported");
5862 | ToKeyword error { $$ = 0; }
5866 AddressRefList: // 359
5867 '(' seqAddressRef ')'
5872 | seqAddressRef ',' AddressRef
5877 TemplateInstance { $$ = $1; }
5880 CallStatement: // 362
5881 Port DotCallOpKeyword PortCallOp optPortCallBody
5883 $$ = new Statement(Statement::S_CALL, $1, $3.templ_inst,
5884 $3.calltimerval, $3.nowait, $3.val, $4);
5885 $$->set_location(infile, @$);
5890 '(' CallParameters optError ')' optToClause
5892 $$.templ_inst = $2.templ_inst;
5893 $$.calltimerval = $2.calltimerval;
5894 $$.nowait = $2.nowait;
5897 | '(' error ')' optToClause
5899 Template *t = new Template(Template::TEMPLATE_ERROR);
5900 t->set_location(infile, @2);
5901 $$.templ_inst = new TemplateInstance(0, 0, t);
5902 $$.templ_inst->set_location(infile, @2);
5903 $$.calltimerval = 0;
5909 CallParameters: // 365
5916 | TemplateInstance ',' optError CallTimerValue
5919 $$.calltimerval=$4.calltimerval;
5920 $$.nowait=$4.nowait;
5924 CallTimerValue: // 366
5937 optPortCallBody: // [368]
5938 /* empty */ { $$=0; }
5939 | '{' CallBodyStatementList optError '}' { $$=$2; }
5940 | '{' error '}' { $$ = new AltGuards; }
5943 CallBodyStatementList: // 369
5944 optError CallBodyStatement
5949 | CallBodyStatementList optError CallBodyStatement
5956 CallBodyStatement: // 370 and 371. rolled into one.
5957 AltGuardChar CallBodyOps ';' // This alternative is a TITAN extension
5959 $$=new AltGuard($1, $2, new StatementBlock());
5960 $$->set_location(infile, @$);
5962 | AltGuardChar CallBodyOps optSemiColon StatementBlock optSemiColon
5964 $$=new AltGuard($1, $2, $4);
5965 $$->set_location(infile, @$);
5970 GetReplyStatement {$$=$1;}
5971 | CatchStatement {$$=$1;}
5974 ReplyStatement: // 373
5975 Port DotReplyKeyword PortReplyOp
5977 $$ = new Statement(Statement::S_REPLY, $1, $3.templ_inst,
5978 $3.replyval, $3.toclause);
5979 $$->set_location(infile, @$);
5984 '(' TemplateInstance optReplyValue optError ')' optToClause
5990 | '(' error ')' optToClause
5992 Template *t = new Template(Template::TEMPLATE_ERROR);
5993 t->set_location(infile, @2);
5994 $$.templ_inst = new TemplateInstance(0, 0, t);
5995 $$.templ_inst->set_location(infile, @2);
6001 optReplyValue: // [376]
6002 /* empty */ { $$=0; }
6003 | ValueKeyword Expression { $$=$2; }
6004 | ValueKeyword error { $$ = 0; }
6007 RaiseStatement: // 377
6008 Port DotRaiseKeyword PortRaiseOp
6010 if ($3.signature) $$ = new Statement(Statement::S_RAISE, $1,
6011 $3.signature, $3.templ_inst, $3.toclause);
6013 $$ = new Statement(Statement::S_ERROR);
6015 delete $3.signature;
6016 delete $3.templ_inst;
6019 $$->set_location(infile, @$);
6024 '(' Signature optError ',' optError TemplateInstance optError ')' optToClause
6030 | '(' error ')' optToClause
6039 ReceiveStatement: // 380
6040 PortOrAny DotReceiveOpKeyword PortReceiveOp
6042 $$ = new Statement(Statement::S_RECEIVE, $1, $3.templ_inst,
6043 $3.fromclause, $3.redirectval, $3.redirectsender);
6044 $$->set_location(infile, @$);
6050 | AnyKeyword PortKeyword { $$ = 0; }
6053 PortReceiveOp: // 382
6054 optReceiveParameter optFromClause optPortRedirect
6058 $$.redirectval = $3.redirectval;
6059 $$.redirectsender = $3.redirectsender;
6063 optReceiveParameter: // [384]
6064 /* empty */ { $$ = 0; }
6065 | '(' ReceiveParameter optError ')' { $$ = $2; }
6068 Template *t = new Template(Template::TEMPLATE_ERROR);
6069 t->set_location(infile, @2);
6070 $$ = new TemplateInstance(0, 0, t);
6071 $$->set_location(infile, @$);
6075 ReceiveParameter: // 384
6076 TemplateInstance { $$ = $1; }
6079 optFromClause: // [385]
6080 /* empty */ { $$=0; }
6081 | FromClause { $$=$1; }
6085 FromKeyword AddressRef { $$=$2; }
6086 | FromKeyword error { $$ = 0; }
6089 optPortRedirect: // [387]
6093 $$.redirectsender=0;
6095 | PortRedirectSymbol ValueSpec
6098 $$.redirectsender=0;
6100 | PortRedirectSymbol SenderSpec
6103 $$.redirectsender=$2;
6105 | PortRedirectSymbol ValueSpec SenderSpec
6108 $$.redirectsender=$3;
6110 | PortRedirectSymbol error
6113 $$.redirectsender=0;
6118 ValueKeyword VariableRef { $$ = $2; }
6119 | ValueKeyword error { $$ = 0; }
6123 SenderKeyword VariableRef { $$ = $2; }
6124 | SenderKeyword error { $$ = 0; }
6127 TriggerStatement: // 393
6128 PortOrAny DotTriggerOpKeyword PortTriggerOp
6130 $$ = new Statement(Statement::S_TRIGGER, $1, $3.templ_inst,
6131 $3.fromclause, $3.redirectval, $3.redirectsender);
6132 $$->set_location(infile, @$);
6136 PortTriggerOp: // 394
6137 optReceiveParameter optFromClause optPortRedirect
6141 $$.redirectval = $3.redirectval;
6142 $$.redirectsender = $3.redirectsender;
6146 GetCallStatement: // 396
6147 PortOrAny DotGetCallOpKeyword PortGetCallOp
6149 $$ = new Statement(Statement::S_GETCALL, $1, $3.templ_inst,
6150 $3.fromclause, $3.redirectparam, $3.redirectsender);
6151 $$->set_location(infile, @$);
6155 PortGetCallOp: // 397
6156 optReceiveParameter optFromClause optPortRedirectWithParam
6160 $$.redirectparam = $3.redirectparam;
6161 $$.redirectsender = $3.redirectsender;
6165 optPortRedirectWithParam: // [399]
6169 $$.redirectsender=0;
6171 | PortRedirectSymbol ParamSpec
6173 $$.redirectparam=$2;
6174 $$.redirectsender=0;
6176 | PortRedirectSymbol ParamSpec SenderSpec
6178 $$.redirectparam=$2;
6179 $$.redirectsender=$3;
6181 | PortRedirectSymbol SenderSpec
6184 $$.redirectsender=$2;
6186 | PortRedirectSymbol error
6189 $$.redirectsender=0;
6194 ParamKeyword ParamAssignmentList { $$ = $2; }
6195 | ParamKeyword error { $$ = 0; }
6198 ParamAssignmentList: // 403
6199 '(' AssignmentList optError ')'
6201 $$=new ParamRedirect($2);
6202 $$->set_location(infile, @$);
6204 | '(' VariableList optError ')'
6206 $$=new ParamRedirect($2);
6207 $$->set_location(infile, @$);
6211 $$=new ParamRedirect(new ParamAssignments());
6212 $$->set_location(infile, @$);
6216 AssignmentList: // 404
6219 $$ = new ParamAssignments();
6222 | error VariableAssignment
6224 $$ = new ParamAssignments();
6227 | AssignmentList optError ',' optError VariableAssignment
6232 | AssignmentList optError ',' error { $$ = $1; }
6235 VariableAssignment: // 405
6236 VariableRef AssignmentChar IDentifier
6238 $$ = new ParamAssignment($3, $1);
6239 $$->set_location(infile, @$);
6243 VariableList: // 407
6246 $$ = new VariableEntries();
6249 | error VariableEntry
6251 $$ = new VariableEntries();
6254 | VariableList optError ',' optError VariableEntry
6259 | VariableList optError ',' error { $$ = $1; }
6262 VariableEntry: // 408
6265 $$ = new VariableEntry($1);
6266 $$->set_location(infile, @$);
6270 $$ = new VariableEntry;
6271 $$->set_location(infile, @$);
6275 GetReplyStatement: // 409
6276 PortOrAny DotGetReplyOpKeyword PortGetReplyOp
6278 $$ = new Statement(Statement::S_GETREPLY, $1, $3.templ_inst,
6279 $3.valuematch, $3.fromclause, $3.redirectval,
6280 $3.redirectparam, $3.redirectsender);
6281 $$->set_location(infile, @$);
6285 PortGetReplyOp: // 410
6286 optGetReplyParameter optFromClause optPortRedirectWithValueAndParam
6288 $$.templ_inst = $1.templ_inst;
6289 $$.valuematch = $1.valuematch;
6291 $$.redirectval = $3.redirectval;
6292 $$.redirectparam = $3.redirectparam;
6293 $$.redirectsender = $3.redirectsender;
6297 optPortRedirectWithValueAndParam: // [411]
6302 $$.redirectsender=0;
6304 | PortRedirectSymbol ValueSpec
6308 $$.redirectsender=0;
6310 | PortRedirectSymbol ValueSpec ParamSpec
6313 $$.redirectparam=$3;
6314 $$.redirectsender=0;
6316 | PortRedirectSymbol ValueSpec SenderSpec
6320 $$.redirectsender=$3;
6322 | PortRedirectSymbol ValueSpec ParamSpec SenderSpec
6325 $$.redirectparam=$3;
6326 $$.redirectsender=$4;
6328 | PortRedirectSymbol ParamSpec
6331 $$.redirectparam=$2;
6332 $$.redirectsender=0;
6334 | PortRedirectSymbol SenderSpec
6338 $$.redirectsender=$2;
6340 | PortRedirectSymbol ParamSpec SenderSpec
6343 $$.redirectparam=$2;
6344 $$.redirectsender=$3;
6346 | PortRedirectSymbol error
6350 $$.redirectsender=0;
6354 optGetReplyParameter:
6360 | '(' ReceiveParameter optError ')'
6365 | '(' ReceiveParameter ValueMatchSpec optError ')'
6372 Template *t = new Template(Template::TEMPLATE_ERROR);
6373 t->set_location(infile, @2);
6374 $$.templ_inst = new TemplateInstance(0, 0, t);
6375 $$.templ_inst->set_location(infile, @2);
6380 ValueMatchSpec: // 414
6381 ValueKeyword TemplateInstance { $$=$2; }
6382 | ValueKeyword error { $$ = 0; }
6385 CheckStatement: // 415
6386 PortOrAny DotCheckOpKeyword optCheckParameter
6388 switch ($3.statementtype) {
6389 case Statement::S_CHECK:
6390 $$ = new Statement(Statement::S_CHECK, $1, $3.templ_inst,
6393 case Statement::S_CHECK_RECEIVE:
6394 $$ = new Statement(Statement::S_CHECK_RECEIVE, $1, $3.templ_inst,
6395 $3.fromclause, $3.redirectval, $3.redirectsender);
6397 case Statement::S_CHECK_GETCALL:
6398 $$ = new Statement(Statement::S_CHECK_GETCALL, $1, $3.templ_inst,
6399 $3.fromclause, $3.redirectparam, $3.redirectsender);
6401 case Statement::S_CHECK_GETREPLY:
6402 $$ = new Statement(Statement::S_CHECK_GETREPLY, $1, $3.templ_inst,
6403 $3.valuematch, $3.fromclause, $3.redirectval,
6404 $3.redirectparam, $3.redirectsender);
6406 case Statement::S_CHECK_CATCH:
6407 $$ = new Statement(Statement::S_CHECK_CATCH, $1, $3.signature,
6408 $3.templ_inst, $3.timeout, $3.fromclause,
6409 $3.redirectval, $3.redirectsender);
6412 FATAL_ERROR("Internal error.");
6414 $$->set_location(infile, @$);
6418 optCheckParameter: // [418]
6421 $$.statementtype = Statement::S_CHECK;
6428 $$.redirectparam = 0;
6429 $$.redirectsender = 0;
6431 | '(' CheckParameter optError ')' { $$ = $2; }
6434 $$.statementtype = Statement::S_CHECK;
6441 $$.redirectparam = 0;
6442 $$.redirectsender = 0;
6446 CheckParameter: // 418
6447 CheckPortOpsPresent { $$ = $1; }
6448 | FromClausePresent { $$ = $1; }
6449 | RedirectPresent { $$ = $1; }
6452 FromClausePresent: // 419
6455 $$.statementtype = Statement::S_CHECK;
6462 $$.redirectparam = 0;
6463 $$.redirectsender = 0;
6465 | FromClause PortRedirectSymbol SenderSpec
6467 $$.statementtype = Statement::S_CHECK;
6474 $$.redirectparam = 0;
6475 $$.redirectsender = $3;
6479 RedirectPresent: // 420
6480 PortRedirectSymbol SenderSpec
6482 $$.statementtype = Statement::S_CHECK;
6489 $$.redirectparam = 0;
6490 $$.redirectsender = $2;
6494 CheckPortOpsPresent: // 421
6495 ReceiveOpKeyword PortReceiveOp
6497 $$.statementtype = Statement::S_CHECK_RECEIVE;
6499 $$.templ_inst = $2.templ_inst;
6502 $$.fromclause = $2.fromclause;
6503 $$.redirectval = $2.redirectval;
6504 $$.redirectparam = 0;
6505 $$.redirectsender = $2.redirectsender;
6507 | GetCallOpKeyword PortGetCallOp
6509 $$.statementtype = Statement::S_CHECK_GETCALL;
6511 $$.templ_inst = $2.templ_inst;
6514 $$.fromclause = $2.fromclause;
6516 $$.redirectparam = $2.redirectparam;
6517 $$.redirectsender = $2.redirectsender;
6519 | GetReplyOpKeyword PortGetReplyOp
6521 $$.statementtype = Statement::S_CHECK_GETREPLY;
6523 $$.templ_inst = $2.templ_inst;
6524 $$.valuematch = $2.valuematch;
6526 $$.fromclause = $2.fromclause;
6527 $$.redirectval = $2.redirectval;
6528 $$.redirectparam = $2.redirectparam;
6529 $$.redirectsender = $2.redirectsender;
6531 | CatchOpKeyword PortCatchOp
6533 $$.statementtype = Statement::S_CHECK_CATCH;
6534 $$.signature = $2.signature;
6535 $$.templ_inst = $2.templ_inst;
6537 $$.timeout = $2.timeout;
6538 $$.fromclause = $2.fromclause;
6539 $$.redirectval = $2.redirectval;
6540 $$.redirectparam = 0;
6541 $$.redirectsender = $2.redirectsender;
6545 CatchStatement: // 422
6546 PortOrAny DotCatchOpKeyword PortCatchOp
6548 $$ = new Statement(Statement::S_CATCH, $1, $3.signature, $3.templ_inst,
6549 $3.timeout, $3.fromclause, $3.redirectval,
6551 $$->set_location(infile, @$);
6556 optCatchOpParameter optFromClause optPortRedirect
6558 $$.signature = $1.signature;
6559 $$.templ_inst = $1.templ_inst;
6560 $$.timeout = $1.timeout;
6562 $$.redirectval = $3.redirectval;
6563 $$.redirectsender = $3.redirectsender;
6567 optCatchOpParameter: // [425]
6574 | '(' CatchOpParameter optError ')' { $$ = $2; }
6583 CatchOpParameter: // 425
6584 Signature optError ',' optError TemplateInstance
6598 ClearStatement: // 426
6599 PortOrAll DotClearOpKeyword
6601 $$ = new Statement(Statement::S_CLEAR, $1);
6602 $$->set_location(infile, @$);
6608 | AllKeyword PortKeyword { $$ = 0; }
6611 StartStatement: // 430
6612 /* Port DotPortStartKeyword -- covered by StartTimerStatement */
6613 AllKeyword PortKeyword DotStartKeyword
6615 $$=new Statement(Statement::S_START_PORT, (Ttcn::Reference*)0);
6616 $$->set_location(infile, @$);
6620 StopStatement: // 432
6621 /* Port DotPortStopKeyword -- covered by StopTimerStatement */
6622 AllKeyword PortKeyword DotStopKeyword
6624 $$=new Statement(Statement::S_STOP_PORT, (Ttcn::Reference*)0);
6625 $$->set_location(infile, @$);
6629 HaltStatement: // 435
6630 PortOrAll DotHaltKeyword
6632 $$ = new Statement(Statement::S_HALT, $1);
6633 $$->set_location(infile, @$);
6637 /* A.1.6.2.5 Timer operations */
6639 TimerStatements: // 439
6640 StartTimerStatement { $$ = $1; }
6641 | StopTimerStatement { $$ = $1; }
6642 | TimeoutStatement { $$ = $1; }
6646 ReadTimerOp { $$ = $1; }
6647 | RunningTimerOp { $$ = $1; }
6650 StartTimerStatement: // 441
6651 VariableRef DotStartKeyword
6653 $$ = new Statement(Statement::S_START_UNDEF, $1, (Value*)0);
6654 $$->set_location(infile, @$);
6656 | VariableRef DotStartKeyword '(' Expression optError ')'
6658 $$ = new Statement(Statement::S_START_UNDEF, $1, $4);
6659 $$->set_location(infile, @$);
6661 | VariableRef DotStartKeyword '(' error ')'
6663 Value *v = new Value(Value::V_ERROR);
6664 v->set_location(infile, @4);
6665 $$ = new Statement(Statement::S_START_UNDEF, $1, v);
6666 $$->set_location(infile, @$);
6670 StopTimerStatement: // 442
6671 TimerRef DotStopKeyword
6673 $$ = new Statement(Statement::S_STOP_UNDEF, $1, (Value*)0);
6674 $$->set_location(infile, @$);
6676 | AllKeyword TimerKeyword DotStopKeyword
6678 $$ = new Statement(Statement::S_STOP_TIMER, (Ttcn::Reference*)0);
6679 $$->set_location(infile, @$);
6683 /* no separate rule, folded into StopTimerStatement
6684 TimerRefOrAll: // 443
6686 | AllKeyword TimerKeyword
6691 TimerRef DotReadKeyword
6693 $$ = new Value(Value::OPTYPE_TMR_READ, $1);
6694 $$->set_location(infile, @$);
6698 RunningTimerOp: // 446
6699 TimerRef DotRunningKeyword
6701 $$ = new Value(Value::OPTYPE_UNDEF_RUNNING, $1);
6702 $$->set_location(infile, @$);
6704 | AnyKeyword TimerKeyword DotRunningKeyword
6706 $$ = new Value(Value::OPTYPE_TMR_RUNNING_ANY);
6707 $$->set_location(infile, @$);
6711 TimeoutStatement: // 447
6712 TimerRefOrAny DotTimeoutKeyword
6714 $$ = new Statement(Statement::S_TIMEOUT, $1);
6715 $$->set_location(infile, @$);
6719 TimerRefOrAny: // 448
6720 TimerRef { $$ = $1; }
6721 | AnyKeyword TimerKeyword { $$ = 0; }
6730 $$->set_location(infile, @$);
6732 | AnyTypeKeyword /* a predefined type with special treatment */
6734 anytype_access = true;
6735 Identifier *id = new Identifier(Identifier::ID_TTCN, string("anytype"));
6736 Ttcn::Reference *ref = new Ttcn::Reference(id);
6737 ref->set_location(infile, @1);
6738 $$ = new Type(Type::T_REFD, ref);
6740 | ReferencedType { $$ = $1; }
6744 PredefinedType: // 451, but see below
6745 BitStringKeyword { $$ = Type::T_BSTR; }
6746 | BooleanKeyword { $$ = Type::T_BOOL; }
6747 | CharStringKeyword { $$ = Type::T_CSTR; }
6748 | UniversalCharString { $$ = Type::T_USTR; }
6749 | CharKeyword // not in the standard anymore
6751 Location loc(infile, @$);
6752 loc.warning("Obsolete type `char' was substituted with `charstring'");
6755 | UniversalChar // not in the standard anymore
6757 Location loc(infile, @$);
6758 loc.warning("Obsolete type `universal char' was substituted with "
6759 "`universal charstring'");
6762 | IntegerKeyword { $$ = Type::T_INT; }
6763 | OctetStringKeyword { $$ = Type::T_OSTR; }
6764 | HexStringKeyword { $$ = Type::T_HSTR; }
6765 | VerdictTypeKeyword { $$ = Type::T_VERDICT; }
6766 | FloatKeyword { $$ = Type::T_REAL; }
6767 | AddressKeyword { $$ = Type::T_ADDRESS; }
6768 | DefaultKeyword { $$ = Type::T_DEFAULT; }
6769 | ObjectIdentifierKeyword { $$ = Type::T_OID; }
6771 * AnyTypeKeyword is not part of PredefinedType (this differs from the BNF
6772 * in the TTCN-3 standard).
6773 * PredefinedType is used in two contexts:
6774 * - as a RHS for Type, above (where AnyTypeKeyword needs special treatment,
6775 * and it's easier to appear as an alternative to PredefinedType)
6776 * - as field name for the anytype (where anytype is not permitted)
6780 UniversalCharString: // 463
6781 UniversalKeyword CharStringKeyword
6785 UniversalKeyword CharKeyword
6788 ReferencedType: // 465
6791 if ($1.is_ref) $$ = new Type(Type::T_REFD, $1.ref);
6793 Ttcn::Reference *ref = new Ttcn::Reference($1.id);
6794 ref->set_location(infile, @1);
6795 $$ = new Type(Type::T_REFD, ref);
6797 $$->set_location(infile, @$);
6799 | FunctionInstance optExtendedFieldReference
6800 /* covers all parameterized type references */
6802 Location loc(infile, @1);
6803 loc.error("Reference to parameterized type is not currently supported");
6805 for (size_t i = 0; i < $2.nElements; i++) delete $2.elements[i];
6807 $$ = new Type(Type::T_ERROR);
6808 $$->set_location(infile, @$);
6813 TypeReference: // 466
6815 | IDentifier TypeActualParList
6819 TypeActualParList: // -> 202 784 "Advanced Parameterization"
6820 '(' seqTypeActualPar optError ')'
6824 seqTypeActualPar: // -> 202 784 "Advanced Parameterization"
6825 optError TypeActualPar
6826 | seqTypeActualPar optError ',' optError TypeActualPar
6827 | seqTypeActualPar optError ',' error
6830 TypeActualPar: // -> 202 784 "Advanced Parameterization"
6831 Expression { delete $1; }
6834 optArrayDef: // [467]
6840 | optArrayDef ArrayIndex
6842 $$.nElements = $1.nElements + 1;
6843 $$.elements = (ArrayDimension**)
6844 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
6845 $$.elements[$1.nElements] = $2;
6852 $$ = new ArrayDimension($2);
6853 $$->set_location(infile, @$);
6855 | '[' ArrayBounds DotDot ArrayBounds ']'
6857 $$ = new ArrayDimension($2, $4);
6858 $$->set_location(infile, @$);
6862 Value *v = new Value(Value::V_ERROR);
6863 v->set_location(infile, @2);
6864 $$ = new ArrayDimension(v);
6865 $$->set_location(infile, @$);
6870 Expression { $$ = $1; }
6876 PredefinedValue { $$ = $1; }
6877 | ReferencedValue { $$ = $1; }
6880 PredefinedValue: // 470
6881 BitStringValue { $$ = $1; }
6882 | BooleanValue { $$ = $1; }
6883 | CharStringValue { $$ = $1; }
6884 | IntegerValue { $$ = $1; }
6885 | OctetStringValue { $$ = $1; }
6886 | HexStringValue { $$ = $1; }
6887 | VerdictValue { $$ = $1; }
6888 /* | EnumeratedValue -- covered by ReferencedValue */
6889 | FloatOrSpecialFloatValue
6891 $$ = new Value(Value::V_REAL, $1);
6892 $$->set_location(infile, @$);
6894 | AddressValue { $$ = $1; }
6895 | OmitValue { $$ = $1; }
6898 $$ = new Value(Value::V_NULL);
6899 $$->set_location(infile, @$);
6903 $$ = new Value(Value::V_MACRO, $1);
6904 $$->set_location(infile, @$);
6906 | ObjectIdentifierValue { $$ = $1; }
6909 $$=new Value(Value::V_ERROR);
6910 $$->set_location(infile, @$);
6914 BitStringValue: // 471
6917 $$ = new Value(Value::V_BSTR, $1);
6918 $$->set_location(infile, @$);
6922 BooleanValue: // 472
6925 $$ = new Value(Value::V_BOOL, true);
6926 $$->set_location(infile, @$);
6930 $$ = new Value(Value::V_BOOL, false);
6931 $$->set_location(infile, @$);
6935 /* TTCN-3 core language V4.2.1 */
6936 FloatOrSpecialFloatValue:
6951 IntegerValue: // 473
6954 $$ = new Value(Value::V_INT, $1);
6955 $$->set_location(infile, @$);
6959 OctetStringValue: // 474
6962 $$ = new Value(Value::V_OSTR, $1);
6963 $$->set_location(infile, @$);
6967 HexStringValue: // 475
6970 $$ = new Value(Value::V_HSTR, $1);
6971 $$->set_location(infile, @$);
6975 VerdictValue: // 476 VerdictTypeValue
6978 $$ = new Value(Value::V_VERDICT, Value::Verdict_NONE);
6979 $$->set_location(infile, @$);
6983 $$ = new Value(Value::V_VERDICT, Value::Verdict_PASS);
6984 $$->set_location(infile, @$);
6988 $$ = new Value(Value::V_VERDICT, Value::Verdict_INCONC);
6989 $$->set_location(infile, @$);
6993 $$ = new Value(Value::V_VERDICT, Value::Verdict_FAIL);
6994 $$->set_location(infile, @$);
6998 $$ = new Value(Value::V_VERDICT, Value::Verdict_ERROR);
6999 $$->set_location(infile, @$);
7003 CharStringValue: // 478
7006 if ($1->is_cstr()) $$ = new Value(Value::V_CSTR, $1);
7008 $$ = new Value(Value::V_USTR, new ustring(*$1));
7011 $$->set_location(infile, @$);
7015 $$ = new Value(Value::V_USTR, new ustring(*$1));
7017 $$->set_location(infile, @$);
7021 $$ = new Value(Value::V_USTR, new ustring($1.elements, $1.nElements));
7022 for(size_t i = 0; i < $1.nElements; ++i) {
7023 Free((char*)$1.elements[i]);
7026 $$->set_location(infile, @$);
7033 Location loc(infile, @1);
7034 $$ = parse_charstring_value($1, loc);
7040 CharKeyword '(' optError UIDlike optError ')'
7050 $$.elements = (const char**)
7051 Realloc($$.elements, ($$.nElements) * sizeof(*$$.elements));
7052 $$.elements[$$.nElements-1] = $1;
7054 | UIDlike optError ',' optError Cstring {
7055 $$.nElements = $1.nElements + 1;
7056 $$.elements = (const char**)
7057 Realloc($1.elements, ($$.nElements) * sizeof(*$$.elements));
7058 $$.elements[$$.nElements-1] = $5;
7063 CharKeyword '(' optError Group optError ',' optError Plane optError ','
7064 optError Row optError ',' optError Cell optError ')'
7065 { $$ = new ustring($4, $8, $12, $16); }
7066 | CharKeyword '(' error ')' { $$ = new ustring; }
7072 if (*$1 < 0 || *$1 > 127) {
7073 Location loc(infile, @1);
7074 loc.error("The first number of quadruple (group) must be within the "
7075 "range 0 .. 127 instead of %s", $1->t_str().c_str());
7076 $$ = *$1 < 0 ? 0 : 127;
7087 if (*$1 < 0 || *$1 > 255) {
7088 Location loc(infile, @1);
7089 loc.error("The second number of quadruple (plane) must be within the "
7090 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7091 $$ = *$1 < 0 ? 0 : 255;
7102 if (*$1 < 0 || *$1 > 255) {
7103 Location loc(infile, @1);
7104 loc.error("The third number of quadruple (row) must be within the "
7105 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7106 $$ = *$1 < 0 ? 0 : 255;
7117 if (*$1 < 0 || *$1 > 255) {
7118 Location loc(infile, @1);
7119 loc.error("The fourth number of quadruple (cell) must be within the "
7120 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7121 $$ = *$1 < 0 ? 0 : 255;
7130 Cstring { $$ = $1; }
7133 $$ = mputstr($1, $2);
7138 AddressValue: // 510
7141 $$ = new Value(Value::V_TTCN3_NULL);
7142 $$->set_location(infile, @$);
7149 $$ = new Value(Value::V_OMIT);
7150 $$->set_location(infile, @$);
7154 ReferencedValue: // 489
7157 if ($1.is_ref) $$ = new Value(Value::V_REFD, $1.ref);
7158 else $$ = new Value(Value::V_UNDEF_LOWERID, $1.id);
7159 $$->set_location(infile, @$);
7162 Reference: // 490 ValueReference
7168 | IDentifier '.' PredefOrIdentifier optExtendedFieldReference
7171 $$.ref = new Ttcn::Reference($1);
7172 FieldOrArrayRef *fieldref = new FieldOrArrayRef($3);
7173 fieldref->set_location(infile, @3);
7174 $$.ref->add(fieldref);
7175 for (size_t i = 0; i < $4.nElements; i++) $$.ref->add($4.elements[i]);
7177 $$.ref->set_location(infile, @$);
7179 | IDentifier ArrayOrBitRef optExtendedFieldReference
7182 $$.ref = new Ttcn::Reference($1);
7184 for (size_t i = 0; i < $3.nElements; i++) $$.ref->add($3.elements[i]);
7186 $$.ref->set_location(infile, @$);
7188 | IDentifier '[' NotUsedSymbol ']'
7191 $$.ref = new Ttcn::Reference($1);
7192 Value* novalue = new Value(Value::V_NOTUSED);
7193 novalue->set_location(infile, @3);
7194 $$.ref->add(new FieldOrArrayRef(novalue));
7195 $$.ref->set_location(infile, @$);
7197 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
7198 optExtendedFieldReference
7201 $$.ref = new Ttcn::Reference($1, $5);
7203 for (size_t i = 0; i < $6.nElements; i++) $$.ref->add($6.elements[i]);
7205 $$.ref->set_location(infile, @$);
7209 /* A.1.6.5 Parameterization */
7212 /* empty */ { $$ = false; }
7213 | LazyKeyword { $$ = true; }
7216 FormalValuePar: // 516
7217 optLazyEval Type IDentifier optParDefaultValue
7219 $$ = new FormalPar(Common::Assignment::A_PAR_VAL, $2, $3, $4, $1);
7220 $$->set_location(infile, @$);
7222 | InParKeyword optLazyEval Type IDentifier optParDefaultValue
7224 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_IN, $3, $4, $5, $2);
7225 $$->set_location(infile, @$);
7227 | InOutParKeyword Type IDentifier optParDefaultValue
7229 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_INOUT, $2, $3, $4);
7230 $$->set_location(infile, @$);
7232 | OutParKeyword Type IDentifier optParDefaultValue
7234 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_OUT, $2, $3, $4);
7235 $$->set_location(infile, @$);
7240 FormalPortPar: // 518
7241 IDentifier IDentifier
7242 | InOutParKeyword IDentifier IDentifier
7246 FormalTimerPar: // 520
7247 TimerKeyword IDentifier optParDefaultValue
7249 $$ = new FormalPar(Common::Assignment::A_PAR_TIMER, $2, $3);
7250 $$->set_location(infile, @$);
7252 | InOutParKeyword TimerKeyword IDentifier optParDefaultValue
7254 $$ = new FormalPar(Common::Assignment::A_PAR_TIMER, $3, $4);
7255 $$->set_location(infile, @$);
7259 FormalTemplatePar: // 522
7260 TemplateOptRestricted optLazyEval Type IDentifier optParDefaultValue
7262 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_IN, $1, $3, $4, $5, $2);
7263 $$->set_location(infile, @$);
7265 | InParKeyword TemplateOptRestricted optLazyEval Type IDentifier optParDefaultValue
7267 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_IN, $2, $4, $5, $6, $3);
7268 $$->set_location(infile, @$);
7270 | InOutParKeyword TemplateOptRestricted Type IDentifier optParDefaultValue
7272 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_INOUT, $2, $3, $4, $5);
7273 $$->set_location(infile, @$);
7275 | OutParKeyword TemplateOptRestricted Type IDentifier optParDefaultValue
7277 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_OUT, $2, $3, $4, $5);
7278 $$->set_location(infile, @$);
7282 /* template with optional restriction */
7283 TemplateOptRestricted:
7284 TemplateKeyword optTemplateRestriction
7294 optTemplateRestriction:
7295 /* none */ { $$ = TR_NONE; }
7296 | TemplateRestriction { $$ = $1; }
7298 TemplateRestriction:
7299 '(' OmitKeyword ')' { $$ = TR_OMIT; }
7300 | '(' ValueKeyword ')' { $$ = TR_VALUE; }
7301 | '(' PresentKeyword ')' { $$ = TR_PRESENT; }
7305 /* empty */ { $$ = NULL; }
7306 | AssignmentChar TemplateInstance { $$ = $2; }
7307 | AssignmentChar NotUsedSymbol
7309 Template *t = new Template(Template::TEMPLATE_NOTUSED);
7310 t->set_location(infile, @$);
7311 $$ = new TemplateInstance(0, 0, t);
7312 $$->set_location(infile, @$);
7316 /* A.1.6.6 With statement */
7318 optWithStatement: // [526]
7319 /* empty */ { $$ = NULL; }
7320 | WithStatement { $$ = $1; }
7323 optWithStatementAndSemiColon:
7324 /* empty */ { $$ = NULL; }
7325 | WithStatement { $$ = $1; }
7326 | ';' { $$ = NULL; }
7327 | WithStatement ';' { $$ = $1; }
7330 WithStatement: // 526
7331 WithKeyword WithAttribList { $$ = $2; }
7334 WithAttribList: // 528
7335 '{' MultiWithAttrib optError '}' { $$ = $2; }
7336 | '{' error '}' { $$ = NULL; }
7339 MultiWithAttrib: // 529
7340 optError SingleWithAttrib optSemiColon
7342 $$ = new MultiWithAttrib;
7343 $$->set_location(infile, @$);
7344 $$->add_element($2);
7346 | MultiWithAttrib optError SingleWithAttrib optSemiColon
7349 $$->add_element($3);
7353 SingleWithAttrib: // 530
7354 AttribKeyword optOverrideKeyword optAttribQualifier AttribSpec
7356 $$ = new SingleWithAttrib($1,$2,$3,$4);
7357 $$->set_location(infile, @$);
7361 AttribKeyword: // 531
7362 EncodeKeyword { $$ = SingleWithAttrib::AT_ENCODE; }
7363 | VariantKeyword { $$ = SingleWithAttrib::AT_VARIANT; }
7364 | DisplayKeyword { $$ = SingleWithAttrib::AT_DISPLAY; }
7365 | ExtensionKeyword { $$ = SingleWithAttrib::AT_EXTENSION; }
7366 | OptionalKeyword { $$ = SingleWithAttrib::AT_OPTIONAL; }
7369 /* workaround to get rid of ErroneousKeyword which would clash with
7370 * existing TTCN-3 source code */
7371 if ($1->get_ttcnname()=="erroneous") $$ = SingleWithAttrib::AT_ERRONEOUS;
7373 Location loc(infile, @1);
7374 loc.error("Invalid attribute. Valid attributes are: "
7375 "`encode', `variant' , `display' , `extension', `optional' and `erroneous'");
7376 if ($1->get_ttcnname()=="titan")
7378 " ________ _____ ________ ____ __ _ \n"
7379 "(___ ___) (_ _) (___ ___) ( ) / \\ / ) \n"
7380 " ) ) | | ) ) / /\\ \\ / /\\ \\ / / \n"
7381 " ( ( | | ( ( ( (__) ) ) ) ) ) ) ) \n"
7382 " ) ) | | ) ) ) ( ( ( ( ( ( ( \n"
7383 " ( ( _| |__ ( ( / /\\ \\ / / \\ \\/ / \n"
7384 " /__\\ /_____( /__\\ /__( )__\\ (_/ \\__/ \n");
7385 $$ = SingleWithAttrib::AT_INVALID;
7391 optOverrideKeyword: // [536]
7392 /* empty */ { $$ = false; }
7393 | OverrideKeyword { $$ = true; }
7396 optAttribQualifier: // [537]
7397 /* empty */ { $$ = NULL; }
7398 | '(' DefOrFieldRefList optError ')' { $$ = $2; }
7399 | '(' error ')' { $$ = NULL; }
7402 DefOrFieldRefList: // 538
7403 optError DefOrFieldRef
7405 $$ = new Qualifiers();
7406 if ($2) $$->add_qualifier($2);
7408 | DefOrFieldRefList optError ',' optError DefOrFieldRef
7411 if ($5) $$->add_qualifier($5);
7413 | DefOrFieldRefList optError ',' error { $$ = $1; }
7416 ArrayOrBitRefOrDash:
7417 ArrayOrBitRef { $$ = $1; }
7418 | '[' NotUsedSymbol ']'
7420 Value* novalue = new Value(Value::V_NOTUSED);
7421 novalue->set_location(infile, @2);
7422 $$ = new FieldOrArrayRef(novalue);
7423 $$->set_location(infile, @$);
7426 DefOrFieldRef: // 539
7429 $$ = new Qualifier();
7430 $$->add(new FieldOrArrayRef($1));
7431 $$->set_location(infile, @1);
7433 | IDentifier '.' IDentifier optExtendedFieldReference
7435 $$ = new Qualifier();
7436 $$->add(new FieldOrArrayRef($1));
7437 $$->add(new FieldOrArrayRef($3));
7438 for(size_t i=0; i<$4.nElements; i++) {
7439 $$->add($4.elements[i]);
7442 $$->set_location(infile, @$);
7444 | IDentifier ArrayOrBitRefOrDash optExtendedFieldReference
7446 $$ = new Qualifier();
7447 $$->add(new FieldOrArrayRef($1));
7449 for(size_t i=0; i<$3.nElements; i++) {
7450 $$->add($3.elements[i]);
7453 $$->set_location(infile, @$);
7455 | ArrayOrBitRefOrDash optExtendedFieldReference
7457 $$ = new Qualifier();
7459 for(size_t i=0; i<$2.nElements; i++) {
7460 $$->add($2.elements[i]);
7463 $$->set_location(infile, @$);
7467 Location loc(infile, @$);
7468 loc.error("Reference to multiple definitions in attribute qualifiers is "
7469 "not currently supported");
7475 GroupKeyword AllKeyword
7476 | GroupKeyword AllKeyword ExceptKeyword '{' GroupRefList optError '}'
7477 | TypeDefKeyword AllKeyword
7478 | TypeDefKeyword AllKeyword ExceptKeyword '{' TypeRefList optError '}'
7479 | TemplateKeyword AllKeyword
7480 | TemplateKeyword AllKeyword ExceptKeyword '{' TemplateRefList optError '}'
7481 | ConstKeyword AllKeyword
7482 | ConstKeyword AllKeyword ExceptKeyword '{' ConstRefList optError '}'
7483 | AltstepKeyword AllKeyword
7484 | AltstepKeyword AllKeyword ExceptKeyword '{' AltstepRefList optError '}'
7485 | TestcaseKeyword AllKeyword
7486 | TestcaseKeyword AllKeyword ExceptKeyword '{' TestcaseRefList optError '}'
7487 | FunctionKeyword AllKeyword
7488 | FunctionKeyword AllKeyword ExceptKeyword '{' FunctionRefList optError '}'
7489 | SignatureKeyword AllKeyword
7490 | SignatureKeyword AllKeyword ExceptKeyword '{' SignatureRefList optError '}'
7491 | ModuleParKeyword AllKeyword
7492 | ModuleParKeyword AllKeyword ExceptKeyword '{' ModuleParRefList optError '}'
7498 $$ = new AttributeSpec(string($1));
7499 $$->set_location(infile, @$);
7504 /* A.1.6.7 Behaviour statements */
7506 BehaviourStatements: // 543
7509 if ($1.ref_pard) $$ = new Statement(Statement::S_TESTCASE_INSTANCE,
7510 $1.ref_pard, $1.value);
7511 else if($1.derefered_value) {
7512 $$ = new Statement(Statement::S_TESTCASE_INSTANCE_REFD,
7513 $1.derefered_value, $1.ap_list->steal_tis(), $1. value);
7516 else $$ = new Statement(Statement::S_ERROR);
7517 $$->set_location(infile, @$);
7521 $$ = new Statement(Statement::S_UNKNOWN_INSTANCE, $1);
7522 $$->set_location(infile, @$);
7526 $$ = new Statement(Statement::S_UNKNOWN_INVOKED, $1.value, $1.ap_list);
7527 $$->set_location(infile, @$);
7529 | ReturnStatement { $$ = $1; }
7530 | AltConstruct { $$ = $1; }
7531 | InterleavedConstruct { $$ = $1; }
7532 | LabelStatement { $$ = $1; }
7533 | GotoStatement { $$=$1; }
7534 | RepeatStatement { $$ = $1; }
7535 | BreakStatement { $$ = $1; }
7536 | ContinueStatement { $$ = $1; }
7537 | DeactivateStatement { $$ = $1; }
7538 /* | AltstepInstance -- covered by FunctionInstance */
7541 if ($1.ref_pard) $$ = new Statement(Statement::S_ACTIVATE, $1.ref_pard);
7542 else if($1.derefered_value) $$ = new Statement(Statement::S_ACTIVATE_REFD,
7543 $1.derefered_value, new ParsedActualParameters($1.ap_list));
7544 else $$ = new Statement(Statement::S_ERROR);
7545 $$->set_location(infile, @$);
7549 VerdictStatements: // 544
7550 SetLocalVerdict { $$ = $1; }
7554 GetLocalVerdict { $$ = $1; }
7557 SetLocalVerdict: // 546
7558 SetVerdictKeyword '(' Expression optError ',' LogItemList optError ')'
7560 $$=new Statement(Statement::S_SETVERDICT, $3, $6);
7561 $$->set_location(infile, @$);
7563 | SetVerdictKeyword '(' Expression optError ')'
7565 $$=new Statement(Statement::S_SETVERDICT, $3, (LogArguments*)0);
7566 $$->set_location(infile, @$);
7568 | SetVerdictKeyword '(' error ')'
7570 Value *v = new Value(Value::V_ERROR);
7571 v->set_location(infile, @3);
7572 $$ = new Statement(Statement::S_SETVERDICT, v);
7573 $$->set_location(infile, @$);
7577 GetLocalVerdict: // 548
7580 $$=new Value(Value::OPTYPE_GETVERDICT);
7581 $$->set_location(infile, @$);
7585 SUTStatements: // 549
7586 ActionKeyword '(' ')'
7588 $$=new Statement(Statement::S_ACTION, (LogArguments*)0);
7589 $$->set_location(infile, @$);
7591 | ActionKeyword '(' LogItemList optError ')'
7593 $$=new Statement(Statement::S_ACTION, $3);
7594 $$->set_location(infile, @$);
7596 | ActionKeyword '(' error ')'
7598 $$=new Statement(Statement::S_ACTION, new LogArguments());
7599 $$->set_location(infile, @$);
7603 StopExecutionStatement:
7606 $$=new Statement(Statement::S_STOP_EXEC);
7607 $$->set_location(infile, @$);
7611 StopTestcaseStatement:
7612 TestcaseKeyword DotStopKeyword
7614 $$ = new Statement(Statement::S_STOP_TESTCASE, (LogArguments*)0);
7615 $$->set_location(infile, @$);
7617 | TestcaseKeyword DotStopKeyword '(' LogItemList optError ')'
7619 $$ = new Statement(Statement::S_STOP_TESTCASE, $4);
7620 $$->set_location(infile, @$);
7624 /* these deliberately don't have their locations set */
7626 TitanSpecificProfilerKeyword DotStartKeyword
7628 $$ = new Statement(Statement::S_START_PROFILER);
7630 | TitanSpecificProfilerKeyword DotStopKeyword
7632 $$ = new Statement(Statement::S_STOP_PROFILER);
7637 int2enumKeyword '(' optError Expression optError ',' optError Reference optError ')'
7639 Ttcn::Reference* out_ref;
7640 if ($8.is_ref) out_ref = $8.ref;
7642 out_ref = new Ttcn::Reference($8.id);
7643 out_ref->set_location(infile, @8);
7645 $$ = new Statement(Statement::S_INT2ENUM, $4, out_ref);
7646 $$->set_location(infile, @$);
7651 TitanSpecificProfilerKeyword DotRunningKeyword
7653 $$ = new Value(Value::OPTYPE_PROF_RUNNING);
7654 $$->set_location(infile, @$);
7658 ReturnStatement: // 552
7661 $$=new Statement(Statement::S_RETURN, (Template*)0);
7662 $$->set_location(infile, @$);
7664 | ReturnKeyword TemplateBody
7666 $$=new Statement(Statement::S_RETURN, $2);
7667 $$->set_location(infile, @$);
7671 AltConstruct: // 553
7672 AltKeyword '{' AltGuardList optError '}'
7674 $$=new Statement(Statement::S_ALT, $3);
7675 $$->set_location(infile, @$);
7677 | AltKeyword '{' error '}'
7679 $$=new Statement(Statement::S_ALT, new AltGuards());
7680 $$->set_location(infile, @$);
7684 AltGuardList: // 555
7690 | AltGuardList optError AltGuard
7698 GuardStatement { $$ = $1; }
7699 | ElseStatement { $$ = $1; }
7702 GuardStatement: // 556
7703 AltGuardChar AltstepInstance optSemiColon
7705 $$=new AltGuard($1, $2, 0);
7706 $$->set_location(infile, @$);
7708 | AltGuardChar ApplyOp optSemiColon
7710 $$=new AltGuard($1, $2.value, $2.ap_list->steal_tis(), 0);
7711 $$->set_location(infile, @$);
7714 | AltGuardChar AltstepInstance optSemiColon StatementBlock optSemiColon
7716 $$=new AltGuard($1, $2, $4);
7717 $$->set_location(infile, @$);
7719 | AltGuardChar ApplyOp optSemiColon StatementBlock optSemiColon
7721 $$= new AltGuard($1, $2.value, $2.ap_list->steal_tis(), $4);
7722 $$->set_location(infile, @$);
7725 | AltGuardChar GuardOp ';'
7727 $$=new AltGuard($1, $2, new StatementBlock());
7728 $$->set_location(infile, @$);
7730 | AltGuardChar GuardOp optSemiColon StatementBlock optSemiColon
7732 $$=new AltGuard($1, $2, $4);
7733 $$->set_location(infile, @$);
7737 ElseStatement: // 557
7738 '[' ElseKeyword ']' StatementBlock optSemiColon
7740 $$=new AltGuard($4);
7741 $$->set_location(infile, @$);
7745 AltGuardChar: // 558
7747 | '[' BooleanExpression ']' { $$ = $2; }
7751 TimeoutStatement { $$=$1; }
7752 | ReceiveStatement { $$=$1; }
7753 | TriggerStatement { $$=$1; }
7754 | GetCallStatement { $$=$1; }
7755 | CatchStatement { $$=$1; }
7756 | CheckStatement { $$=$1; }
7757 | GetReplyStatement { $$=$1; }
7758 | DoneStatement { $$=$1; }
7759 | KilledStatement { $$ = $1; }
7762 InterleavedConstruct: // 560
7763 InterleavedKeyword '{' InterleavedGuardList optError '}'
7765 $$ = new Statement(Statement::S_INTERLEAVE, $3);
7766 $$->set_location(infile, @$);
7768 | InterleavedKeyword '{' error '}'
7770 $$ = new Statement(Statement::S_INTERLEAVE, new AltGuards());
7771 $$->set_location(infile, @$);
7775 InterleavedGuardList: // 562
7776 optError InterleavedGuardElement
7778 $$ = new AltGuards();
7781 | InterleavedGuardList optError InterleavedGuardElement
7782 { $$ = $1; $$->add_ag($3); }
7785 InterleavedGuardElement: // 563
7786 '[' optError ']' GuardOp ';'
7788 $$ = new AltGuard(0, $4, new StatementBlock());
7789 $$->set_location(infile, @$);
7791 | '[' optError ']' GuardOp optSemiColon StatementBlock optSemiColon
7793 $$ = new AltGuard(0, $4, $6);
7794 $$->set_location(infile, @$);
7798 /* The following were folded into the above rule:
7800 InterleavedGuardElement: // 563
7801 InterleavedGuard InterleavedAction
7804 InterleavedGuard: // 564
7808 InterleavedAction: // 565
7813 LabelStatement: // 566
7814 LabelKeyword IDentifier
7816 $$=new Statement(Statement::S_LABEL, $2);
7817 $$->set_location(infile, @$);
7821 GotoStatement: // 569
7822 GotoKeyword IDentifier
7824 $$=new Statement(Statement::S_GOTO, $2);
7825 $$->set_location(infile, @$);
7827 | GotoKeyword AltKeyword
7829 Location loc(infile, @$);
7830 loc.warning("Obsolete statement `goto alt' was substituted with `repeat'");
7831 $$=new Statement(Statement::S_REPEAT);
7832 $$->set_location(infile, @$);
7836 RepeatStatement: // 571
7839 $$=new Statement(Statement::S_REPEAT);
7840 $$->set_location(infile, @$);
7845 ActivateKeyword '(' AltstepInstance optError ')'
7848 $$.derefered_value = 0;
7851 | ActivateKeyword '(' DereferOp '(' optFunctionActualParList ')' optError ')'
7853 $5->set_location(infile, @4, @6);
7855 $$.derefered_value = $3;
7856 $$.ap_list = $5->steal_tis(); /* XXX perhaps propagate the datatype instead ? */
7859 | ActivateKeyword '(' error ')'
7862 $$.derefered_value = 0;
7868 RefersKeyword '(' FunctionRef ')'
7870 Ttcn::Reference* t_ref = new Ttcn::Reference($3.modid, $3.id);
7871 t_ref->set_location(infile, @3);
7872 $$ = new Value(Value::V_REFER, t_ref);
7873 $$->set_location(infile, @$);
7877 DeactivateStatement: // 574
7880 $$=new Statement(Statement::S_DEACTIVATE, (Value*)0);
7881 $$->set_location(infile, @$);
7883 | DeactivateKeyword '(' Expression optError ')'
7885 $$=new Statement(Statement::S_DEACTIVATE, $3);
7886 $$->set_location(infile, @$);
7888 | DeactivateKeyword '(' error ')'
7890 Value *v = new Value(Value::V_ERROR);
7891 v->set_location(infile, @3);
7892 $$ = new Statement(Statement::S_DEACTIVATE, v);
7893 $$->set_location(infile, @$);
7897 BreakStatement: // 576
7900 $$=new Statement(Statement::S_BREAK);
7901 $$->set_location(infile, @$);
7905 ContinueStatement: // 577
7908 $$=new Statement(Statement::S_CONTINUE);
7909 $$->set_location(infile, @$);
7913 /* A.1.6.8 Basic statements */
7915 BasicStatements: // 578
7918 $$=new Statement(Statement::S_ASSIGNMENT, $1);
7919 $$->set_location(infile, @$);
7921 | LogStatement { $$ = $1; }
7922 | String2TtcnStatement { $$ = $1; }
7925 $$ = new Statement(Statement::S_BLOCK, $1);
7926 $$->set_location(infile, @$);
7928 | TitanSpecificTryKeyword StatementBlock
7930 $$ = new Statement(Statement::S_BLOCK, $2);
7931 $2->set_exception_handling(StatementBlock::EH_TRY);
7932 $$->set_location(infile, @$);
7934 | TitanSpecificCatchKeyword '(' IDentifier ')' StatementBlock
7936 $$ = new Statement(Statement::S_BLOCK, $5);
7937 $5->set_exception_handling(StatementBlock::EH_CATCH);
7938 /* add a newly constructed first statement which will contain the error message,
7939 same as: 'var charstring IDentifier;' */
7940 Type* str_type = new Type(Type::T_CSTR);
7941 str_type->set_location(infile, @3);
7942 Def_Var* str_def = new Def_Var($3, str_type, 0);
7943 str_def->set_location(infile, @3);
7944 Statement* str_stmt = new Statement(Statement::S_DEF, str_def);
7945 str_stmt->set_location(infile, @3);
7946 $5->add_stmt(str_stmt, true);
7947 $$->set_location(infile, @$);
7949 | LoopConstruct { $$ = $1; }
7950 | ConditionalConstruct { $$ = $1; }
7951 | SelectCaseConstruct { $$ = $1; }
7955 '(' optError Expression optError ')' { $$ = $3; }
7958 $$ = new Value(Value::V_ERROR);
7959 $$->set_location(infile, @$);
7961 | '+' Expression %prec UnarySign
7963 $$ = new Value(Value::OPTYPE_UNARYPLUS, $2);
7964 $$->set_location(infile, @$);
7966 | '-' Expression %prec UnarySign
7968 $$ = new Value(Value::OPTYPE_UNARYMINUS, $2);
7969 $$->set_location(infile, @$);
7971 | Expression '*' Expression
7973 $$ = new Value(Value::OPTYPE_MULTIPLY, $1, $3);
7974 $$->set_location(infile, @$);
7976 | Expression '/' Expression
7978 $$ = new Value(Value::OPTYPE_DIVIDE, $1, $3);
7979 $$->set_location(infile, @$);
7981 | Expression ModKeyword Expression
7983 $$ = new Value(Value::OPTYPE_MOD, $1, $3);
7984 $$->set_location(infile, @$);
7986 | Expression RemKeyword Expression
7988 $$ = new Value(Value::OPTYPE_REM, $1, $3);
7989 $$->set_location(infile, @$);
7991 | Expression '+' Expression
7993 $$ = new Value(Value::OPTYPE_ADD, $1, $3);
7994 $$->set_location(infile, @$);
7996 | Expression '-' Expression
7998 $$ = new Value(Value::OPTYPE_SUBTRACT, $1, $3);
7999 $$->set_location(infile, @$);
8001 | Expression '&' Expression
8003 $$ = new Value(Value::OPTYPE_CONCAT, $1, $3);
8004 $$->set_location(infile, @$);
8006 | Not4bKeyword Expression
8008 $$ = new Value(Value::OPTYPE_NOT4B, $2);
8009 $$->set_location(infile, @$);
8011 | Expression And4bKeyword Expression
8013 $$ = new Value(Value::OPTYPE_AND4B, $1, $3);
8014 $$->set_location(infile, @$);
8016 | Expression Xor4bKeyword Expression
8018 $$ = new Value(Value::OPTYPE_XOR4B, $1, $3);
8019 $$->set_location(infile, @$);
8021 | Expression Or4bKeyword Expression
8023 $$ = new Value(Value::OPTYPE_OR4B, $1, $3);
8024 $$->set_location(infile, @$);
8026 | Expression SL Expression
8028 $$ = new Value(Value::OPTYPE_SHL, $1, $3);
8029 $$->set_location(infile, @$);
8031 | Expression SR Expression
8033 $$ = new Value(Value::OPTYPE_SHR, $1, $3);
8034 $$->set_location(infile, @$);
8036 | Expression RL Expression
8038 $$ = new Value(Value::OPTYPE_ROTL, $1, $3);
8039 $$->set_location(infile, @$);
8041 | Expression _RR Expression
8043 $$ = new Value(Value::OPTYPE_ROTR, $1, $3);
8044 $$->set_location(infile, @$);
8046 | Expression '<' Expression
8048 $$ = new Value(Value::OPTYPE_LT, $1, $3);
8049 $$->set_location(infile, @$);
8051 | Expression '>' Expression
8053 $$ = new Value(Value::OPTYPE_GT, $1, $3);
8054 $$->set_location(infile, @$);
8056 | Expression LE Expression
8058 $$ = new Value(Value::OPTYPE_LE, $1, $3);
8059 $$->set_location(infile, @$);
8061 | Expression GE Expression
8063 $$ = new Value(Value::OPTYPE_GE, $1, $3);
8064 $$->set_location(infile, @$);
8066 | Expression EQ Expression
8068 $$ = new Value(Value::OPTYPE_EQ, $1, $3);
8069 $$->set_location(infile, @$);
8071 | Expression NE Expression
8073 $$ = new Value(Value::OPTYPE_NE, $1, $3);
8074 $$->set_location(infile, @$);
8076 | NotKeyword Expression
8078 $$ = new Value(Value::OPTYPE_NOT, $2);
8079 $$->set_location(infile, @$);
8081 | Expression AndKeyword Expression
8083 $$ = new Value(Value::OPTYPE_AND, $1, $3);
8084 $$->set_location(infile, @$);
8086 | Expression XorKeyword Expression
8088 $$ = new Value(Value::OPTYPE_XOR, $1, $3);
8089 $$->set_location(infile, @$);
8091 | Expression OrKeyword Expression
8093 $$ = new Value(Value::OPTYPE_OR, $1, $3);
8094 $$->set_location(infile, @$);
8096 | OpCall { $$ = $1; }
8097 | Value { $$ = $1; }
8098 | CompoundExpression { $$ = $1; }
8101 CompoundExpression: // 565
8102 FieldExpressionList { $$ = $1; }
8103 | ArrayExpressionList { $$ = $1; }
8104 | ArrayExpression { $$ = $1; }
8107 FieldExpressionList: // 581
8108 '{' seqFieldExpressionSpec optError '}'
8110 $$ = new Value(Value::V_SEQ, $2);
8111 $$->set_location(infile, @$);
8115 seqFieldExpressionSpec:
8118 $$ = new NamedValues();
8121 | error FieldExpressionSpec
8123 $$ = new NamedValues();
8126 | seqFieldExpressionSpec optError ',' optError FieldExpressionSpec
8131 | seqFieldExpressionSpec optError ',' error { $$ = $1; }
8134 FieldExpressionSpec: // 582
8135 FieldReference AssignmentChar NotUsedOrExpression
8137 $$ = new NamedValue($1, $3);
8138 $$->set_location(infile, @$);
8142 ArrayExpressionList:
8143 '{' seqArrayExpressionSpec optError '}'
8145 $$ = new Value(Value::V_SEQOF, $2);
8146 $$->set_location(infile, @$);
8150 seqArrayExpressionSpec:
8151 optError ArrayExpressionSpec
8153 // The only place for indexed-list notation.
8154 $$ = new Values(true);
8157 | seqArrayExpressionSpec optError ',' optError ArrayExpressionSpec
8162 | seqArrayExpressionSpec optError ',' error { $$ = $1; }
8165 ArrayExpressionSpec:
8166 ArrayOrBitRef AssignmentChar Expression
8168 $$ = new IndexedValue($1, $3);
8169 $$->set_location(infile, @$);
8173 ArrayExpression: // 583
8176 $$ = new Value(Value::V_SEQOF, new Values);
8177 $$->set_location(infile, @$);
8179 | '{' ArrayElementExpressionList optError '}'
8181 $$ = new Value(Value::V_SEQOF, $2);
8182 $$->set_location(infile, @$);
8186 $$ = new Value(Value::V_ERROR);
8187 $$->set_location(infile, @$);
8191 ArrayElementExpressionList: // 584
8197 | error NotUsedOrExpression
8202 | ArrayElementExpressionList optError ',' optError NotUsedOrExpression
8207 | ArrayElementExpressionList optError ',' error { $$ = $1; }
8210 NotUsedOrExpression: // 585
8211 Expression { $$ = $1; }
8214 $$ = new Value(Value::V_NOTUSED);
8215 $$->set_location(infile, @$);
8219 BooleanExpression: // 588
8220 Expression { $$ = $1; }
8223 $$ = new Value(Value::V_ERROR);
8224 $$->set_location(infile, @$);
8229 VariableRef AssignmentChar TemplateBody
8231 $$ = new Ttcn::Assignment($1, $3);
8232 $$->set_location(infile, @$);
8236 /* This can not be a single CompoundExpression (as opposed to Expression) */
8237 SingleExpression: // 595
8238 '(' SingleExpression ')' { $$ = $2; }
8239 | '(' error SingleExpression ')' { $$ = $3; }
8242 $$ = new Value(Value::V_ERROR);
8243 $$->set_location(infile, @$);
8245 | '+' Expression %prec UnarySign
8247 $$ = new Value(Value::OPTYPE_UNARYPLUS, $2);
8248 $$->set_location(infile, @$);
8250 | '-' Expression %prec UnarySign
8252 $$ = new Value(Value::OPTYPE_UNARYMINUS, $2);
8253 $$->set_location(infile, @$);
8255 | SingleExpression '*' Expression
8257 $$ = new Value(Value::OPTYPE_MULTIPLY, $1, $3);
8258 $$->set_location(infile, @$);
8260 | SingleExpression '/' Expression
8262 $$ = new Value(Value::OPTYPE_DIVIDE, $1, $3);
8263 $$->set_location(infile, @$);
8265 | SingleExpression ModKeyword Expression
8267 $$ = new Value(Value::OPTYPE_MOD, $1, $3);
8268 $$->set_location(infile, @$);
8270 | SingleExpression RemKeyword Expression
8272 $$ = new Value(Value::OPTYPE_REM, $1, $3);
8273 $$->set_location(infile, @$);
8275 | SingleExpression '+' Expression
8277 $$ = new Value(Value::OPTYPE_ADD, $1, $3);
8278 $$->set_location(infile, @$);
8280 | SingleExpression '-' Expression
8282 $$ = new Value(Value::OPTYPE_SUBTRACT, $1, $3);
8283 $$->set_location(infile, @$);
8285 | SingleExpression '&' Expression
8287 $$ = new Value(Value::OPTYPE_CONCAT, $1, $3);
8288 $$->set_location(infile, @$);
8290 | Not4bKeyword Expression
8292 $$ = new Value(Value::OPTYPE_NOT4B, $2);
8293 $$->set_location(infile, @$);
8295 | SingleExpression And4bKeyword Expression
8297 $$ = new Value(Value::OPTYPE_AND4B, $1, $3);
8298 $$->set_location(infile, @$);
8300 | SingleExpression Xor4bKeyword Expression
8302 $$ = new Value(Value::OPTYPE_XOR4B, $1, $3);
8303 $$->set_location(infile, @$);
8305 | SingleExpression Or4bKeyword Expression
8307 $$ = new Value(Value::OPTYPE_OR4B, $1, $3);
8308 $$->set_location(infile, @$);
8310 | SingleExpression SL Expression
8312 $$ = new Value(Value::OPTYPE_SHL, $1, $3);
8313 $$->set_location(infile, @$);
8315 | SingleExpression SR Expression
8317 $$ = new Value(Value::OPTYPE_SHR, $1, $3);
8318 $$->set_location(infile, @$);
8320 | SingleExpression RL Expression
8322 $$ = new Value(Value::OPTYPE_ROTL, $1, $3);
8323 $$->set_location(infile, @$);
8325 | SingleExpression _RR Expression
8327 $$ = new Value(Value::OPTYPE_ROTR, $1, $3);
8328 $$->set_location(infile, @$);
8330 | SingleExpression '<' Expression
8332 $$ = new Value(Value::OPTYPE_LT, $1, $3);
8333 $$->set_location(infile, @$);
8335 | SingleExpression '>' Expression
8337 $$ = new Value(Value::OPTYPE_GT, $1, $3);
8338 $$->set_location(infile, @$);
8340 | SingleExpression LE Expression
8342 $$ = new Value(Value::OPTYPE_LE, $1, $3);
8343 $$->set_location(infile, @$);
8345 | SingleExpression GE Expression
8347 $$ = new Value(Value::OPTYPE_GE, $1, $3);
8348 $$->set_location(infile, @$);
8350 | SingleExpression EQ Expression
8352 $$ = new Value(Value::OPTYPE_EQ, $1, $3);
8353 $$->set_location(infile, @$);
8355 | SingleExpression NE Expression
8357 $$ = new Value(Value::OPTYPE_NE, $1, $3);
8358 $$->set_location(infile, @$);
8360 | NotKeyword Expression
8362 $$ = new Value(Value::OPTYPE_NOT, $2);
8363 $$->set_location(infile, @$);
8365 | SingleExpression AndKeyword Expression
8367 $$ = new Value(Value::OPTYPE_AND, $1, $3);
8368 $$->set_location(infile, @$);
8370 | SingleExpression XorKeyword Expression
8372 $$ = new Value(Value::OPTYPE_XOR, $1, $3);
8373 $$->set_location(infile, @$);
8375 | SingleExpression OrKeyword Expression
8377 $$ = new Value(Value::OPTYPE_OR, $1, $3);
8378 $$->set_location(infile, @$);
8380 | OpCall { $$ = $1; }
8381 | Value { $$ = $1; }
8384 optExtendedFieldReference:
8385 // perhaps this should be called seqExtendedFieldReference,
8386 // but the convention appears to be that seq... can not be empty
8392 | optExtendedFieldReference FieldOrArrayReference
8394 $$.nElements = $1.nElements + 1;
8395 $$.elements = (FieldOrArrayRef**)
8396 Realloc($1.elements, ($$.nElements) * sizeof(*$$.elements));
8397 $$.elements[$1.nElements] = $2;
8401 FieldOrArrayReference:
8404 $$ = new FieldOrArrayRef($2);
8405 $$->set_location(infile, @$);
8407 | ArrayOrBitRefOrDash { $$ = $1; }
8411 PredefOrIdentifier { $$ = $1; }
8412 | IDentifier /* maybe PredefOrIdentifier here too */ TypeActualParList
8414 Location loc(infile, @$);
8415 loc.error("Reference to a parameterized field of type `anytype' is "
8416 "not currently supported");
8422 ConfigurationOps { $$ = $1; }
8423 | VerdictOps { $$ = $1; }
8424 | TimerOps { $$ = $1; }
8427 if ($1.ref_pard) $$ = new Value(Value::OPTYPE_EXECUTE, $1.ref_pard,
8429 else if($1.derefered_value)
8430 $$ = new Value(Value::OPTYPE_EXECUTE_REFD, $1.derefered_value, $1.ap_list,
8432 else $$ = new Value(Value::V_ERROR);
8433 $$->set_location(infile, @$);
8435 | FunctionInstance optExtendedFieldReference
8437 for (size_t i = 0; i < $2.nElements; i++) $1->add($2.elements[i]);
8439 $$ = new Value(Value::V_REFD, $1);
8440 $$->set_location(infile, @$);
8444 $$ = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
8445 $$->set_location(infile, @$);
8447 | TemplateOps { $$ = $1; }
8448 | PredefinedOps { $$ = $1; }
8449 | ReferOp { $$ = $1; }
8452 if ($1.ref_pard) $$ = new Value(Value::OPTYPE_ACTIVATE, $1.ref_pard);
8453 else if($1.derefered_value) $$ = new Value(Value::OPTYPE_ACTIVATE_REFD,
8454 $1.derefered_value, new ParsedActualParameters($1.ap_list));
8455 else $$ = new Value(Value::V_ERROR);
8456 $$->set_location(infile, @$);
8458 | ProfilerRunningOp { $$ = $1; }
8462 PredefinedOpKeyword1 '(' optError Expression optError ')'
8464 $$ = new Value($1, $4);
8465 $$->set_location(infile, @$);
8467 | PredefinedOpKeyword1 '(' error ')'
8469 Value *v1 = new Value(Value::V_ERROR);
8470 v1->set_location(infile, @3);
8471 $$ = new Value($1, v1);
8472 $$->set_location(infile, @$);
8474 | PredefinedOpKeyword2 '(' optError Expression optError ',' optError
8475 Expression optError ')'
8477 $$ = new Value($1, $4, $8);
8478 $$->set_location(infile, @$);
8480 | PredefinedOpKeyword2 '(' error ')'
8482 Value *v1 = new Value(Value::V_ERROR);
8483 v1->set_location(infile, @3);
8484 Value *v2 = new Value(Value::V_ERROR);
8485 v2->set_location(infile, @3);
8486 $$ = new Value($1, v1, v2);
8487 $$->set_location(infile, @$);
8489 | PredefinedOpKeyword3 '(' optError Expression optError ',' optError
8490 Expression optError ')'
8492 $$ = new Value($1, $4, $8);
8493 $$->set_location(infile, @$);
8495 | PredefinedOpKeyword3 '(' optError Expression optError ')'
8497 $$ = new Value($1, $4, (Common::Value*)NULL);
8498 $$->set_location(infile, @$);
8500 | PredefinedOpKeyword3 '(' error ')'
8502 Value *v1 = new Value(Value::V_ERROR);
8503 v1->set_location(infile, @3);
8504 Value *v2 = new Value(Value::V_ERROR);
8505 v2->set_location(infile, @3);
8506 $$ = new Value($1, v1, v2);
8507 $$->set_location(infile, @$);
8509 | decompKeyword '(' optError Expression optError ',' optError
8510 Expression optError ',' optError Expression optError ')'
8512 $$ = new Value(Value::OPTYPE_DECOMP, $4, $8, $12);
8513 $$->set_location(infile, @$);
8515 | decompKeyword '(' error ')'
8517 Value *v1 = new Value(Value::V_ERROR);
8518 v1->set_location(infile, @3);
8519 Value *v2 = new Value(Value::V_ERROR);
8520 v2->set_location(infile, @3);
8521 Value *v3 = new Value(Value::V_ERROR);
8522 v3->set_location(infile, @3);
8523 $$ = new Value(Value::OPTYPE_DECOMP, v1, v2, v3);
8524 $$->set_location(infile, @$);
8526 | regexpKeyword '(' optError TemplateInstance optError ',' optError
8527 TemplateInstance optError ',' optError Expression optError ')'
8529 $$ = new Value(Value::OPTYPE_REGEXP, $4, $8, $12);
8530 $$->set_location(infile, @$);
8532 | regexpKeyword NocaseKeyword '(' optError TemplateInstance optError ',' optError
8533 TemplateInstance optError ',' optError Expression optError ')'
8535 $$ = new Value(Value::OPTYPE_REGEXP, $5, $9, $13);
8536 $$->set_location(infile, @$);
8538 | regexpKeyword '(' error ')'
8540 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8541 t1->set_location(infile, @3);
8542 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8543 ti1->set_location(infile, @3);
8544 Template *t2 = new Template(Template::TEMPLATE_ERROR);
8545 t2->set_location(infile, @3);
8546 TemplateInstance *ti2 = new TemplateInstance(0, 0, t2);
8547 ti2->set_location(infile, @3);
8548 Value *v3 = new Value(Value::V_ERROR);
8549 v3->set_location(infile, @3);
8550 $$ = new Value(Value::OPTYPE_REGEXP, ti1, ti2, v3);
8551 $$->set_location(infile, @$);
8553 | regexpKeyword NocaseKeyword '(' error ')'
8555 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8556 t1->set_location(infile, @4);
8557 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8558 ti1->set_location(infile, @4);
8559 Template *t2 = new Template(Template::TEMPLATE_ERROR);
8560 t2->set_location(infile, @4);
8561 TemplateInstance *ti2 = new TemplateInstance(0, 0, t2);
8562 ti2->set_location(infile, @4);
8563 Value *v3 = new Value(Value::V_ERROR);
8564 v3->set_location(infile, @4);
8565 $$ = new Value(Value::OPTYPE_REGEXP, ti1, ti2, v3);
8566 $$->set_location(infile, @$);
8568 | encvalueKeyword '(' optError TemplateInstance optError ')'
8570 $$ = new Value(Value::OPTYPE_ENCODE, $4);
8571 $$->set_location(infile, @$);
8573 | encvalueKeyword '(' error ')'
8575 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8576 t1->set_location(infile, @3);
8577 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8578 ti1->set_location(infile, @3);
8579 $$ = new Value(Value::OPTYPE_ENCODE, ti1);
8580 $$->set_location(infile, @$);
8582 | substrKeyword '(' optError TemplateInstance optError ',' optError
8583 Expression optError ',' optError Expression optError ')'
8585 $$ = new Value(Value::OPTYPE_SUBSTR, $4, $8, $12);
8586 $$->set_location(infile, @$);
8588 | substrKeyword '(' error ')'
8590 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8591 t1->set_location(infile, @3);
8592 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8593 ti1->set_location(infile, @3);
8594 Value *v2 = new Value(Value::V_ERROR);
8595 v2->set_location(infile, @3);
8596 Value *v3 = new Value(Value::V_ERROR);
8597 v3->set_location(infile, @3);
8598 $$ = new Value(Value::OPTYPE_SUBSTR, ti1, v2, v3);
8599 $$->set_location(infile, @$);
8601 | replaceKeyword '(' optError TemplateInstance optError ',' optError
8602 Expression optError ',' optError Expression optError ',' optError
8603 TemplateInstance optError ')'
8605 $$ = new Value(Value::OPTYPE_REPLACE, $4, $8, $12, $16);
8606 $$->set_location(infile, @$);
8608 | replaceKeyword '(' error ')'
8610 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8611 t1->set_location(infile, @3);
8612 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8613 ti1->set_location(infile, @3);
8614 Value *v2 = new Value(Value::V_ERROR);
8615 v2->set_location(infile, @3);
8616 Value *v3 = new Value(Value::V_ERROR);
8617 v3->set_location(infile, @3);
8618 Template *t4 = new Template(Template::TEMPLATE_ERROR);
8619 t4->set_location(infile, @3);
8620 TemplateInstance *ti4 = new TemplateInstance(0, 0, t4);
8621 ti4->set_location(infile, @3);
8622 $$ = new Value(Value::OPTYPE_REPLACE, ti1, v2, v3, ti4);
8623 $$->set_location(infile, @$);
8625 | decvalueKeyword '(' optError DecValueArg optError ',' optError DecValueArg optError ')'
8627 $$ = new Value(Value::OPTYPE_DECODE, $4, $8);
8628 $$->set_location(infile, @$);
8630 | decvalueKeyword '(' error ')'
8632 /*Value *v1 = new Value(Value::V_ERROR);
8633 v1->set_location(infile, @3);
8634 TemplateInstance *t2 = new TemplateInstance(Type::T_ERROR);*/
8635 $$ = new Value(Value::V_ERROR);
8636 $$->set_location(infile, @$);
8638 | isvalueKeyword '(' optError TemplateInstance optError ')'
8640 $$ = new Value(Value::OPTYPE_ISVALUE, $4);
8641 $$->set_location(infile, @$);
8643 | isvalueKeyword '(' error ')'
8645 $$ = new Value(Value::V_ERROR);
8646 $$->set_location(infile, @$);
8648 | isboundKeyword '(' optError TemplateInstance optError ')'
8650 $$ = new Value(Value::OPTYPE_ISBOUND, $4);
8651 $$->set_location(infile, @$);
8653 | isboundKeyword '(' error ')'
8655 $$ = new Value(Value::V_ERROR);
8656 $$->set_location(infile, @$);
8658 | ischosenKeyword '(' optError IschosenArg optError ')'
8660 $$ = new Value(Value::OPTYPE_ISCHOSEN, $4.ref, $4.id);
8661 $$->set_location(infile, @$);
8663 | ischosenKeyword '(' error ')'
8665 $$ = new Value(Value::V_ERROR);
8666 $$->set_location(infile, @$);
8668 | ispresentKeyword '(' optError TemplateInstance optError ')'
8670 $$ = new Value(Value::OPTYPE_ISPRESENT, $4);
8671 $$->set_location(infile, @$);
8673 | ispresentKeyword '(' error ')'
8675 $$ = new Value(Value::V_ERROR);
8676 $$->set_location(infile, @$);
8678 | lengthofKeyword '(' optError TemplateInstance optError ')'
8680 $$ = new Value(Value::OPTYPE_LENGTHOF, $4);
8681 $$->set_location(infile, @$);
8683 | lengthofKeyword '(' error ')'
8685 $$ = new Value(Value::V_ERROR);
8686 $$->set_location(infile, @$);
8688 | rndKeyword '(' ')'
8690 $$ = new Value(Value::OPTYPE_RND);
8691 $$->set_location(infile, @$);
8693 | rndKeyword '(' optError Expression optError ')'
8695 $$ = new Value(Value::OPTYPE_RNDWITHVAL, $4);
8696 $$->set_location(infile, @$);
8698 | rndKeyword '(' error ')'
8700 Value *v = new Value(Value::V_ERROR);
8701 v->set_location(infile, @3);
8702 $$ = new Value(Value::OPTYPE_RNDWITHVAL, v);
8703 $$->set_location(infile, @$);
8705 | sizeofKeyword '(' optError TemplateInstance optError ')'
8707 $$ = new Value(Value::OPTYPE_SIZEOF, $4);
8708 $$->set_location(infile, @$);
8710 | sizeofKeyword '(' error ')'
8712 $$ = new Value(Value::V_ERROR);
8713 $$->set_location(infile, @$);
8715 | log2strKeyword '(' ')'
8717 $$ = new Value(Value::OPTYPE_LOG2STR, new LogArguments());
8718 $$->set_location(infile, @$);
8720 | log2strKeyword '(' LogItemList optError ')'
8722 $$ = new Value(Value::OPTYPE_LOG2STR, $3);
8723 $$->set_location(infile, @$);
8725 | log2strKeyword '(' error ')'
8727 $$ = new Value(Value::OPTYPE_LOG2STR, new LogArguments());
8728 $$->set_location(infile, @$);
8730 | any2unistrKeyWord '(' LogItemList optError ')'
8732 if ($3->get_nof_logargs() != 1) {
8733 Location loc(infile, @1);
8734 loc.error("The any2unistr function takes exactly one argument, not %lu.",
8735 $3->get_nof_logargs());
8737 $$ = new Value(Value::OPTYPE_ANY2UNISTR, new LogArguments());
8738 $$->set_location(infile, @$);
8740 $$ = new Value(Value::OPTYPE_ANY2UNISTR, $3);
8741 $$->set_location(infile, @$);
8744 | testcasenameKeyword '(' ')'
8746 $$ = new Value(Value::OPTYPE_TESTCASENAME);
8747 $$->set_location(infile, @$);
8749 | ttcn2stringKeyword '(' optError TemplateInstance optError ')'
8751 $$ = new Value(Value::OPTYPE_TTCN2STRING, $4);
8752 $$->set_location(infile, @$);
8754 | ttcn2stringKeyword '(' error ')'
8756 $$ = new Value(Value::V_ERROR);
8757 $$->set_location(infile, @$);
8759 | encvalue_unicharKeyWord '(' optError TemplateInstance optError ',' optError
8760 Expression optError ')'
8762 $$ = new Value(Value::OPTYPE_ENCVALUE_UNICHAR, $4, $8);
8763 $$->set_location(infile, @$);
8765 | encvalue_unicharKeyWord '(' optError TemplateInstance optError ')'
8767 $$ = new Value(Value::OPTYPE_ENCVALUE_UNICHAR, $4);
8768 $$->set_location(infile, @$);
8770 | encvalue_unicharKeyWord '(' error ')'
8772 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8773 t1->set_location(infile, @3);
8774 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8775 ti1->set_location(infile, @3);
8776 $$ = new Value(Value::OPTYPE_ENCVALUE_UNICHAR, ti1);
8777 $$->set_location(infile, @$);
8779 | decvalue_unicharKeyWord '(' optError DecValueArg optError ',' optError
8780 DecValueArg optError ')'
8782 $$ = new Value(Value::OPTYPE_DECVALUE_UNICHAR, $4, $8);
8783 $$->set_location(infile, @$);
8785 | decvalue_unicharKeyWord '(' optError DecValueArg optError ',' optError
8786 DecValueArg optError ',' optError Expression optError ')'
8788 $$ = new Value(Value::OPTYPE_DECVALUE_UNICHAR, $4, $8, $12);
8789 $$->set_location(infile, @$);
8791 | decvalue_unicharKeyWord '(' error ')'
8793 $$ = new Value(Value::V_ERROR);
8794 $$->set_location(infile, @$);
8801 if ($1.is_ref) $$ = $1.ref;
8803 $$ = new Ttcn::Reference($1.id);
8804 $$->set_location(infile, @$);
8807 | FunctionInstance { $$ = $1; }
8811 IDentifier { $$ = $1; }
8812 | PredefinedType /* shall not be "anytype" */
8814 // Construct an identifier "on the fly" ($1 here is just a typetype_t)
8815 const char* builtin_typename = Type::get_typename_builtin($1);
8816 if (0 == builtin_typename) FATAL_ERROR("Unexpected type %d", $1);
8817 const string& at_field = anytype_field(string(builtin_typename));
8819 $$ = new Identifier(Identifier::ID_TTCN, at_field);
8823 $$ = new Identifier(Identifier::ID_NAME, string("NULL"));
8826 IschosenArg: /* see also Reference... */
8827 IDentifier '.' PredefOrIdentifier
8829 $$.ref = new Ttcn::Reference($1);
8830 $$.ref->set_location(infile, @1);
8833 | IDentifier '.' PredefOrIdentifier optExtendedFieldReference '.' PredefOrIdentifier
8835 $$.ref = new Ttcn::Reference($1);
8836 FieldOrArrayRef *fieldref = new FieldOrArrayRef($3);
8837 fieldref->set_location(infile, @3);
8838 $$.ref->add(fieldref);
8839 for(size_t i=0; i<$4.nElements; i++) $$.ref->add($4.elements[i]);
8841 $$.ref->set_location(infile, @1, @4);
8844 | IDentifier ArrayOrBitRef optExtendedFieldReference '.' PredefOrIdentifier
8846 $$.ref = new Ttcn::Reference($1);
8848 for(size_t i=0; i<$3.nElements; i++) $$.ref->add($3.elements[i]);
8850 $$.ref->set_location(infile, @1, @3);
8853 | IDentifier '.' ObjectIdentifierValue '.' IDentifier optExtendedFieldReference
8854 '.' PredefOrIdentifier
8856 $$.ref = new Ttcn::Reference($1, $5);
8858 for(size_t i=0; i<$6.nElements; i++) $$.ref->add($6.elements[i]);
8860 $$.ref->set_location(infile, @1, @6);
8865 PredefinedOpKeyword1:
8866 bit2hexKeyword { $$ = Value::OPTYPE_BIT2HEX; }
8867 | bit2intKeyword { $$ = Value::OPTYPE_BIT2INT; }
8868 | bit2octKeyword { $$ = Value::OPTYPE_BIT2OCT; }
8869 | bit2strKeyword { $$ = Value::OPTYPE_BIT2STR; }
8870 | char2intKeyword { $$ = Value::OPTYPE_CHAR2INT; }
8871 | char2octKeyword { $$ = Value::OPTYPE_CHAR2OCT; }
8872 | float2intKeyword { $$ = Value::OPTYPE_FLOAT2INT; }
8873 | float2strKeyword { $$ = Value::OPTYPE_FLOAT2STR; }
8874 | hex2bitKeyword { $$ = Value::OPTYPE_HEX2BIT; }
8875 | hex2intKeyword { $$ = Value::OPTYPE_HEX2INT; }
8876 | hex2octKeyword { $$ = Value::OPTYPE_HEX2OCT; }
8877 | hex2strKeyword { $$ = Value::OPTYPE_HEX2STR; }
8878 | int2charKeyword { $$ = Value::OPTYPE_INT2CHAR; }
8879 | int2floatKeyword { $$ = Value::OPTYPE_INT2FLOAT; }
8880 | int2strKeyword { $$ = Value::OPTYPE_INT2STR; }
8881 | int2unicharKeyword { $$ = Value::OPTYPE_INT2UNICHAR; }
8882 | oct2bitKeyword { $$ = Value::OPTYPE_OCT2BIT; }
8883 | oct2charKeyword { $$ = Value::OPTYPE_OCT2CHAR; }
8884 | oct2hexKeyword { $$ = Value::OPTYPE_OCT2HEX; }
8885 | oct2intKeyword { $$ = Value::OPTYPE_OCT2INT; }
8886 | oct2strKeyword { $$ = Value::OPTYPE_OCT2STR; }
8887 | str2bitKeyword { $$ = Value::OPTYPE_STR2BIT; }
8888 | str2floatKeyword { $$ = Value::OPTYPE_STR2FLOAT; }
8889 | str2hexKeyword { $$ = Value::OPTYPE_STR2HEX; }
8890 | str2intKeyword { $$ = Value::OPTYPE_STR2INT; }
8891 | str2octKeyword { $$ = Value::OPTYPE_STR2OCT; }
8892 | unichar2intKeyword { $$ = Value::OPTYPE_UNICHAR2INT; }
8893 | unichar2charKeyword { $$ = Value::OPTYPE_UNICHAR2CHAR; }
8894 | enum2intKeyword { $$ = Value::OPTYPE_ENUM2INT; }
8895 | remove_bomKeyWord { $$ = Value::OPTYPE_REMOVE_BOM; }
8896 | get_stringencodingKeyWord { $$ = Value::OPTYPE_GET_STRINGENCODING; }
8897 | decode_base64KeyWord { $$ = Value::OPTYPE_DECODE_BASE64; }
8900 PredefinedOpKeyword2:
8901 int2bitKeyword { $$ = Value::OPTYPE_INT2BIT; }
8902 | int2hexKeyword { $$ = Value::OPTYPE_INT2HEX; }
8903 | int2octKeyword { $$ = Value::OPTYPE_INT2OCT; }
8906 PredefinedOpKeyword3:
8907 unichar2octKeyword { $$ = Value::OPTYPE_UNICHAR2OCT; }
8908 | oct2unicharKeyword { $$ = Value::OPTYPE_OCT2UNICHAR; }
8909 | encode_base64KeyWord { $$ = Value::OPTYPE_ENCODE_BASE64; }
8912 String2TtcnStatement:
8913 string2ttcnKeyword '(' optError Expression optError ',' optError Reference optError ')'
8915 Ttcn::Reference* out_ref;
8916 if ($8.is_ref) out_ref = $8.ref;
8918 out_ref = new Ttcn::Reference($8.id);
8919 out_ref->set_location(infile, @8);
8921 $$ = new Statement(Statement::S_STRING2TTCN, $4, out_ref);
8922 $$->set_location(infile, @$);
8926 LogStatement: // 619
8929 $$=new Statement(Statement::S_LOG, (LogArguments*)0);
8930 $$->set_location(infile, @$);
8932 | LogKeyword '(' LogItemList optError ')'
8934 $$=new Statement(Statement::S_LOG, $3);
8935 $$->set_location(infile, @$);
8937 | LogKeyword '(' error ')'
8939 $$=new Statement(Statement::S_LOG, new LogArguments());
8940 $$->set_location(infile, @$);
8947 $$ = new LogArguments();
8950 | LogItemList optError ',' optError LogItem
8955 | LogItemList optError ',' error { $$ = $1; }
8961 $$ = new LogArgument($1);
8962 $$->set_location(infile, @$);
8966 LoopConstruct: // 622
8967 ForStatement { $$ = $1; }
8968 | WhileStatement { $$ = $1; }
8969 | DoWhileStatement { $$ = $1; }
8972 ForStatement: // 623
8973 ForKeyword '(' Initial ';' Final ';' Step optError ')'
8976 $$ = new Statement(Statement::S_FOR, $3.defs, $3.ass, $5, $7, $10);
8977 $$->set_location(infile, @$);
8984 $$.defs = new Definitions;
8985 for (size_t i = 0; i < $1.nElements; i++) $$.defs->add_ass($1.elements[i]);
8996 $$.defs = new Definitions;
9002 BooleanExpression { $$ = $1; }
9006 Assignment { $$ = $1; }
9007 /** \todo for-ban nem lehet null a step
9008 | error { $$=NULL; }
9012 WhileStatement: // 628
9013 WhileKeyword '(' BooleanExpression ')' StatementBlock
9015 $$=new Statement(Statement::S_WHILE, $3, $5);
9016 $$->set_location(infile, @$);
9020 DoWhileStatement: // 630
9021 DoKeyword StatementBlock
9022 WhileKeyword '(' BooleanExpression ')'
9024 $$=new Statement(Statement::S_DOWHILE, $5, $2);
9025 $$->set_location(infile, @$);
9029 ConditionalConstruct: // 632
9030 IfKeyword '(' BooleanExpression ')'
9032 seqElseIfClause optElseClause
9034 IfClause *ic=new IfClause($3, $5);
9035 ic->set_location(infile, @1, @5);
9036 $6->add_front_ic(ic);
9037 $$=new Statement(Statement::S_IF, $6, $7,
9038 $7 ? new Location(infile, @7) : 0);
9039 $$->set_location(infile, @$);
9044 /* empty */ { $$=new IfClauses(); }
9045 | seqElseIfClause ElseIfClause
9052 ElseIfClause: // 634
9053 ElseKeyword IfKeyword '(' BooleanExpression ')' StatementBlock
9055 $$=new IfClause($4, $6);
9056 $$->set_location(infile, @$);
9060 optElseClause: // [636]
9061 /* empty */ { $$=0; }
9062 | ElseKeyword StatementBlock { $$=$2; }
9065 SelectCaseConstruct: // 637
9066 SelectKeyword '(' Expression optError ')' SelectCaseBody
9068 $$=new Statement(Statement::S_SELECT, $3, $6);
9069 $$->set_location(infile, @$);
9071 | SelectKeyword '(' error ')' SelectCaseBody
9073 Value *v = new Value(Value::V_ERROR);
9074 v->set_location(infile, @3);
9075 $$=new Statement(Statement::S_SELECT, v, $5);
9076 $$->set_location(infile, @$);
9080 SelectCaseBody: // 639
9081 '{' seqSelectCase optError '}' {$$=$2;}
9082 | '{' error '}' {$$=new SelectCases;}
9091 | seqSelectCase optError SelectCase
9099 CaseKeyword '(' seqTemplateInstance optError ')' StatementBlock optSemiColon
9101 $3->set_location(infile, @2, @5);
9102 $$=new SelectCase($3, $6);
9103 $$->set_location(infile, @$);
9105 | CaseKeyword '(' error ')' StatementBlock optSemiColon
9107 TemplateInstances *tis = new TemplateInstances;
9108 tis->set_location(infile, @2, @4);
9109 $$ = new SelectCase(tis, $5);
9110 $$->set_location(infile, @$);
9112 | CaseKeyword ElseKeyword StatementBlock optSemiColon
9114 $$=new SelectCase(0, $3);
9115 $$->set_location(infile, @$);
9119 seqTemplateInstance:
9120 optError TemplateInstance
9122 $$ = new TemplateInstances;
9125 | seqTemplateInstance optError ',' optError TemplateInstance
9130 | seqTemplateInstance optError ',' error { $$ = $1; }
9133 /* A.1.6.9 Miscellaneous productions */
9135 optSemiColon: // [645]
9140 /* A.1 ASN.1 support, from ES 201 873-7 V3.1.1 (2005-06) */
9142 optDefinitiveIdentifier:
9144 | DefinitiveIdentifier
9147 DefinitiveIdentifier:
9148 '.' ObjectIdentifierKeyword '{' DefinitiveObjIdComponentList optError '}'
9149 | '.' ObjectIdentifierKeyword '{' error '}'
9152 DefinitiveObjIdComponentList:
9153 optError DefinitiveObjIdComponent
9154 | DefinitiveObjIdComponentList optError DefinitiveObjIdComponent
9157 DefinitiveObjIdComponent:
9159 | DefinitiveNumberForm
9160 | DefinitiveNameAndNumberForm
9163 DefinitiveNumberForm:
9164 Number { delete $1; }
9167 DefinitiveNameAndNumberForm:
9168 IDentifier '(' Number optError ')' { delete $1; delete $3; }
9169 | IDentifier '(' error ')' { delete $1; }
9172 ObjectIdentifierValue:
9173 ObjectIdentifierKeyword '{' ObjIdComponentList optError '}'
9176 $$->set_location(infile, @$);
9178 | ObjectIdentifierKeyword '{' error '}'
9180 $$ = new Value(Value::V_ERROR);
9181 $$->set_location(infile, @$);
9186 optError ObjIdComponent
9188 $$ = new Value(Value::V_OID);
9189 $$->add_oid_comp($2);
9191 | ObjIdComponentList optError ObjIdComponent
9194 $$->add_oid_comp($3);
9199 /* NameForm -- covered by NumberForm (as ReferencedValue) */
9200 NumberForm { $$ = $1; }
9201 | NameAndNumberForm { $$ = $1; }
9207 Value *v = new Value(Value::V_INT, $1);
9208 v->set_location(infile, @1);
9209 $$ = new OID_comp(0, v);
9210 $$->set_location(infile, @$);
9215 /* it can be only a referenced value */
9216 Value *v = new Value(Value::V_REFD, $1.ref);
9217 v->set_location(infile, @1);
9218 $$ = new OID_comp(v);
9220 /* it can be either a name form or a referenced value */
9221 $$ = new OID_comp($1.id, 0);
9223 $$->set_location(infile, @$);
9228 IDentifier '(' Number optError ')'
9230 Value *v = new Value(Value::V_INT, $3);
9231 v->set_location(infile, @3);
9232 $$ = new OID_comp($1, v);
9233 $$->set_location(infile, @$);
9235 | IDentifier '(' ReferencedValue optError ')'
9237 $$ = new OID_comp($1, $3);
9238 $$->set_location(infile, @$);
9240 | IDentifier '(' error ')'
9242 Value *v = new Value(Value::V_ERROR);
9243 v->set_location(infile, @3);
9244 $$ = new OID_comp($1, v);
9245 $$->set_location(infile, @$);
9250 IDentifier { delete $1; }
9253 /* Rules for error recovery */
9262 | optErrorBlock ErrorBlock optError
9267 | '{' optError ErrorBlock optError '}'
9272 static void ttcn3_error(const char *str)
9274 Location loc(infile, ttcn3_lloc);
9276 // the most recently parsed token is known
9277 loc.error("at or before token `%s': %s", ttcn3_text, str);
9279 // the most recently parsed token is unknown
9280 loc.error("%s", str);
9284 int ttcn3_parse_file(const char* filename, boolean generate_code)
9286 anytype_access = false;
9287 ttcn3_in = fopen(filename, "r");
9288 if (ttcn3_in == NULL) {
9289 ERROR("Cannot open input file `%s': %s", filename, strerror(errno));
9295 is_erroneous_parsed = false;
9296 NOTIFY("Parsing TTCN-3 module `%s'...", filename);
9298 int retval = ttcn3_parse();
9300 free_ttcn3_lex(); // does fclose(ttcn3_in);
9302 if (act_ttcn3_module) {
9303 act_ttcn3_module->set_location(filename);
9304 set_md5_checksum(act_ttcn3_module);
9305 if (generate_code) act_ttcn3_module->set_gen_code();
9306 modules->add_mod(act_ttcn3_module);
9307 act_ttcn3_module = 0;
9315 Ttcn::ErroneousAttributeSpec* ttcn3_parse_erroneous_attr_spec_string(
9316 const char* p_str, const Common::Location& str_loc)
9318 is_erroneous_parsed = true;
9319 act_ttcn3_erroneous_attr_spec = NULL;
9320 string titan_err_str("$#&&&(#TITANERRONEOUS$#&&^#% ");
9321 int hack_str_len = (int)titan_err_str.size();
9322 string *parsed_string = parse_charstring_value(p_str, str_loc);
9323 titan_err_str += *parsed_string;
9324 delete parsed_string;
9325 init_erroneous_lex(str_loc.get_filename(), str_loc.get_first_line(), str_loc.get_first_column()-hack_str_len+1);
9326 yy_buffer_state *flex_buffer = ttcn3__scan_string(titan_err_str.c_str());
9327 if (flex_buffer == NULL) {
9328 ERROR("Flex buffer creation failed.");
9332 ttcn3_lex_destroy();
9333 free_dot_flag_stuff();
9335 return act_ttcn3_erroneous_attr_spec;
9339 static void yyprint(FILE *file, int type, const YYSTYPE& value)
9343 fprintf(file, "``%s''", value.id->get_name().c_str());
9346 fprintf(file, "%s", value.int_val->t_str().c_str());
9349 fprintf(file, "%f", value.float_val);
9354 case BitStringMatch:
9355 case HexStringMatch:
9356 case OctetStringMatch:
9357 fprintf(file, "``%s''", value.string_val->c_str());
9360 fprintf(file, "``%s''", value.str);