1 /******************************************************************************
2 * Copyright (c) 2000-2015 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 ******************************************************************************/
8 /* Syntax check parser and compiler for TTCN-3 */
10 /* BNF compliance: v3.2.1 with extensions */
21 #include "../../common/dbgnew.hh"
22 #include "../../common/memory.h"
24 #include "../datatypes.h"
25 #include "Attributes.hh"
29 #include "../Identifier.hh"
30 #include "Templatestuff.hh"
31 #include "AST_ttcn3.hh"
33 #include "../CompType.hh"
34 #include "../CompField.hh"
35 #include "../EnumItem.hh"
36 #include "../SigParam.hh"
38 #include "../subtype.hh"
39 #include "../Value.hh"
40 #include "../Valuestuff.hh"
41 #include "../ustring.hh"
42 #include "Ttcnstuff.hh"
43 #include "TtcnTemplate.hh"
44 #include "Templatestuff.hh"
45 #include "ArrayDimensions.hh"
46 #include "PatternString.hh"
47 #include "Statement.hh"
50 using namespace Common;
52 const char *infile = NULL;
54 static Ttcn::Module *act_ttcn3_module = NULL;
55 static Ttcn::ErroneousAttributeSpec *act_ttcn3_erroneous_attr_spec = NULL;
56 bool is_erroneous_parsed = false;
57 static void ttcn3_error(const char *str);
58 static Group* act_group = NULL;
59 extern string anytype_field(const string& type_name);
60 static bool anytype_access = false;
65 static void yyprint(FILE *file, int type, const YYSTYPE& value);
66 #define YYPRINT(f,t,v) yyprint(f,t,v)
70 extern Modules *modules;
72 extern FILE *ttcn3_in;
73 extern char *ttcn3_text;
74 extern int ttcn3_lex();
75 extern void init_ttcn3_lex();
76 extern void free_ttcn3_lex();
77 extern void set_md5_checksum(Ttcn::Module *m);
79 extern void init_erroneous_lex(const char* p_infile, int p_line, int p_column);
80 struct yy_buffer_state;
81 extern int ttcn3_lex_destroy(void);
82 extern yy_buffer_state *ttcn3__scan_string(const char *yy_str);
83 extern void free_dot_flag_stuff();
85 extern string *parse_charstring_value(const char *str, const Location& loc);
86 extern PatternString* parse_pattern(const char *str, const Location& loc);
88 static const string anyname("anytype");
90 /* Various C macros */
92 #define YYERROR_VERBOSE
97 /* Bison declarations */
99 /*********************************************************************
101 *********************************************************************/
104 /* NOTE: the union is written to compiler.tab.hh, which is #included
105 * into compiler.l; therefore all types used here must be declared
106 * in compiler.l (forward declared or #included) */
107 bool bool_val; /* boolean value */
108 char *str; /* simple string value */
109 unsigned char uchar_val;
111 int_val_t *int_val; /* integer value */
112 Real float_val; /* float value */
115 ustring *ustring_val;
117 Type::typetype_t typetype;
118 PortTypeBody::PortOperationMode_t portoperationmode;
119 Value::operationtype_t operationtype;
120 Value::macrotype_t macrotype;
121 SingleWithAttrib::attribtype_t attribtype;
122 ImpMod::imptype_t imptype;
125 AltGuards *altguards;
126 ArrayDimension *arraydimension;
127 AttributeSpec *attributespec;
128 CompField *compfield;
129 CompFieldMap *compfieldmap;
132 Definition *definition;
135 EnumItems *enumitems;
136 FieldOrArrayRef *fieldorarrayref;
137 FormalPar *formalpar;
138 FormalParList *formalparlist;
140 FriendMod *friendMod;
142 IfClauses *ifclauses;
144 LengthRestriction *lenrestr;
146 LogArguments *logargs;
147 NamedTemplate *namedtempl;
148 NamedTemplates *namedtempls;
149 NamedValue *namedvalue;
150 NamedValues *namedvalues;
151 IndexedTemplate *indexedtempl;
152 IndexedTemplates *indexedtempls;
153 IndexedValue *indexedvalue;
154 MultiWithAttrib *multiwithattrib;
156 ParamAssignment *parass;
157 ParamAssignments *parasss;
158 ParamRedirect *parredir;
159 ParsedActualParameters *parsedpar;
160 PatternString *patstr;
161 Qualifier *qualifier;
162 Qualifiers *qualifiers;
163 SelectCase *selectcase;
164 SelectCases *selectcases;
165 SignatureExceptions *signexc;
166 SignatureParam *signparam;
167 SignatureParamList *signparamlist;
168 SingleWithAttrib *singlewithattrib;
170 StatementBlock *statementblock;
171 SubTypeParse *subtypeparse;
173 TemplateInstance *templinst;
174 TemplateInstances *templinsts;
176 Ttcn::Assignment *ass;
177 Ttcn::Ref_base *refbase;
178 Ttcn::Ref_pard *refpard;
179 Ttcn::Reference *reference;
180 ValueRange *valuerange;
185 VariableEntries *variableentries;
186 VariableEntry *variableentry;
187 vector<SubTypeParse> *subtypeparses;
188 CompTypeRefList *comprefs;
189 ComponentTypeBody *compbody;
190 template_restriction_t template_restriction;
194 ErroneousAttributeSpec::indicator_t indicator;
195 } erroneous_indicator;
197 struct arraydimension_list_t {
199 ArrayDimension **elements;
200 } arraydimension_list;
204 FieldOrArrayRef **elements;
205 } fieldorarrayref_list;
209 Ttcn::Definition **elements;
214 Ttcn::FriendMod **elements;
219 Statement **elements;
225 bool lower_exclusive;
227 bool upper_exclusive;
232 bool returns_template;
233 template_restriction_t template_restriction;
239 } returntypeornoblock;
252 Ttcn::Types *in_list, *out_list, *inout_list;
253 bool in_all, out_all, inout_all;
257 Ttcn::Reference *ref;
263 LengthRestriction *len_restr;
264 } extramatchingattrs;
269 FormalParList *fp_list;
278 Ttcn::Ref_pard *ref_pard;
279 Value *derefered_value;
280 ParsedActualParameters *ap_list;
285 Ttcn::Ref_pard *ref_pard;
286 Value *derefered_value;
287 TemplateInstances *ap_list;
291 TemplateInstance *templ_inst;
296 Value *calltimerval; // if NULL: see nowait
301 TemplateInstance *templ_inst;
302 Value *calltimerval; // if NULL: see nowait
304 Value *val; // not used in callparams
308 TemplateInstance *templ_inst;
314 Ttcn::Reference *signature;
315 TemplateInstance *templ_inst;
320 Ttcn::Reference *redirectval;
321 Ttcn::Reference *redirectsender;
325 ParamRedirect *redirectparam;
326 Ttcn::Reference *redirectsender;
327 } portredirectwithparam;
330 Ttcn::Reference *redirectval;
331 ParamRedirect *redirectparam;
332 Ttcn::Reference *redirectsender;
333 } portredirectwithvalueandparam;
336 TemplateInstance *templ_inst;
337 TemplateInstance *valuematch;
341 TemplateInstance *templ_inst;
342 TemplateInstance *fromclause;
343 Ttcn::Reference *redirectval;
344 Ttcn::Reference *redirectsender;
348 TemplateInstance *templ_inst;
349 TemplateInstance *fromclause;
350 ParamRedirect *redirectparam;
351 Ttcn::Reference *redirectsender;
355 TemplateInstance *templ_inst;
356 TemplateInstance *valuematch;
357 TemplateInstance *fromclause;
358 Ttcn::Reference *redirectval;
359 ParamRedirect *redirectparam;
360 Ttcn::Reference *redirectsender;
364 Ttcn::Reference *signature;
365 TemplateInstance *templ_inst;
370 Ttcn::Reference *signature;
371 TemplateInstance *templ_inst;
373 TemplateInstance *fromclause;
374 Ttcn::Reference *redirectval;
375 Ttcn::Reference *redirectsender;
379 Statement::statementtype_t statementtype;
380 Ttcn::Reference *signature;
381 TemplateInstance *templ_inst;
382 TemplateInstance *valuematch;
384 TemplateInstance *fromclause;
385 Ttcn::Reference *redirectval;
386 ParamRedirect *redirectparam;
387 Ttcn::Reference *redirectsender;
392 Ttcn::Reference *portref;
397 Ttcn::Reference *portref1;
399 Ttcn::Reference *portref2;
403 TemplateInstance *donematch;
404 Ttcn::Reference *redirect;
410 Ttcn::Reference *ref;
417 Ttcn::Assignment *ass;
421 Ttcn::Reference *runsonref;
422 Ttcn::Reference *systemref;
432 ParsedActualParameters *ap_list;
436 struct extconstidentifier_t {
439 } extconstidentifier;
443 extconstidentifier_t *elements;
446 struct singlevarinst_t {
448 arraydimension_list_t arrays;
449 Value *initial_value;
453 struct singlevarinst_list_t {
455 struct singlevarinst_t *elements;
456 } singlevarinst_list;
458 struct singletempvarinst_t {
460 arraydimension_list_t arrays;
461 Template *initial_value;
465 struct singletempvarinst_list_t {
467 singletempvarinst_t *elements;
468 } singletempvarinst_list;
470 struct singlemodulepar_t {
476 struct singletemplatemodulepar_t {
480 } singletemplatemodulepar;
482 struct singlemodulepar_list_t {
484 singlemodulepar_t *elements;
485 } singlemodulepar_list;
487 struct singletemplatemodulepar_list_t {
489 singletemplatemodulepar_t *elements;
490 } singletemplatemodulepar_list;
492 struct portelement_t {
494 ArrayDimensions *dims;
498 struct portelement_list_t {
500 portelement_t *elements;
503 struct runs_on_compref_or_self_t {
505 Ttcn::Reference *reference;
506 } runs_on_compref_or_self;
509 visibility_t visibility;
513 /* Tokens of TTCN-3 */
515 /*********************************************************************
516 * Tokens with semantic value
517 *********************************************************************/
519 /* Terminals with semantic value */
521 %token <int_val> Number
522 %token <float_val> FloatValue
523 %token <id> IDentifier "Identifier"
525 %token <string_val> Bstring
532 %token NullValue "ASN.1_NULL_value"
533 %token <macrotype> MacroValue
535 /*********************************************************************
536 * Tokens without semantic value
537 *********************************************************************/
539 /* Terminals without semantic value - keywords, operators, etc. */
541 %token TOK_errval "erroneous_value"
543 /* A number of terminals (including ApplyKeyword, CallOpKeyword, etc)
544 * are listed as unused by Bison. They do not appear in any rule,
545 * because the lexer does some magic to combine them with the preceding dot
546 * and returns a (DotApplyKeyword, DotCallOpKeyword, etc) instead.
547 * This magic requires the presence of the unused keywords.
548 * (It can return an ApplyKeyword if not preceded by a dot) */
549 %token TitanErroneousHackKeyword
551 %token ActivateKeyword
552 %token AddressKeyword
556 %token AltstepKeyword
560 %token AnyTypeKeyword
562 %token BitStringKeyword
563 %token BooleanKeyword
567 %token CatchOpKeyword
569 %token CharStringKeyword
570 %token CheckOpKeyword
571 %token ClearOpKeyword
572 %token ComplementKeyword
573 %token ComponentKeyword
574 %token ConnectKeyword
576 %token ContinueKeyword
577 %token ControlKeyword
579 %token DeactivateKeyword
580 %token DefaultKeyword
581 %token DerefersKeyword
582 %token DisconnectKeyword
583 %token DisplayKeyword
591 %token ExceptionKeyword
592 %token ExecuteKeyword
593 %token ExtendsKeyword
594 %token ExtensionKeyword
602 %token FunctionKeyword
603 %token GetCallOpKeyword
604 %token GetReplyOpKeyword
605 %token GetVerdictKeyword
609 %token HexStringKeyword
611 %token IfPresentKeyword
614 %token InfinityKeyword
615 %token InOutParKeyword
617 %token IntegerKeyword
618 %token InterleavedKeyword
622 %token LanguageKeyword
627 %token MessageKeyword
630 %token ModifiesKeyword
631 %token ModuleParKeyword
634 %token NoBlockKeyword
640 %token ObjectIdentifierKeyword
641 %token OctetStringKeyword
645 %token OptionalKeyword
649 %token OverrideKeyword
652 %token PatternKeyword
653 %token PermutationKeyword
654 %token PresentKeyword
656 %token PrivateKeyword
657 %token ProcedureKeyword
661 %token ReceiveOpKeyword
663 %token RecursiveKeyword
669 %token RunningKeyword
676 %token SetVerdictKeyword
677 %token SignatureKeyword
681 %token SupersetKeyword
683 %token TemplateKeyword
684 %token TestcaseKeyword
685 %token TimeoutKeyword
688 %token TriggerOpKeyword
690 %token TTCN3ModuleKeyword
691 %token TypeDefKeyword
693 %token UniversalKeyword
696 %token ValueofKeyword
698 %token VariantKeyword
699 %token VerdictTypeKeyword
705 /* TITAN specific keywords */
706 %token TitanSpecificTryKeyword
707 %token TitanSpecificCatchKeyword
708 %token TitanSpecificLazyKeyword
709 %token TitanSpecificProfilerKeyword
711 /* Keywords combined with a leading dot */
713 /* If a '.' (dot) character is followed by one of the keywords below the
714 * lexical analyzer shall return one combined token instead of two distinct
715 * tokens. This eliminates the ambiguity that causes additional shift/reduce
716 * conflicts because the dot can be either the part of a field reference or a
717 * built-in operation denoted by a keyword. */
719 %token DotAliveKeyword
720 %token DotApplyKeyword
721 %token DotCallOpKeyword
722 %token DotCatchOpKeyword
723 %token DotCheckOpKeyword
724 %token DotClearOpKeyword
725 %token DotCreateKeyword
726 %token DotDoneKeyword
727 %token DotGetCallOpKeyword
728 %token DotGetReplyOpKeyword
729 %token DotHaltKeyword
730 %token DotKillKeyword
731 %token DotKilledKeyword
732 %token DotRaiseKeyword
733 %token DotReadKeyword
734 %token DotReceiveOpKeyword
735 %token DotReplyKeyword
736 %token DotRunningKeyword
737 %token DotSendOpKeyword
738 %token DotStartKeyword
739 %token DotStopKeyword
740 %token DotTimeoutKeyword
741 %token DotTriggerOpKeyword
743 /* Predefined function identifiers */
745 %token bit2hexKeyword
746 %token bit2intKeyword
747 %token bit2octKeyword
748 %token bit2strKeyword
749 %token char2intKeyword
750 %token char2octKeyword
752 %token float2intKeyword
753 %token hex2bitKeyword
754 %token hex2intKeyword
755 %token hex2octKeyword
756 %token hex2strKeyword
757 %token int2bitKeyword
758 %token int2charKeyword
759 %token int2enumKeyword
760 %token int2floatKeyword
761 %token int2hexKeyword
762 %token int2octKeyword
763 %token int2strKeyword
764 %token int2unicharKeyword
765 %token isvalueKeyword
766 %token isboundKeyword
767 %token ischosenKeyword
768 %token ispresentKeyword
769 %token lengthofKeyword
770 %token oct2bitKeyword
771 %token oct2charKeyword
772 %token oct2hexKeyword
773 %token oct2intKeyword
774 %token oct2strKeyword
775 %token oct2unicharKeyword
777 %token replaceKeyword
779 %token testcasenameKeyword
781 %token str2floatKeyword
782 %token str2intKeyword
783 %token str2octKeyword
785 %token unichar2intKeyword
786 %token unichar2charKeyword
787 %token unichar2octKeyword
789 %token float2strKeyword
790 %token str2bitKeyword
791 %token str2hexKeyword
793 %token log2strKeyword
794 %token enum2intKeyword
796 %token encvalueKeyword
797 %token decvalueKeyword
799 %token ttcn2stringKeyword
800 %token string2ttcnKeyword
801 %token remove_bomKeyWord
802 %token get_stringencodingKeyWord
803 %token encode_base64KeyWord
804 %token decode_base64KeyWord
806 /* Multi-character operators */
808 %token AssignmentChar ":="
810 %token PortRedirectSymbol "->"
818 %token _RR "@>" /* Name clash with bn.h:292 */
820 /*********************************************************************
821 * Semantic types of nonterminals
822 *********************************************************************/
824 %type <bool_val> optAliveKeyword optOptionalKeyword optOverrideKeyword
825 optErrValueRaw optAllKeyword optLazyEval
826 %type <str> FreeText optLanguageSpec PatternChunk PatternChunkList
827 %type <uchar_val> Group Plane Row Cell
828 %type <id> FieldIdentifier FieldReference GlobalModuleId
829 IdentifierOrAddressKeyword StructFieldRef PredefOrIdentifier
830 %type <string_val> CstringList
831 %type <ustring_val> Quadruple
833 %type <typetype> PredefinedType
834 %type <portoperationmode> PortOperationMode
835 %type <operationtype> PredefinedOpKeyword1 PredefinedOpKeyword2 PredefinedOpKeyword3
837 %type <activateop> ActivateOp
838 %type <attribtype> AttribKeyword
840 %type <altguard> CallBodyStatement AltGuard ElseStatement GuardStatement
841 InterleavedGuardElement
842 %type <altguards> AltGuardList CallBodyStatementList InterleavedGuardList
844 %type <arraydimension> ArrayIndex
845 %type <attributespec> AttribSpec
846 %type <compbody> optComponentDefList ComponentElementDefList
847 %type <compfield> StructFieldDef UnionFieldDef
848 %type <compfieldmap> StructFieldDefList optStructFieldDefList UnionFieldDefList
849 %type <definition> AltstepDef ExtFunctionDef FunctionDef TemplateDef TestcaseDef
850 %type <deftype> TypeDefBody StructuredTypeDef SubTypeDef RecordDef UnionDef
851 SetDef RecordOfDef SetOfDef EnumDef PortDef PortDefBody ComponentDef
852 TypeDef SignatureDef FunctionTypeDef AltstepTypeDef TestcaseTypeDef
853 %type <deftimer> SingleTimerInstance
854 %type <enumitem> Enumeration
855 %type <enumitems> EnumerationList
856 %type <fieldorarrayref> ArrayOrBitRef ArrayOrBitRefOrDash FieldOrArrayReference
857 %type <formalpar> FormalValuePar FormalTemplatePar FormalTimerPar
858 TemplateFormalPar FunctionFormalPar TestcaseFormalPar
859 %type <formalparlist> optTemplateFormalParList TemplateFormalParList
860 optFunctionFormalParList FunctionFormalParList optTestcaseFormalParList
861 TestcaseFormalParList optAltstepFormalParList
862 %type <group> GroupDef GroupIdentifier
863 %type <friend_list> FriendModuleDef
864 %type <ifclause> ElseIfClause
865 %type <ifclauses> seqElseIfClause
866 %type <impmod> ImportFromSpec ModuleId ImportDef
867 %type <lenrestr> optStringLength LengthMatch StringLength
868 %type <logarg> LogItem
869 %type <logargs> LogItemList
870 %type <multiwithattrib> MultiWithAttrib WithAttribList WithStatement
871 optWithStatement optWithStatementAndSemiColon
872 %type <namedtempl> FieldSpec
873 %type <namedtempls> seqFieldSpec
874 %type <namedvalue> FieldExpressionSpec
875 %type <namedvalues> seqFieldExpressionSpec
876 %type <indexedtempl> ArraySpec
877 %type <indexedtempls> seqArraySpec
878 %type <indexedvalue> ArrayExpressionSpec
879 %type <oidcomp> NumberForm NameAndNumberForm ObjIdComponent
880 %type <parass> VariableAssignment
881 %type <parasss> AssignmentList
882 %type <parredir> ParamAssignmentList ParamSpec
883 %type <patstr> CharStringMatch
884 %type <qualifier> DefOrFieldRef FullGroupIdentifier
885 %type <qualifiers> DefOrFieldRefList optAttribQualifier
886 %type <selectcase> SelectCase
887 %type <selectcases> seqSelectCase SelectCaseBody
888 %type <signexc> ExceptionTypeList optExceptionSpec
889 %type <signparam> SignatureFormalPar
890 %type <signparamlist> SignatureFormalParList optSignatureFormalParList
891 %type <singlewithattrib> SingleWithAttrib
892 %type <stmt> AltConstruct BasicStatements BreakStatement BehaviourStatements
893 CallBodyOps CallStatement CatchStatement CheckStatement ClearStatement
894 CommunicationStatements ConditionalConstruct ConfigurationStatements
895 ConnectStatement ContinueStatement ControlStatement DeactivateStatement
896 DisconnectStatement DoWhileStatement DoneStatement ForStatement
897 FunctionStatement GetCallStatement GetReplyStatement GotoStatement GuardOp
898 HaltStatement InterleavedConstruct KillTCStatement KilledStatement
899 LabelStatement LogStatement LoopConstruct MapStatement RaiseStatement
900 ReceiveStatement RepeatStatement ReplyStatement ReturnStatement SUTStatements
901 SendStatement SetLocalVerdict StartStatement StartTCStatement
902 StartTimerStatement StopExecutionStatement StopStatement StopTCStatement
903 StopTimerStatement TimeoutStatement TimerStatements TriggerStatement
904 UnmapStatement VerdictStatements WhileStatement SelectCaseConstruct
905 StopTestcaseStatement String2TtcnStatement ProfilerStatement int2enumStatement
906 %type <statementblock> StatementBlock optElseClause FunctionStatementOrDefList
907 ControlStatementOrDefList ModuleControlBody
908 %type <subtypeparse> ValueOrRange
909 %type <templ> MatchingSymbol SingleValueOrAttrib SimpleSpec TemplateBody
910 ArrayElementSpec ArrayValueOrAttrib FieldSpecList ArraySpecList
911 AllElementsFrom TemplateListElem
912 %type <templinst> AddressRef FromClause FunctionActualPar InLineTemplate
913 ReceiveParameter SendParameter TemplateActualPar TemplateInstance
914 /* TestcaseActualPar */ ValueMatchSpec optFromClause optParDefaultValue
916 %type <parsedpar> FunctionActualParList TestcaseActualParList
917 optFunctionActualParList optTestcaseActualParList
918 NamedPart UnnamedPart
919 %type <templinsts> optTemplateActualParList
920 seqTemplateActualPar seqTemplateInstance
921 %type <templs> ValueOrAttribList seqValueOrAttrib ValueList Complement
922 ArrayElementSpecList SubsetMatch SupersetMatch PermutationMatch
923 %type <ass> Assignment Step
924 %type <refbase> DerivedRefWithParList TemplateRefWithParList DecValueArg
925 %type <refpard> FunctionInstance AltstepInstance
926 %type <reference> PortType optDerivedDef DerivedDef Signature VariableRef
927 TimerRef TimerRefOrAny Port PortOrAny PortOrAll ValueSpec
928 SenderSpec ComponentType optRunsOnSpec RunsOnSpec optSystemSpec
929 %type <valuerange> Range
930 %type <type> NestedEnumDef NestedRecordDef NestedRecordOfDef NestedSetDef
931 NestedSetOfDef NestedTypeDef NestedUnionDef PortDefAttribs ReferencedType
932 Type TypeOrNestedTypeDef NestedFunctionTypeDef NestedAltstepTypeDef
933 NestedTestcaseTypeDef
934 %type <types> TypeList AllOrTypeList
935 %type <value> AddressValue AliveOp AllPortsSpec AltGuardChar ArrayBounds
936 ArrayExpression ArrayExpressionList BitStringValue BooleanExpression
937 BooleanValue CharStringValue ComponentRef ComponentReferenceOrLiteral
938 ComponentOrDefaultReference CompoundExpression ConfigurationOps CreateOp
939 DereferOp Expression FieldExpressionList Final GetLocalVerdict HexStringValue
940 IntegerValue LowerBound MTCOp MatchOp NotUsedOrExpression ObjIdComponentList
941 ObjectIdentifierValue OctetStringValue OmitValue OpCall PredefinedOps
942 PredefinedValue ReadTimerOp ReferOp ReferencedValue RunningOp RunningTimerOp
943 SelfOp SingleExpression SingleLowerBound SystemOp TemplateOps TimerOps
944 TimerValue UpperBound Value ValueofOp VerdictOps VerdictValue optReplyValue
945 optTestcaseTimerValue optToClause ProfilerRunningOp
946 %type <values> ArrayElementExpressionList seqArrayExpressionSpec
947 %type <variableentries> VariableList
948 %type <variableentry> VariableEntry
949 %type <subtypeparses> seqValueOrRange AllowedValues optSubTypeSpec
951 %type <arraydimension_list> optArrayDef
952 %type <fieldorarrayref_list> optExtendedFieldReference
953 %type <def_list> AltstepLocalDef AltstepLocalDefList ComponentElementDef
954 ConstDef ExtConstDef FunctionLocalDef FunctionLocalInst ModuleDef ModulePar
955 ModuleParDef MultiTypedModuleParList PortInstance TimerInstance TimerList
957 %type <stmt_list> FunctionStatementOrDef ControlStatementOrDef
959 %type <rangedef> RangeDef
960 %type <returntype> optReturnType
961 %type <returntypeornoblock> optReturnTypeOrNoBlockKeyword
962 %type <structdefbody> StructDefBody UnionDefBody
963 %type <structofdefbody> StructOfDefBody
964 %type <portdefbody> PortDefList seqPortDefList PortDefLists
965 %type <ischosenarg> IschosenArg
966 %type <extramatchingattrs> optExtraMatchingAttributes
967 %type <basetemplate> BaseTemplate
968 %type <templateref> TemplateRef TestcaseRef FunctionRef
969 %type <testcaseinst> TestcaseInstance
970 %type <portsendop> PortSendOp
971 %type <calltimerval> CallTimerValue
972 %type <portcallop> PortCallOp CallParameters
973 %type <portreplyop> PortReplyOp
974 %type <portraiseop> PortRaiseOp
975 %type <portredirect> optPortRedirect
976 %type <portredirectwithparam> optPortRedirectWithParam
977 %type <portredirectwithvalueandparam> optPortRedirectWithValueAndParam
978 %type <getreplypar> optGetReplyParameter
979 %type <portreceiveop> PortReceiveOp PortTriggerOp
980 %type <portgetcallop> PortGetCallOp
981 %type <portgetreplyop> PortGetReplyOp
982 %type <catchoppar> optCatchOpParameter CatchOpParameter
983 %type <portcatchop> PortCatchOp
984 %type <portcheckop> optCheckParameter CheckParameter CheckPortOpsPresent
985 FromClausePresent RedirectPresent
986 %type <portref> PortRef AllConnectionsSpec
987 %type <connspec> SingleConnectionSpec SingleOrMultiConnectionSpec
988 %type <donepar> optDoneParameter
989 %type <reforid> Reference
990 %type <initial> Initial
991 %type <configspec> ConfigSpec
992 %type <createpar> optCreateParameter
993 %type <applyop> ApplyOp
994 %type <identifier_list> IdentifierList
995 %type <singlevarinst> SingleConstDef SingleVarInstance
996 %type <singlevarinst_list> ConstList VarList
997 %type <singletempvarinst> SingleTempVarInstance
998 %type <singletempvarinst_list> TempVarList
999 %type <singlemodulepar> SingleModulePar
1000 %type <singletemplatemodulepar> SingleTemplateModulePar
1001 %type <singlemodulepar_list> ModuleParList
1002 %type <singletemplatemodulepar_list> TemplateModuleParList
1003 %type <portelement> PortElement
1004 %type <portelement_list> PortElementList
1005 %type <comprefs> optExtendsDef ComponentTypeList
1006 %type <runs_on_compref_or_self> optRunsOnComprefOrSelf
1007 %type <template_restriction> TemplateRestriction optTemplateRestriction
1008 TemplateOptRestricted
1009 %type <visbilitytype> optVisibility ComponentElementVisibility
1010 %type <float_val> FloatOrSpecialFloatValue
1011 %type <erroneous_indicator> ErroneousIndicator
1012 %type <imptype> ImportSpec ImportElement
1014 /*********************************************************************
1016 *********************************************************************/
1019 act_group = $$->get_parent_group();
1024 %destructor {Free($$);}
1033 delete $$.derefered_value;
1038 %destructor {delete $$;}
1052 ArrayElementExpressionList
1054 ArrayElementSpecList
1073 CallBodyStatementList
1080 CommunicationStatements
1083 ComponentElementDefList
1084 ComponentOrDefaultReference
1086 ComponentReferenceOrLiteral
1090 ConditionalConstruct
1092 ConfigurationStatements
1096 ControlStatementOrDefList
1103 DerivedRefWithParList
1117 FieldOrArrayReference
1129 FunctionActualParList
1132 FunctionFormalParList
1135 FunctionStatementOrDefList
1149 IdentifierOrAddressKeyword
1154 InterleavedConstruct
1155 InterleavedGuardElement
1156 InterleavedGuardList
1164 String2TtcnStatement
1176 NestedAltstepTypeDef
1178 NestedFunctionTypeDef
1183 NestedTestcaseTypeDef
1191 ObjectIdentifierValue
1239 SignatureFormalParList
1252 StopExecutionStatement
1253 StopTestcaseStatement
1270 TemplateFormalParList
1273 TemplateRefWithParList
1274 /* TestcaseActualPar */
1275 TestcaseActualParList
1278 TestcaseFormalParList
1315 optAltstepFormalParList
1323 optFunctionActualParList
1324 optFunctionFormalParList
1330 optSignatureFormalParList
1332 optStructFieldDefList
1334 optTemplateActualParList
1335 optTemplateFormalParList
1336 optTestcaseActualParList
1337 optTestcaseFormalParList
1338 optTestcaseTimerValue
1341 optWithStatementAndSemiColon
1343 seqFieldExpressionSpec
1345 seqTemplateActualPar
1351 for (size_t i = 0; i < $$->size(); i++) delete (*$$)[i];
1360 for(size_t i=0; i<$$.nElements; i++) delete $$.elements[i];
1367 ControlStatementOrDef
1371 FunctionStatementOrDef
1375 MultiTypedModuleParList
1381 optExtendedFieldReference
1394 optReturnTypeOrNoBlockKeyword
1412 delete $$.inout_list;
1425 delete $$.len_restr;
1427 optExtraMatchingAttributes
1446 delete $$.derefered_value;
1453 delete $$.templ_inst;
1459 delete $$.calltimerval;
1464 delete $$.templ_inst;
1465 delete $$.calltimerval;
1468 PortCallOp CallParameters
1471 delete $$.templ_inst;
1478 delete $$.signature;
1479 delete $$.templ_inst;
1485 delete $$.redirectval;
1486 delete $$.redirectsender;
1491 delete $$.redirectparam;
1492 delete $$.redirectsender;
1494 optPortRedirectWithParam
1497 delete $$.redirectval;
1498 delete $$.redirectparam;
1499 delete $$.redirectsender;
1501 optPortRedirectWithValueAndParam
1504 delete $$.templ_inst;
1505 delete $$.valuematch;
1507 optGetReplyParameter
1510 delete $$.templ_inst;
1511 delete $$.fromclause;
1512 delete $$.redirectval;
1513 delete $$.redirectsender;
1519 delete $$.templ_inst;
1520 delete $$.fromclause;
1521 delete $$.redirectparam;
1522 delete $$.redirectsender;
1527 delete $$.templ_inst;
1528 delete $$.valuematch;
1529 delete $$.fromclause;
1530 delete $$.redirectval;
1531 delete $$.redirectparam;
1532 delete $$.redirectsender;
1537 delete $$.signature;
1538 delete $$.templ_inst;
1544 delete $$.signature;
1545 delete $$.templ_inst;
1546 delete $$.fromclause;
1547 delete $$.redirectval;
1548 delete $$.redirectsender;
1553 delete $$.signature;
1554 delete $$.templ_inst;
1555 delete $$.valuematch;
1556 delete $$.fromclause;
1557 delete $$.redirectval;
1558 delete $$.redirectparam;
1559 delete $$.redirectsender;
1580 SingleConnectionSpec
1581 SingleOrMultiConnectionSpec
1584 delete $$.donematch;
1590 if ($$.is_ref) delete $$.ref;
1602 delete $$.runsonref;
1603 delete $$.systemref;
1620 for (size_t i = 0; i < $$.nElements; i++) delete $$.elements[i].id;
1627 for (size_t i = 0; i < $$.arrays.nElements; i++)
1628 delete $$.arrays.elements[i];
1629 Free($$.arrays.elements);
1630 delete $$.initial_value;
1634 SingleTempVarInstance
1637 for (size_t i = 0; i < $$.nElements; i++) {
1638 delete $$.elements[i].id;
1639 for (size_t j = 0; i < $$.elements[i].arrays.nElements; j++)
1640 delete $$.elements[i].arrays.elements[j];
1641 Free($$.elements[i].arrays.elements);
1642 delete $$.elements[i].initial_value;
1660 SingleTemplateModulePar
1663 for (size_t i = 0; i < $$.nElements; i++) {
1664 delete $$.elements[i].id;
1665 delete $$.elements[i].defval;
1672 for (size_t i = 0; i < $$.nElements; i++) {
1673 delete $$.elements[i].id;
1674 delete $$.elements[i].deftempl;
1678 TemplateModuleParList
1687 for (size_t i = 0; i < $$.nElements; i++) {
1688 delete $$.elements[i].id;
1689 delete $$.elements[i].dims;
1696 delete $$.reference;
1698 optRunsOnComprefOrSelf
1700 /*********************************************************************
1701 * Operator precedences (lowest first)
1702 *********************************************************************/
1709 %nonassoc '<' '>' GE LE
1716 %left '*' '/' ModKeyword RemKeyword
1724 XXX Source of conflicts (26 S/R):
1726 1.) 9 conflicts in one state
1727 The Expression after 'return' keyword is optional in ReturnStatement.
1728 For 9 tokens the parser cannot decide whether the token is a part of
1729 the return expression (shift) or it is the beginning of the next statement
1732 2.) 9 distinct states, each with one conflict caused by token '['
1733 The local definitions in altsteps can be followed immediately by the guard
1734 expression. When the parser sees the '[' token it cannot decide whether it
1735 belongs to the local definition as array dimension or array subreference
1736 (shift) or it is the beginning of the first guard expression (reduce).
1737 The situations are the following:
1738 - var t v := ref <here> [
1739 - var t v := ref[subref] <here> [
1740 - var t v := ref.integer <here> [
1741 - var t v := ref.subref <here> [
1744 - var t v := ref.objid{...}.subref <here> [
1745 - var template t v <here> [
1746 - var t v := function(...)<subrefs> <here> [
1749 The sequence identifier.objid can be either the beginning of a module name
1750 qualified with a module object identifier (shift) or a reference to an objid
1751 value within an entity of type anytype (reduce).
1754 The '{' token after a call statement can be either the part of the response and
1755 exception handling part (shift) or the beginning of the next statement, which
1756 is a StatementBlock (reduce). Note that StatementBlock as a statement is a
1757 non-standard language extension.
1759 5.) 5 conflicts in in three states, related to named parameters
1761 6.) 1 Conflict due to pattern concatenation
1763 Note that the parser implemented by bison always chooses to shift instead of
1764 reduce in case of conflicts.
1769 /*********************************************************************
1771 *********************************************************************/
1773 /* The grammar of TTCN-3 */
1774 /* The numbers correspond to ES 201 873-1 V4.1.2 (2009-07) */
1779 if (is_erroneous_parsed) {
1780 delete act_ttcn3_module;
1781 act_ttcn3_module = NULL;
1782 Location loc(infile, @1);
1783 loc.error("The erroneous attribute cannot be a TTCN-3 module.");
1786 | TitanErroneousHackKeyword ErroneousAttributeSpec
1788 if (!is_erroneous_parsed) {
1789 delete act_ttcn3_erroneous_attr_spec;
1790 act_ttcn3_erroneous_attr_spec = NULL;
1791 Location loc(infile, @$);
1792 loc.error("File `%s' does not contain a TTCN-3 module.", infile);
1798 ErroneousAttributeSpec:
1799 ErroneousIndicator AssignmentChar TemplateInstance optAllKeyword
1801 act_ttcn3_erroneous_attr_spec = new ErroneousAttributeSpec($1.is_raw, $1.indicator, $3, $4);
1806 ValueKeyword optErrValueRaw
1808 $$.indicator = ErroneousAttributeSpec::I_VALUE;
1811 | IDentifier optErrValueRaw
1813 if ($1->get_ttcnname()=="before") $$.indicator = ErroneousAttributeSpec::I_BEFORE;
1814 else if ($1->get_ttcnname()=="after") $$.indicator = ErroneousAttributeSpec::I_AFTER;
1816 Location loc(infile, @1);
1817 loc.error("Invalid indicator. Valid indicators are: "
1818 "`before', `value' and `after'");
1819 $$.indicator = ErroneousAttributeSpec::I_INVALID;
1827 /* empty */ { $$ = false; }
1828 | AllKeyword { $$ = true; }
1832 /* empty */ { $$ = false; }
1833 | '(' IDentifier ')'
1835 if ($2->get_ttcnname()=="raw") $$ = true;
1837 Location loc(infile, @2);
1838 loc.error("Invalid keyword, only the optional `raw' keyword can be used here.");
1846 /* A.1.6.0 TTCN Module */
1849 TTCN3ModuleId ModuleBody optWithStatementAndSemiColon optError
1851 act_ttcn3_module->set_with_attr($3);
1852 if (anytype_access) {
1853 // If there was an attempted access to an anytype field, artificially
1854 // create a type definition as if the following appeared in TTCN-3:
1855 // type union anytype { /* empty, members added later */ }
1856 // NOTE: anything which looks like usage of an anytype field will bring
1857 // the local anytype to life, which trumps any imported anytype
1858 // (when resolving, the local anytype will be found first).
1859 // TODO: just to be safe, anytype should be removed from the exports.
1860 Type *t = new Type(Type::T_ANYTYPE);
1861 Identifier *anytype_id = new Identifier(Identifier::ID_TTCN, anyname);
1862 Def_Type *anytypedef = new Def_Type(anytype_id, t);
1863 anytypedef->set_parent_path(act_ttcn3_module->get_attrib_path());
1864 act_ttcn3_module->add_ass(anytypedef);
1865 // Def_Type is-a Definition is-a Assignment
1871 optError TTCN3ModuleKeyword IDentifier optDefinitiveIdentifier
1872 optLanguageSpec optError
1874 act_ttcn3_module = new Ttcn::Module($3);
1875 act_ttcn3_module->set_scope_name($3->get_dispname());
1876 act_ttcn3_module->set_language_spec($5);
1882 GlobalModuleId optLanguageSpec
1884 $$ = new ImpMod($1);
1885 $$->set_language_spec($2);
1890 GlobalModuleId: // 5
1891 IDentifier { $$ = $1; }
1892 | IDentifier '.' ObjectIdentifierValue
1893 { $$ = $1; delete $3; }
1897 /* empty */ { $$ = NULL; }
1898 | LanguageKeyword FreeText { $$ = $2; } // sort-of 7 LanguageSpec
1902 '{' optErrorBlock '}'
1903 | '{' ModuleDefinitionsList optErrorBlock '}'
1904 | '{' ModuleDefinitionsList ModuleControlPart optErrorBlock '}'
1905 | '{' ModuleControlPart optErrorBlock '}'
1908 /* A.1.6.1 Module definitions part */
1910 /* A.1.6.1.0 General */
1912 ModuleDefinitionsList: // 10
1913 ModuleDefinition optSemiColon
1914 | error ModuleDefinition optSemiColon
1915 | ModuleDefinitionsList optErrorBlock ModuleDefinition optSemiColon
1918 optVisibility: // 12
1919 // /* empty */ { $$.visibility = PUBLIC;}
1920 /* empty */ { $$.visibility = NOCHANGE;}
1921 | PublicKeyword { $$.visibility = PUBLIC;}
1922 | PrivateKeyword { $$.visibility = PRIVATE;}
1923 | FriendKeyword { $$.visibility = FRIEND;}
1926 /* A definition _in_ the module, not a definition _of_ a module */
1927 ModuleDefinition: // 11
1928 optVisibility ModuleDef optWithStatement
1930 for (size_t i = 0; i < $2.nElements; i++) {
1932 if (i == 0) $2.elements[i]->set_with_attr($3);
1933 else $2.elements[i]->set_with_attr($3->clone());
1935 if ($1.visibility != NOCHANGE) {
1936 $2.elements[i]->set_visibility($1.visibility);
1938 act_ttcn3_module->add_ass($2.elements[i]);
1940 $2.elements[i]->set_parent_path(act_group->get_attrib_path());
1941 act_group->add_ass($2.elements[i]);
1943 $2.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
1948 | optVisibility ImportDef optWithStatement
1950 $2->set_with_attr($3);
1951 if ($1.visibility != NOCHANGE) {
1952 $2->set_visibility($1.visibility);
1955 $2->set_parent_path(act_group->get_attrib_path());
1956 act_group->add_impmod($2);
1958 $2->set_parent_path(act_ttcn3_module->get_attrib_path());
1960 act_ttcn3_module->add_impmod($2);
1962 | PublicKeyword GroupDef optWithStatement
1963 { // only public allowed for group, and it's redundant
1964 $2->set_with_attr($3);
1965 act_group = $2->get_parent_group();
1967 | GroupDef optWithStatement
1968 { // same code as above
1969 $1->set_with_attr($2);
1970 act_group = $1->get_parent_group();
1972 | PrivateKeyword FriendModuleDef optWithStatement
1973 { // only private allowed for "friend module", and it's redundant
1974 for (size_t i = 0; i < $2.nElements; i++) {
1976 if (i == 0) $2.elements[i]->set_with_attr($3);
1977 else $2.elements[i]->set_with_attr($3->clone());
1979 act_ttcn3_module->add_friendmod($2.elements[i]);
1981 $2.elements[i]->set_parent_path(act_group->get_attrib_path());
1982 act_group->add_friendmod($2.elements[i]);
1984 $2.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
1989 | FriendModuleDef optWithStatement
1990 { // same code as above
1991 for (size_t i = 0; i < $1.nElements; i++) {
1993 if (i == 0) $1.elements[i]->set_with_attr($2);
1994 else $1.elements[i]->set_with_attr($2->clone());
1996 act_ttcn3_module->add_friendmod($1.elements[i]);
1998 $1.elements[i]->set_parent_path(act_group->get_attrib_path());
1999 act_group->add_friendmod($1.elements[i]);
2001 $1.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path());
2009 ConstDef { $$ = $1; }
2010 | ModuleParDef { $$ = $1; }
2014 $$.elements = (Ttcn::Definition**)
2015 Malloc(sizeof(*$$.elements));
2016 $$.elements[0] = $1;
2021 $$.elements = (Ttcn::Definition**)
2022 Malloc(sizeof(*$$.elements));
2023 $$.elements[0] = $1;
2028 $$.elements = (Ttcn::Definition**)
2029 Malloc(sizeof(*$$.elements));
2030 $$.elements[0] = $1;
2035 $$.elements = (Ttcn::Definition**)
2036 Malloc(sizeof(*$$.elements));
2037 $$.elements[0] = $1;
2042 $$.elements = (Ttcn::Definition**)
2043 Malloc(sizeof(*$$.elements));
2044 $$.elements[0] = $1;
2049 $$.elements = (Ttcn::Definition**)
2050 Malloc(sizeof(*$$.elements));
2051 $$.elements[0] = $1;
2056 $$.elements = (Ttcn::Definition**)
2057 Malloc(sizeof(*$$.elements));
2058 $$.elements[0] = $1;
2060 | ExtConstDef { $$ = $1; }
2063 /* A.1.6.1.1 Typedef definitions */
2066 TypeDefKeyword TypeDefBody
2069 $$->set_location(infile, @$);
2074 StructuredTypeDef { $$ = $1; }
2075 | SubTypeDef { $$ = $1; }
2078 StructuredTypeDef: // 16
2079 RecordDef { $$ = $1; }
2080 | UnionDef { $$ = $1; }
2081 | SetDef { $$ = $1; }
2082 | RecordOfDef { $$ = $1; }
2083 | SetOfDef { $$ = $1; }
2084 | EnumDef { $$ = $1; }
2085 | PortDef { $$ = $1; }
2086 | ComponentDef { $$ = $1; }
2087 | FunctionTypeDef { $$ = $1; }
2088 | AltstepTypeDef { $$ = $1; }
2089 | TestcaseTypeDef { $$ = $1; }
2093 RecordKeyword StructDefBody
2095 Type *type = new Type(Type::T_SEQ_T, $2.cfm);
2096 type->set_location(infile, @$);
2097 $$ = new Def_Type($2.id, type);
2101 StructDefBody: // 19
2102 IDentifier optStructDefFormalParList
2103 '{' optStructFieldDefList '}'
2108 | AddressKeyword '{' optStructFieldDefList '}'
2110 $$.id = new Identifier(Identifier::ID_TTCN, string("address"));
2115 optStructDefFormalParList:
2116 /* empty */ optError
2117 | '(' StructDefFormalParList optError ')'
2119 Location loc(infile, @$);
2120 loc.error("Type parameterization is not currently supported");
2124 Location loc(infile, @$);
2125 loc.error("Type parameterization is not currently supported");
2129 StructDefFormalParList: // -> 202 784 "Advanced Parameterization", 9
2130 optError StructDefFormalPar
2131 | StructDefFormalParList optError ',' optError StructDefFormalPar
2132 | StructDefFormalParList optError ',' error
2135 StructDefFormalPar: // -> 202 784 "Advanced Parameterization", 10
2136 FormalValuePar { delete $1; }
2139 optStructFieldDefList:
2140 /* empty */ optError { $$ = new CompFieldMap; }
2141 | StructFieldDefList optError { $$ = $1; }
2145 optError StructFieldDef
2147 $$ = new CompFieldMap;
2150 | StructFieldDefList optError ',' optError StructFieldDef
2155 | StructFieldDefList optError ',' error { $$ = $1; }
2158 StructFieldDef: // 21
2159 TypeOrNestedTypeDef IDentifier optArrayDef optSubTypeSpec optOptionalKeyword
2162 /* The subtype constraint belongs to the innermost embedded type of
2163 * possible nested 'record of' or 'set of' constructs. */
2165 while (t->is_seof()) t = t->get_ofType();
2166 t->set_parsed_restrictions($4);
2169 /* creation of array type(s) if necessary (from right to left) */
2170 for (size_t i = $3.nElements; i > 0; i--) {
2171 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2172 type->set_location(*$1);
2175 $$ = new CompField($2, type, $5);
2176 $$->set_location(infile, @$);
2181 /* empty */ { $$ = false; }
2182 | OptionalKeyword { $$ = true; }
2185 TypeOrNestedTypeDef:
2187 | NestedTypeDef { $$ = $1; }
2190 NestedTypeDef: // 22
2191 NestedRecordDef { $$ = $1; }
2192 | NestedUnionDef { $$ = $1; }
2193 | NestedSetDef { $$ = $1; }
2194 | NestedRecordOfDef { $$ = $1; }
2195 | NestedSetOfDef { $$ = $1; }
2196 | NestedEnumDef { $$ = $1; }
2197 | NestedFunctionTypeDef { $$ = $1; }
2198 | NestedAltstepTypeDef { $$ = $1; }
2199 | NestedTestcaseTypeDef { $$ = $1; }
2202 NestedRecordDef: // 23
2203 RecordKeyword '{' optStructFieldDefList '}'
2205 $$ = new Type(Type::T_SEQ_T, $3);
2206 $$->set_location(infile, @$);
2210 NestedUnionDef: // 24
2211 UnionKeyword '{' UnionFieldDefList optError '}'
2213 $$ = new Type(Type::T_CHOICE_T, $3);
2214 $$->set_location(infile, @$);
2219 SetKeyword '{' optStructFieldDefList '}'
2221 $$ = new Type(Type::T_SET_T, $3);
2222 $$->set_location(infile, @$);
2226 NestedRecordOfDef: // 26
2227 RecordKeyword optStringLength OfKeyword TypeOrNestedTypeDef
2229 $$ = new Type(Type::T_SEQOF, $4);
2231 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2232 SubTypeParse *stp = new SubTypeParse($2);
2234 $$->set_parsed_restrictions(vstp);
2236 $$->set_location(infile, @$);
2240 NestedSetOfDef: // 27
2241 SetKeyword optStringLength OfKeyword TypeOrNestedTypeDef
2243 $$ = new Type(Type::T_SETOF, $4);
2245 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2246 SubTypeParse *stp = new SubTypeParse($2);
2248 $$->set_parsed_restrictions(vstp);
2250 $$->set_location(infile, @$);
2254 NestedEnumDef: // 28
2255 EnumKeyword '{' EnumerationList optError '}'
2257 $$ = new Type(Type::T_ENUM_T, $3);
2258 $$->set_location(infile, @$);
2262 NestedFunctionTypeDef:
2263 FunctionKeyword '(' optFunctionFormalParList ')'
2264 optRunsOnComprefOrSelf optReturnType
2266 $3->set_location(infile, @2, @4);
2267 $$ = new Type(Type::T_FUNCTION, $3, $5.reference, $5.self, $6.type,
2268 $6.returns_template, $6.template_restriction);
2269 $$->set_location(infile, @$);
2273 NestedAltstepTypeDef:
2274 AltstepKeyword '(' optAltstepFormalParList ')'
2275 optRunsOnComprefOrSelf
2277 $3->set_location(infile, @2, @4);
2278 $$ = new Type(Type::T_ALTSTEP, $3, $5.reference, $5.self);
2279 $$->set_location(infile, @$);
2283 NestedTestcaseTypeDef:
2284 TestcaseKeyword '(' optTestcaseFormalParList ')'
2287 $3->set_location(infile, @2, @4);
2288 $$ = new Type(Type::T_TESTCASE, $3, $5.runsonref,
2290 $$->set_location(infile, @$);
2295 UnionKeyword UnionDefBody
2297 Type *type = new Type(Type::T_CHOICE_T, $2.cfm);
2298 type->set_location(infile, @$);
2299 $$ = new Def_Type($2.id, type);
2304 IDentifier optStructDefFormalParList
2305 '{' UnionFieldDefList optError '}'
2310 | AddressKeyword '{' UnionFieldDefList optError '}'
2312 $$.id = new Identifier(Identifier::ID_TTCN, string("address"));
2318 optError UnionFieldDef
2320 $$ = new CompFieldMap;
2323 | UnionFieldDefList optError ',' optError UnionFieldDef
2328 | UnionFieldDefList optError ',' error { $$ = $1; }
2329 | error { $$ = new CompFieldMap; }
2332 UnionFieldDef: // 34
2333 TypeOrNestedTypeDef IDentifier optArrayDef optSubTypeSpec
2336 /* The subtype constraint belongs to the innermost embedded type of
2337 * possible nested 'record of' or 'set of' constructs. */
2339 while (t->is_seof()) t = t->get_ofType();
2340 t->set_parsed_restrictions($4);
2343 /* creation of array type(s) if necessary (from right to left) */
2344 for (size_t i = $3.nElements; i > 0; i--) {
2345 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2346 type->set_location(*$1);
2349 $$ = new CompField($2, type, false);
2350 $$->set_location(infile, @$);
2355 SetKeyword StructDefBody
2357 Type *type = new Type(Type::T_SET_T, $2.cfm);
2358 type->set_location(infile, @$);
2359 $$ = new Def_Type($2.id, type);
2364 RecordKeyword optStringLength OfKeyword StructOfDefBody
2366 Type *type = new Type(Type::T_SEQOF, $4.type);
2368 vector<SubTypeParse> *vstp = new vector<SubTypeParse>;
2369 vstp->add(new SubTypeParse($2));
2370 type->set_parsed_restrictions(vstp);
2372 type->set_location(infile, @$);
2373 $$ = new Def_Type($4.id, type);
2377 StructOfDefBody: // 39
2378 TypeOrNestedTypeDef IdentifierOrAddressKeyword optSubTypeSpec
2381 /* The subtype constraint belongs to the innermost embedded type of
2382 * possible nested 'record of' or 'set of' constructs. */
2384 while (t->is_seof()) t = t->get_ofType();
2385 t->set_parsed_restrictions($3);
2392 IdentifierOrAddressKeyword:
2393 IDentifier { $$ = $1; }
2396 $$ = new Identifier(Identifier::ID_TTCN, string("address"));
2401 SetKeyword optStringLength OfKeyword StructOfDefBody
2403 Type *type = new Type(Type::T_SETOF, $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);
2415 EnumKeyword IdentifierOrAddressKeyword
2416 '{' EnumerationList optError '}'
2418 Type *type = new Type(Type::T_ENUM_T, $4);
2419 type->set_location(infile, @$);
2420 $$ = new Def_Type($2, type);
2424 EnumerationList: // 44
2425 optError Enumeration
2430 | EnumerationList optError ',' optError Enumeration
2435 | EnumerationList optError ',' error { $$ = $1; }
2436 | error { $$ = new EnumItems; }
2442 $$ = new EnumItem($1, NULL);
2443 $$->set_location(infile, @$);
2445 | IDentifier '(' Number optError ')'
2447 Value *value = new Value(Value::V_INT, $3);
2448 value->set_location(infile, @3);
2449 $$ = new EnumItem($1, value);
2450 $$->set_location(infile, @$);
2452 | IDentifier '(' '-' Number optError ')'
2455 Value *value = new Value(Value::V_INT, $4);
2456 value->set_location(infile, @3, @4);
2457 $$ = new EnumItem($1, value);
2458 $$->set_location(infile, @$);
2460 | IDentifier '(' error ')'
2462 Value *value = new Value(Value::V_ERROR);
2463 value->set_location(infile, @3);
2464 $$ = new EnumItem($1, value);
2465 $$->set_location(infile, @$);
2470 Type IdentifierOrAddressKeyword optArrayDef optSubTypeSpec
2472 /* the subtype constraint belongs to the innermost type */
2473 if ($4) $1->set_parsed_restrictions($4);
2475 /* creation of array type(s) if necessary (from right to left) */
2476 for (size_t i = $3.nElements; i > 0; i--) {
2477 type = new Type(Type::T_ARRAY, type, $3.elements[i - 1], true);
2478 type->set_location(*$1);
2481 $$ = new Def_Type($2, type);
2485 optSubTypeSpec: // [49]
2486 /* empty */ { $$ = 0; }
2487 | AllowedValues { $$ = $1; }
2488 | AllowedValues StringLength
2491 $$->add(new SubTypeParse($2));
2495 $$ = new vector<SubTypeParse>;
2496 $$->add(new SubTypeParse($1));
2500 AllowedValues: // 50
2501 '(' seqValueOrRange optError ')' { $$ = $2; }
2502 | '(' CharStringMatch optError ')'
2504 $$ = new vector<SubTypeParse>;
2505 $$->add(new SubTypeParse($2));
2507 | '(' error ')' { $$ = new vector<SubTypeParse>; }
2511 optError ValueOrRange
2513 $$ = new vector<SubTypeParse>;
2516 | seqValueOrRange optError ',' optError ValueOrRange
2521 | seqValueOrRange optError ',' error { $$ = $1; }
2525 RangeDef { $$ = new SubTypeParse($1.lower, $1.lower_exclusive, $1.upper, $1.upper_exclusive); }
2526 | Expression { $$ = new SubTypeParse($1); }
2530 LowerBound DotDot UpperBound
2532 $$.lower_exclusive = false;
2534 $$.upper_exclusive = false;
2537 | '!' LowerBound DotDot UpperBound
2539 $$.lower_exclusive = true;
2541 $$.upper_exclusive = false;
2544 | LowerBound DotDot '!' UpperBound
2546 $$.lower_exclusive = false;
2548 $$.upper_exclusive = true;
2551 | '!' LowerBound DotDot '!' UpperBound
2553 $$.lower_exclusive = true;
2555 $$.upper_exclusive = true;
2561 /* empty */ optError { $$ = 0; }
2562 | StringLength { $$ = $1; }
2566 LengthKeyword '(' Expression optError ')'
2568 $$ = new LengthRestriction($3);
2569 $$->set_location(infile, @$);
2571 | LengthKeyword '(' Expression DotDot UpperBound optError ')'
2573 $$ = new LengthRestriction($3, $5);
2574 $$->set_location(infile, @$);
2576 | LengthKeyword '(' error ')'
2578 Value *value = new Value(Value::V_ERROR);
2579 value->set_location(infile, @3);
2580 $$ = new LengthRestriction(value);
2581 $$->set_location(infile, @$);
2588 $$ = new Ttcn::Reference($1);
2589 $$->set_location(infile, @$);
2591 | IDentifier '.' IDentifier
2593 $$ = new Ttcn::Reference($1, $3);
2594 $$->set_location(infile, @$);
2596 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
2598 $$ = new Ttcn::Reference($1, $5);
2599 $$->set_location(infile, @$);
2605 PortKeyword PortDefBody { $$ = $2; }
2609 IDentifier PortDefAttribs
2611 $$ = new Def_Type($1, $2);
2615 PortDefAttribs: // 60
2616 PortOperationMode PortDefLists
2618 PortTypeBody *body = new PortTypeBody($1,
2619 $2.in_list, $2.out_list, $2.inout_list,
2620 $2.in_all, $2.out_all, $2.inout_all);
2621 body->set_location(infile, @$);
2622 $$ = new Type(Type::T_PORT, body);
2623 $$->set_location(infile, @$);
2628 MessageKeyword { $$ = PortTypeBody::PO_MESSAGE; } // 61
2629 | ProcedureKeyword { $$ = PortTypeBody::PO_PROCEDURE; } // 68
2630 | MixedKeyword { $$ = PortTypeBody::PO_MIXED; } // 73
2631 | error { $$ = PortTypeBody::PO_MIXED; }
2635 '{' seqPortDefList '}' { $$ = $2; }
2643 $$.inout_all = false;
2648 optError PortDefList optSemiColon { $$ = $2; }
2649 | seqPortDefList PortDefList optSemiColon
2654 $$.in_list->steal_types($2.in_list);
2656 } else $$.in_list = $2.in_list;
2660 $$.out_list->steal_types($2.out_list);
2662 } else $$.out_list = $2.out_list;
2664 if ($2.inout_list) {
2665 if ($$.inout_list) {
2666 $$.inout_list->steal_types($2.inout_list);
2667 delete $2.inout_list;
2668 } else $$.inout_list = $2.inout_list;
2672 Location loc(infile, @2);
2673 loc.warning("Duplicate directive `in all' in port type definition");
2674 } else $$.in_all = true;
2678 Location loc(infile, @2);
2679 loc.warning("Duplicate directive `out all' in port type definition");
2680 } else $$.out_all = true;
2684 Location loc(infile, @2);
2685 loc.warning("Duplicate directive `inout all' in port type definition");
2686 } else $$.inout_all = true;
2692 InParKeyword AllOrTypeList
2696 $$.in_list->set_location(infile, @$);
2705 $$.inout_all = false;
2707 | OutParKeyword AllOrTypeList
2713 $$.out_list->set_location(infile, @$);
2720 $$.inout_all = false;
2722 | InOutParKeyword AllOrTypeList
2730 $$.inout_list->set_location(infile, @$);
2731 $$.inout_all = false;
2734 $$.inout_all = true;
2737 | InParKeyword error
2744 $$.inout_all = false;
2746 | OutParKeyword error
2753 $$.inout_all = false;
2755 | InOutParKeyword error
2762 $$.inout_all = false;
2766 AllOrTypeList: // 65
2767 AllKeyword { $$ = 0; }
2768 | TypeList { $$ = $1; }
2777 | TypeList optError ',' optError Type
2782 | TypeList optError ',' error { $$ = $1; }
2786 ComponentKeyword IDentifier
2788 '{' optComponentDefList '}'
2791 if ($3) $5->add_extends($3);
2792 $5->set_location(infile, @$);
2793 Type *type = new Type(Type::T_COMPONENT, $5);
2794 type->set_location(infile, @$);
2795 $$ = new Def_Type($2, type);
2800 /* empty */ optError { $$ = 0; }
2801 | ExtendsKeyword ComponentTypeList optError
2804 $$->set_location(infile, @1, @2);
2806 | ExtendsKeyword error { $$ = 0; }
2810 optError ComponentType
2812 $$ = new CompTypeRefList();
2815 | ComponentTypeList optError ',' optError ComponentType
2820 | ComponentTypeList optError ',' error { $$ = $1; }
2823 ComponentType: // 81
2826 $$ = new Ttcn::Reference($1);
2827 $$->set_location(infile, @$);
2829 | IDentifier '.' IDentifier
2831 $$ = new Ttcn::Reference($1, $3);
2832 $$->set_location(infile, @$);
2834 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
2836 $$ = new Ttcn::Reference($1, $5);
2837 $$->set_location(infile, @$);
2842 optComponentDefList:
2843 optError /* empty */ { $$ = new ComponentTypeBody(); }
2844 | ComponentElementDefList optError { $$ = $1; }
2847 ComponentElementDefList:
2848 optError ComponentElementDef optSemiColon
2850 $$ = new ComponentTypeBody();
2851 for (size_t i = 0; i < $2.nElements; i++)
2852 $$->add_ass($2.elements[i]);
2855 | ComponentElementDefList optError ComponentElementDef optSemiColon
2858 for (size_t i = 0; i < $3.nElements; i++)
2859 $$->add_ass($3.elements[i]);
2864 ComponentElementVisibility:
2865 PublicKeyword { $$.visibility = PUBLIC;}
2866 | PrivateKeyword { $$.visibility = PRIVATE;}
2869 ComponentElementDef: // 84
2870 PortInstance { $$ = $1; }
2871 | VarInstance { $$ = $1; }
2872 | TimerInstance { $$ = $1; }
2873 | ConstDef { $$ = $1; }
2874 | ComponentElementVisibility PortInstance
2877 for (size_t i = 0; i < $2.nElements; i++) {
2878 $2.elements[i]->set_visibility($1.visibility);
2881 | ComponentElementVisibility VarInstance
2884 for (size_t i = 0; i < $2.nElements; i++) {
2885 $2.elements[i]->set_visibility($1.visibility);
2888 | ComponentElementVisibility TimerInstance
2891 for (size_t i = 0; i < $2.nElements; i++) {
2892 $2.elements[i]->set_visibility($1.visibility);
2895 | ComponentElementVisibility ConstDef
2898 for (size_t i = 0; i < $2.nElements; i++) {
2899 $2.elements[i]->set_visibility($1.visibility);
2905 PortKeyword PortType PortElementList
2907 $$.nElements = $3.nElements;
2908 $$.elements = (Ttcn::Definition**)
2909 Malloc($$.nElements*sizeof(*$$.elements));
2910 for (size_t i = 0; i < $3.nElements; i++) {
2911 Ttcn::Reference *ref = i > 0 ? $2->clone() : $2;
2912 $$.elements[i] = new Ttcn::Def_Port($3.elements[i].id, ref,
2913 $3.elements[i].dims);
2914 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
2921 optError PortElement
2924 $$.elements = (YYSTYPE::portelement_t*)Malloc(sizeof(*$$.elements));
2925 $$.elements[0] = $2;
2927 | PortElementList ',' optError PortElement
2929 $$.nElements = $1.nElements + 1;
2930 $$.elements = (YYSTYPE::portelement_t*)
2931 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
2932 $$.elements[$$.nElements - 1] = $4;
2934 | PortElementList ',' error { $$ = $1; }
2938 IDentifier optArrayDef
2941 if ($2.nElements > 0) {
2942 $$.dims = new ArrayDimensions;
2943 for (size_t i = 0; i < $2.nElements; i++) $$.dims->add($2.elements[i]);
2950 /* A.1.6.1.2 Constant definitions */
2953 ConstKeyword Type ConstList
2955 $$.nElements = $3.nElements;
2956 $$.elements = (Ttcn::Definition**)
2957 Malloc($$.nElements*sizeof(*$$.elements));
2958 for (size_t i = 0; i < $$.nElements; i++) {
2961 type = new Type(Type::T_REFDSPEC, $2);
2962 type->set_location(*$2);
2964 /* creation of array type(s) if necessary (from right to left) */
2965 for (size_t j = $3.elements[i].arrays.nElements; j > 0; j--) {
2966 type = new Type(Type::T_ARRAY, type,
2967 $3.elements[i].arrays.elements[j - 1], false);
2968 type->set_location(*$2);
2970 Free($3.elements[i].arrays.elements);
2972 /* Create the definition */
2973 $$.elements[i] = new Def_Const($3.elements[i].id,
2974 type, $3.elements[i].initial_value);
2975 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
2982 optError SingleConstDef
2985 $$.elements = (YYSTYPE::singlevarinst_t*)Malloc(sizeof(*$$.elements));
2986 $$.elements[0] = $2;
2988 | ConstList ',' optError SingleConstDef
2990 $$.nElements = $1.nElements + 1;
2991 $$.elements = (YYSTYPE::singlevarinst_t*)
2992 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
2993 $$.elements[$$.nElements - 1] = $4;
2997 SingleConstDef: // 90
2998 IDentifier optArrayDef AssignmentChar Expression
3002 $$.initial_value = $4;
3008 FunctionKeyword IDentifier '(' optFunctionFormalParList ')'
3009 optRunsOnComprefOrSelf optReturnType
3011 $4->set_location(infile, @3, @5);
3012 Type *type = new Type(Type::T_FUNCTION, $4, $6.reference, $6.self, $7.type,
3013 $7.returns_template, $7.template_restriction);
3014 type->set_location(infile, @$);
3015 $$ = new Ttcn::Def_Type($2, type);
3016 $$->set_location(infile, @$);
3021 AltstepKeyword IDentifier '(' optAltstepFormalParList ')'
3022 optRunsOnComprefOrSelf
3024 $4->set_location(infile, @3, @5);
3025 Type *type = new Type(Type::T_ALTSTEP, $4, $6.reference, $6.self);
3026 type->set_location(infile, @$);
3027 $$ = new Ttcn::Def_Type($2, type);
3028 $$->set_location(infile, @$);
3033 TestcaseKeyword IDentifier '(' optTestcaseFormalParList ')'
3036 $4->set_location(infile, @3, @5);
3037 Type *type = new Type(Type::T_TESTCASE, $4, $6.runsonref,
3039 type->set_location(infile, @$);
3040 $$ = new Ttcn::Def_Type($2, type);
3041 $$->set_location(infile, @$);
3045 /* A.1.6.1.3 Template definitions */
3048 TemplateKeyword optTemplateRestriction BaseTemplate
3049 optDerivedDef AssignmentChar TemplateBody
3051 $$ = new Def_Template($2, $3.name, $3.type, $3.fp_list, $4, $6);
3052 $$->set_location(infile, @$);
3057 Type IDentifier optTemplateFormalParList
3063 /* | Signature IDentifier optTemplateFormalParList -- covered by the previous
3068 /* empty */ { $$ = 0; }
3069 | DerivedDef { $$ = $1; }
3073 ModifiesKeyword TemplateRef
3075 $$ = new Ttcn::Reference($2.modid, $2.id);
3076 $$->set_location(infile, @$);
3078 | ModifiesKeyword error { $$ = 0; }
3081 optTemplateFormalParList:
3082 /* empty */ optError { $$ = 0; }
3083 | '(' TemplateFormalParList optError ')'
3086 $$->set_location(infile, @$);
3090 $$ = new FormalParList;
3091 $$->set_location(infile, @$);
3095 TemplateFormalParList: // 99 is a FormalParList*
3096 optError TemplateFormalPar
3098 $$ = new FormalParList;
3101 | TemplateFormalParList optError ',' optError TemplateFormalPar
3106 | TemplateFormalParList optError ',' error { $$ = $1; }
3109 TemplateFormalPar: // 100
3110 FormalValuePar { $$ = $1; }
3111 | FormalTemplatePar { $$ = $1; }
3114 TemplateBody: // 101 is a Template*
3115 SimpleSpec optExtraMatchingAttributes
3118 $$->set_length_restriction($2.len_restr);
3119 $$->set_ifpresent($2.is_ifpresent);
3121 | FieldSpecList optExtraMatchingAttributes
3124 $$->set_length_restriction($2.len_restr);
3125 $$->set_ifpresent($2.is_ifpresent);
3127 | ArraySpecList optExtraMatchingAttributes
3130 $$->set_length_restriction($2.len_restr);
3131 $$->set_ifpresent($2.is_ifpresent);
3133 | ArrayValueOrAttrib optExtraMatchingAttributes
3136 $$->set_length_restriction($2.len_restr);
3137 $$->set_ifpresent($2.is_ifpresent);
3142 SingleValueOrAttrib { $$ = $1; }
3145 FieldSpecList: // 103
3148 $$ = new Template(Template::TEMPLATE_LIST, new Templates());
3149 $$->set_location(infile, @$);
3152 | '{' seqFieldSpec optError '}'
3154 $$ = new Template($2); // NAMED_TEMLATE_LIST
3155 $$->set_location(infile, @$);
3159 $$ = new Template(Template::TEMPLATE_ERROR);
3160 $$->set_location(infile, @$);
3164 /* Sequence of FieldSpec. \note Cannot be empty */
3165 seqFieldSpec: // a NamedTemplates*
3168 $$ = new NamedTemplates();
3173 $$ = new NamedTemplates();
3176 | seqFieldSpec optError ',' optError FieldSpec
3181 | seqFieldSpec optError ',' error { $$ = $1; }
3184 FieldSpec: // 104 a NamedTemplate*
3185 FieldReference AssignmentChar TemplateBody
3187 $$ = new NamedTemplate($1, $3);
3188 $$->set_location(infile, @$);
3190 | FieldReference AssignmentChar NotUsedSymbol
3192 Template* temp = new Template(Template::TEMPLATE_NOTUSED);
3193 temp->set_location(infile, @3);
3194 $$ = new NamedTemplate($1, temp);
3195 $$->set_location(infile, @$);
3199 FieldReference: // 105
3200 StructFieldRef { $$ = $1; }
3201 /* | ArrayOrBitRef -- covered by ArraySpecList */
3202 /* | ParRef -- covered by StructFieldRef */
3205 StructFieldRef: // 106 (and 107. ParRef)
3206 PredefOrIdentifier { $$ = $1; }
3208 Note: Non-parameterized type references are covered by (StructField)Identifier.
3209 Parameterized type references are covered by FunctionInstance */
3212 Location loc(infile, @$);
3213 loc.error("Reference to a parameterized field of type `anytype' is "
3214 "not currently supported");
3216 $$ = new Identifier(Identifier::ID_TTCN, string("<error>"));
3221 '{' seqArraySpec optError '}'
3223 $$ = new Template($2);
3224 $$->set_location(infile, @$);
3231 $$ = new IndexedTemplates();
3234 /* It was optError before. */
3237 $$ = new IndexedTemplates();
3240 | seqArraySpec optError ',' optError ArraySpec
3245 | seqArraySpec optError ',' error { $$ = $1; }
3249 ArrayOrBitRef AssignmentChar TemplateBody
3251 $$ = new IndexedTemplate($1, $3);
3252 $$->set_location(infile, @$);
3256 ArrayOrBitRef: // 109
3259 $$ = new FieldOrArrayRef($2);
3260 $$->set_location(infile, @$);
3264 $$ = new FieldOrArrayRef(new Value(Value::V_ERROR));
3265 $$->set_location(infile, @$);
3269 SingleValueOrAttrib: // 111
3270 MatchingSymbol { $$ = $1; }
3273 if ($1->get_valuetype() == Value::V_OMIT) {
3275 $$ = new Template(Template::OMIT_VALUE);
3276 } else $$ = new Template($1); // SPECIFIC_VALUE; SingleExpr is a Template*
3277 $$->set_location(infile, @$);
3279 /* | TemplateRefWithParList -- covered by SingleExpression */
3282 ArrayValueOrAttrib: // 112
3283 '{' ArrayElementSpecList optError '}'
3285 $$ = new Template(Template::TEMPLATE_LIST, $2);
3286 $$->set_location(infile, @$);
3290 ArrayElementSpecList: // 113
3296 | error ArrayElementSpec
3301 | ArrayElementSpecList optError ',' optError ArrayElementSpec
3306 | ArrayElementSpecList optError ',' error { $$ = $1; }
3309 ArrayElementSpec: // 114 is a Template*
3312 $$ = new Template(Template::TEMPLATE_NOTUSED);
3313 $$->set_location(infile, @$);
3317 $$ = new Template(Template::PERMUTATION_MATCH, $1);
3318 $$->set_location(infile, @$);
3320 | TemplateListElem { $$ = $1; }
3323 NotUsedSymbol: // 115
3327 MatchingSymbol: // 116 is a Template*
3330 $$ = new Template(Template::COMPLEMENTED_LIST, $1);
3331 $$->set_location(infile, @$);
3335 $$ = new Template(Template::ANY_VALUE);
3336 $$->set_location(infile, @$);
3340 $$ = new Template(Template::ANY_OR_OMIT);
3341 $$->set_location(infile, @$);
3345 $$ = new Template(Template::VALUE_LIST, $1);
3346 $$->set_location(infile, @$);
3350 $$ = new Template($1);
3351 $$->set_location(infile, @$);
3355 $$ = new Template(Template::BSTR_PATTERN, $1);
3356 $$->set_location(infile, @$);
3360 $$ = new Template(Template::HSTR_PATTERN, $1);
3361 $$->set_location(infile, @$);
3365 $$ = new Template(Template::OSTR_PATTERN, $1);
3366 $$->set_location(infile, @$);
3370 $$ = new Template($1);
3371 $$->set_location(infile, @$);
3375 $$ = new Template(Template::SUBSET_MATCH, $1);
3376 $$->set_location(infile, @$);
3380 $$ = new Template(Template::SUPERSET_MATCH, $1);
3381 $$->set_location(infile, @$);
3383 | '(' AllElementsFrom ')'
3385 $$ = new Template(Template::VALUE_LIST_ALL_FROM, $2);
3386 $$->set_location(infile, @$);
3390 optExtraMatchingAttributes: // [117]
3393 $$.is_ifpresent = false;
3394 $$.len_restr = NULL;
3399 $$.is_ifpresent = false;
3403 $$.len_restr = NULL;
3404 $$.is_ifpresent = true;
3406 | LengthMatch IfPresentMatch
3409 $$.is_ifpresent = true;
3413 CharStringMatch: // 124
3414 PatternKeyword PatternChunkList
3416 Location loc(infile, @2);
3417 $$ = parse_pattern($2, loc);
3427 | PatternChunkList '&' PatternChunk
3430 $$ = mputstr($$, $3);
3442 switch ($1->get_valuetype()) {
3443 case Value::V_REFD: {
3444 /* Pretend to be a reference. Let pstring_la.l discover the
3446 Common::Reference *ref = $1->get_reference();
3447 $$ = mprintf("{%s}", (ref->get_dispname()).c_str());
3449 case Value::V_UNDEF_LOWERID: {
3450 const Common::Identifier *id = $1->get_val_id();
3451 $$ = mprintf("{%s}", (id->get_dispname()).c_str());
3454 FATAL_ERROR("Internal error.");
3456 /* Forget the Node. */
3461 ustring::universal_char& uc = $1->operator[](0);
3462 $$ = mprintf("\\q{%d,%d,%d,%d}", uc.group, uc.plane, uc.row, uc.cell);
3467 Complement: // 130 is a Templates*
3468 ComplementKeyword ValueList { $$ = $2; }
3471 ValueList: // 132 is a Templates*
3472 '(' seqValueOrAttrib optError ')' { $$ = $2; }
3473 | '(' error ')' { $$ = new Templates; }
3476 seqValueOrAttrib: // is a Templates*
3477 optError TemplateListElem
3482 | seqValueOrAttrib optError ',' optError TemplateListElem
3487 | seqValueOrAttrib optError ',' error { $$ = $1; }
3490 SubsetMatch: // 133 is a Templates*
3491 SubsetKeyword ValueList { $$ = $2; }
3494 SupersetMatch: // 135 is a Templates*
3495 SupersetKeyword ValueList { $$ = $2; }
3498 PermutationMatch: // 137 is a Templates*
3499 PermutationKeyword ValueList { $$ = $2; }
3510 TemplateListElem: // is a Template*
3515 AllElementsFrom: // is a Template*
3516 AllKeyword FromKeyword TemplateBody
3517 { // $3 is a Template*
3518 $$ = new Template($3); // Constructs ALL_FROM
3519 $$->set_location(infile, @$);
3523 ValueOrAttribList: // 142 is a Templates*
3524 /* ValueOrAttribList always has two or more elements
3525 * (there's always a comma) and is reduced through
3526 * ValueOrAttribList -> MatchingSymbol -> SingleValueOrAttrib
3528 * The one-element list is reduced through
3529 * '(' SingleExpression ')' -> SingleExpression -> SingleValueOrAttrib */
3530 '(' TemplateListElem optError ',' seqValueOrAttrib optError ')'
3533 $$->add_front_t($2);
3535 | '(' error TemplateListElem optError ',' seqValueOrAttrib optError ')'
3538 $$->add_front_t($3);
3543 StringLength { $$ = $1; }
3546 IfPresentMatch: // 144
3551 '(' SingleLowerBound DotDot UpperBound optError ')'
3552 { $$ = new ValueRange($2, $4); }
3558 if ($1->is_parsed_infinity()==-1) {
3559 /* the conflicting rule alternative faked here: '-' InfinityKeyword */
3571 if ($1->is_parsed_infinity()==-1) {
3572 /* the conflicting rule alternative faked here: '-' InfinityKeyword */
3584 if ($1->is_parsed_infinity()==1) {
3585 /* the conflicting rule alternative faked here: InfinityKeyword */
3594 TemplateInstance: // 151
3595 InLineTemplate { $$ = $1; }
3598 TemplateRefWithParList: /* refbase */ // 153 ?
3599 TemplateRef optTemplateActualParList
3602 $$ = new Ttcn::Ref_pard($1.modid, $1.id, new ParsedActualParameters($2));
3603 $$->set_location(infile, @$);
3605 $$ = new Ttcn::Reference($1.modid, $1.id);
3606 $$->set_location(infile, @$);
3617 | IDentifier '.' IDentifier
3622 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
3630 InLineTemplate: // 155
3633 $$ = new TemplateInstance(0, 0, $1);
3634 $$->set_location(infile, @$);
3636 | Type ':' TemplateBody
3638 $$ = new TemplateInstance($1, 0, $3);
3639 $$->set_location(infile, @$);
3641 /* | Signature ':' TemplateBody -- covered by the previous rule */
3642 | DerivedRefWithParList AssignmentChar TemplateBody
3644 $$ = new TemplateInstance(0, $1, $3);
3645 $$->set_location(infile, @$);
3647 | Type ':' DerivedRefWithParList AssignmentChar TemplateBody
3649 $$ = new TemplateInstance($1, $3, $5);
3650 $$->set_location(infile, @$);
3652 /* | Signature ':' DerivedRefWithParList AssignmentChar TemplateBody
3653 -- covered by the previous rule */
3656 DerivedRefWithParList: // 156
3657 ModifiesKeyword TemplateRefWithParList { $$ = $2; }
3660 optTemplateActualParList: // [157]
3661 /* empty */ optError { $$ = 0; }
3662 | '(' seqTemplateActualPar optError ')'
3665 $$->set_location(infile, @$);
3669 $$ = new TemplateInstances;
3670 $$->set_location(infile, @$);
3674 seqTemplateActualPar:
3675 optError TemplateActualPar
3677 $$ = new TemplateInstances;
3680 | seqTemplateActualPar optError ',' optError TemplateActualPar
3685 | seqTemplateActualPar optError ',' error { $$ = $1; }
3688 TemplateActualPar: // 158
3689 TemplateInstance { $$ = $1; }
3692 Template *t = new Template(Template::TEMPLATE_NOTUSED);
3693 t->set_location(infile, @$);
3694 $$ = new TemplateInstance(0, 0, t);
3695 $$->set_location(infile, @$);
3700 MatchOp { $$ = $1; }
3701 | ValueofOp { $$ = $1; }
3705 MatchKeyword '(' optError Expression optError ',' optError TemplateInstance
3708 $$ = new Value(Value::OPTYPE_MATCH, $4, $8);
3709 $$->set_location(infile, @$);
3711 | MatchKeyword '(' error ')'
3713 Value *v = new Value(Value::V_ERROR);
3714 v->set_location(infile, @3);
3715 Template *t = new Template(Template::TEMPLATE_ERROR);
3716 t->set_location(infile, @3);
3717 TemplateInstance *ti = new TemplateInstance(0, 0, t);
3718 ti->set_location(infile, @3);
3719 $$ = new Value(Value::OPTYPE_MATCH, v, ti);
3720 $$->set_location(infile, @$);
3725 ValueofKeyword '(' optError TemplateInstance optError ')'
3727 $$ = new Value(Value::OPTYPE_VALUEOF, $4);
3728 $$->set_location(infile, @$);
3730 | ValueofKeyword '(' error ')'
3732 Template *t = new Template(Template::TEMPLATE_ERROR);
3733 t->set_location(infile, @3);
3734 TemplateInstance *ti = new TemplateInstance(0, 0, t);
3735 ti->set_location(infile, @3);
3736 $$ = new Value(Value::OPTYPE_VALUEOF, ti);
3737 $$->set_location(infile, @$);
3741 /* A.1.6.1.4 Function definitions */
3744 FunctionKeyword IDentifier '(' optFunctionFormalParList ')'
3745 optRunsOnSpec optReturnType optError StatementBlock
3747 $4->set_location(infile, @3, @5);
3748 $$ = new Def_Function($2, $4, $6, $7.type, $7.returns_template,
3749 $7.template_restriction, $9);
3750 $$->set_location(infile, @$);
3754 optFunctionFormalParList: // [167]
3755 /* empty */ { $$ = new FormalParList; }
3756 | FunctionFormalParList { $$ = $1; }
3757 | error { $$ = new FormalParList; }
3760 FunctionFormalParList: // 167
3761 optError FunctionFormalPar
3763 $$ = new FormalParList;
3766 | FunctionFormalParList optError ',' optError FunctionFormalPar
3771 | FunctionFormalParList optError ',' error { $$ = $1; }
3774 FunctionFormalPar: // 168
3775 FormalValuePar { $$ = $1; }
3776 | FormalTimerPar { $$ = $1; }
3777 | FormalTemplatePar { $$ = $1; }
3778 /*| FormalPortPar -- covered by FormalValuePar */
3781 optReturnType: // [169]
3785 $$.returns_template = false;
3786 $$.template_restriction = TR_NONE;
3788 | ReturnKeyword Type
3791 $$.returns_template = false;
3792 $$.template_restriction = TR_NONE;
3794 | ReturnKeyword TemplateOptRestricted Type
3797 $$.returns_template = true;
3798 $$.template_restriction = $2;
3800 | ReturnKeyword error
3803 $$.returns_template = false;
3804 $$.template_restriction = TR_NONE;
3808 optRunsOnComprefOrSelf:
3814 | RunsKeyword OnKeyword SelfKeyword
3822 /* empty */ { $$ = 0; }
3823 | RunsOnSpec { $$ = $1; }
3824 | RunsKeyword error { $$ = 0; }
3828 RunsKeyword OnKeyword ComponentType { $$ = $3; }
3831 /* StatementBlock changed in 4.1.2 to explicitly prevent statements
3832 * followed by definitions. TITAN still allows them to be mixed. */
3833 StatementBlock: /* StatementBlock *statementblock */ // 175
3836 $$ = new StatementBlock;
3837 $$->set_location(infile, @$);
3839 | '{' FunctionStatementOrDefList optError '}'
3842 $$->set_location(infile, @$);
3846 FunctionStatementOrDefList: // (171 in 3.2.1)
3847 optError FunctionStatementOrDef optSemiColon
3849 $$ = new StatementBlock;
3850 for(size_t i=0; i<$2.nElements; i++) $$->add_stmt($2.elements[i]);
3853 | FunctionStatementOrDefList optError FunctionStatementOrDef optSemiColon
3856 for(size_t i=0; i<$3.nElements; i++) $$->add_stmt($3.elements[i]);
3861 FunctionStatementOrDef: // (172 in 3.2.1)
3862 FunctionLocalDef // constant or template definition
3864 $$.nElements=$1.nElements;
3865 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3866 for(size_t i=0; i<$1.nElements; i++) {
3867 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
3868 $$.elements[i]->set_location(*$1.elements[i]);
3872 | FunctionLocalInst // variable or timer instance
3874 $$.nElements=$1.nElements;
3875 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3876 for(size_t i=0; i<$1.nElements; i++) {
3877 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
3878 $$.elements[i]->set_location(*$1.elements[i]);
3885 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
3890 FunctionLocalInst: // 178
3891 VarInstance { $$=$1; }
3892 | TimerInstance { $$=$1; }
3895 FunctionLocalDef: // 179
3901 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
3902 $$.elements[0] = $1;
3906 FunctionStatement: // 180
3907 ConfigurationStatements {$$=$1;}
3908 | TimerStatements {$$=$1;}
3909 | CommunicationStatements {$$=$1;}
3910 | BasicStatements {$$=$1;}
3911 | BehaviourStatements {$$=$1;}
3912 | VerdictStatements {$$=$1;}
3913 | SUTStatements {$$=$1;}
3914 | StopExecutionStatement { $$ = $1; }
3915 | StopTestcaseStatement { $$ = $1; }
3916 | ProfilerStatement { $$ = $1; }
3917 | int2enumStatement { $$ = $1; }
3920 FunctionInstance: /* refpard */ // 181
3921 FunctionRef '(' optFunctionActualParList ')'
3922 /* templateref templinsts */
3924 $3->set_location(infile, @2, @4);
3925 $$ = new Ttcn::Ref_pard($1.modid, $1.id, $3);
3926 $$->set_location(infile, @$);
3936 | IDentifier '.' IDentifier
3941 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
3949 optFunctionActualParList: /* parsedpar */ // [185]
3950 /* empty */ optError { $$ = new ParsedActualParameters; }
3951 | FunctionActualParList optError { $$ = $1; }
3954 /* ***** this * can * not * be * empty ****************** */
3955 FunctionActualParList: /* parsedpar */ // 184
3958 | UnnamedPart ',' NamedPart
3959 /* Splitting the NamedPart and UnnamedPart ensures that a named parameter
3960 * followed by an unnamed one causes a syntax error */
3962 /* UnnamedPart becomes the value */
3964 /* append the elements from NamedPart */
3965 const size_t n3 = $3->get_nof_nps();
3966 for (size_t i = 0; i < n3; ++i) {
3967 $$->add_np( $3->extract_np_byIndex(i) );
3973 UnnamedPart: /* parsedpar */
3974 /*optError*/ FunctionActualPar
3976 $$ = new ParsedActualParameters;
3979 | UnnamedPart /*optError*/ ',' /*optError*/ FunctionActualPar
3980 /* These optErrors mess up the parsing of actual parameters.
3981 * After only one FunctionActualPar, it is reduced to UnnamedPart
3982 * and the rest is expected to be the NamedPart */
3987 | UnnamedPart optError ',' error { $$ = $1; }
3990 NamedPart: /* parsedpar */
3991 seqFieldSpec /* namedtempls */
3993 $$ = new ParsedActualParameters(0, new NamedParams);
3994 const size_t n1 = $1->get_nof_nts();
3995 for (size_t i = 0; i < n1; ++i) {
3996 NamedTemplate *pnt = $1->get_nt_byIndex(i);
3997 TemplateInstance *pti = new TemplateInstance(0,0,pnt->extract_template());
3998 NamedParam *pnp = new NamedParam(pnt->get_name().clone(), pti);
3999 pnp->set_location(*pnt);
4003 $$->set_location(infile, @$);
4004 // This call to ParsedActualParameters::set_location copies the same
4005 // location info to the named and unnamed part. We cannot copy
4006 // the location info from the NamedTemplates to the named part,
4007 // because NamedTemplates is not a Location.
4011 FunctionActualPar: /* templinst */ // 185
4013 TemplateInstance { $$ = $1; }
4016 Template *t = new Template(Template::TEMPLATE_NOTUSED);
4017 t->set_location(infile, @$);
4018 $$ = new TemplateInstance(0, 0, t);
4019 $$->set_location(infile, @$);
4022 | ComponentRef -- TemplateInstance covers all the others */
4026 Reference DotApplyKeyword '(' optFunctionActualParList ')'
4028 if($1.is_ref) $$.value = new Value(Value::V_REFD, $1.ref);
4030 Ttcn::Reference *t_ref = new Ttcn::Reference($1.id);
4031 t_ref->set_location(infile, @1);
4032 $$.value = new Value(Value::V_REFD, t_ref);
4034 $$.value->set_location(infile, @1);
4036 $$.ap_list->set_location(infile, @3 , @5);
4038 | FunctionInstance DotApplyKeyword '(' optFunctionActualParList ')'
4040 $$.value = new Value(Value::V_REFD, $1);
4041 $$.value->set_location(infile, @1);
4043 $$.ap_list->set_location(infile, @3 , @5);
4045 | ApplyOp DotApplyKeyword '(' optFunctionActualParList ')'
4047 $$.value = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
4048 $$.value->set_location(infile, @1);
4050 $$.ap_list->set_location(infile, @3 , @5);
4055 DerefersKeyword '(' Expression ')' { $$ = $3; }
4058 /* A.1.6.1.5 Signature definitions */
4060 SignatureDef: // 187
4061 SignatureKeyword IDentifier
4062 '(' optSignatureFormalParList ')' optReturnTypeOrNoBlockKeyword
4065 Type *type = new Type(Type::T_SIGNATURE, $4, $6.type, $6.no_block_kw, $7);
4066 type->set_location(infile, @3, @7);
4067 $$ = new Ttcn::Def_Type($2, type);
4068 $$->set_location(infile, @$);
4072 optSignatureFormalParList: // [190]
4073 /* empty */ { $$ = 0; }
4074 | SignatureFormalParList { $$ = $1; }
4078 SignatureFormalParList: // 190
4079 optError SignatureFormalPar
4081 $$ = new SignatureParamList;
4084 | SignatureFormalParList optError ',' optError SignatureFormalPar
4089 | SignatureFormalParList optError ',' error { $$ = $1; }
4092 SignatureFormalPar: // 191
4095 $$ = new SignatureParam(SignatureParam::PARAM_IN, $1, $2);
4096 $$->set_location(infile, @$);
4098 | InParKeyword Type IDentifier
4100 $$ = new SignatureParam(SignatureParam::PARAM_IN, $2, $3);
4101 $$->set_location(infile, @$);
4103 | InOutParKeyword Type IDentifier
4105 $$ = new SignatureParam(SignatureParam::PARAM_INOUT, $2, $3);
4106 $$->set_location(infile, @$);
4108 | OutParKeyword Type IDentifier
4110 $$ = new SignatureParam(SignatureParam::PARAM_OUT, $2, $3);
4111 $$->set_location(infile, @$);
4115 optReturnTypeOrNoBlockKeyword:
4119 $$.no_block_kw = false;
4121 | ReturnKeyword Type
4124 $$.no_block_kw = false;
4129 $$.no_block_kw = true;
4133 optExceptionSpec: // [192]
4134 /* empty */ { $$ = NULL; }
4135 | ExceptionKeyword '(' error ')' { $$ = NULL; }
4136 | ExceptionKeyword '(' ExceptionTypeList optError ')'
4139 $$->set_location(infile, @$);
4143 ExceptionTypeList: // 194
4146 $$ = new SignatureExceptions;
4149 | ExceptionTypeList optError ',' optError Type
4154 | ExceptionTypeList optError ',' error { $$ = $1; }
4160 $$ = new Ttcn::Reference($1);
4161 $$->set_location(infile, @$);
4163 | IDentifier '.' IDentifier
4165 $$ = new Ttcn::Reference($1, $3);
4166 $$->set_location(infile, @$);
4168 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4170 $$ = new Ttcn::Reference($1, $5);
4171 $$->set_location(infile, @$);
4176 /* A.1.6.1.6 Testcase definitions */
4179 TestcaseKeyword IDentifier '(' optTestcaseFormalParList ')'
4180 ConfigSpec optError StatementBlock
4182 $4->set_location(infile, @3, @5);
4183 $$ = new Def_Testcase($2, $4, $6.runsonref, $6.systemref, $8);
4184 $$->set_location(infile, @$);
4188 optTestcaseFormalParList: // [200]
4189 /* empty */ { $$ = new FormalParList; }
4190 | TestcaseFormalParList { $$ = $1; }
4191 | error { $$ = new FormalParList; }
4194 TestcaseFormalParList: // 200
4195 optError TestcaseFormalPar
4197 $$ = new FormalParList;
4200 | TestcaseFormalParList optError ',' optError TestcaseFormalPar
4205 | TestcaseFormalParList optError ',' error { $$ = $1; }
4208 TestcaseFormalPar: // 201
4209 FormalValuePar { $$ = $1; }
4210 | FormalTemplatePar { $$ = $1; }
4214 RunsOnSpec optSystemSpec
4221 optSystemSpec: // [203]
4222 /* empty */ { $$ = 0; }
4223 | SystemKeyword ComponentType { $$ = $2; }
4224 | SystemKeyword error { $$ = 0; }
4227 TestcaseInstance: // 205
4228 ExecuteKeyword '(' TestcaseRef '(' optTestcaseActualParList ')'
4229 optTestcaseTimerValue optError ')'
4231 $5->set_location(infile, @4, @6);
4232 $$.ref_pard = new Ttcn::Ref_pard($3.modid, $3.id, $5);
4233 $$.ref_pard->set_location(infile, @3, @6);
4234 $$.derefered_value = 0;
4238 | ExecuteKeyword '(' DereferOp '(' optTestcaseActualParList ')'
4239 optTestcaseTimerValue optError ')'
4241 $5->set_location(infile, @4, @6);
4243 $$.derefered_value = $3;
4247 | ExecuteKeyword '(' error ')'
4250 $$.derefered_value = 0;
4262 | IDentifier '.' IDentifier
4267 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4275 optTestcaseTimerValue:
4276 /* empty */ { $$ = 0; }
4277 | ',' optError Expression { $$ = $3; }
4280 $$ = new Value(Value::V_ERROR);
4281 $$->set_location(infile, @$);
4285 optTestcaseActualParList: // [202]
4286 /* empty */ optError { $$ = new ParsedActualParameters; }
4287 | TestcaseActualParList optError { $$ = $1; }
4290 TestcaseActualParList: // 208
4293 | UnnamedPart ',' NamedPart
4294 /* Splitting the NamedPart and UnnamedPart ensures that a named parameter
4295 * followed by an unnamed one causes a syntax error */
4297 /* UnnamedPart becomes the value */
4299 /* append the elements from NamedPart */
4300 const size_t n3 = $3->get_nof_nps();
4301 for (size_t i = 0; i < n3; ++i) {
4302 $$->add_np( $3->extract_np_byIndex(i) );
4308 optError TestcaseActualPar
4310 $$ = new TemplateInstances;
4313 | TestcaseActualParList optError ',' optError TestcaseActualPar
4318 | TestcaseActualParList optError ',' error { $$ = $1; }
4324 TemplateInstance { $$ = $1; }
4327 Template *t = new Template(Template::TEMPLATE_NOTUSED);
4328 t->set_location(infile, @$);
4329 $$ = new TemplateInstance(0, 0, t);
4330 $$->set_location(infile, @$);
4335 /* A.1.6.1.7 Altstep definitions */
4338 AltstepKeyword IDentifier '(' optAltstepFormalParList ')' optRunsOnSpec
4339 optError '{' AltstepLocalDefList AltGuardList optError '}'
4341 StatementBlock *sb = new StatementBlock;
4342 for (size_t i = 0; i < $9.nElements; i++) {
4343 Statement *stmt = new Statement(Statement::S_DEF, $9.elements[i]);
4344 stmt->set_location(*$9.elements[i]);
4348 $4->set_location(infile, @4);
4349 $$ = new Def_Altstep($2, $4, $6, sb, $10);
4350 $$->set_location(infile, @$);
4354 optAltstepFormalParList: // [214]
4355 /* empty */ { $$ = new FormalParList; }
4356 | FunctionFormalParList { $$ = $1; }
4357 | error { $$ = new FormalParList; }
4360 AltstepLocalDefList: // 215
4366 | AltstepLocalDefList optError AltstepLocalDef optSemiColon
4368 $$.nElements = $1.nElements + $3.nElements;
4369 $$.elements = (Ttcn::Definition**)
4370 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4371 memcpy($$.elements + $1.nElements, $3.elements,
4372 $3.nElements * sizeof(*$$.elements));
4377 AltstepLocalDef: // 216
4378 VarInstance { $$ = $1; }
4379 | TimerInstance { $$ = $1; }
4380 | ConstDef { $$ = $1; }
4385 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
4386 $$.elements[0] = $1;
4390 AltstepInstance: /* refpard */ // 217
4391 FunctionRef '(' optFunctionActualParList ')'
4393 $3->set_location(infile, @2, @4);
4394 $$ = new Ttcn::Ref_pard($1.modid, $1.id, $3);
4395 $$->set_location(infile, @$);
4399 /* Taken over by FunctionRef
4402 | IDentifier '.' IDentifier
4403 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
4407 /* A.1.6.1.8 Import definitions */
4410 ImportKeyword ImportFromSpec AllWithExcepts
4412 $2->set_imptype(ImpMod::I_ALL);
4413 $2->set_location(infile, @$);
4417 | ImportKeyword ImportFromSpec '{' ImportSpec '}'
4419 Location loc(infile, @$);
4420 if ( $4 == ImpMod::I_IMPORTSPEC) {
4421 loc.warning("Unsupported selective import statement was treated as "
4424 $2->set_imptype($4);
4425 $2->set_location(infile, @$);
4431 AllWithExcepts: // 221
4433 | AllKeyword ExceptsDef
4435 Location loc(infile, @$);
4436 loc.warning("Unsupported selective import statement was treated as "
4442 ExceptKeyword '{' ExceptSpec '}'
4446 /* empty */ optError
4447 | ExceptSpec ExceptElement optSemiColon
4450 ExceptElement: // 225
4453 | ExceptTemplateSpec
4455 | ExceptTestcaseSpec
4457 | ExceptFunctionSpec
4458 | ExceptSignatureSpec
4459 | ExceptModuleParSpec
4462 ExceptGroupSpec: // 226
4463 GroupKeyword ExceptGroupRefList
4464 | GroupKeyword AllKeyword
4467 ExceptTypeDefSpec: // 227
4468 TypeDefKeyword TypeRefList
4469 | TypeDefKeyword AllKeyword
4472 ExceptTemplateSpec: // 228
4473 TemplateKeyword TemplateRefList
4474 | TemplateKeyword AllKeyword
4477 ExceptConstSpec: // 229
4478 ConstKeyword ConstRefList
4479 | ConstKeyword AllKeyword
4482 ExceptTestcaseSpec: // 230
4483 TestcaseKeyword TestcaseRefList
4484 | TestcaseKeyword AllKeyword
4487 ExceptAltstepSpec: // 231
4488 AltstepKeyword AltstepRefList
4489 | AltstepKeyword AllKeyword
4492 ExceptFunctionSpec: // 232
4493 FunctionKeyword FunctionRefList
4494 | FunctionKeyword AllKeyword
4497 ExceptSignatureSpec: // 233
4498 SignatureKeyword SignatureRefList
4499 | SignatureKeyword AllKeyword
4502 ExceptModuleParSpec: // 234
4503 ModuleParKeyword ModuleParRefList
4504 | ModuleParKeyword AllKeyword
4508 /* empty */ optError
4509 { $$ = ImpMod::I_ALL; }
4510 | ImportSpec ImportElement optSemiColon
4513 case ImpMod::I_ALL: // it was empty before
4517 case ImpMod::I_IMPORTSPEC:
4519 case ImpMod::I_IMPORTSPEC:
4520 // selective import followed by another selective import: NOP
4522 case ImpMod::I_IMPORTIMPORT:
4523 $$ = $2; // import of import wins over selective import
4525 default: // including I_ALL
4526 FATAL_ERROR("Selective import cannot be followed by import all");
4530 case ImpMod::I_IMPORTIMPORT:
4532 case ImpMod::I_IMPORTSPEC:
4533 // import of import followed by selective import: NOP (import of import wins)
4535 case ImpMod::I_IMPORTIMPORT:
4536 // import of import following another import of import: error
4537 Location(infile, @2).error("Import of imports can only be used once");
4539 default: // including I_ALL
4540 FATAL_ERROR("Import of imports cannot be followed by import all");
4545 FATAL_ERROR("Invalid import type");
4550 ImportElement: // 236
4552 { $$ = ImpMod::I_IMPORTSPEC; }
4554 { $$ = ImpMod::I_IMPORTSPEC; }
4555 | ImportTemplateSpec
4556 { $$ = ImpMod::I_IMPORTSPEC; }
4558 { $$ = ImpMod::I_IMPORTSPEC; }
4559 | ImportTestcaseSpec
4560 { $$ = ImpMod::I_IMPORTSPEC; }
4562 { $$ = ImpMod::I_IMPORTSPEC; }
4563 | ImportFunctionSpec
4564 { $$ = ImpMod::I_IMPORTSPEC; }
4565 | ImportSignatureSpec
4566 { $$ = ImpMod::I_IMPORTSPEC; }
4567 | ImportModuleParSpec
4568 { $$ = ImpMod::I_IMPORTSPEC; }
4570 { $$ = ImpMod::I_IMPORTIMPORT; }
4574 ImportKeyword AllKeyword
4576 ImportFromSpec: // 237
4577 FromKeyword ModuleId { $$ = $2; }
4578 | FromKeyword ModuleId RecursiveKeyword // already deprecated in v3.2.1
4581 $$->set_recursive();
4585 ImportGroupSpec: // 239
4586 GroupKeyword GroupRefListWithExcept
4587 | GroupKeyword AllGroupsWithExcept
4588 | GroupKeyword error
4591 GroupRefList: // 240
4592 optError FullGroupIdentifier { delete $2; }
4593 | GroupRefList optError ',' optError FullGroupIdentifier { delete $5; }
4594 | GroupRefList optError ',' error
4597 GroupRefListWithExcept: // 241
4598 optError FullGroupIdentifierWithExcept
4599 | GroupRefListWithExcept optError ',' optError FullGroupIdentifierWithExcept
4600 | GroupRefListWithExcept optError ',' error
4603 AllGroupsWithExcept: // 242
4606 | AllKeyword ExceptKeyword GroupRefList
4607 | AllKeyword ExceptKeyword error
4610 FullGroupIdentifier: // 243
4613 $$ = new Qualifier();
4614 $$->add(new FieldOrArrayRef($1));
4615 $$->set_location(infile, @$);
4617 | FullGroupIdentifier '.' IDentifier
4620 $$->add(new FieldOrArrayRef($3));
4621 $$->set_location(infile, @$);
4625 FullGroupIdentifierWithExcept: // 244
4626 FullGroupIdentifier { delete $1; }
4627 | FullGroupIdentifier ExceptsDef { delete $1; }
4630 ExceptGroupRefList: // 245
4631 optError ExceptFullGroupIdentifier
4632 | ExceptGroupRefList optError ',' optError ExceptFullGroupIdentifier
4633 | ExceptGroupRefList optError ',' error
4636 ExceptFullGroupIdentifier: // 246
4637 FullGroupIdentifier { delete $1;}
4640 ImportTypeDefSpec: // 247
4641 TypeDefKeyword TypeRefList
4642 | TypeDefKeyword AllTypesWithExcept
4643 | TypeDefKeyword error
4647 optError IDentifier { delete $2; }
4648 | TypeRefList optError ',' optError IDentifier { delete $5; }
4649 | TypeRefList optError ',' error
4652 AllTypesWithExcept: // 249
4655 | AllKeyword ExceptKeyword TypeRefList
4656 | AllKeyword ExceptKeyword error
4659 /* 250. TypeDefIdentifier is replaced by IDentifier */
4661 ImportTemplateSpec: // 251
4662 TemplateKeyword TemplateRefList
4663 | TemplateKeyword AllTemplsWithExcept
4664 | TemplateKeyword error
4667 TemplateRefList: // 252
4668 optError IDentifier { delete $2; }
4669 | TemplateRefList optError ',' optError IDentifier { delete $5; }
4670 | TemplateRefList optError ',' error
4673 AllTemplsWithExcept: // 253
4676 | AllKeyword ExceptKeyword TemplateRefList
4677 | AllKeyword ExceptKeyword error
4680 ImportConstSpec: // 254
4681 ConstKeyword ConstRefList
4682 | ConstKeyword AllConstsWithExcept
4683 | ConstKeyword error
4686 ConstRefList: // 255
4687 optError IDentifier { delete $2; }
4688 | ConstRefList optError ',' optError IDentifier { delete $5; }
4689 | ConstRefList optError ',' error
4692 AllConstsWithExcept: // 256
4695 | AllKeyword ExceptKeyword ConstRefList
4696 | AllKeyword ExceptKeyword error
4699 ImportAltstepSpec: // 257
4700 AltstepKeyword AltstepRefList
4701 | AltstepKeyword AllAltstepsWithExcept
4702 | AltstepKeyword error
4705 AltstepRefList: // 258
4706 optError IDentifier { delete $2; }
4707 | AltstepRefList optError ',' optError IDentifier { delete $5; }
4708 | AltstepRefList optError ',' error
4711 AllAltstepsWithExcept: // 259
4714 | AllKeyword ExceptKeyword AltstepRefList
4715 | AllKeyword ExceptKeyword error
4718 ImportTestcaseSpec: // 260
4719 TestcaseKeyword TestcaseRefList
4720 | TestcaseKeyword AllTestcasesWithExcept
4721 | TestcaseKeyword error
4724 TestcaseRefList: // 261
4725 optError IDentifier { delete $2; }
4726 | TestcaseRefList optError ',' optError IDentifier { delete $5; }
4727 | TestcaseRefList optError ',' error
4730 AllTestcasesWithExcept: // 262
4733 | AllKeyword ExceptKeyword TestcaseRefList
4734 | AllKeyword ExceptKeyword error
4737 ImportFunctionSpec: // 263
4738 FunctionKeyword FunctionRefList
4739 | FunctionKeyword AllFunctionsWithExcept
4740 | FunctionKeyword error
4743 FunctionRefList: // 264
4744 optError IDentifier { delete $2; }
4745 | FunctionRefList optError ',' optError IDentifier { delete $5; }
4746 | FunctionRefList optError ',' error
4749 AllFunctionsWithExcept: // 265
4752 | AllKeyword ExceptKeyword FunctionRefList
4753 | AllKeyword ExceptKeyword error
4756 ImportSignatureSpec: // 266
4757 SignatureKeyword SignatureRefList
4758 | SignatureKeyword AllSignaturesWithExcept
4759 | SignatureKeyword error
4762 SignatureRefList: // 267
4763 optError IDentifier { delete $2; }
4764 | SignatureRefList optError ',' optError IDentifier { delete $5; }
4765 | SignatureRefList optError ',' error
4768 AllSignaturesWithExcept: // 268
4771 | AllKeyword ExceptKeyword SignatureRefList
4772 | AllKeyword ExceptKeyword error
4775 ImportModuleParSpec: // 269
4776 ModuleParKeyword ModuleParRefList
4777 | ModuleParKeyword AllModuleParWithExcept
4778 | ModuleParKeyword error
4781 ModuleParRefList: // 270
4782 optError IDentifier { delete $2; }
4783 | ModuleParRefList optError ',' optError IDentifier { delete $5; }
4784 | ModuleParRefList optError ',' error
4787 AllModuleParWithExcept: // 271
4790 | AllKeyword ExceptKeyword ModuleParRefList
4791 | AllKeyword ExceptKeyword error
4794 // 272 ImportImportSpec: ImportKeyword AllKeyword
4796 /* A.1.6.1.9 Group definitions */
4799 GroupIdentifier '{' optErrorBlock '}'
4802 $$->set_location(infile, @$);
4804 | GroupIdentifier '{' ModuleDefinitionsList optErrorBlock '}'
4807 $$->set_location(infile, @$);
4811 GroupIdentifier: // 274 (followed by) 275.
4812 GroupKeyword IDentifier
4815 $$->set_parent_group(act_group);
4816 $$->set_location(infile, @$);
4818 act_group->add_group($$);
4819 $$->set_parent_path(act_group->get_attrib_path());
4821 act_ttcn3_module->add_group($$);
4822 $$->set_parent_path(act_ttcn3_module->get_attrib_path());
4828 /* A.1.6.1.10 External function definitions */
4830 ExtFunctionDef: // 276
4831 ExtKeyword FunctionKeyword IDentifier
4832 '(' optFunctionFormalParList ')' optReturnType
4834 $5->set_location(infile, @4, @6);
4835 $$ = new Def_ExtFunction($3, $5, $7.type, $7.returns_template,
4836 $7.template_restriction);
4837 $$->set_location(infile, @$);
4841 /* A.1.6.1.11 External constant definitions */
4844 ExtKeyword ConstKeyword Type IdentifierList
4846 $$.nElements = $4.nElements;
4847 $$.elements = (Ttcn::Definition**)
4848 Malloc($$.nElements * sizeof(*$$.elements));
4849 for (size_t i = 0; i < $$.nElements; i++) {
4852 type = new Type(Type::T_REFDSPEC, $3);
4853 type->set_location(*$3);
4855 $$.elements[i] = new Ttcn::Def_ExtConst($4.elements[i].id, type);
4856 $$.elements[i]->set_location(infile, $4.elements[i].yyloc);
4862 IdentifierList: // 280 ExtConstIdentifierList
4866 $$.elements = (YYSTYPE::extconstidentifier_t*)Malloc(sizeof(*$$.elements));
4867 $$.elements[0].id = $2;
4868 $$.elements[0].yyloc = @2;
4870 | IdentifierList ',' optError IDentifier
4872 $$.nElements = $1.nElements + 1;
4873 $$.elements = (YYSTYPE::extconstidentifier_t*)
4874 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4875 $$.elements[$1.nElements].id = $4;
4876 $$.elements[$1.nElements].yyloc = @4;
4878 | IdentifierList ',' error { $$ = $1; }
4881 /* A.1.6.1.12 Module parameter definitions */
4883 ModuleParDef: // 282
4884 ModuleParKeyword ModulePar { $$ = $2; }
4885 | ModuleParKeyword '{' MultiTypedModuleParList optError '}' { $$ = $3; }
4886 | ModuleParKeyword '{' error '}' { $$.nElements = 0; $$.elements = NULL; }
4889 MultiTypedModuleParList: // 284
4890 optError ModulePar optSemiColon { $$ = $2; }
4891 | MultiTypedModuleParList optError ModulePar optSemiColon
4893 $$.nElements = $1.nElements + $3.nElements;
4894 $$.elements = (Ttcn::Definition**)
4895 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4896 memcpy($$.elements + $1.nElements, $3.elements,
4897 $3.nElements * sizeof(*$$.elements));
4905 $$.nElements = $2.nElements;
4906 $$.elements = (Ttcn::Definition**)
4907 Malloc($$.nElements * sizeof(*$$.elements));
4908 for(size_t i = 0; i < $2.nElements; i++) {
4911 type = new Type(Type::T_REFDSPEC, $1);
4912 type->set_location(*$1);
4914 $$.elements[i] = new Def_Modulepar($2.elements[i].id, type,
4915 $2.elements[i].defval);
4916 $$.elements[i]->set_location(infile, $2.elements[i].yyloc);
4920 | TemplateKeyword Type TemplateModuleParList
4922 $$.nElements = $3.nElements;
4923 $$.elements = (Ttcn::Definition**)Malloc($$.nElements * sizeof(*$$.elements));
4924 for(size_t i = 0; i < $3.nElements; i++) {
4927 type = new Type(Type::T_REFDSPEC, $2);
4928 type->set_location(*$2);
4930 $$.elements[i] = new Def_Modulepar_Template($3.elements[i].id, type, $3.elements[i].deftempl);
4931 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
4937 ModuleParList: // 287
4938 optError SingleModulePar
4941 $$.elements = (YYSTYPE::singlemodulepar_t*)Malloc(sizeof(*$$.elements));
4942 $$.elements[0] = $2;
4944 | ModuleParList ',' optError SingleModulePar
4946 $$.nElements = $1.nElements + 1;
4947 $$.elements = (YYSTYPE::singlemodulepar_t*)
4948 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4949 $$.elements[$$.nElements - 1] = $4;
4953 TemplateModuleParList: // 287
4954 optError SingleTemplateModulePar
4957 $$.elements = (YYSTYPE::singletemplatemodulepar_t*)Malloc(sizeof(*$$.elements));
4958 $$.elements[0] = $2;
4960 | TemplateModuleParList ',' optError SingleTemplateModulePar
4962 $$.nElements = $1.nElements + 1;
4963 $$.elements = (YYSTYPE::singletemplatemodulepar_t*)
4964 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
4965 $$.elements[$$.nElements - 1] = $4;
4976 | IDentifier AssignmentChar Expression
4984 SingleTemplateModulePar:
4991 | IDentifier AssignmentChar TemplateBody
5000 FriendModuleDef: // 289
5001 FriendKeyword TTCN3ModuleKeyword IdentifierList optSemiColon
5003 $$.nElements = $3.nElements;
5004 $$.elements = (Ttcn::FriendMod**)
5005 Malloc($$.nElements*sizeof(*$$.elements));
5006 for (size_t i = 0; i < $$.nElements; i++) {
5007 $$.elements[i] = new FriendMod($3.elements[i].id);
5008 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
5014 /* A.1.6.2 Control part */
5016 /* A.1.6.2.0 General */
5018 ModuleControlPart: // 290
5019 optError ControlKeyword
5020 '{' ModuleControlBody '}'
5021 optWithStatementAndSemiColon
5023 ControlPart* controlpart = new ControlPart($4);
5024 controlpart->set_location(infile, @2, @6);
5025 controlpart->set_with_attr($6);
5026 controlpart->set_parent_path(act_ttcn3_module->get_attrib_path());
5027 act_ttcn3_module->add_controlpart(controlpart);
5031 ModuleControlBody: // 292
5032 /* empty */ optError { $$=new StatementBlock(); }
5033 | ControlStatementOrDefList { $$ = $1; }
5036 ControlStatementOrDefList: // 293
5037 optError ControlStatementOrDef optSemiColon
5039 $$=new StatementBlock();
5040 for(size_t i=0; i<$2.nElements; i++) $$->add_stmt($2.elements[i]);
5043 | ControlStatementOrDefList optError ControlStatementOrDef optSemiColon
5046 for(size_t i=0; i<$3.nElements; i++) $$->add_stmt($3.elements[i]);
5051 ControlStatementOrDef: // 294
5054 $$.nElements=$1.nElements;
5055 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5056 for(size_t i=0; i<$1.nElements; i++) {
5057 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
5058 $$.elements[i]->set_location(*$1.elements[i]);
5064 $$.nElements=$1.nElements;
5065 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5066 for(size_t i=0; i<$1.nElements; i++) {
5067 $$.elements[i]=new Statement(Statement::S_DEF, $1.elements[i]);
5068 $$.elements[i]->set_location(*$1.elements[i]);
5075 $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements));
5080 ControlStatement: /* Statement *stmt */ // 295
5081 TimerStatements { $$ = $1; }
5082 | BasicStatements { $$ = $1; }
5083 | BehaviourStatements { $$ = $1; }
5084 | SUTStatements { $$ = $1; }
5085 | StopExecutionStatement { $$ = $1; }
5086 | ProfilerStatement { $$ = $1; }
5087 | int2enumStatement { $$ = $1; }
5090 /* A.1.6.2.1 Variable instantiation */
5093 VarKeyword Type VarList
5095 $$.nElements = $3.nElements;
5096 $$.elements = (Ttcn::Definition**)
5097 Malloc($$.nElements*sizeof(*$$.elements));
5098 for (size_t i = 0; i < $$.nElements; i++) {
5101 type = new Type(Type::T_REFDSPEC, $2);
5102 type->set_location(*$2);
5104 /* creation of array type(s) if necessary (from right to left) */
5105 for (size_t j = $3.elements[i].arrays.nElements; j > 0; j--) {
5106 type = new Type(Type::T_ARRAY, type,
5107 $3.elements[i].arrays.elements[j - 1], false);
5108 type->set_location(*$2);
5110 Free($3.elements[i].arrays.elements);
5112 /* Create the definition */
5113 $$.elements[i] = new Def_Var($3.elements[i].id,
5114 type, $3.elements[i].initial_value);
5115 $$.elements[i]->set_location(infile, $3.elements[i].yyloc);
5119 | VarKeyword TemplateOptRestricted Type TempVarList
5121 $$.nElements = $4.nElements;
5122 $$.elements = (Ttcn::Definition**)
5123 Malloc($$.nElements * sizeof(*$$.elements));
5124 for (size_t i = 0; i < $$.nElements; i++) {
5127 type = new Type(Type::T_REFDSPEC, $3);
5128 type->set_location(*$3);
5130 /* creation of array type(s) if necessary (from right to left) */
5131 for (size_t j = $4.elements[i].arrays.nElements; j > 0; j--) {
5132 type = new Type(Type::T_ARRAY, type,
5133 $4.elements[i].arrays.elements[j - 1], false);
5134 type->set_location(*$3);
5136 Free($4.elements[i].arrays.elements);
5138 /* Create the definition */
5139 $$.elements[i] = new Def_Var_Template($4.elements[i].id, type,
5140 $4.elements[i].initial_value, $2);
5141 $$.elements[i]->set_location(infile, $4.elements[i].yyloc);
5149 optError SingleVarInstance
5152 $$.elements = (YYSTYPE::singlevarinst_t*)Malloc(sizeof(*$$.elements));
5153 $$.elements[0] = $2;
5155 | VarList ',' optError SingleVarInstance
5157 $$.nElements = $1.nElements + 1;
5158 $$.elements = (YYSTYPE::singlevarinst_t*)
5159 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5160 $$.elements[$$.nElements - 1] = $4;
5164 SingleVarInstance: // 298
5165 IDentifier optArrayDef
5169 $$.initial_value = 0;
5172 | IDentifier optArrayDef AssignmentChar Expression
5176 $$.initial_value = $4;
5182 optError SingleTempVarInstance
5185 $$.elements = (YYSTYPE::singletempvarinst_t*)Malloc(sizeof(*$$.elements));
5186 $$.elements[0] = $2;
5188 | TempVarList ',' optError SingleTempVarInstance
5190 $$.nElements = $1.nElements + 1;
5191 $$.elements = (YYSTYPE::singletempvarinst_t*)
5192 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5193 $$.elements[$$.nElements - 1] = $4;
5197 SingleTempVarInstance: // 303
5198 IDentifier optArrayDef
5202 $$.initial_value = NULL;
5205 | IDentifier optArrayDef AssignmentChar TemplateBody
5209 $$.initial_value = $4;
5217 if ($1.is_ref) $$ = $1.ref;
5219 $$ = new Ttcn::Reference($1.id);
5220 $$->set_location(infile, @$);
5225 /* A.1.6.2.2 Timer instantiation */
5227 TimerInstance: // 306
5228 TimerKeyword TimerList { $$ = $2; }
5232 optError SingleTimerInstance
5235 $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements));
5236 $$.elements[0] = $2;
5238 | TimerList ',' optError SingleTimerInstance
5240 $$.nElements = $1.nElements + 1;
5241 $$.elements = (Ttcn::Definition**)
5242 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
5243 $$.elements[$$.nElements - 1] = $4;
5247 SingleTimerInstance: // 308
5248 IDentifier optArrayDef
5250 ArrayDimensions *dims;
5251 if ($2.nElements > 0) {
5252 dims = new ArrayDimensions;
5253 for (size_t i = 0; i < $2.nElements; i++) dims->add($2.elements[i]);
5256 $$ = new Ttcn::Def_Timer($1, dims, 0);
5257 $$->set_location(infile, @$);
5259 | IDentifier optArrayDef AssignmentChar TimerValue
5261 ArrayDimensions *dims;
5262 if ($2.nElements > 0) {
5263 dims = new ArrayDimensions;
5264 for (size_t i = 0; i < $2.nElements; i++) dims->add($2.elements[i]);
5267 $$ = new Ttcn::Def_Timer($1, dims, $4);
5268 $$->set_location(infile, @$);
5273 Expression { $$ = $1; }
5277 VariableRef { $$ = $1; }
5280 /* A.1.6.2.3 Component operations */
5282 ConfigurationStatements: // 313
5283 ConnectStatement { $$ = $1; }
5284 | MapStatement { $$ = $1; }
5285 | DisconnectStatement { $$ = $1; }
5286 | UnmapStatement { $$ = $1; }
5287 | DoneStatement { $$ = $1; }
5288 | KilledStatement { $$ = $1; }
5289 | StartTCStatement { $$ = $1; }
5290 | StopTCStatement { $$ = $1; }
5291 | KillTCStatement { $$ = $1; }
5294 ConfigurationOps: // 314
5299 | RunningOp {$$=$1;}
5300 | AliveOp { $$ = $1; }
5304 VariableRef DotCreateKeyword optCreateParameter optAliveKeyword
5306 $$ = new Value(Value::OPTYPE_COMP_CREATE, $1, $3.name, $3.loc, $4);
5307 $$->set_location(infile, @$);
5317 | '(' optError Expression optError ')'
5322 | '(' optError Expression optError ',' optError Expression optError ')'
5327 | '(' optError NotUsedSymbol optError ',' optError Expression optError ')'
5339 optAliveKeyword: // [328]
5340 /* empty */ { $$ = false; }
5341 | AliveKeyword { $$ = true; }
5347 $$=new Value(Value::OPTYPE_COMP_SYSTEM);
5348 $$->set_location(infile, @$);
5355 $$=new Value(Value::OPTYPE_COMP_SELF);
5356 $$->set_location(infile, @$);
5363 $$=new Value(Value::OPTYPE_COMP_MTC);
5364 $$->set_location(infile, @$);
5368 DoneStatement: // 319
5369 ComponentOrDefaultReference DotDoneKeyword optDoneParameter
5371 $$ = new Statement(Statement::S_DONE, $1, $3.donematch, $3.redirect);
5372 $$->set_location(infile, @$);
5374 | AnyKeyword ComponentKeyword DotDoneKeyword
5376 $$ = new Statement(Statement::S_DONE, Statement::C_ANY);
5377 $$->set_location(infile, @$);
5379 | AllKeyword ComponentKeyword DotDoneKeyword
5381 $$ = new Statement(Statement::S_DONE, Statement::C_ALL);
5382 $$->set_location(infile, @$);
5392 | optReceiveParameter PortRedirectSymbol ValueSpec
5399 KilledStatement: // 320
5400 ComponentOrDefaultReference DotKilledKeyword
5402 $$ = new Statement(Statement::S_KILLED, $1);
5403 $$->set_location(infile, @$);
5405 | AnyKeyword ComponentKeyword DotKilledKeyword
5407 $$ = new Statement(Statement::S_KILLED, Statement::C_ANY);
5408 $$->set_location(infile, @$);
5410 | AllKeyword ComponentKeyword DotKilledKeyword
5412 $$ = new Statement(Statement::S_KILLED, Statement::C_ALL);
5413 $$->set_location(infile, @$);
5419 ComponentOrDefaultReference
5420 | AnyKeyword ComponentKeyword
5421 | AllKeyword ComponentKeyword
5426 /* VariableRef DotRunningKeyword -- covered by RunningTimerOp */
5427 FunctionInstance DotRunningKeyword
5429 Value *t_val = new Value(Value::V_REFD, $1);
5430 t_val->set_location(infile, @1);
5431 $$ = new Value(Value::OPTYPE_COMP_RUNNING, t_val);
5432 $$->set_location(infile, @$);
5434 | ApplyOp DotRunningKeyword
5436 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5437 t_val->set_location(infile, @1);
5438 $$ = new Value(Value::OPTYPE_COMP_RUNNING, t_val);
5439 $$->set_location(infile, @$);
5441 | AnyKeyword ComponentKeyword DotRunningKeyword
5443 $$ = new Value(Value::OPTYPE_COMP_RUNNING_ANY);
5444 $$->set_location(infile, @$);
5446 | AllKeyword ComponentKeyword DotRunningKeyword
5448 $$ = new Value(Value::OPTYPE_COMP_RUNNING_ALL);
5449 $$->set_location(infile, @$);
5454 ComponentOrDefaultReference DotAliveKeyword
5456 $$ = new Value(Value::OPTYPE_COMP_ALIVE, $1);
5457 $$->set_location(infile, @$);
5459 | AnyKeyword ComponentKeyword DotAliveKeyword
5461 $$ = new Value(Value::OPTYPE_COMP_ALIVE_ANY);
5462 $$->set_location(infile, @$);
5464 | AllKeyword ComponentKeyword DotAliveKeyword
5466 $$ = new Value(Value::OPTYPE_COMP_ALIVE_ALL);
5467 $$->set_location(infile, @$);
5471 ConnectStatement: // 329
5472 ConnectKeyword SingleConnectionSpec
5474 $$=new Statement(Statement::S_CONNECT,
5475 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5476 $$->set_location(infile, @$);
5480 SingleConnectionSpec: // 331
5481 '(' PortRef optError ',' optError PortRef optError ')'
5483 $$.compref1 = $2.compref;
5484 $$.portref1 = $2.portref;
5485 $$.compref2 = $6.compref;
5486 $$.portref2 = $6.portref;
5491 ComponentRef ':' Port
5498 ComponentRef: // 333
5499 ComponentOrDefaultReference { $$ = $1; }
5500 | SystemOp { $$ = $1; }
5501 | SelfOp { $$ = $1; }
5502 | MTCOp { $$ = $1; }
5505 DisconnectStatement: // 335
5508 Location loc(infile, @$);
5509 loc.error("Disconnect operation on multiple connections is "
5510 "not currently supported");
5511 $$ = new Statement(Statement::S_ERROR);
5512 $$->set_location(infile, @$);
5514 | DisconnectKeyword SingleOrMultiConnectionSpec
5516 if ($2.compref1 && $2.portref1 && $2.compref1 && $2.compref2) {
5517 $$ = new Statement(Statement::S_DISCONNECT,
5518 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5520 Location loc(infile, @$);
5521 loc.error("Disconnect operation on multiple connections is "
5522 "not currently supported");
5527 $$ = new Statement(Statement::S_ERROR);
5529 $$->set_location(infile, @$);
5533 SingleOrMultiConnectionSpec: // 336
5534 SingleConnectionSpec { $$ = $1; }
5535 | AllConnectionsSpec
5537 $$.compref1 = $1.compref;
5538 $$.portref1 = $1.portref;
5549 | AllCompsAllPortsSpec
5558 AllConnectionsSpec: // 337
5559 '(' PortRef optError ')' { $$ = $2; }
5562 AllPortsSpec: // 338
5563 '(' ComponentRef ':' AllKeyword PortKeyword optError ')' { $$ = $2; }
5566 AllCompsAllPortsSpec: // 339
5567 '(' AllKeyword ComponentKeyword ':' AllKeyword PortKeyword optError ')'
5570 MapStatement: // 341
5571 MapKeyword SingleConnectionSpec
5573 $$=new Statement(Statement::S_MAP,
5574 $2.compref1, $2.portref1,
5575 $2.compref2, $2.portref2);
5576 $$->set_location(infile, @$);
5580 UnmapStatement: // 343
5583 $$ = new Statement(Statement::S_ERROR);
5584 $$->set_location(infile, @$);
5585 Location loc(infile, @$);
5586 loc.error("Unmap operation on multiple mappings is "
5587 "not currently supported");
5589 | UnmapKeyword SingleOrMultiConnectionSpec
5591 if ($2.compref1 && $2.portref1 && $2.compref1 && $2.compref2) {
5592 $$ = new Statement(Statement::S_UNMAP,
5593 $2.compref1, $2.portref1, $2.compref2, $2.portref2);
5595 Location loc(infile, @$);
5596 loc.error("Unmap operation on multiple mappings is "
5597 "not currently supported");
5602 $$ = new Statement(Statement::S_ERROR);
5604 $$->set_location(infile, @$);
5608 StartTCStatement: // 345
5609 /* VariableRef DotStartKeyword '(' FunctionInstance ')'
5610 -- covered by StartTimerStatement */
5611 VariableRef DotStartKeyword '(' DereferOp '(' optFunctionActualParList ')'
5614 Value *t_val = new Value(Value::V_REFD, $1);
5615 t_val->set_location(infile, @1);
5616 $6->set_location(infile, @5, @7);
5617 //ParsedActualParameters *pap = new ParsedActualParameters($6);
5618 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5619 $$->set_location(infile, @$);
5621 | FunctionInstance DotStartKeyword '(' FunctionInstance optError ')'
5623 Value *t_val = new Value(Value::V_REFD, $1);
5624 t_val->set_location(infile, @1);
5625 $$ = new Statement(Statement::S_START_COMP, t_val, $4);
5626 $$->set_location(infile, @$);
5628 | FunctionInstance DotStartKeyword '(' DereferOp '('
5629 optFunctionActualParList ')' optError ')'
5631 Value *t_val = new Value(Value::V_REFD, $1);
5632 t_val->set_location(infile, @1);
5633 $6->set_location(infile, @5 , @7);
5634 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5635 $$->set_location(infile, @$);
5637 | FunctionInstance DotStartKeyword '(' error ')'
5640 $$ = new Statement(Statement::S_ERROR);
5641 $$->set_location(infile, @$);
5643 | ApplyOp DotStartKeyword '(' FunctionInstance ')'
5645 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5646 t_val->set_location(infile, @1);
5647 $$ = new Statement(Statement::S_START_COMP, t_val, $4);
5648 $$->set_location(infile, @$);
5650 | ApplyOp DotStartKeyword '(' DereferOp '(' optFunctionActualParList ')'
5653 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5654 t_val->set_location(infile, @1);
5655 $6->set_location(infile, @5 , @7);
5656 $$ = new Statement(Statement::S_START_COMP_REFD, t_val, $4, $6);
5657 $$->set_location(infile, @$);
5659 | ApplyOp DotStartKeyword '(' error ')'
5663 $$ = new Statement(Statement::S_ERROR);
5664 $$->set_location(infile, @$);
5668 StopTCStatement: // 337
5669 /* VariableRef DotStopKeyword -- covered by StopTimerStatement */
5670 FunctionInstance DotStopKeyword
5672 Value *t_val = new Value(Value::V_REFD, $1);
5673 t_val->set_location(infile, @1);
5674 $$ = new Statement(Statement::S_STOP_COMP, t_val);
5675 $$->set_location(infile, @$);
5677 | ApplyOp DotStopKeyword
5679 Value *t_val = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5680 t_val->set_location(infile, @1);
5681 $$ = new Statement(Statement::S_STOP_COMP, t_val);
5682 $$->set_location(infile, @$);
5684 | MTCOp DotStopKeyword
5686 $$ = new Statement(Statement::S_STOP_COMP, $1);
5687 $$->set_location(infile, @$);
5689 | SelfOp DotStopKeyword
5691 $$ = new Statement(Statement::S_STOP_COMP, $1);
5692 $$->set_location(infile, @$);
5694 | AllKeyword ComponentKeyword DotStopKeyword
5696 $$ = new Statement(Statement::S_STOP_COMP, (Value*)0);
5697 $$->set_location(infile, @$);
5701 ComponentReferenceOrLiteral: // 348
5702 ComponentOrDefaultReference { $$ = $1; }
5703 | MTCOp { $$ = $1; }
5704 | SelfOp { $$ = $1; }
5707 KillTCStatement: // 349
5710 Value *self = new Value(Value::OPTYPE_COMP_SELF);
5711 self->set_location(infile, @1);
5712 $$ = new Statement(Statement::S_KILL, self);
5713 $$->set_location(infile, @$);
5715 | ComponentReferenceOrLiteral DotKillKeyword
5717 $$ = new Statement(Statement::S_KILL, $1);
5718 $$->set_location(infile, @$);
5720 | AllKeyword ComponentKeyword DotKillKeyword
5722 $$ = new Statement(Statement::S_KILL, (Value*)0);
5723 $$->set_location(infile, @$);
5727 ComponentOrDefaultReference: // 350
5730 $$ = new Value(Value::V_REFD, $1);
5731 $$->set_location(infile, @$);
5735 $$ = new Value(Value::V_REFD, $1);
5736 $$->set_location(infile, @$);
5740 $$ = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
5741 $$->set_location(infile, @$);
5745 /* A.1.6.2.4 Port operations */
5748 VariableRef { $$ = $1; }
5751 CommunicationStatements: // 353
5752 SendStatement {$$ = $1;}
5753 | CallStatement {$$ = $1;}
5754 | ReplyStatement {$$ = $1;}
5755 | RaiseStatement {$$ = $1;}
5756 | ReceiveStatement {$$ = $1;}
5757 | TriggerStatement {$$ = $1;}
5758 | GetCallStatement {$$ = $1;}
5759 | GetReplyStatement {$$ = $1;}
5760 | CatchStatement {$$ = $1;}
5761 | CheckStatement {$$ = $1;}
5762 | ClearStatement {$$ = $1;}
5763 | StartStatement {$$ = $1;}
5764 | StopStatement {$$ = $1;}
5765 | HaltStatement { $$ = $1; }
5768 SendStatement: // 354
5769 Port DotSendOpKeyword PortSendOp
5771 $$ = new Statement(Statement::S_SEND, $1, $3.templ_inst, $3.val);
5772 $$->set_location(infile, @$);
5777 '(' SendParameter optError ')' optToClause
5782 | '(' error ')' optToClause
5784 Template *t = new Template(Template::TEMPLATE_ERROR);
5785 t->set_location(infile, @2);
5786 $$.templ_inst = new TemplateInstance(0, 0, t);
5787 $$.templ_inst->set_location(infile, @2);
5792 SendParameter: // 357
5793 TemplateInstance { $$=$1; }
5796 optToClause: // [3583]
5797 /* empty */ { $$ = 0; }
5798 | ToKeyword AddressRef
5800 Template *templ = $2->get_Template();
5801 if (!$2->get_Type() && !$2->get_DerivedRef() && templ->is_Value()) {
5802 $$ = templ->get_Value();
5804 Location loc(infile, @$);
5805 loc.error("Multicast communication is not currently supported");
5810 /* | ToKeyword AddressRefList -- covered by the previous rule
5811 (as ValueOrAttribList) */
5812 | ToKeyword AllKeyword ComponentKeyword
5814 Location loc(infile, @$);
5815 loc.error("Broadcast communication is not currently supported");
5818 | ToKeyword error { $$ = 0; }
5822 AddressRefList: // 359
5823 '(' seqAddressRef ')'
5828 | seqAddressRef ',' AddressRef
5833 TemplateInstance { $$ = $1; }
5836 CallStatement: // 362
5837 Port DotCallOpKeyword PortCallOp optPortCallBody
5839 $$ = new Statement(Statement::S_CALL, $1, $3.templ_inst,
5840 $3.calltimerval, $3.nowait, $3.val, $4);
5841 $$->set_location(infile, @$);
5846 '(' CallParameters optError ')' optToClause
5848 $$.templ_inst = $2.templ_inst;
5849 $$.calltimerval = $2.calltimerval;
5850 $$.nowait = $2.nowait;
5853 | '(' error ')' optToClause
5855 Template *t = new Template(Template::TEMPLATE_ERROR);
5856 t->set_location(infile, @2);
5857 $$.templ_inst = new TemplateInstance(0, 0, t);
5858 $$.templ_inst->set_location(infile, @2);
5859 $$.calltimerval = 0;
5865 CallParameters: // 365
5872 | TemplateInstance ',' optError CallTimerValue
5875 $$.calltimerval=$4.calltimerval;
5876 $$.nowait=$4.nowait;
5880 CallTimerValue: // 366
5893 optPortCallBody: // [368]
5894 /* empty */ { $$=0; }
5895 | '{' CallBodyStatementList optError '}' { $$=$2; }
5896 | '{' error '}' { $$ = new AltGuards; }
5899 CallBodyStatementList: // 369
5900 optError CallBodyStatement
5905 | CallBodyStatementList optError CallBodyStatement
5912 CallBodyStatement: // 370 and 371. rolled into one.
5913 AltGuardChar CallBodyOps ';' // This alternative is a TITAN extension
5915 $$=new AltGuard($1, $2, new StatementBlock());
5916 $$->set_location(infile, @$);
5918 | AltGuardChar CallBodyOps optSemiColon StatementBlock optSemiColon
5920 $$=new AltGuard($1, $2, $4);
5921 $$->set_location(infile, @$);
5926 GetReplyStatement {$$=$1;}
5927 | CatchStatement {$$=$1;}
5930 ReplyStatement: // 373
5931 Port DotReplyKeyword PortReplyOp
5933 $$ = new Statement(Statement::S_REPLY, $1, $3.templ_inst,
5934 $3.replyval, $3.toclause);
5935 $$->set_location(infile, @$);
5940 '(' TemplateInstance optReplyValue optError ')' optToClause
5946 | '(' error ')' optToClause
5948 Template *t = new Template(Template::TEMPLATE_ERROR);
5949 t->set_location(infile, @2);
5950 $$.templ_inst = new TemplateInstance(0, 0, t);
5951 $$.templ_inst->set_location(infile, @2);
5957 optReplyValue: // [376]
5958 /* empty */ { $$=0; }
5959 | ValueKeyword Expression { $$=$2; }
5960 | ValueKeyword error { $$ = 0; }
5963 RaiseStatement: // 377
5964 Port DotRaiseKeyword PortRaiseOp
5966 if ($3.signature) $$ = new Statement(Statement::S_RAISE, $1,
5967 $3.signature, $3.templ_inst, $3.toclause);
5969 $$ = new Statement(Statement::S_ERROR);
5971 delete $3.signature;
5972 delete $3.templ_inst;
5975 $$->set_location(infile, @$);
5980 '(' Signature optError ',' optError TemplateInstance optError ')' optToClause
5986 | '(' error ')' optToClause
5995 ReceiveStatement: // 380
5996 PortOrAny DotReceiveOpKeyword PortReceiveOp
5998 $$ = new Statement(Statement::S_RECEIVE, $1, $3.templ_inst,
5999 $3.fromclause, $3.redirectval, $3.redirectsender);
6000 $$->set_location(infile, @$);
6006 | AnyKeyword PortKeyword { $$ = 0; }
6009 PortReceiveOp: // 382
6010 optReceiveParameter optFromClause optPortRedirect
6014 $$.redirectval = $3.redirectval;
6015 $$.redirectsender = $3.redirectsender;
6019 optReceiveParameter: // [384]
6020 /* empty */ { $$ = 0; }
6021 | '(' ReceiveParameter optError ')' { $$ = $2; }
6024 Template *t = new Template(Template::TEMPLATE_ERROR);
6025 t->set_location(infile, @2);
6026 $$ = new TemplateInstance(0, 0, t);
6027 $$->set_location(infile, @$);
6031 ReceiveParameter: // 384
6032 TemplateInstance { $$ = $1; }
6035 optFromClause: // [385]
6036 /* empty */ { $$=0; }
6037 | FromClause { $$=$1; }
6041 FromKeyword AddressRef { $$=$2; }
6042 | FromKeyword error { $$ = 0; }
6045 optPortRedirect: // [387]
6049 $$.redirectsender=0;
6051 | PortRedirectSymbol ValueSpec
6054 $$.redirectsender=0;
6056 | PortRedirectSymbol SenderSpec
6059 $$.redirectsender=$2;
6061 | PortRedirectSymbol ValueSpec SenderSpec
6064 $$.redirectsender=$3;
6066 | PortRedirectSymbol error
6069 $$.redirectsender=0;
6074 ValueKeyword VariableRef { $$ = $2; }
6075 | ValueKeyword error { $$ = 0; }
6079 SenderKeyword VariableRef { $$ = $2; }
6080 | SenderKeyword error { $$ = 0; }
6083 TriggerStatement: // 393
6084 PortOrAny DotTriggerOpKeyword PortTriggerOp
6086 $$ = new Statement(Statement::S_TRIGGER, $1, $3.templ_inst,
6087 $3.fromclause, $3.redirectval, $3.redirectsender);
6088 $$->set_location(infile, @$);
6092 PortTriggerOp: // 394
6093 optReceiveParameter optFromClause optPortRedirect
6097 $$.redirectval = $3.redirectval;
6098 $$.redirectsender = $3.redirectsender;
6102 GetCallStatement: // 396
6103 PortOrAny DotGetCallOpKeyword PortGetCallOp
6105 $$ = new Statement(Statement::S_GETCALL, $1, $3.templ_inst,
6106 $3.fromclause, $3.redirectparam, $3.redirectsender);
6107 $$->set_location(infile, @$);
6111 PortGetCallOp: // 397
6112 optReceiveParameter optFromClause optPortRedirectWithParam
6116 $$.redirectparam = $3.redirectparam;
6117 $$.redirectsender = $3.redirectsender;
6121 optPortRedirectWithParam: // [399]
6125 $$.redirectsender=0;
6127 | PortRedirectSymbol ParamSpec
6129 $$.redirectparam=$2;
6130 $$.redirectsender=0;
6132 | PortRedirectSymbol ParamSpec SenderSpec
6134 $$.redirectparam=$2;
6135 $$.redirectsender=$3;
6137 | PortRedirectSymbol SenderSpec
6140 $$.redirectsender=$2;
6142 | PortRedirectSymbol error
6145 $$.redirectsender=0;
6150 ParamKeyword ParamAssignmentList { $$ = $2; }
6151 | ParamKeyword error { $$ = 0; }
6154 ParamAssignmentList: // 403
6155 '(' AssignmentList optError ')'
6157 $$=new ParamRedirect($2);
6158 $$->set_location(infile, @$);
6160 | '(' VariableList optError ')'
6162 $$=new ParamRedirect($2);
6163 $$->set_location(infile, @$);
6167 $$=new ParamRedirect(new ParamAssignments());
6168 $$->set_location(infile, @$);
6172 AssignmentList: // 404
6175 $$ = new ParamAssignments();
6178 | error VariableAssignment
6180 $$ = new ParamAssignments();
6183 | AssignmentList optError ',' optError VariableAssignment
6188 | AssignmentList optError ',' error { $$ = $1; }
6191 VariableAssignment: // 405
6192 VariableRef AssignmentChar IDentifier
6194 $$ = new ParamAssignment($3, $1);
6195 $$->set_location(infile, @$);
6199 VariableList: // 407
6202 $$ = new VariableEntries();
6205 | error VariableEntry
6207 $$ = new VariableEntries();
6210 | VariableList optError ',' optError VariableEntry
6215 | VariableList optError ',' error { $$ = $1; }
6218 VariableEntry: // 408
6221 $$ = new VariableEntry($1);
6222 $$->set_location(infile, @$);
6226 $$ = new VariableEntry;
6227 $$->set_location(infile, @$);
6231 GetReplyStatement: // 409
6232 PortOrAny DotGetReplyOpKeyword PortGetReplyOp
6234 $$ = new Statement(Statement::S_GETREPLY, $1, $3.templ_inst,
6235 $3.valuematch, $3.fromclause, $3.redirectval,
6236 $3.redirectparam, $3.redirectsender);
6237 $$->set_location(infile, @$);
6241 PortGetReplyOp: // 410
6242 optGetReplyParameter optFromClause optPortRedirectWithValueAndParam
6244 $$.templ_inst = $1.templ_inst;
6245 $$.valuematch = $1.valuematch;
6247 $$.redirectval = $3.redirectval;
6248 $$.redirectparam = $3.redirectparam;
6249 $$.redirectsender = $3.redirectsender;
6253 optPortRedirectWithValueAndParam: // [411]
6258 $$.redirectsender=0;
6260 | PortRedirectSymbol ValueSpec
6264 $$.redirectsender=0;
6266 | PortRedirectSymbol ValueSpec ParamSpec
6269 $$.redirectparam=$3;
6270 $$.redirectsender=0;
6272 | PortRedirectSymbol ValueSpec SenderSpec
6276 $$.redirectsender=$3;
6278 | PortRedirectSymbol ValueSpec ParamSpec SenderSpec
6281 $$.redirectparam=$3;
6282 $$.redirectsender=$4;
6284 | PortRedirectSymbol ParamSpec
6287 $$.redirectparam=$2;
6288 $$.redirectsender=0;
6290 | PortRedirectSymbol SenderSpec
6294 $$.redirectsender=$2;
6296 | PortRedirectSymbol ParamSpec SenderSpec
6299 $$.redirectparam=$2;
6300 $$.redirectsender=$3;
6302 | PortRedirectSymbol error
6306 $$.redirectsender=0;
6310 optGetReplyParameter:
6316 | '(' ReceiveParameter optError ')'
6321 | '(' ReceiveParameter ValueMatchSpec optError ')'
6328 Template *t = new Template(Template::TEMPLATE_ERROR);
6329 t->set_location(infile, @2);
6330 $$.templ_inst = new TemplateInstance(0, 0, t);
6331 $$.templ_inst->set_location(infile, @2);
6336 ValueMatchSpec: // 414
6337 ValueKeyword TemplateInstance { $$=$2; }
6338 | ValueKeyword error { $$ = 0; }
6341 CheckStatement: // 415
6342 PortOrAny DotCheckOpKeyword optCheckParameter
6344 switch ($3.statementtype) {
6345 case Statement::S_CHECK:
6346 $$ = new Statement(Statement::S_CHECK, $1, $3.templ_inst,
6349 case Statement::S_CHECK_RECEIVE:
6350 $$ = new Statement(Statement::S_CHECK_RECEIVE, $1, $3.templ_inst,
6351 $3.fromclause, $3.redirectval, $3.redirectsender);
6353 case Statement::S_CHECK_GETCALL:
6354 $$ = new Statement(Statement::S_CHECK_GETCALL, $1, $3.templ_inst,
6355 $3.fromclause, $3.redirectparam, $3.redirectsender);
6357 case Statement::S_CHECK_GETREPLY:
6358 $$ = new Statement(Statement::S_CHECK_GETREPLY, $1, $3.templ_inst,
6359 $3.valuematch, $3.fromclause, $3.redirectval,
6360 $3.redirectparam, $3.redirectsender);
6362 case Statement::S_CHECK_CATCH:
6363 $$ = new Statement(Statement::S_CHECK_CATCH, $1, $3.signature,
6364 $3.templ_inst, $3.timeout, $3.fromclause,
6365 $3.redirectval, $3.redirectsender);
6368 FATAL_ERROR("Internal error.");
6370 $$->set_location(infile, @$);
6374 optCheckParameter: // [418]
6377 $$.statementtype = Statement::S_CHECK;
6384 $$.redirectparam = 0;
6385 $$.redirectsender = 0;
6387 | '(' CheckParameter optError ')' { $$ = $2; }
6390 $$.statementtype = Statement::S_CHECK;
6397 $$.redirectparam = 0;
6398 $$.redirectsender = 0;
6402 CheckParameter: // 418
6403 CheckPortOpsPresent { $$ = $1; }
6404 | FromClausePresent { $$ = $1; }
6405 | RedirectPresent { $$ = $1; }
6408 FromClausePresent: // 419
6411 $$.statementtype = Statement::S_CHECK;
6418 $$.redirectparam = 0;
6419 $$.redirectsender = 0;
6421 | FromClause PortRedirectSymbol SenderSpec
6423 $$.statementtype = Statement::S_CHECK;
6430 $$.redirectparam = 0;
6431 $$.redirectsender = $3;
6435 RedirectPresent: // 420
6436 PortRedirectSymbol SenderSpec
6438 $$.statementtype = Statement::S_CHECK;
6445 $$.redirectparam = 0;
6446 $$.redirectsender = $2;
6450 CheckPortOpsPresent: // 421
6451 ReceiveOpKeyword PortReceiveOp
6453 $$.statementtype = Statement::S_CHECK_RECEIVE;
6455 $$.templ_inst = $2.templ_inst;
6458 $$.fromclause = $2.fromclause;
6459 $$.redirectval = $2.redirectval;
6460 $$.redirectparam = 0;
6461 $$.redirectsender = $2.redirectsender;
6463 | GetCallOpKeyword PortGetCallOp
6465 $$.statementtype = Statement::S_CHECK_GETCALL;
6467 $$.templ_inst = $2.templ_inst;
6470 $$.fromclause = $2.fromclause;
6472 $$.redirectparam = $2.redirectparam;
6473 $$.redirectsender = $2.redirectsender;
6475 | GetReplyOpKeyword PortGetReplyOp
6477 $$.statementtype = Statement::S_CHECK_GETREPLY;
6479 $$.templ_inst = $2.templ_inst;
6480 $$.valuematch = $2.valuematch;
6482 $$.fromclause = $2.fromclause;
6483 $$.redirectval = $2.redirectval;
6484 $$.redirectparam = $2.redirectparam;
6485 $$.redirectsender = $2.redirectsender;
6487 | CatchOpKeyword PortCatchOp
6489 $$.statementtype = Statement::S_CHECK_CATCH;
6490 $$.signature = $2.signature;
6491 $$.templ_inst = $2.templ_inst;
6493 $$.timeout = $2.timeout;
6494 $$.fromclause = $2.fromclause;
6495 $$.redirectval = $2.redirectval;
6496 $$.redirectparam = 0;
6497 $$.redirectsender = $2.redirectsender;
6501 CatchStatement: // 422
6502 PortOrAny DotCatchOpKeyword PortCatchOp
6504 $$ = new Statement(Statement::S_CATCH, $1, $3.signature, $3.templ_inst,
6505 $3.timeout, $3.fromclause, $3.redirectval,
6507 $$->set_location(infile, @$);
6512 optCatchOpParameter optFromClause optPortRedirect
6514 $$.signature = $1.signature;
6515 $$.templ_inst = $1.templ_inst;
6516 $$.timeout = $1.timeout;
6518 $$.redirectval = $3.redirectval;
6519 $$.redirectsender = $3.redirectsender;
6523 optCatchOpParameter: // [425]
6530 | '(' CatchOpParameter optError ')' { $$ = $2; }
6539 CatchOpParameter: // 425
6540 Signature optError ',' optError TemplateInstance
6554 ClearStatement: // 426
6555 PortOrAll DotClearOpKeyword
6557 $$ = new Statement(Statement::S_CLEAR, $1);
6558 $$->set_location(infile, @$);
6564 | AllKeyword PortKeyword { $$ = 0; }
6567 StartStatement: // 430
6568 /* Port DotPortStartKeyword -- covered by StartTimerStatement */
6569 AllKeyword PortKeyword DotStartKeyword
6571 $$=new Statement(Statement::S_START_PORT, (Ttcn::Reference*)0);
6572 $$->set_location(infile, @$);
6576 StopStatement: // 432
6577 /* Port DotPortStopKeyword -- covered by StopTimerStatement */
6578 AllKeyword PortKeyword DotStopKeyword
6580 $$=new Statement(Statement::S_STOP_PORT, (Ttcn::Reference*)0);
6581 $$->set_location(infile, @$);
6585 HaltStatement: // 435
6586 PortOrAll DotHaltKeyword
6588 $$ = new Statement(Statement::S_HALT, $1);
6589 $$->set_location(infile, @$);
6593 /* A.1.6.2.5 Timer operations */
6595 TimerStatements: // 439
6596 StartTimerStatement { $$ = $1; }
6597 | StopTimerStatement { $$ = $1; }
6598 | TimeoutStatement { $$ = $1; }
6602 ReadTimerOp { $$ = $1; }
6603 | RunningTimerOp { $$ = $1; }
6606 StartTimerStatement: // 441
6607 VariableRef DotStartKeyword
6609 $$ = new Statement(Statement::S_START_UNDEF, $1, (Value*)0);
6610 $$->set_location(infile, @$);
6612 | VariableRef DotStartKeyword '(' Expression optError ')'
6614 $$ = new Statement(Statement::S_START_UNDEF, $1, $4);
6615 $$->set_location(infile, @$);
6617 | VariableRef DotStartKeyword '(' error ')'
6619 Value *v = new Value(Value::V_ERROR);
6620 v->set_location(infile, @4);
6621 $$ = new Statement(Statement::S_START_UNDEF, $1, v);
6622 $$->set_location(infile, @$);
6626 StopTimerStatement: // 442
6627 TimerRef DotStopKeyword
6629 $$ = new Statement(Statement::S_STOP_UNDEF, $1, (Value*)0);
6630 $$->set_location(infile, @$);
6632 | AllKeyword TimerKeyword DotStopKeyword
6634 $$ = new Statement(Statement::S_STOP_TIMER, (Ttcn::Reference*)0);
6635 $$->set_location(infile, @$);
6639 /* no separate rule, folded into StopTimerStatement
6640 TimerRefOrAll: // 443
6642 | AllKeyword TimerKeyword
6647 TimerRef DotReadKeyword
6649 $$ = new Value(Value::OPTYPE_TMR_READ, $1);
6650 $$->set_location(infile, @$);
6654 RunningTimerOp: // 446
6655 TimerRef DotRunningKeyword
6657 $$ = new Value(Value::OPTYPE_UNDEF_RUNNING, $1);
6658 $$->set_location(infile, @$);
6660 | AnyKeyword TimerKeyword DotRunningKeyword
6662 $$ = new Value(Value::OPTYPE_TMR_RUNNING_ANY);
6663 $$->set_location(infile, @$);
6667 TimeoutStatement: // 447
6668 TimerRefOrAny DotTimeoutKeyword
6670 $$ = new Statement(Statement::S_TIMEOUT, $1);
6671 $$->set_location(infile, @$);
6675 TimerRefOrAny: // 448
6676 TimerRef { $$ = $1; }
6677 | AnyKeyword TimerKeyword { $$ = 0; }
6686 $$->set_location(infile, @$);
6688 | AnyTypeKeyword /* a predefined type with special treatment */
6690 anytype_access = true;
6691 Identifier *id = new Identifier(Identifier::ID_TTCN, string("anytype"));
6692 Ttcn::Reference *ref = new Ttcn::Reference(id);
6693 ref->set_location(infile, @1);
6694 $$ = new Type(Type::T_REFD, ref);
6696 | ReferencedType { $$ = $1; }
6700 PredefinedType: // 451, but see below
6701 BitStringKeyword { $$ = Type::T_BSTR; }
6702 | BooleanKeyword { $$ = Type::T_BOOL; }
6703 | CharStringKeyword { $$ = Type::T_CSTR; }
6704 | UniversalCharString { $$ = Type::T_USTR; }
6705 | CharKeyword // not in the standard anymore
6707 Location loc(infile, @$);
6708 loc.warning("Obsolete type `char' was substituted with `charstring'");
6711 | UniversalChar // not in the standard anymore
6713 Location loc(infile, @$);
6714 loc.warning("Obsolete type `universal char' was substituted with "
6715 "`universal charstring'");
6718 | IntegerKeyword { $$ = Type::T_INT; }
6719 | OctetStringKeyword { $$ = Type::T_OSTR; }
6720 | HexStringKeyword { $$ = Type::T_HSTR; }
6721 | VerdictTypeKeyword { $$ = Type::T_VERDICT; }
6722 | FloatKeyword { $$ = Type::T_REAL; }
6723 | AddressKeyword { $$ = Type::T_ADDRESS; }
6724 | DefaultKeyword { $$ = Type::T_DEFAULT; }
6725 | ObjectIdentifierKeyword { $$ = Type::T_OID; }
6727 * AnyTypeKeyword is not part of PredefinedType (this differs from the BNF
6728 * in the TTCN-3 standard).
6729 * PredefinedType is used in two contexts:
6730 * - as a RHS for Type, above (where AnyTypeKeyword needs special treatment,
6731 * and it's easier to appear as an alternative to PredefinedType)
6732 * - as field name for the anytype (where anytype is not permitted)
6736 UniversalCharString: // 463
6737 UniversalKeyword CharStringKeyword
6741 UniversalKeyword CharKeyword
6744 ReferencedType: // 465
6747 if ($1.is_ref) $$ = new Type(Type::T_REFD, $1.ref);
6749 Ttcn::Reference *ref = new Ttcn::Reference($1.id);
6750 ref->set_location(infile, @1);
6751 $$ = new Type(Type::T_REFD, ref);
6753 $$->set_location(infile, @$);
6755 | FunctionInstance optExtendedFieldReference
6756 /* covers all parameterized type references */
6758 Location loc(infile, @1);
6759 loc.error("Reference to parameterized type is not currently supported");
6761 for (size_t i = 0; i < $2.nElements; i++) delete $2.elements[i];
6763 $$ = new Type(Type::T_ERROR);
6764 $$->set_location(infile, @$);
6769 TypeReference: // 466
6771 | IDentifier TypeActualParList
6775 TypeActualParList: // -> 202 784 "Advanced Parameterization"
6776 '(' seqTypeActualPar optError ')'
6780 seqTypeActualPar: // -> 202 784 "Advanced Parameterization"
6781 optError TypeActualPar
6782 | seqTypeActualPar optError ',' optError TypeActualPar
6783 | seqTypeActualPar optError ',' error
6786 TypeActualPar: // -> 202 784 "Advanced Parameterization"
6787 Expression { delete $1; }
6790 optArrayDef: // [467]
6796 | optArrayDef ArrayIndex
6798 $$.nElements = $1.nElements + 1;
6799 $$.elements = (ArrayDimension**)
6800 Realloc($1.elements, $$.nElements * sizeof(*$$.elements));
6801 $$.elements[$1.nElements] = $2;
6808 $$ = new ArrayDimension($2);
6809 $$->set_location(infile, @$);
6811 | '[' ArrayBounds DotDot ArrayBounds ']'
6813 $$ = new ArrayDimension($2, $4);
6814 $$->set_location(infile, @$);
6818 Value *v = new Value(Value::V_ERROR);
6819 v->set_location(infile, @2);
6820 $$ = new ArrayDimension(v);
6821 $$->set_location(infile, @$);
6826 Expression { $$ = $1; }
6832 PredefinedValue { $$ = $1; }
6833 | ReferencedValue { $$ = $1; }
6836 PredefinedValue: // 470
6837 BitStringValue { $$ = $1; }
6838 | BooleanValue { $$ = $1; }
6839 | CharStringValue { $$ = $1; }
6840 | IntegerValue { $$ = $1; }
6841 | OctetStringValue { $$ = $1; }
6842 | HexStringValue { $$ = $1; }
6843 | VerdictValue { $$ = $1; }
6844 /* | EnumeratedValue -- covered by ReferencedValue */
6845 | FloatOrSpecialFloatValue
6847 $$ = new Value(Value::V_REAL, $1);
6848 $$->set_location(infile, @$);
6850 | AddressValue { $$ = $1; }
6851 | OmitValue { $$ = $1; }
6854 $$ = new Value(Value::V_NULL);
6855 $$->set_location(infile, @$);
6859 $$ = new Value(Value::V_MACRO, $1);
6860 $$->set_location(infile, @$);
6862 | ObjectIdentifierValue { $$ = $1; }
6865 $$=new Value(Value::V_ERROR);
6866 $$->set_location(infile, @$);
6870 BitStringValue: // 471
6873 $$ = new Value(Value::V_BSTR, $1);
6874 $$->set_location(infile, @$);
6878 BooleanValue: // 472
6881 $$ = new Value(Value::V_BOOL, true);
6882 $$->set_location(infile, @$);
6886 $$ = new Value(Value::V_BOOL, false);
6887 $$->set_location(infile, @$);
6891 /* TTCN-3 core language V4.2.1 */
6892 FloatOrSpecialFloatValue:
6907 IntegerValue: // 473
6910 $$ = new Value(Value::V_INT, $1);
6911 $$->set_location(infile, @$);
6915 OctetStringValue: // 474
6918 $$ = new Value(Value::V_OSTR, $1);
6919 $$->set_location(infile, @$);
6923 HexStringValue: // 475
6926 $$ = new Value(Value::V_HSTR, $1);
6927 $$->set_location(infile, @$);
6931 VerdictValue: // 476 VerdictTypeValue
6934 $$ = new Value(Value::V_VERDICT, Value::Verdict_NONE);
6935 $$->set_location(infile, @$);
6939 $$ = new Value(Value::V_VERDICT, Value::Verdict_PASS);
6940 $$->set_location(infile, @$);
6944 $$ = new Value(Value::V_VERDICT, Value::Verdict_INCONC);
6945 $$->set_location(infile, @$);
6949 $$ = new Value(Value::V_VERDICT, Value::Verdict_FAIL);
6950 $$->set_location(infile, @$);
6954 $$ = new Value(Value::V_VERDICT, Value::Verdict_ERROR);
6955 $$->set_location(infile, @$);
6959 CharStringValue: // 478
6962 if ($1->is_cstr()) $$ = new Value(Value::V_CSTR, $1);
6964 $$ = new Value(Value::V_USTR, new ustring(*$1));
6967 $$->set_location(infile, @$);
6971 $$ = new Value(Value::V_USTR, new ustring(*$1));
6973 $$->set_location(infile, @$);
6980 Location loc(infile, @1);
6981 $$ = parse_charstring_value($1, loc);
6987 CharKeyword '(' optError Group optError ',' optError Plane optError ','
6988 optError Row optError ',' optError Cell optError ')'
6989 { $$ = new ustring($4, $8, $12, $16); }
6990 | CharKeyword '(' error ')' { $$ = new ustring; }
6996 if (*$1 < 0 || *$1 > 127) {
6997 Location loc(infile, @1);
6998 loc.error("The first number of quadruple (group) must be within the "
6999 "range 0 .. 127 instead of %s", $1->t_str().c_str());
7000 $$ = *$1 < 0 ? 0 : 127;
7011 if (*$1 < 0 || *$1 > 255) {
7012 Location loc(infile, @1);
7013 loc.error("The second number of quadruple (plane) must be within the "
7014 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7015 $$ = *$1 < 0 ? 0 : 255;
7026 if (*$1 < 0 || *$1 > 255) {
7027 Location loc(infile, @1);
7028 loc.error("The third number of quadruple (row) must be within the "
7029 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7030 $$ = *$1 < 0 ? 0 : 255;
7041 if (*$1 < 0 || *$1 > 255) {
7042 Location loc(infile, @1);
7043 loc.error("The fourth number of quadruple (cell) must be within the "
7044 "range 0 .. 255 instead of %s", $1->t_str().c_str());
7045 $$ = *$1 < 0 ? 0 : 255;
7054 Cstring { $$ = $1; }
7057 $$ = mputstr($1, $2);
7062 AddressValue: // 510
7065 $$ = new Value(Value::V_TTCN3_NULL);
7066 $$->set_location(infile, @$);
7073 $$ = new Value(Value::V_OMIT);
7074 $$->set_location(infile, @$);
7078 ReferencedValue: // 489
7081 if ($1.is_ref) $$ = new Value(Value::V_REFD, $1.ref);
7082 else $$ = new Value(Value::V_UNDEF_LOWERID, $1.id);
7083 $$->set_location(infile, @$);
7086 Reference: // 490 ValueReference
7092 | IDentifier '.' PredefOrIdentifier optExtendedFieldReference
7095 $$.ref = new Ttcn::Reference($1);
7096 FieldOrArrayRef *fieldref = new FieldOrArrayRef($3);
7097 fieldref->set_location(infile, @3);
7098 $$.ref->add(fieldref);
7099 for (size_t i = 0; i < $4.nElements; i++) $$.ref->add($4.elements[i]);
7101 $$.ref->set_location(infile, @$);
7103 | IDentifier ArrayOrBitRef optExtendedFieldReference
7106 $$.ref = new Ttcn::Reference($1);
7108 for (size_t i = 0; i < $3.nElements; i++) $$.ref->add($3.elements[i]);
7110 $$.ref->set_location(infile, @$);
7112 | IDentifier '[' NotUsedSymbol ']'
7115 $$.ref = new Ttcn::Reference($1);
7116 Value* novalue = new Value(Value::V_NOTUSED);
7117 novalue->set_location(infile, @3);
7118 $$.ref->add(new FieldOrArrayRef(novalue));
7119 $$.ref->set_location(infile, @$);
7121 | IDentifier '.' ObjectIdentifierValue '.' IDentifier
7122 optExtendedFieldReference
7125 $$.ref = new Ttcn::Reference($1, $5);
7127 for (size_t i = 0; i < $6.nElements; i++) $$.ref->add($6.elements[i]);
7129 $$.ref->set_location(infile, @$);
7133 /* A.1.6.5 Parameterization */
7136 /* empty */ { $$ = false; }
7137 | TitanSpecificLazyKeyword { $$ = true; }
7140 FormalValuePar: // 516
7141 optLazyEval Type IDentifier optParDefaultValue
7143 $$ = new FormalPar(Common::Assignment::A_PAR_VAL, $2, $3, $4, $1);
7144 $$->set_location(infile, @$);
7146 | InParKeyword optLazyEval Type IDentifier optParDefaultValue
7148 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_IN, $3, $4, $5, $2);
7149 $$->set_location(infile, @$);
7151 | InOutParKeyword Type IDentifier optParDefaultValue
7153 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_INOUT, $2, $3, $4);
7154 $$->set_location(infile, @$);
7156 | OutParKeyword Type IDentifier optParDefaultValue
7158 $$ = new FormalPar(Common::Assignment::A_PAR_VAL_OUT, $2, $3, $4);
7159 $$->set_location(infile, @$);
7164 FormalPortPar: // 518
7165 IDentifier IDentifier
7166 | InOutParKeyword IDentifier IDentifier
7170 FormalTimerPar: // 520
7171 TimerKeyword IDentifier optParDefaultValue
7173 $$ = new FormalPar(Common::Assignment::A_PAR_TIMER, $2, $3);
7174 $$->set_location(infile, @$);
7176 | InOutParKeyword TimerKeyword IDentifier optParDefaultValue
7178 $$ = new FormalPar(Common::Assignment::A_PAR_TIMER, $3, $4);
7179 $$->set_location(infile, @$);
7183 FormalTemplatePar: // 522
7184 TemplateOptRestricted optLazyEval Type IDentifier optParDefaultValue
7186 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_IN, $1, $3, $4, $5, $2);
7187 $$->set_location(infile, @$);
7189 | InParKeyword TemplateOptRestricted optLazyEval Type IDentifier optParDefaultValue
7191 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_IN, $2, $4, $5, $6, $3);
7192 $$->set_location(infile, @$);
7194 | InOutParKeyword TemplateOptRestricted Type IDentifier optParDefaultValue
7196 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_INOUT, $2, $3, $4, $5);
7197 $$->set_location(infile, @$);
7199 | OutParKeyword TemplateOptRestricted Type IDentifier optParDefaultValue
7201 $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_OUT, $2, $3, $4, $5);
7202 $$->set_location(infile, @$);
7206 /* template with optional restriction */
7207 TemplateOptRestricted:
7208 TemplateKeyword optTemplateRestriction
7218 optTemplateRestriction:
7219 /* none */ { $$ = TR_NONE; }
7220 | TemplateRestriction { $$ = $1; }
7222 TemplateRestriction:
7223 '(' OmitKeyword ')' { $$ = TR_OMIT; }
7224 | '(' ValueKeyword ')' { $$ = TR_VALUE; }
7225 | '(' PresentKeyword ')' { $$ = TR_PRESENT; }
7229 /* empty */ { $$ = NULL; }
7230 | AssignmentChar TemplateInstance { $$ = $2; }
7231 | AssignmentChar NotUsedSymbol
7233 Template *t = new Template(Template::TEMPLATE_NOTUSED);
7234 t->set_location(infile, @$);
7235 $$ = new TemplateInstance(0, 0, t);
7236 $$->set_location(infile, @$);
7240 /* A.1.6.6 With statement */
7242 optWithStatement: // [526]
7243 /* empty */ { $$ = NULL; }
7244 | WithStatement { $$ = $1; }
7247 optWithStatementAndSemiColon:
7248 /* empty */ { $$ = NULL; }
7249 | WithStatement { $$ = $1; }
7250 | ';' { $$ = NULL; }
7251 | WithStatement ';' { $$ = $1; }
7254 WithStatement: // 526
7255 WithKeyword WithAttribList { $$ = $2; }
7258 WithAttribList: // 528
7259 '{' MultiWithAttrib optError '}' { $$ = $2; }
7260 | '{' error '}' { $$ = NULL; }
7263 MultiWithAttrib: // 529
7264 optError SingleWithAttrib optSemiColon
7266 $$ = new MultiWithAttrib;
7267 $$->set_location(infile, @$);
7268 $$->add_element($2);
7270 | MultiWithAttrib optError SingleWithAttrib optSemiColon
7273 $$->add_element($3);
7277 SingleWithAttrib: // 530
7278 AttribKeyword optOverrideKeyword optAttribQualifier AttribSpec
7280 $$ = new SingleWithAttrib($1,$2,$3,$4);
7281 $$->set_location(infile, @$);
7285 AttribKeyword: // 531
7286 EncodeKeyword { $$ = SingleWithAttrib::AT_ENCODE; }
7287 | VariantKeyword { $$ = SingleWithAttrib::AT_VARIANT; }
7288 | DisplayKeyword { $$ = SingleWithAttrib::AT_DISPLAY; }
7289 | ExtensionKeyword { $$ = SingleWithAttrib::AT_EXTENSION; }
7290 | OptionalKeyword { $$ = SingleWithAttrib::AT_OPTIONAL; }
7293 /* workaround to get rid of ErroneousKeyword which would clash with
7294 * existing TTCN-3 source code */
7295 if ($1->get_ttcnname()=="erroneous") $$ = SingleWithAttrib::AT_ERRONEOUS;
7297 Location loc(infile, @1);
7298 loc.error("Invalid attribute. Valid attributes are: "
7299 "`encode', `variant' , `display' , `extension', `optional' and `erroneous'");
7300 if ($1->get_ttcnname()=="titan")
7302 " ________ _____ ________ ____ __ _ \n"
7303 "(___ ___) (_ _) (___ ___) ( ) / \\ / ) \n"
7304 " ) ) | | ) ) / /\\ \\ / /\\ \\ / / \n"
7305 " ( ( | | ( ( ( (__) ) ) ) ) ) ) ) \n"
7306 " ) ) | | ) ) ) ( ( ( ( ( ( ( \n"
7307 " ( ( _| |__ ( ( / /\\ \\ / / \\ \\/ / \n"
7308 " /__\\ /_____( /__\\ /__( )__\\ (_/ \\__/ \n");
7309 $$ = SingleWithAttrib::AT_INVALID;
7315 optOverrideKeyword: // [536]
7316 /* empty */ { $$ = false; }
7317 | OverrideKeyword { $$ = true; }
7320 optAttribQualifier: // [537]
7321 /* empty */ { $$ = NULL; }
7322 | '(' DefOrFieldRefList optError ')' { $$ = $2; }
7323 | '(' error ')' { $$ = NULL; }
7326 DefOrFieldRefList: // 538
7327 optError DefOrFieldRef
7329 $$ = new Qualifiers();
7330 if ($2) $$->add_qualifier($2);
7332 | DefOrFieldRefList optError ',' optError DefOrFieldRef
7335 if ($5) $$->add_qualifier($5);
7337 | DefOrFieldRefList optError ',' error { $$ = $1; }
7340 ArrayOrBitRefOrDash:
7341 ArrayOrBitRef { $$ = $1; }
7342 | '[' NotUsedSymbol ']'
7344 Value* novalue = new Value(Value::V_NOTUSED);
7345 novalue->set_location(infile, @2);
7346 $$ = new FieldOrArrayRef(novalue);
7347 $$->set_location(infile, @$);
7350 DefOrFieldRef: // 539
7353 $$ = new Qualifier();
7354 $$->add(new FieldOrArrayRef($1));
7355 $$->set_location(infile, @1);
7357 | IDentifier '.' IDentifier optExtendedFieldReference
7359 $$ = new Qualifier();
7360 $$->add(new FieldOrArrayRef($1));
7361 $$->add(new FieldOrArrayRef($3));
7362 for(size_t i=0; i<$4.nElements; i++) {
7363 $$->add($4.elements[i]);
7366 $$->set_location(infile, @$);
7368 | IDentifier ArrayOrBitRefOrDash optExtendedFieldReference
7370 $$ = new Qualifier();
7371 $$->add(new FieldOrArrayRef($1));
7373 for(size_t i=0; i<$3.nElements; i++) {
7374 $$->add($3.elements[i]);
7377 $$->set_location(infile, @$);
7379 | ArrayOrBitRefOrDash optExtendedFieldReference
7381 $$ = new Qualifier();
7383 for(size_t i=0; i<$2.nElements; i++) {
7384 $$->add($2.elements[i]);
7387 $$->set_location(infile, @$);
7391 Location loc(infile, @$);
7392 loc.error("Reference to multiple definitions in attribute qualifiers is "
7393 "not currently supported");
7399 GroupKeyword AllKeyword
7400 | GroupKeyword AllKeyword ExceptKeyword '{' GroupRefList optError '}'
7401 | TypeDefKeyword AllKeyword
7402 | TypeDefKeyword AllKeyword ExceptKeyword '{' TypeRefList optError '}'
7403 | TemplateKeyword AllKeyword
7404 | TemplateKeyword AllKeyword ExceptKeyword '{' TemplateRefList optError '}'
7405 | ConstKeyword AllKeyword
7406 | ConstKeyword AllKeyword ExceptKeyword '{' ConstRefList optError '}'
7407 | AltstepKeyword AllKeyword
7408 | AltstepKeyword AllKeyword ExceptKeyword '{' AltstepRefList optError '}'
7409 | TestcaseKeyword AllKeyword
7410 | TestcaseKeyword AllKeyword ExceptKeyword '{' TestcaseRefList optError '}'
7411 | FunctionKeyword AllKeyword
7412 | FunctionKeyword AllKeyword ExceptKeyword '{' FunctionRefList optError '}'
7413 | SignatureKeyword AllKeyword
7414 | SignatureKeyword AllKeyword ExceptKeyword '{' SignatureRefList optError '}'
7415 | ModuleParKeyword AllKeyword
7416 | ModuleParKeyword AllKeyword ExceptKeyword '{' ModuleParRefList optError '}'
7422 $$ = new AttributeSpec(string($1));
7423 $$->set_location(infile, @$);
7428 /* A.1.6.7 Behaviour statements */
7430 BehaviourStatements: // 543
7433 if ($1.ref_pard) $$ = new Statement(Statement::S_TESTCASE_INSTANCE,
7434 $1.ref_pard, $1.value);
7435 else if($1.derefered_value) {
7436 $$ = new Statement(Statement::S_TESTCASE_INSTANCE_REFD,
7437 $1.derefered_value, $1.ap_list->steal_tis(), $1. value);
7440 else $$ = new Statement(Statement::S_ERROR);
7441 $$->set_location(infile, @$);
7445 $$ = new Statement(Statement::S_UNKNOWN_INSTANCE, $1);
7446 $$->set_location(infile, @$);
7450 $$ = new Statement(Statement::S_UNKNOWN_INVOKED, $1.value, $1.ap_list);
7451 $$->set_location(infile, @$);
7453 | ReturnStatement { $$ = $1; }
7454 | AltConstruct { $$ = $1; }
7455 | InterleavedConstruct { $$ = $1; }
7456 | LabelStatement { $$ = $1; }
7457 | GotoStatement { $$=$1; }
7458 | RepeatStatement { $$ = $1; }
7459 | BreakStatement { $$ = $1; }
7460 | ContinueStatement { $$ = $1; }
7461 | DeactivateStatement { $$ = $1; }
7462 /* | AltstepInstance -- covered by FunctionInstance */
7465 if ($1.ref_pard) $$ = new Statement(Statement::S_ACTIVATE, $1.ref_pard);
7466 else if($1.derefered_value) $$ = new Statement(Statement::S_ACTIVATE_REFD,
7467 $1.derefered_value, new ParsedActualParameters($1.ap_list));
7468 else $$ = new Statement(Statement::S_ERROR);
7469 $$->set_location(infile, @$);
7473 VerdictStatements: // 544
7474 SetLocalVerdict { $$ = $1; }
7478 GetLocalVerdict { $$ = $1; }
7481 SetLocalVerdict: // 546
7482 SetVerdictKeyword '(' Expression optError ',' LogItemList optError ')'
7484 $$=new Statement(Statement::S_SETVERDICT, $3, $6);
7485 $$->set_location(infile, @$);
7487 | SetVerdictKeyword '(' Expression optError ')'
7489 $$=new Statement(Statement::S_SETVERDICT, $3, (LogArguments*)0);
7490 $$->set_location(infile, @$);
7492 | SetVerdictKeyword '(' error ')'
7494 Value *v = new Value(Value::V_ERROR);
7495 v->set_location(infile, @3);
7496 $$ = new Statement(Statement::S_SETVERDICT, v);
7497 $$->set_location(infile, @$);
7501 GetLocalVerdict: // 548
7504 $$=new Value(Value::OPTYPE_GETVERDICT);
7505 $$->set_location(infile, @$);
7509 SUTStatements: // 549
7510 ActionKeyword '(' ')'
7512 $$=new Statement(Statement::S_ACTION, (LogArguments*)0);
7513 $$->set_location(infile, @$);
7515 | ActionKeyword '(' LogItemList optError ')'
7517 $$=new Statement(Statement::S_ACTION, $3);
7518 $$->set_location(infile, @$);
7520 | ActionKeyword '(' error ')'
7522 $$=new Statement(Statement::S_ACTION, new LogArguments());
7523 $$->set_location(infile, @$);
7527 StopExecutionStatement:
7530 $$=new Statement(Statement::S_STOP_EXEC);
7531 $$->set_location(infile, @$);
7535 StopTestcaseStatement:
7536 TestcaseKeyword DotStopKeyword
7538 $$ = new Statement(Statement::S_STOP_TESTCASE, (LogArguments*)0);
7539 $$->set_location(infile, @$);
7541 | TestcaseKeyword DotStopKeyword '(' LogItemList optError ')'
7543 $$ = new Statement(Statement::S_STOP_TESTCASE, $4);
7544 $$->set_location(infile, @$);
7548 /* these deliberately don't have their locations set */
7550 TitanSpecificProfilerKeyword DotStartKeyword
7552 $$ = new Statement(Statement::S_START_PROFILER);
7554 | TitanSpecificProfilerKeyword DotStopKeyword
7556 $$ = new Statement(Statement::S_STOP_PROFILER);
7561 int2enumKeyword '(' optError Expression optError ',' optError Reference optError ')'
7563 Ttcn::Reference* out_ref;
7564 if ($8.is_ref) out_ref = $8.ref;
7566 out_ref = new Ttcn::Reference($8.id);
7567 out_ref->set_location(infile, @8);
7569 $$ = new Statement(Statement::S_INT2ENUM, $4, out_ref);
7570 $$->set_location(infile, @$);
7575 TitanSpecificProfilerKeyword DotRunningKeyword
7577 $$ = new Value(Value::OPTYPE_PROF_RUNNING);
7578 $$->set_location(infile, @$);
7582 ReturnStatement: // 552
7585 $$=new Statement(Statement::S_RETURN, (Template*)0);
7586 $$->set_location(infile, @$);
7588 | ReturnKeyword TemplateBody
7590 $$=new Statement(Statement::S_RETURN, $2);
7591 $$->set_location(infile, @$);
7595 AltConstruct: // 553
7596 AltKeyword '{' AltGuardList optError '}'
7598 $$=new Statement(Statement::S_ALT, $3);
7599 $$->set_location(infile, @$);
7601 | AltKeyword '{' error '}'
7603 $$=new Statement(Statement::S_ALT, new AltGuards());
7604 $$->set_location(infile, @$);
7608 AltGuardList: // 555
7614 | AltGuardList optError AltGuard
7622 GuardStatement { $$ = $1; }
7623 | ElseStatement { $$ = $1; }
7626 GuardStatement: // 556
7627 AltGuardChar AltstepInstance optSemiColon
7629 $$=new AltGuard($1, $2, 0);
7630 $$->set_location(infile, @$);
7632 | AltGuardChar ApplyOp optSemiColon
7634 $$=new AltGuard($1, $2.value, $2.ap_list->steal_tis(), 0);
7635 $$->set_location(infile, @$);
7638 | AltGuardChar AltstepInstance optSemiColon StatementBlock optSemiColon
7640 $$=new AltGuard($1, $2, $4);
7641 $$->set_location(infile, @$);
7643 | AltGuardChar ApplyOp optSemiColon StatementBlock optSemiColon
7645 $$= new AltGuard($1, $2.value, $2.ap_list->steal_tis(), $4);
7646 $$->set_location(infile, @$);
7649 | AltGuardChar GuardOp ';'
7651 $$=new AltGuard($1, $2, new StatementBlock());
7652 $$->set_location(infile, @$);
7654 | AltGuardChar GuardOp optSemiColon StatementBlock optSemiColon
7656 $$=new AltGuard($1, $2, $4);
7657 $$->set_location(infile, @$);
7661 ElseStatement: // 557
7662 '[' ElseKeyword ']' StatementBlock optSemiColon
7664 $$=new AltGuard($4);
7665 $$->set_location(infile, @$);
7669 AltGuardChar: // 558
7671 | '[' BooleanExpression ']' { $$ = $2; }
7675 TimeoutStatement { $$=$1; }
7676 | ReceiveStatement { $$=$1; }
7677 | TriggerStatement { $$=$1; }
7678 | GetCallStatement { $$=$1; }
7679 | CatchStatement { $$=$1; }
7680 | CheckStatement { $$=$1; }
7681 | GetReplyStatement { $$=$1; }
7682 | DoneStatement { $$=$1; }
7683 | KilledStatement { $$ = $1; }
7686 InterleavedConstruct: // 560
7687 InterleavedKeyword '{' InterleavedGuardList optError '}'
7689 $$ = new Statement(Statement::S_INTERLEAVE, $3);
7690 $$->set_location(infile, @$);
7692 | InterleavedKeyword '{' error '}'
7694 $$ = new Statement(Statement::S_INTERLEAVE, new AltGuards());
7695 $$->set_location(infile, @$);
7699 InterleavedGuardList: // 562
7700 optError InterleavedGuardElement
7702 $$ = new AltGuards();
7705 | InterleavedGuardList optError InterleavedGuardElement
7706 { $$ = $1; $$->add_ag($3); }
7709 InterleavedGuardElement: // 563
7710 '[' optError ']' GuardOp ';'
7712 $$ = new AltGuard(0, $4, new StatementBlock());
7713 $$->set_location(infile, @$);
7715 | '[' optError ']' GuardOp optSemiColon StatementBlock optSemiColon
7717 $$ = new AltGuard(0, $4, $6);
7718 $$->set_location(infile, @$);
7722 /* The following were folded into the above rule:
7724 InterleavedGuardElement: // 563
7725 InterleavedGuard InterleavedAction
7728 InterleavedGuard: // 564
7732 InterleavedAction: // 565
7737 LabelStatement: // 566
7738 LabelKeyword IDentifier
7740 $$=new Statement(Statement::S_LABEL, $2);
7741 $$->set_location(infile, @$);
7745 GotoStatement: // 569
7746 GotoKeyword IDentifier
7748 $$=new Statement(Statement::S_GOTO, $2);
7749 $$->set_location(infile, @$);
7751 | GotoKeyword AltKeyword
7753 Location loc(infile, @$);
7754 loc.warning("Obsolete statement `goto alt' was substituted with `repeat'");
7755 $$=new Statement(Statement::S_REPEAT);
7756 $$->set_location(infile, @$);
7760 RepeatStatement: // 571
7763 $$=new Statement(Statement::S_REPEAT);
7764 $$->set_location(infile, @$);
7769 ActivateKeyword '(' AltstepInstance optError ')'
7772 $$.derefered_value = 0;
7775 | ActivateKeyword '(' DereferOp '(' optFunctionActualParList ')' optError ')'
7777 $5->set_location(infile, @4, @6);
7779 $$.derefered_value = $3;
7780 $$.ap_list = $5->steal_tis(); /* XXX perhaps propagate the datatype instead ? */
7783 | ActivateKeyword '(' error ')'
7786 $$.derefered_value = 0;
7792 RefersKeyword '(' FunctionRef ')'
7794 Ttcn::Reference* t_ref = new Ttcn::Reference($3.modid, $3.id);
7795 t_ref->set_location(infile, @3);
7796 $$ = new Value(Value::V_REFER, t_ref);
7797 $$->set_location(infile, @$);
7801 DeactivateStatement: // 574
7804 $$=new Statement(Statement::S_DEACTIVATE, (Value*)0);
7805 $$->set_location(infile, @$);
7807 | DeactivateKeyword '(' Expression optError ')'
7809 $$=new Statement(Statement::S_DEACTIVATE, $3);
7810 $$->set_location(infile, @$);
7812 | DeactivateKeyword '(' error ')'
7814 Value *v = new Value(Value::V_ERROR);
7815 v->set_location(infile, @3);
7816 $$ = new Statement(Statement::S_DEACTIVATE, v);
7817 $$->set_location(infile, @$);
7821 BreakStatement: // 576
7824 $$=new Statement(Statement::S_BREAK);
7825 $$->set_location(infile, @$);
7829 ContinueStatement: // 577
7832 $$=new Statement(Statement::S_CONTINUE);
7833 $$->set_location(infile, @$);
7837 /* A.1.6.8 Basic statements */
7839 BasicStatements: // 578
7842 $$=new Statement(Statement::S_ASSIGNMENT, $1);
7843 $$->set_location(infile, @$);
7845 | LogStatement { $$ = $1; }
7846 | String2TtcnStatement { $$ = $1; }
7849 $$ = new Statement(Statement::S_BLOCK, $1);
7850 $$->set_location(infile, @$);
7852 | TitanSpecificTryKeyword StatementBlock
7854 $$ = new Statement(Statement::S_BLOCK, $2);
7855 $2->set_exception_handling(StatementBlock::EH_TRY);
7856 $$->set_location(infile, @$);
7858 | TitanSpecificCatchKeyword '(' IDentifier ')' StatementBlock
7860 $$ = new Statement(Statement::S_BLOCK, $5);
7861 $5->set_exception_handling(StatementBlock::EH_CATCH);
7862 /* add a newly constructed first statement which will contain the error message,
7863 same as: 'var charstring IDentifier;' */
7864 Type* str_type = new Type(Type::T_CSTR);
7865 str_type->set_location(infile, @3);
7866 Def_Var* str_def = new Def_Var($3, str_type, 0);
7867 str_def->set_location(infile, @3);
7868 Statement* str_stmt = new Statement(Statement::S_DEF, str_def);
7869 str_stmt->set_location(infile, @3);
7870 $5->add_stmt(str_stmt, true);
7871 $$->set_location(infile, @$);
7873 | LoopConstruct { $$ = $1; }
7874 | ConditionalConstruct { $$ = $1; }
7875 | SelectCaseConstruct { $$ = $1; }
7879 '(' optError Expression optError ')' { $$ = $3; }
7882 $$ = new Value(Value::V_ERROR);
7883 $$->set_location(infile, @$);
7885 | '+' Expression %prec UnarySign
7887 $$ = new Value(Value::OPTYPE_UNARYPLUS, $2);
7888 $$->set_location(infile, @$);
7890 | '-' Expression %prec UnarySign
7892 $$ = new Value(Value::OPTYPE_UNARYMINUS, $2);
7893 $$->set_location(infile, @$);
7895 | Expression '*' Expression
7897 $$ = new Value(Value::OPTYPE_MULTIPLY, $1, $3);
7898 $$->set_location(infile, @$);
7900 | Expression '/' Expression
7902 $$ = new Value(Value::OPTYPE_DIVIDE, $1, $3);
7903 $$->set_location(infile, @$);
7905 | Expression ModKeyword Expression
7907 $$ = new Value(Value::OPTYPE_MOD, $1, $3);
7908 $$->set_location(infile, @$);
7910 | Expression RemKeyword Expression
7912 $$ = new Value(Value::OPTYPE_REM, $1, $3);
7913 $$->set_location(infile, @$);
7915 | Expression '+' Expression
7917 $$ = new Value(Value::OPTYPE_ADD, $1, $3);
7918 $$->set_location(infile, @$);
7920 | Expression '-' Expression
7922 $$ = new Value(Value::OPTYPE_SUBTRACT, $1, $3);
7923 $$->set_location(infile, @$);
7925 | Expression '&' Expression
7927 $$ = new Value(Value::OPTYPE_CONCAT, $1, $3);
7928 $$->set_location(infile, @$);
7930 | Not4bKeyword Expression
7932 $$ = new Value(Value::OPTYPE_NOT4B, $2);
7933 $$->set_location(infile, @$);
7935 | Expression And4bKeyword Expression
7937 $$ = new Value(Value::OPTYPE_AND4B, $1, $3);
7938 $$->set_location(infile, @$);
7940 | Expression Xor4bKeyword Expression
7942 $$ = new Value(Value::OPTYPE_XOR4B, $1, $3);
7943 $$->set_location(infile, @$);
7945 | Expression Or4bKeyword Expression
7947 $$ = new Value(Value::OPTYPE_OR4B, $1, $3);
7948 $$->set_location(infile, @$);
7950 | Expression SL Expression
7952 $$ = new Value(Value::OPTYPE_SHL, $1, $3);
7953 $$->set_location(infile, @$);
7955 | Expression SR Expression
7957 $$ = new Value(Value::OPTYPE_SHR, $1, $3);
7958 $$->set_location(infile, @$);
7960 | Expression RL Expression
7962 $$ = new Value(Value::OPTYPE_ROTL, $1, $3);
7963 $$->set_location(infile, @$);
7965 | Expression _RR Expression
7967 $$ = new Value(Value::OPTYPE_ROTR, $1, $3);
7968 $$->set_location(infile, @$);
7970 | Expression '<' Expression
7972 $$ = new Value(Value::OPTYPE_LT, $1, $3);
7973 $$->set_location(infile, @$);
7975 | Expression '>' Expression
7977 $$ = new Value(Value::OPTYPE_GT, $1, $3);
7978 $$->set_location(infile, @$);
7980 | Expression LE Expression
7982 $$ = new Value(Value::OPTYPE_LE, $1, $3);
7983 $$->set_location(infile, @$);
7985 | Expression GE Expression
7987 $$ = new Value(Value::OPTYPE_GE, $1, $3);
7988 $$->set_location(infile, @$);
7990 | Expression EQ Expression
7992 $$ = new Value(Value::OPTYPE_EQ, $1, $3);
7993 $$->set_location(infile, @$);
7995 | Expression NE Expression
7997 $$ = new Value(Value::OPTYPE_NE, $1, $3);
7998 $$->set_location(infile, @$);
8000 | NotKeyword Expression
8002 $$ = new Value(Value::OPTYPE_NOT, $2);
8003 $$->set_location(infile, @$);
8005 | Expression AndKeyword Expression
8007 $$ = new Value(Value::OPTYPE_AND, $1, $3);
8008 $$->set_location(infile, @$);
8010 | Expression XorKeyword Expression
8012 $$ = new Value(Value::OPTYPE_XOR, $1, $3);
8013 $$->set_location(infile, @$);
8015 | Expression OrKeyword Expression
8017 $$ = new Value(Value::OPTYPE_OR, $1, $3);
8018 $$->set_location(infile, @$);
8020 | OpCall { $$ = $1; }
8021 | Value { $$ = $1; }
8022 | CompoundExpression { $$ = $1; }
8025 CompoundExpression: // 565
8026 FieldExpressionList { $$ = $1; }
8027 | ArrayExpressionList { $$ = $1; }
8028 | ArrayExpression { $$ = $1; }
8031 FieldExpressionList: // 581
8032 '{' seqFieldExpressionSpec optError '}'
8034 $$ = new Value(Value::V_SEQ, $2);
8035 $$->set_location(infile, @$);
8039 seqFieldExpressionSpec:
8042 $$ = new NamedValues();
8045 | error FieldExpressionSpec
8047 $$ = new NamedValues();
8050 | seqFieldExpressionSpec optError ',' optError FieldExpressionSpec
8055 | seqFieldExpressionSpec optError ',' error { $$ = $1; }
8058 FieldExpressionSpec: // 582
8059 FieldReference AssignmentChar NotUsedOrExpression
8061 $$ = new NamedValue($1, $3);
8062 $$->set_location(infile, @$);
8066 ArrayExpressionList:
8067 '{' seqArrayExpressionSpec optError '}'
8069 $$ = new Value(Value::V_SEQOF, $2);
8070 $$->set_location(infile, @$);
8074 seqArrayExpressionSpec:
8075 optError ArrayExpressionSpec
8077 // The only place for indexed-list notation.
8078 $$ = new Values(true);
8081 | seqArrayExpressionSpec optError ',' optError ArrayExpressionSpec
8086 | seqArrayExpressionSpec optError ',' error { $$ = $1; }
8089 ArrayExpressionSpec:
8090 ArrayOrBitRef AssignmentChar Expression
8092 $$ = new IndexedValue($1, $3);
8093 $$->set_location(infile, @$);
8097 ArrayExpression: // 583
8100 $$ = new Value(Value::V_SEQOF, new Values);
8101 $$->set_location(infile, @$);
8103 | '{' ArrayElementExpressionList optError '}'
8105 $$ = new Value(Value::V_SEQOF, $2);
8106 $$->set_location(infile, @$);
8110 $$ = new Value(Value::V_ERROR);
8111 $$->set_location(infile, @$);
8115 ArrayElementExpressionList: // 584
8121 | error NotUsedOrExpression
8126 | ArrayElementExpressionList optError ',' optError NotUsedOrExpression
8131 | ArrayElementExpressionList optError ',' error { $$ = $1; }
8134 NotUsedOrExpression: // 585
8135 Expression { $$ = $1; }
8138 $$ = new Value(Value::V_NOTUSED);
8139 $$->set_location(infile, @$);
8143 BooleanExpression: // 588
8144 Expression { $$ = $1; }
8147 $$ = new Value(Value::V_ERROR);
8148 $$->set_location(infile, @$);
8153 VariableRef AssignmentChar TemplateBody
8155 $$ = new Ttcn::Assignment($1, $3);
8156 $$->set_location(infile, @$);
8160 /* This can not be a single CompoundExpression (as opposed to Expression) */
8161 SingleExpression: // 595
8162 '(' SingleExpression ')' { $$ = $2; }
8163 | '(' error SingleExpression ')' { $$ = $3; }
8166 $$ = new Value(Value::V_ERROR);
8167 $$->set_location(infile, @$);
8169 | '+' Expression %prec UnarySign
8171 $$ = new Value(Value::OPTYPE_UNARYPLUS, $2);
8172 $$->set_location(infile, @$);
8174 | '-' Expression %prec UnarySign
8176 $$ = new Value(Value::OPTYPE_UNARYMINUS, $2);
8177 $$->set_location(infile, @$);
8179 | SingleExpression '*' Expression
8181 $$ = new Value(Value::OPTYPE_MULTIPLY, $1, $3);
8182 $$->set_location(infile, @$);
8184 | SingleExpression '/' Expression
8186 $$ = new Value(Value::OPTYPE_DIVIDE, $1, $3);
8187 $$->set_location(infile, @$);
8189 | SingleExpression ModKeyword Expression
8191 $$ = new Value(Value::OPTYPE_MOD, $1, $3);
8192 $$->set_location(infile, @$);
8194 | SingleExpression RemKeyword Expression
8196 $$ = new Value(Value::OPTYPE_REM, $1, $3);
8197 $$->set_location(infile, @$);
8199 | SingleExpression '+' Expression
8201 $$ = new Value(Value::OPTYPE_ADD, $1, $3);
8202 $$->set_location(infile, @$);
8204 | SingleExpression '-' Expression
8206 $$ = new Value(Value::OPTYPE_SUBTRACT, $1, $3);
8207 $$->set_location(infile, @$);
8209 | SingleExpression '&' Expression
8211 $$ = new Value(Value::OPTYPE_CONCAT, $1, $3);
8212 $$->set_location(infile, @$);
8214 | Not4bKeyword Expression
8216 $$ = new Value(Value::OPTYPE_NOT4B, $2);
8217 $$->set_location(infile, @$);
8219 | SingleExpression And4bKeyword Expression
8221 $$ = new Value(Value::OPTYPE_AND4B, $1, $3);
8222 $$->set_location(infile, @$);
8224 | SingleExpression Xor4bKeyword Expression
8226 $$ = new Value(Value::OPTYPE_XOR4B, $1, $3);
8227 $$->set_location(infile, @$);
8229 | SingleExpression Or4bKeyword Expression
8231 $$ = new Value(Value::OPTYPE_OR4B, $1, $3);
8232 $$->set_location(infile, @$);
8234 | SingleExpression SL Expression
8236 $$ = new Value(Value::OPTYPE_SHL, $1, $3);
8237 $$->set_location(infile, @$);
8239 | SingleExpression SR Expression
8241 $$ = new Value(Value::OPTYPE_SHR, $1, $3);
8242 $$->set_location(infile, @$);
8244 | SingleExpression RL Expression
8246 $$ = new Value(Value::OPTYPE_ROTL, $1, $3);
8247 $$->set_location(infile, @$);
8249 | SingleExpression _RR Expression
8251 $$ = new Value(Value::OPTYPE_ROTR, $1, $3);
8252 $$->set_location(infile, @$);
8254 | SingleExpression '<' Expression
8256 $$ = new Value(Value::OPTYPE_LT, $1, $3);
8257 $$->set_location(infile, @$);
8259 | SingleExpression '>' Expression
8261 $$ = new Value(Value::OPTYPE_GT, $1, $3);
8262 $$->set_location(infile, @$);
8264 | SingleExpression LE Expression
8266 $$ = new Value(Value::OPTYPE_LE, $1, $3);
8267 $$->set_location(infile, @$);
8269 | SingleExpression GE Expression
8271 $$ = new Value(Value::OPTYPE_GE, $1, $3);
8272 $$->set_location(infile, @$);
8274 | SingleExpression EQ Expression
8276 $$ = new Value(Value::OPTYPE_EQ, $1, $3);
8277 $$->set_location(infile, @$);
8279 | SingleExpression NE Expression
8281 $$ = new Value(Value::OPTYPE_NE, $1, $3);
8282 $$->set_location(infile, @$);
8284 | NotKeyword Expression
8286 $$ = new Value(Value::OPTYPE_NOT, $2);
8287 $$->set_location(infile, @$);
8289 | SingleExpression AndKeyword Expression
8291 $$ = new Value(Value::OPTYPE_AND, $1, $3);
8292 $$->set_location(infile, @$);
8294 | SingleExpression XorKeyword Expression
8296 $$ = new Value(Value::OPTYPE_XOR, $1, $3);
8297 $$->set_location(infile, @$);
8299 | SingleExpression OrKeyword Expression
8301 $$ = new Value(Value::OPTYPE_OR, $1, $3);
8302 $$->set_location(infile, @$);
8304 | OpCall { $$ = $1; }
8305 | Value { $$ = $1; }
8308 optExtendedFieldReference:
8309 // perhaps this should be called seqExtendedFieldReference,
8310 // but the convention appears to be that seq... can not be empty
8316 | optExtendedFieldReference FieldOrArrayReference
8318 $$.nElements = $1.nElements + 1;
8319 $$.elements = (FieldOrArrayRef**)
8320 Realloc($1.elements, ($$.nElements) * sizeof(*$$.elements));
8321 $$.elements[$1.nElements] = $2;
8325 FieldOrArrayReference:
8328 $$ = new FieldOrArrayRef($2);
8329 $$->set_location(infile, @$);
8331 | ArrayOrBitRefOrDash { $$ = $1; }
8335 PredefOrIdentifier { $$ = $1; }
8336 | IDentifier /* maybe PredefOrIdentifier here too */ TypeActualParList
8338 Location loc(infile, @$);
8339 loc.error("Reference to a parameterized field of type `anytype' is "
8340 "not currently supported");
8346 ConfigurationOps { $$ = $1; }
8347 | VerdictOps { $$ = $1; }
8348 | TimerOps { $$ = $1; }
8351 if ($1.ref_pard) $$ = new Value(Value::OPTYPE_EXECUTE, $1.ref_pard,
8353 else if($1.derefered_value)
8354 $$ = new Value(Value::OPTYPE_EXECUTE_REFD, $1.derefered_value, $1.ap_list,
8356 else $$ = new Value(Value::V_ERROR);
8357 $$->set_location(infile, @$);
8359 | FunctionInstance optExtendedFieldReference
8361 for (size_t i = 0; i < $2.nElements; i++) $1->add($2.elements[i]);
8363 $$ = new Value(Value::V_REFD, $1);
8364 $$->set_location(infile, @$);
8368 $$ = new Value(Value::V_INVOKE, $1.value, $1.ap_list);
8369 $$->set_location(infile, @$);
8371 | TemplateOps { $$ = $1; }
8372 | PredefinedOps { $$ = $1; }
8373 | ReferOp { $$ = $1; }
8376 if ($1.ref_pard) $$ = new Value(Value::OPTYPE_ACTIVATE, $1.ref_pard);
8377 else if($1.derefered_value) $$ = new Value(Value::OPTYPE_ACTIVATE_REFD,
8378 $1.derefered_value, new ParsedActualParameters($1.ap_list));
8379 else $$ = new Value(Value::V_ERROR);
8380 $$->set_location(infile, @$);
8382 | ProfilerRunningOp { $$ = $1; }
8386 PredefinedOpKeyword1 '(' optError Expression optError ')'
8388 $$ = new Value($1, $4);
8389 $$->set_location(infile, @$);
8391 | PredefinedOpKeyword1 '(' error ')'
8393 Value *v1 = new Value(Value::V_ERROR);
8394 v1->set_location(infile, @3);
8395 $$ = new Value($1, v1);
8396 $$->set_location(infile, @$);
8398 | PredefinedOpKeyword2 '(' optError Expression optError ',' optError
8399 Expression optError ')'
8401 $$ = new Value($1, $4, $8);
8402 $$->set_location(infile, @$);
8404 | PredefinedOpKeyword2 '(' error ')'
8406 Value *v1 = new Value(Value::V_ERROR);
8407 v1->set_location(infile, @3);
8408 Value *v2 = new Value(Value::V_ERROR);
8409 v2->set_location(infile, @3);
8410 $$ = new Value($1, v1, v2);
8411 $$->set_location(infile, @$);
8413 | PredefinedOpKeyword3 '(' optError Expression optError ',' optError
8414 Expression optError ')'
8416 $$ = new Value($1, $4, $8);
8417 $$->set_location(infile, @$);
8419 | PredefinedOpKeyword3 '(' optError Expression optError ')'
8421 $$ = new Value($1, $4, (Common::Value*)NULL);
8422 $$->set_location(infile, @$);
8424 | PredefinedOpKeyword3 '(' error ')'
8426 Value *v1 = new Value(Value::V_ERROR);
8427 v1->set_location(infile, @3);
8428 Value *v2 = new Value(Value::V_ERROR);
8429 v2->set_location(infile, @3);
8430 $$ = new Value($1, v1, v2);
8431 $$->set_location(infile, @$);
8433 | decompKeyword '(' optError Expression optError ',' optError
8434 Expression optError ',' optError Expression optError ')'
8436 $$ = new Value(Value::OPTYPE_DECOMP, $4, $8, $12);
8437 $$->set_location(infile, @$);
8439 | decompKeyword '(' error ')'
8441 Value *v1 = new Value(Value::V_ERROR);
8442 v1->set_location(infile, @3);
8443 Value *v2 = new Value(Value::V_ERROR);
8444 v2->set_location(infile, @3);
8445 Value *v3 = new Value(Value::V_ERROR);
8446 v3->set_location(infile, @3);
8447 $$ = new Value(Value::OPTYPE_DECOMP, v1, v2, v3);
8448 $$->set_location(infile, @$);
8450 | regexpKeyword '(' optError TemplateInstance optError ',' optError
8451 TemplateInstance optError ',' optError Expression optError ')'
8453 $$ = new Value(Value::OPTYPE_REGEXP, $4, $8, $12);
8454 $$->set_location(infile, @$);
8456 | regexpKeyword '(' error ')'
8458 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8459 t1->set_location(infile, @3);
8460 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8461 ti1->set_location(infile, @3);
8462 Template *t2 = new Template(Template::TEMPLATE_ERROR);
8463 t2->set_location(infile, @3);
8464 TemplateInstance *ti2 = new TemplateInstance(0, 0, t2);
8465 ti2->set_location(infile, @3);
8466 Value *v3 = new Value(Value::V_ERROR);
8467 v3->set_location(infile, @3);
8468 $$ = new Value(Value::OPTYPE_REGEXP, ti1, ti2, v3);
8469 $$->set_location(infile, @$);
8471 | encvalueKeyword '(' optError TemplateInstance optError ')'
8473 $$ = new Value(Value::OPTYPE_ENCODE, $4);
8474 $$->set_location(infile, @$);
8476 | encvalueKeyword '(' error ')'
8478 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8479 t1->set_location(infile, @3);
8480 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8481 ti1->set_location(infile, @3);
8482 $$ = new Value(Value::OPTYPE_ENCODE, ti1);
8483 $$->set_location(infile, @$);
8485 | substrKeyword '(' optError TemplateInstance optError ',' optError
8486 Expression optError ',' optError Expression optError ')'
8488 $$ = new Value(Value::OPTYPE_SUBSTR, $4, $8, $12);
8489 $$->set_location(infile, @$);
8491 | substrKeyword '(' error ')'
8493 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8494 t1->set_location(infile, @3);
8495 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8496 ti1->set_location(infile, @3);
8497 Value *v2 = new Value(Value::V_ERROR);
8498 v2->set_location(infile, @3);
8499 Value *v3 = new Value(Value::V_ERROR);
8500 v3->set_location(infile, @3);
8501 $$ = new Value(Value::OPTYPE_SUBSTR, ti1, v2, v3);
8502 $$->set_location(infile, @$);
8504 | replaceKeyword '(' optError TemplateInstance optError ',' optError
8505 Expression optError ',' optError Expression optError ',' optError
8506 TemplateInstance optError ')'
8508 $$ = new Value(Value::OPTYPE_REPLACE, $4, $8, $12, $16);
8509 $$->set_location(infile, @$);
8511 | replaceKeyword '(' error ')'
8513 Template *t1 = new Template(Template::TEMPLATE_ERROR);
8514 t1->set_location(infile, @3);
8515 TemplateInstance *ti1 = new TemplateInstance(0, 0, t1);
8516 ti1->set_location(infile, @3);
8517 Value *v2 = new Value(Value::V_ERROR);
8518 v2->set_location(infile, @3);
8519 Value *v3 = new Value(Value::V_ERROR);
8520 v3->set_location(infile, @3);
8521 Template *t4 = new Template(Template::TEMPLATE_ERROR);
8522 t4->set_location(infile, @3);
8523 TemplateInstance *ti4 = new TemplateInstance(0, 0, t4);
8524 ti4->set_location(infile, @3);
8525 $$ = new Value(Value::OPTYPE_REPLACE, ti1, v2, v3, ti4);
8526 $$->set_location(infile, @$);
8528 | decvalueKeyword '(' optError DecValueArg optError ',' optError DecValueArg optError ')'
8530 $$ = new Value(Value::OPTYPE_DECODE, $4, $8);
8531 $$->set_location(infile, @$);
8533 | decvalueKeyword '(' error ')'
8535 /*Value *v1 = new Value(Value::V_ERROR);
8536 v1->set_location(infile, @3);
8537 TemplateInstance *t2 = new TemplateInstance(Type::T_ERROR);*/
8538 $$ = new Value(Value::V_ERROR);
8539 $$->set_location(infile, @$);
8541 | isvalueKeyword '(' optError TemplateInstance optError ')'
8543 $$ = new Value(Value::OPTYPE_ISVALUE, $4);
8544 $$->set_location(infile, @$);
8546 | isvalueKeyword '(' error ')'
8548 $$ = new Value(Value::V_ERROR);
8549 $$->set_location(infile, @$);
8551 | isboundKeyword '(' optError TemplateInstance optError ')'
8553 $$ = new Value(Value::OPTYPE_ISBOUND, $4);
8554 $$->set_location(infile, @$);
8556 | isboundKeyword '(' error ')'
8558 $$ = new Value(Value::V_ERROR);
8559 $$->set_location(infile, @$);
8561 | ischosenKeyword '(' optError IschosenArg optError ')'
8563 $$ = new Value(Value::OPTYPE_ISCHOSEN, $4.ref, $4.id);
8564 $$->set_location(infile, @$);
8566 | ischosenKeyword '(' error ')'
8568 $$ = new Value(Value::V_ERROR);
8569 $$->set_location(infile, @$);
8571 | ispresentKeyword '(' optError TemplateInstance optError ')'
8573 $$ = new Value(Value::OPTYPE_ISPRESENT, $4);
8574 $$->set_location(infile, @$);
8576 | ispresentKeyword '(' error ')'
8578 $$ = new Value(Value::V_ERROR);
8579 $$->set_location(infile, @$);
8581 | lengthofKeyword '(' optError TemplateInstance optError ')'
8583 $$ = new Value(Value::OPTYPE_LENGTHOF, $4);
8584 $$->set_location(infile, @$);
8586 | lengthofKeyword '(' error ')'
8588 $$ = new Value(Value::V_ERROR);
8589 $$->set_location(infile, @$);
8591 | rndKeyword '(' ')'
8593 $$ = new Value(Value::OPTYPE_RND);
8594 $$->set_location(infile, @$);
8596 | rndKeyword '(' optError Expression optError ')'
8598 $$ = new Value(Value::OPTYPE_RNDWITHVAL, $4);
8599 $$->set_location(infile, @$);
8601 | rndKeyword '(' error ')'
8603 Value *v = new Value(Value::V_ERROR);
8604 v->set_location(infile, @3);
8605 $$ = new Value(Value::OPTYPE_RNDWITHVAL, v);
8606 $$->set_location(infile, @$);
8608 | sizeofKeyword '(' optError TemplateInstance optError ')'
8610 $$ = new Value(Value::OPTYPE_SIZEOF, $4);
8611 $$->set_location(infile, @$);
8613 | sizeofKeyword '(' error ')'
8615 $$ = new Value(Value::V_ERROR);
8616 $$->set_location(infile, @$);
8618 | log2strKeyword '(' ')'
8620 $$ = new Value(Value::OPTYPE_LOG2STR, new LogArguments());
8621 $$->set_location(infile, @$);
8623 | log2strKeyword '(' LogItemList optError ')'
8625 $$ = new Value(Value::OPTYPE_LOG2STR, $3);
8626 $$->set_location(infile, @$);
8628 | log2strKeyword '(' error ')'
8630 $$ = new Value(Value::OPTYPE_LOG2STR, new LogArguments());
8631 $$->set_location(infile, @$);
8633 | testcasenameKeyword '(' ')'
8635 $$ = new Value(Value::OPTYPE_TESTCASENAME);
8636 $$->set_location(infile, @$);
8638 | ttcn2stringKeyword '(' optError TemplateInstance optError ')'
8640 $$ = new Value(Value::OPTYPE_TTCN2STRING, $4);
8641 $$->set_location(infile, @$);
8643 | ttcn2stringKeyword '(' error ')'
8645 $$ = new Value(Value::V_ERROR);
8646 $$->set_location(infile, @$);
8653 if ($1.is_ref) $$ = $1.ref;
8655 $$ = new Ttcn::Reference($1.id);
8656 $$->set_location(infile, @$);
8659 | FunctionInstance { $$ = $1; }
8663 IDentifier { $$ = $1; }
8664 | PredefinedType /* shall not be "anytype" */
8666 // Construct an identifier "on the fly" ($1 here is just a typetype_t)
8667 const char* builtin_typename = Type::get_typename_builtin($1);
8668 if (0 == builtin_typename) FATAL_ERROR("Unexpected type %d", $1);
8669 const string& at_field = anytype_field(string(builtin_typename));
8671 $$ = new Identifier(Identifier::ID_TTCN, at_field);
8675 $$ = new Identifier(Identifier::ID_NAME, string("NULL"));
8678 IschosenArg: /* see also Reference... */
8679 IDentifier '.' PredefOrIdentifier
8681 $$.ref = new Ttcn::Reference($1);
8682 $$.ref->set_location(infile, @1);
8685 | IDentifier '.' PredefOrIdentifier optExtendedFieldReference '.' PredefOrIdentifier
8687 $$.ref = new Ttcn::Reference($1);
8688 FieldOrArrayRef *fieldref = new FieldOrArrayRef($3);
8689 fieldref->set_location(infile, @3);
8690 $$.ref->add(fieldref);
8691 for(size_t i=0; i<$4.nElements; i++) $$.ref->add($4.elements[i]);
8693 $$.ref->set_location(infile, @1, @4);
8696 | IDentifier ArrayOrBitRef optExtendedFieldReference '.' PredefOrIdentifier
8698 $$.ref = new Ttcn::Reference($1);
8700 for(size_t i=0; i<$3.nElements; i++) $$.ref->add($3.elements[i]);
8702 $$.ref->set_location(infile, @1, @3);
8705 | IDentifier '.' ObjectIdentifierValue '.' IDentifier optExtendedFieldReference
8706 '.' PredefOrIdentifier
8708 $$.ref = new Ttcn::Reference($1, $5);
8710 for(size_t i=0; i<$6.nElements; i++) $$.ref->add($6.elements[i]);
8712 $$.ref->set_location(infile, @1, @6);
8717 PredefinedOpKeyword1:
8718 bit2hexKeyword { $$ = Value::OPTYPE_BIT2HEX; }
8719 | bit2intKeyword { $$ = Value::OPTYPE_BIT2INT; }
8720 | bit2octKeyword { $$ = Value::OPTYPE_BIT2OCT; }
8721 | bit2strKeyword { $$ = Value::OPTYPE_BIT2STR; }
8722 | char2intKeyword { $$ = Value::OPTYPE_CHAR2INT; }
8723 | char2octKeyword { $$ = Value::OPTYPE_CHAR2OCT; }
8724 | float2intKeyword { $$ = Value::OPTYPE_FLOAT2INT; }
8725 | float2strKeyword { $$ = Value::OPTYPE_FLOAT2STR; }
8726 | hex2bitKeyword { $$ = Value::OPTYPE_HEX2BIT; }
8727 | hex2intKeyword { $$ = Value::OPTYPE_HEX2INT; }
8728 | hex2octKeyword { $$ = Value::OPTYPE_HEX2OCT; }
8729 | hex2strKeyword { $$ = Value::OPTYPE_HEX2STR; }
8730 | int2charKeyword { $$ = Value::OPTYPE_INT2CHAR; }
8731 | int2floatKeyword { $$ = Value::OPTYPE_INT2FLOAT; }
8732 | int2strKeyword { $$ = Value::OPTYPE_INT2STR; }
8733 | int2unicharKeyword { $$ = Value::OPTYPE_INT2UNICHAR; }
8734 | oct2bitKeyword { $$ = Value::OPTYPE_OCT2BIT; }
8735 | oct2charKeyword { $$ = Value::OPTYPE_OCT2CHAR; }
8736 | oct2hexKeyword { $$ = Value::OPTYPE_OCT2HEX; }
8737 | oct2intKeyword { $$ = Value::OPTYPE_OCT2INT; }
8738 | oct2strKeyword { $$ = Value::OPTYPE_OCT2STR; }
8739 | str2bitKeyword { $$ = Value::OPTYPE_STR2BIT; }
8740 | str2floatKeyword { $$ = Value::OPTYPE_STR2FLOAT; }
8741 | str2hexKeyword { $$ = Value::OPTYPE_STR2HEX; }
8742 | str2intKeyword { $$ = Value::OPTYPE_STR2INT; }
8743 | str2octKeyword { $$ = Value::OPTYPE_STR2OCT; }
8744 | unichar2intKeyword { $$ = Value::OPTYPE_UNICHAR2INT; }
8745 | unichar2charKeyword { $$ = Value::OPTYPE_UNICHAR2CHAR; }
8746 | enum2intKeyword { $$ = Value::OPTYPE_ENUM2INT; }
8747 | remove_bomKeyWord { $$ = Value::OPTYPE_REMOVE_BOM; }
8748 | get_stringencodingKeyWord { $$ = Value::OPTYPE_GET_STRINGENCODING; }
8749 | decode_base64KeyWord { $$ = Value::OPTYPE_DECODE_BASE64; }
8752 PredefinedOpKeyword2:
8753 int2bitKeyword { $$ = Value::OPTYPE_INT2BIT; }
8754 | int2hexKeyword { $$ = Value::OPTYPE_INT2HEX; }
8755 | int2octKeyword { $$ = Value::OPTYPE_INT2OCT; }
8758 PredefinedOpKeyword3:
8759 unichar2octKeyword { $$ = Value::OPTYPE_UNICHAR2OCT; }
8760 | oct2unicharKeyword { $$ = Value::OPTYPE_OCT2UNICHAR; }
8761 | encode_base64KeyWord { $$ = Value::OPTYPE_ENCODE_BASE64; }
8764 String2TtcnStatement:
8765 string2ttcnKeyword '(' optError Expression optError ',' optError Reference optError ')'
8767 Ttcn::Reference* out_ref;
8768 if ($8.is_ref) out_ref = $8.ref;
8770 out_ref = new Ttcn::Reference($8.id);
8771 out_ref->set_location(infile, @8);
8773 $$ = new Statement(Statement::S_STRING2TTCN, $4, out_ref);
8774 $$->set_location(infile, @$);
8778 LogStatement: // 619
8781 $$=new Statement(Statement::S_LOG, (LogArguments*)0);
8782 $$->set_location(infile, @$);
8784 | LogKeyword '(' LogItemList optError ')'
8786 $$=new Statement(Statement::S_LOG, $3);
8787 $$->set_location(infile, @$);
8789 | LogKeyword '(' error ')'
8791 $$=new Statement(Statement::S_LOG, new LogArguments());
8792 $$->set_location(infile, @$);
8799 $$ = new LogArguments();
8802 | LogItemList optError ',' optError LogItem
8807 | LogItemList optError ',' error { $$ = $1; }
8813 $$ = new LogArgument($1);
8814 $$->set_location(infile, @$);
8818 LoopConstruct: // 622
8819 ForStatement { $$ = $1; }
8820 | WhileStatement { $$ = $1; }
8821 | DoWhileStatement { $$ = $1; }
8824 ForStatement: // 623
8825 ForKeyword '(' Initial ';' Final ';' Step optError ')'
8828 $$ = new Statement(Statement::S_FOR, $3.defs, $3.ass, $5, $7, $10);
8829 $$->set_location(infile, @$);
8836 $$.defs = new Definitions;
8837 for (size_t i = 0; i < $1.nElements; i++) $$.defs->add_ass($1.elements[i]);
8848 $$.defs = new Definitions;
8854 BooleanExpression { $$ = $1; }
8858 Assignment { $$ = $1; }
8859 /** \todo for-ban nem lehet null a step
8860 | error { $$=NULL; }
8864 WhileStatement: // 628
8865 WhileKeyword '(' BooleanExpression ')' StatementBlock
8867 $$=new Statement(Statement::S_WHILE, $3, $5);
8868 $$->set_location(infile, @$);
8872 DoWhileStatement: // 630
8873 DoKeyword StatementBlock
8874 WhileKeyword '(' BooleanExpression ')'
8876 $$=new Statement(Statement::S_DOWHILE, $5, $2);
8877 $$->set_location(infile, @$);
8881 ConditionalConstruct: // 632
8882 IfKeyword '(' BooleanExpression ')'
8884 seqElseIfClause optElseClause
8886 IfClause *ic=new IfClause($3, $5);
8887 ic->set_location(infile, @1, @5);
8888 $6->add_front_ic(ic);
8889 $$=new Statement(Statement::S_IF, $6, $7,
8890 $7 ? new Location(infile, @7) : 0);
8891 $$->set_location(infile, @$);
8896 /* empty */ { $$=new IfClauses(); }
8897 | seqElseIfClause ElseIfClause
8904 ElseIfClause: // 634
8905 ElseKeyword IfKeyword '(' BooleanExpression ')' StatementBlock
8907 $$=new IfClause($4, $6);
8908 $$->set_location(infile, @$);
8912 optElseClause: // [636]
8913 /* empty */ { $$=0; }
8914 | ElseKeyword StatementBlock { $$=$2; }
8917 SelectCaseConstruct: // 637
8918 SelectKeyword '(' Expression optError ')' SelectCaseBody
8920 $$=new Statement(Statement::S_SELECT, $3, $6);
8921 $$->set_location(infile, @$);
8923 | SelectKeyword '(' error ')' SelectCaseBody
8925 Value *v = new Value(Value::V_ERROR);
8926 v->set_location(infile, @3);
8927 $$=new Statement(Statement::S_SELECT, v, $5);
8928 $$->set_location(infile, @$);
8932 SelectCaseBody: // 639
8933 '{' seqSelectCase optError '}' {$$=$2;}
8934 | '{' error '}' {$$=new SelectCases;}
8943 | seqSelectCase optError SelectCase
8951 CaseKeyword '(' seqTemplateInstance optError ')' StatementBlock optSemiColon
8953 $3->set_location(infile, @2, @5);
8954 $$=new SelectCase($3, $6);
8955 $$->set_location(infile, @$);
8957 | CaseKeyword '(' error ')' StatementBlock optSemiColon
8959 TemplateInstances *tis = new TemplateInstances;
8960 tis->set_location(infile, @2, @4);
8961 $$ = new SelectCase(tis, $5);
8962 $$->set_location(infile, @$);
8964 | CaseKeyword ElseKeyword StatementBlock optSemiColon
8966 $$=new SelectCase(0, $3);
8967 $$->set_location(infile, @$);
8971 seqTemplateInstance:
8972 optError TemplateInstance
8974 $$ = new TemplateInstances;
8977 | seqTemplateInstance optError ',' optError TemplateInstance
8982 | seqTemplateInstance optError ',' error { $$ = $1; }
8985 /* A.1.6.9 Miscellaneous productions */
8987 optSemiColon: // [645]
8992 /* A.1 ASN.1 support, from ES 201 873-7 V3.1.1 (2005-06) */
8994 optDefinitiveIdentifier:
8996 | DefinitiveIdentifier
8999 DefinitiveIdentifier:
9000 '.' ObjectIdentifierKeyword '{' DefinitiveObjIdComponentList optError '}'
9001 | '.' ObjectIdentifierKeyword '{' error '}'
9004 DefinitiveObjIdComponentList:
9005 optError DefinitiveObjIdComponent
9006 | DefinitiveObjIdComponentList optError DefinitiveObjIdComponent
9009 DefinitiveObjIdComponent:
9011 | DefinitiveNumberForm
9012 | DefinitiveNameAndNumberForm
9015 DefinitiveNumberForm:
9016 Number { delete $1; }
9019 DefinitiveNameAndNumberForm:
9020 IDentifier '(' Number optError ')' { delete $1; delete $3; }
9021 | IDentifier '(' error ')' { delete $1; }
9024 ObjectIdentifierValue:
9025 ObjectIdentifierKeyword '{' ObjIdComponentList optError '}'
9028 $$->set_location(infile, @$);
9030 | ObjectIdentifierKeyword '{' error '}'
9032 $$ = new Value(Value::V_ERROR);
9033 $$->set_location(infile, @$);
9038 optError ObjIdComponent
9040 $$ = new Value(Value::V_OID);
9041 $$->add_oid_comp($2);
9043 | ObjIdComponentList optError ObjIdComponent
9046 $$->add_oid_comp($3);
9051 /* NameForm -- covered by NumberForm (as ReferencedValue) */
9052 NumberForm { $$ = $1; }
9053 | NameAndNumberForm { $$ = $1; }
9059 Value *v = new Value(Value::V_INT, $1);
9060 v->set_location(infile, @1);
9061 $$ = new OID_comp(0, v);
9062 $$->set_location(infile, @$);
9067 /* it can be only a referenced value */
9068 Value *v = new Value(Value::V_REFD, $1.ref);
9069 v->set_location(infile, @1);
9070 $$ = new OID_comp(v);
9072 /* it can be either a name form or a referenced value */
9073 $$ = new OID_comp($1.id, 0);
9075 $$->set_location(infile, @$);
9080 IDentifier '(' Number optError ')'
9082 Value *v = new Value(Value::V_INT, $3);
9083 v->set_location(infile, @3);
9084 $$ = new OID_comp($1, v);
9085 $$->set_location(infile, @$);
9087 | IDentifier '(' ReferencedValue optError ')'
9089 $$ = new OID_comp($1, $3);
9090 $$->set_location(infile, @$);
9092 | IDentifier '(' error ')'
9094 Value *v = new Value(Value::V_ERROR);
9095 v->set_location(infile, @3);
9096 $$ = new OID_comp($1, v);
9097 $$->set_location(infile, @$);
9102 IDentifier { delete $1; }
9105 /* Rules for error recovery */
9114 | optErrorBlock ErrorBlock optError
9119 | '{' optError ErrorBlock optError '}'
9124 static void ttcn3_error(const char *str)
9126 Location loc(infile, ttcn3_lloc);
9128 // the most recently parsed token is known
9129 loc.error("at or before token `%s': %s", ttcn3_text, str);
9131 // the most recently parsed token is unknown
9132 loc.error("%s", str);
9136 int ttcn3_parse_file(const char* filename, boolean generate_code)
9138 anytype_access = false;
9139 ttcn3_in = fopen(filename, "r");
9140 if (ttcn3_in == NULL) {
9141 ERROR("Cannot open input file `%s': %s", filename, strerror(errno));
9147 is_erroneous_parsed = false;
9148 NOTIFY("Parsing TTCN-3 module `%s'...", filename);
9150 int retval = ttcn3_parse();
9152 free_ttcn3_lex(); // does fclose(ttcn3_in);
9154 if (act_ttcn3_module) {
9155 act_ttcn3_module->set_location(filename);
9156 set_md5_checksum(act_ttcn3_module);
9157 if (generate_code) act_ttcn3_module->set_gen_code();
9158 modules->add_mod(act_ttcn3_module);
9159 act_ttcn3_module = 0;
9167 Ttcn::ErroneousAttributeSpec* ttcn3_parse_erroneous_attr_spec_string(
9168 const char* p_str, const Common::Location& str_loc)
9170 is_erroneous_parsed = true;
9171 act_ttcn3_erroneous_attr_spec = NULL;
9172 string titan_err_str("$#&&&(#TITANERRONEOUS$#&&^#% ");
9173 int hack_str_len = (int)titan_err_str.size();
9174 string *parsed_string = parse_charstring_value(p_str, str_loc);
9175 titan_err_str += *parsed_string;
9176 delete parsed_string;
9177 init_erroneous_lex(str_loc.get_filename(), str_loc.get_first_line(), str_loc.get_first_column()-hack_str_len+1);
9178 yy_buffer_state *flex_buffer = ttcn3__scan_string(titan_err_str.c_str());
9179 if (flex_buffer == NULL) {
9180 ERROR("Flex buffer creation failed.");
9184 ttcn3_lex_destroy();
9185 free_dot_flag_stuff();
9187 return act_ttcn3_erroneous_attr_spec;
9191 static void yyprint(FILE *file, int type, const YYSTYPE& value)
9195 fprintf(file, "``%s''", value.id->get_name().c_str());
9198 fprintf(file, "%s", value.int_val->t_str().c_str());
9201 fprintf(file, "%f", value.float_val);
9206 case BitStringMatch:
9207 case HexStringMatch:
9208 case OctetStringMatch:
9209 fprintf(file, "``%s''", value.string_val->c_str());
9212 fprintf(file, "``%s''", value.str);