| 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 */ |
| 9 | |
| 10 | /* BNF compliance: v3.2.1 with extensions */ |
| 11 | |
| 12 | %{ |
| 13 | |
| 14 | /* C declarations */ |
| 15 | |
| 16 | #include <stdio.h> |
| 17 | #include <stdlib.h> |
| 18 | #include <string.h> |
| 19 | #include <errno.h> |
| 20 | |
| 21 | #include "../../common/dbgnew.hh" |
| 22 | #include "../../common/memory.h" |
| 23 | |
| 24 | #include "../datatypes.h" |
| 25 | #include "Attributes.hh" |
| 26 | #include "../main.hh" |
| 27 | #include "compiler.h" |
| 28 | |
| 29 | #include "../Identifier.hh" |
| 30 | #include "Templatestuff.hh" |
| 31 | #include "AST_ttcn3.hh" |
| 32 | #include "../Type.hh" |
| 33 | #include "../CompType.hh" |
| 34 | #include "../CompField.hh" |
| 35 | #include "../EnumItem.hh" |
| 36 | #include "../SigParam.hh" |
| 37 | |
| 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" |
| 48 | |
| 49 | using namespace Ttcn; |
| 50 | using namespace Common; |
| 51 | |
| 52 | const char *infile = NULL; |
| 53 | |
| 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; |
| 61 | |
| 62 | #ifndef NDEBUG |
| 63 | |
| 64 | union YYSTYPE; |
| 65 | static void yyprint(FILE *file, int type, const YYSTYPE& value); |
| 66 | #define YYPRINT(f,t,v) yyprint(f,t,v) |
| 67 | |
| 68 | #endif |
| 69 | |
| 70 | extern Modules *modules; |
| 71 | |
| 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); |
| 78 | |
| 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(); |
| 84 | |
| 85 | extern string *parse_charstring_value(const char *str, const Location& loc); |
| 86 | extern PatternString* parse_pattern(const char *str, const Location& loc); |
| 87 | |
| 88 | static const string anyname("anytype"); |
| 89 | |
| 90 | /* Various C macros */ |
| 91 | |
| 92 | #define YYERROR_VERBOSE |
| 93 | |
| 94 | |
| 95 | %} |
| 96 | |
| 97 | /* Bison declarations */ |
| 98 | |
| 99 | /********************************************************************* |
| 100 | * The union-type |
| 101 | *********************************************************************/ |
| 102 | |
| 103 | %union { |
| 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; |
| 110 | |
| 111 | int_val_t *int_val; /* integer value */ |
| 112 | Real float_val; /* float value */ |
| 113 | Identifier *id; |
| 114 | string *string_val; |
| 115 | ustring *ustring_val; |
| 116 | |
| 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; |
| 123 | |
| 124 | AltGuard *altguard; |
| 125 | AltGuards *altguards; |
| 126 | ArrayDimension *arraydimension; |
| 127 | AttributeSpec *attributespec; |
| 128 | CompField *compfield; |
| 129 | CompFieldMap *compfieldmap; |
| 130 | Def_Type *deftype; |
| 131 | Def_Timer *deftimer; |
| 132 | Definition *definition; |
| 133 | Definitions *defs; |
| 134 | EnumItem *enumitem; |
| 135 | EnumItems *enumitems; |
| 136 | FieldOrArrayRef *fieldorarrayref; |
| 137 | FormalPar *formalpar; |
| 138 | FormalParList *formalparlist; |
| 139 | Group *group; |
| 140 | FriendMod *friendMod; |
| 141 | IfClause *ifclause; |
| 142 | IfClauses *ifclauses; |
| 143 | ImpMod *impmod; |
| 144 | LengthRestriction *lenrestr; |
| 145 | LogArgument *logarg; |
| 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; |
| 155 | OID_comp *oidcomp; |
| 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; |
| 169 | Statement *stmt; |
| 170 | StatementBlock *statementblock; |
| 171 | SubTypeParse *subtypeparse; |
| 172 | Template *templ; |
| 173 | TemplateInstance *templinst; |
| 174 | TemplateInstances *templinsts; |
| 175 | Templates *templs; |
| 176 | Ttcn::Assignment *ass; |
| 177 | Ttcn::Ref_base *refbase; |
| 178 | Ttcn::Ref_pard *refpard; |
| 179 | Ttcn::Reference *reference; |
| 180 | ValueRange *valuerange; |
| 181 | Type *type; |
| 182 | Types *types; |
| 183 | Value *value; |
| 184 | Values *values; |
| 185 | VariableEntries *variableentries; |
| 186 | VariableEntry *variableentry; |
| 187 | vector<SubTypeParse> *subtypeparses; |
| 188 | CompTypeRefList *comprefs; |
| 189 | ComponentTypeBody *compbody; |
| 190 | template_restriction_t template_restriction; |
| 191 | |
| 192 | struct { |
| 193 | bool is_raw; |
| 194 | ErroneousAttributeSpec::indicator_t indicator; |
| 195 | } erroneous_indicator; |
| 196 | |
| 197 | struct arraydimension_list_t { |
| 198 | size_t nElements; |
| 199 | ArrayDimension **elements; |
| 200 | } arraydimension_list; |
| 201 | |
| 202 | struct { |
| 203 | size_t nElements; |
| 204 | FieldOrArrayRef **elements; |
| 205 | } fieldorarrayref_list; |
| 206 | |
| 207 | struct { |
| 208 | size_t nElements; |
| 209 | Ttcn::Definition **elements; |
| 210 | } def_list; |
| 211 | |
| 212 | struct { |
| 213 | size_t nElements; |
| 214 | Ttcn::FriendMod **elements; |
| 215 | } friend_list; |
| 216 | |
| 217 | struct { |
| 218 | size_t nElements; |
| 219 | Statement **elements; |
| 220 | } stmt_list; |
| 221 | |
| 222 | |
| 223 | struct { |
| 224 | Value *lower; |
| 225 | bool lower_exclusive; |
| 226 | Value *upper; |
| 227 | bool upper_exclusive; |
| 228 | } rangedef; |
| 229 | |
| 230 | struct { |
| 231 | Type *type; |
| 232 | bool returns_template; |
| 233 | template_restriction_t template_restriction; |
| 234 | } returntype; |
| 235 | |
| 236 | struct { |
| 237 | Type *type; |
| 238 | bool no_block_kw; |
| 239 | } returntypeornoblock; |
| 240 | |
| 241 | struct { |
| 242 | Identifier *id; |
| 243 | CompFieldMap* cfm; |
| 244 | } structdefbody; |
| 245 | |
| 246 | struct { |
| 247 | Type *type; |
| 248 | Identifier *id; |
| 249 | } structofdefbody; |
| 250 | |
| 251 | struct { |
| 252 | Ttcn::Types *in_list, *out_list, *inout_list; |
| 253 | bool in_all, out_all, inout_all; |
| 254 | } portdefbody; |
| 255 | |
| 256 | struct { |
| 257 | Ttcn::Reference *ref; |
| 258 | Identifier *id; |
| 259 | } ischosenarg; |
| 260 | |
| 261 | struct { |
| 262 | bool is_ifpresent; |
| 263 | LengthRestriction *len_restr; |
| 264 | } extramatchingattrs; |
| 265 | |
| 266 | struct { |
| 267 | Identifier *name; |
| 268 | Type *type; |
| 269 | FormalParList *fp_list; |
| 270 | } basetemplate; |
| 271 | |
| 272 | struct { |
| 273 | Identifier *modid; |
| 274 | Identifier *id; |
| 275 | } templateref; |
| 276 | |
| 277 | struct { |
| 278 | Ttcn::Ref_pard *ref_pard; |
| 279 | Value *derefered_value; |
| 280 | ParsedActualParameters *ap_list; |
| 281 | Value *value; |
| 282 | } testcaseinst; |
| 283 | |
| 284 | struct { |
| 285 | Ttcn::Ref_pard *ref_pard; |
| 286 | Value *derefered_value; |
| 287 | TemplateInstances *ap_list; |
| 288 | } activateop; |
| 289 | |
| 290 | struct { |
| 291 | TemplateInstance *templ_inst; |
| 292 | Value *val; |
| 293 | } portsendop; |
| 294 | |
| 295 | struct { |
| 296 | Value *calltimerval; // if NULL: see nowait |
| 297 | bool nowait; |
| 298 | } calltimerval; |
| 299 | |
| 300 | struct { |
| 301 | TemplateInstance *templ_inst; |
| 302 | Value *calltimerval; // if NULL: see nowait |
| 303 | bool nowait; |
| 304 | Value *val; // not used in callparams |
| 305 | } portcallop; |
| 306 | |
| 307 | struct { |
| 308 | TemplateInstance *templ_inst; |
| 309 | Value *replyval; |
| 310 | Value *toclause; |
| 311 | } portreplyop; |
| 312 | |
| 313 | struct { |
| 314 | Ttcn::Reference *signature; |
| 315 | TemplateInstance *templ_inst; |
| 316 | Value *toclause; |
| 317 | } portraiseop; |
| 318 | |
| 319 | struct { |
| 320 | Ttcn::Reference *redirectval; |
| 321 | Ttcn::Reference *redirectsender; |
| 322 | } portredirect; |
| 323 | |
| 324 | struct { |
| 325 | ParamRedirect *redirectparam; |
| 326 | Ttcn::Reference *redirectsender; |
| 327 | } portredirectwithparam; |
| 328 | |
| 329 | struct { |
| 330 | Ttcn::Reference *redirectval; |
| 331 | ParamRedirect *redirectparam; |
| 332 | Ttcn::Reference *redirectsender; |
| 333 | } portredirectwithvalueandparam; |
| 334 | |
| 335 | struct { |
| 336 | TemplateInstance *templ_inst; |
| 337 | TemplateInstance *valuematch; |
| 338 | } getreplypar; |
| 339 | |
| 340 | struct { |
| 341 | TemplateInstance *templ_inst; |
| 342 | TemplateInstance *fromclause; |
| 343 | Ttcn::Reference *redirectval; |
| 344 | Ttcn::Reference *redirectsender; |
| 345 | } portreceiveop; |
| 346 | |
| 347 | struct { |
| 348 | TemplateInstance *templ_inst; |
| 349 | TemplateInstance *fromclause; |
| 350 | ParamRedirect *redirectparam; |
| 351 | Ttcn::Reference *redirectsender; |
| 352 | } portgetcallop; |
| 353 | |
| 354 | struct { |
| 355 | TemplateInstance *templ_inst; |
| 356 | TemplateInstance *valuematch; |
| 357 | TemplateInstance *fromclause; |
| 358 | Ttcn::Reference *redirectval; |
| 359 | ParamRedirect *redirectparam; |
| 360 | Ttcn::Reference *redirectsender; |
| 361 | } portgetreplyop; |
| 362 | |
| 363 | struct { |
| 364 | Ttcn::Reference *signature; |
| 365 | TemplateInstance *templ_inst; |
| 366 | bool timeout; |
| 367 | } catchoppar; |
| 368 | |
| 369 | struct { |
| 370 | Ttcn::Reference *signature; |
| 371 | TemplateInstance *templ_inst; |
| 372 | bool timeout; |
| 373 | TemplateInstance *fromclause; |
| 374 | Ttcn::Reference *redirectval; |
| 375 | Ttcn::Reference *redirectsender; |
| 376 | } portcatchop; |
| 377 | |
| 378 | struct { |
| 379 | Statement::statementtype_t statementtype; |
| 380 | Ttcn::Reference *signature; |
| 381 | TemplateInstance *templ_inst; |
| 382 | TemplateInstance *valuematch; |
| 383 | bool timeout; |
| 384 | TemplateInstance *fromclause; |
| 385 | Ttcn::Reference *redirectval; |
| 386 | ParamRedirect *redirectparam; |
| 387 | Ttcn::Reference *redirectsender; |
| 388 | } portcheckop; |
| 389 | |
| 390 | struct { |
| 391 | Value *compref; |
| 392 | Ttcn::Reference *portref; |
| 393 | } portref; |
| 394 | |
| 395 | struct { |
| 396 | Value *compref1; |
| 397 | Ttcn::Reference *portref1; |
| 398 | Value *compref2; |
| 399 | Ttcn::Reference *portref2; |
| 400 | } connspec; |
| 401 | |
| 402 | struct { |
| 403 | TemplateInstance *donematch; |
| 404 | Ttcn::Reference *redirect; |
| 405 | } donepar; |
| 406 | |
| 407 | struct { |
| 408 | bool is_ref; |
| 409 | union { |
| 410 | Ttcn::Reference *ref; |
| 411 | Identifier *id; |
| 412 | }; |
| 413 | } reforid; |
| 414 | |
| 415 | struct { |
| 416 | Definitions *defs; |
| 417 | Ttcn::Assignment *ass; |
| 418 | } initial; |
| 419 | |
| 420 | struct { |
| 421 | Ttcn::Reference *runsonref; |
| 422 | Ttcn::Reference *systemref; |
| 423 | } configspec; |
| 424 | |
| 425 | struct { |
| 426 | Value *name; |
| 427 | Value *loc; |
| 428 | } createpar; |
| 429 | |
| 430 | struct { |
| 431 | Value *value; |
| 432 | ParsedActualParameters *ap_list; |
| 433 | } applyop; |
| 434 | |
| 435 | |
| 436 | struct extconstidentifier_t { |
| 437 | Identifier *id; |
| 438 | YYLTYPE yyloc; |
| 439 | } extconstidentifier; |
| 440 | |
| 441 | struct { |
| 442 | size_t nElements; |
| 443 | extconstidentifier_t *elements; |
| 444 | } identifier_list; |
| 445 | |
| 446 | struct singlevarinst_t { |
| 447 | Identifier *id; |
| 448 | arraydimension_list_t arrays; |
| 449 | Value *initial_value; |
| 450 | YYLTYPE yyloc; |
| 451 | } singlevarinst; |
| 452 | |
| 453 | struct singlevarinst_list_t { |
| 454 | size_t nElements; |
| 455 | struct singlevarinst_t *elements; |
| 456 | } singlevarinst_list; |
| 457 | |
| 458 | struct singletempvarinst_t { |
| 459 | Identifier *id; |
| 460 | arraydimension_list_t arrays; |
| 461 | Template *initial_value; |
| 462 | YYLTYPE yyloc; |
| 463 | } singletempvarinst; |
| 464 | |
| 465 | struct singletempvarinst_list_t { |
| 466 | size_t nElements; |
| 467 | singletempvarinst_t *elements; |
| 468 | } singletempvarinst_list; |
| 469 | |
| 470 | struct singlemodulepar_t { |
| 471 | Identifier *id; |
| 472 | Value *defval; |
| 473 | YYLTYPE yyloc; |
| 474 | } singlemodulepar; |
| 475 | |
| 476 | struct singletemplatemodulepar_t { |
| 477 | Identifier *id; |
| 478 | Template *deftempl; |
| 479 | YYLTYPE yyloc; |
| 480 | } singletemplatemodulepar; |
| 481 | |
| 482 | struct singlemodulepar_list_t { |
| 483 | size_t nElements; |
| 484 | singlemodulepar_t *elements; |
| 485 | } singlemodulepar_list; |
| 486 | |
| 487 | struct singletemplatemodulepar_list_t { |
| 488 | size_t nElements; |
| 489 | singletemplatemodulepar_t *elements; |
| 490 | } singletemplatemodulepar_list; |
| 491 | |
| 492 | struct portelement_t { |
| 493 | Identifier *id; |
| 494 | ArrayDimensions *dims; |
| 495 | YYLTYPE yyloc; |
| 496 | } portelement; |
| 497 | |
| 498 | struct portelement_list_t { |
| 499 | size_t nElements; |
| 500 | portelement_t *elements; |
| 501 | } portelement_list; |
| 502 | |
| 503 | struct runs_on_compref_or_self_t { |
| 504 | bool self; |
| 505 | Ttcn::Reference *reference; |
| 506 | } runs_on_compref_or_self; |
| 507 | |
| 508 | struct { |
| 509 | visibility_t visibility; |
| 510 | } visbilitytype; |
| 511 | } |
| 512 | |
| 513 | /* Tokens of TTCN-3 */ |
| 514 | |
| 515 | /********************************************************************* |
| 516 | * Tokens with semantic value |
| 517 | *********************************************************************/ |
| 518 | |
| 519 | /* Terminals with semantic value */ |
| 520 | |
| 521 | %token <int_val> Number |
| 522 | %token <float_val> FloatValue |
| 523 | %token <id> IDentifier "Identifier" |
| 524 | |
| 525 | %token <string_val> Bstring |
| 526 | Hstring |
| 527 | Ostring |
| 528 | BitStringMatch |
| 529 | HexStringMatch |
| 530 | OctetStringMatch |
| 531 | %token <str> Cstring |
| 532 | %token NullValue "ASN.1_NULL_value" |
| 533 | %token <macrotype> MacroValue |
| 534 | |
| 535 | /********************************************************************* |
| 536 | * Tokens without semantic value |
| 537 | *********************************************************************/ |
| 538 | |
| 539 | /* Terminals without semantic value - keywords, operators, etc. */ |
| 540 | |
| 541 | %token TOK_errval "erroneous_value" |
| 542 | |
| 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 |
| 550 | %token ActionKeyword |
| 551 | %token ActivateKeyword |
| 552 | %token AddressKeyword |
| 553 | %token AliveKeyword |
| 554 | %token AllKeyword |
| 555 | %token AltKeyword |
| 556 | %token AltstepKeyword |
| 557 | %token AndKeyword |
| 558 | %token And4bKeyword |
| 559 | %token AnyKeyword |
| 560 | %token AnyTypeKeyword |
| 561 | %token ApplyKeyword |
| 562 | %token BitStringKeyword |
| 563 | %token BooleanKeyword |
| 564 | %token BreakKeyword |
| 565 | %token CallOpKeyword |
| 566 | %token CaseKeyword |
| 567 | %token CatchOpKeyword |
| 568 | %token CharKeyword |
| 569 | %token CharStringKeyword |
| 570 | %token CheckOpKeyword |
| 571 | %token ClearOpKeyword |
| 572 | %token ComplementKeyword |
| 573 | %token ComponentKeyword |
| 574 | %token ConnectKeyword |
| 575 | %token ConstKeyword |
| 576 | %token ContinueKeyword |
| 577 | %token ControlKeyword |
| 578 | %token CreateKeyword |
| 579 | %token DeactivateKeyword |
| 580 | %token DefaultKeyword |
| 581 | %token DerefersKeyword |
| 582 | %token DisconnectKeyword |
| 583 | %token DisplayKeyword |
| 584 | %token DoKeyword |
| 585 | %token DoneKeyword |
| 586 | %token ElseKeyword |
| 587 | %token EncodeKeyword |
| 588 | %token EnumKeyword |
| 589 | %token ErrorKeyword |
| 590 | %token ExceptKeyword |
| 591 | %token ExceptionKeyword |
| 592 | %token ExecuteKeyword |
| 593 | %token ExtendsKeyword |
| 594 | %token ExtensionKeyword |
| 595 | %token ExtKeyword |
| 596 | %token FailKeyword |
| 597 | %token FalseKeyword |
| 598 | %token FloatKeyword |
| 599 | %token ForKeyword |
| 600 | %token FriendKeyword |
| 601 | %token FromKeyword |
| 602 | %token FunctionKeyword |
| 603 | %token GetCallOpKeyword |
| 604 | %token GetReplyOpKeyword |
| 605 | %token GetVerdictKeyword |
| 606 | %token GotoKeyword |
| 607 | %token GroupKeyword |
| 608 | %token HaltKeyword |
| 609 | %token HexStringKeyword |
| 610 | %token IfKeyword |
| 611 | %token IfPresentKeyword |
| 612 | %token ImportKeyword |
| 613 | %token InconcKeyword |
| 614 | %token InfinityKeyword |
| 615 | %token InOutParKeyword |
| 616 | %token InParKeyword |
| 617 | %token IntegerKeyword |
| 618 | %token InterleavedKeyword |
| 619 | %token KillKeyword |
| 620 | %token KilledKeyword |
| 621 | %token LabelKeyword |
| 622 | %token LanguageKeyword |
| 623 | %token LengthKeyword |
| 624 | %token LogKeyword |
| 625 | %token MapKeyword |
| 626 | %token MatchKeyword |
| 627 | %token MessageKeyword |
| 628 | %token MixedKeyword |
| 629 | %token ModKeyword |
| 630 | %token ModifiesKeyword |
| 631 | %token ModuleParKeyword |
| 632 | %token MTCKeyword |
| 633 | %token NaNKeyword |
| 634 | %token NoBlockKeyword |
| 635 | %token NoneKeyword |
| 636 | %token NotKeyword |
| 637 | %token Not4bKeyword |
| 638 | %token NowaitKeyword |
| 639 | %token NullKeyword |
| 640 | %token ObjectIdentifierKeyword |
| 641 | %token OctetStringKeyword |
| 642 | %token OfKeyword |
| 643 | %token OmitKeyword |
| 644 | %token OnKeyword |
| 645 | %token OptionalKeyword |
| 646 | %token OrKeyword |
| 647 | %token Or4bKeyword |
| 648 | %token OutParKeyword |
| 649 | %token OverrideKeyword |
| 650 | %token PassKeyword |
| 651 | %token ParamKeyword |
| 652 | %token PatternKeyword |
| 653 | %token PermutationKeyword |
| 654 | %token PresentKeyword |
| 655 | %token PortKeyword |
| 656 | %token PrivateKeyword |
| 657 | %token ProcedureKeyword |
| 658 | %token PublicKeyword |
| 659 | %token RaiseKeyword |
| 660 | %token ReadKeyword |
| 661 | %token ReceiveOpKeyword |
| 662 | %token RecordKeyword |
| 663 | %token RecursiveKeyword |
| 664 | %token RefersKeyword |
| 665 | %token RemKeyword |
| 666 | %token RepeatKeyword |
| 667 | %token ReplyKeyword |
| 668 | %token ReturnKeyword |
| 669 | %token RunningKeyword |
| 670 | %token RunsKeyword |
| 671 | %token SelectKeyword |
| 672 | %token SelfKeyword |
| 673 | %token SenderKeyword |
| 674 | %token SendOpKeyword |
| 675 | %token SetKeyword |
| 676 | %token SetVerdictKeyword |
| 677 | %token SignatureKeyword |
| 678 | %token StartKeyword |
| 679 | %token StopKeyword |
| 680 | %token SubsetKeyword |
| 681 | %token SupersetKeyword |
| 682 | %token SystemKeyword |
| 683 | %token TemplateKeyword |
| 684 | %token TestcaseKeyword |
| 685 | %token TimeoutKeyword |
| 686 | %token TimerKeyword |
| 687 | %token ToKeyword |
| 688 | %token TriggerOpKeyword |
| 689 | %token TrueKeyword |
| 690 | %token TTCN3ModuleKeyword |
| 691 | %token TypeDefKeyword |
| 692 | %token UnionKeyword |
| 693 | %token UniversalKeyword |
| 694 | %token UnmapKeyword |
| 695 | %token ValueKeyword |
| 696 | %token ValueofKeyword |
| 697 | %token VarKeyword |
| 698 | %token VariantKeyword |
| 699 | %token VerdictTypeKeyword |
| 700 | %token WhileKeyword |
| 701 | %token WithKeyword |
| 702 | %token XorKeyword |
| 703 | %token Xor4bKeyword |
| 704 | |
| 705 | /* TITAN specific keywords */ |
| 706 | %token TitanSpecificTryKeyword |
| 707 | %token TitanSpecificCatchKeyword |
| 708 | %token TitanSpecificLazyKeyword |
| 709 | %token TitanSpecificProfilerKeyword |
| 710 | |
| 711 | /* Keywords combined with a leading dot */ |
| 712 | |
| 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. */ |
| 718 | |
| 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 |
| 742 | |
| 743 | /* Predefined function identifiers */ |
| 744 | |
| 745 | %token bit2hexKeyword |
| 746 | %token bit2intKeyword |
| 747 | %token bit2octKeyword |
| 748 | %token bit2strKeyword |
| 749 | %token char2intKeyword |
| 750 | %token char2octKeyword |
| 751 | %token decompKeyword |
| 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 |
| 776 | %token regexpKeyword |
| 777 | %token replaceKeyword |
| 778 | %token rndKeyword |
| 779 | %token testcasenameKeyword |
| 780 | %token sizeofKeyword |
| 781 | %token str2floatKeyword |
| 782 | %token str2intKeyword |
| 783 | %token str2octKeyword |
| 784 | %token substrKeyword |
| 785 | %token unichar2intKeyword |
| 786 | %token unichar2charKeyword |
| 787 | %token unichar2octKeyword |
| 788 | |
| 789 | %token float2strKeyword |
| 790 | %token str2bitKeyword |
| 791 | %token str2hexKeyword |
| 792 | |
| 793 | %token log2strKeyword |
| 794 | %token enum2intKeyword |
| 795 | |
| 796 | %token encvalueKeyword |
| 797 | %token decvalueKeyword |
| 798 | |
| 799 | %token ttcn2stringKeyword |
| 800 | %token string2ttcnKeyword |
| 801 | %token remove_bomKeyWord |
| 802 | %token get_stringencodingKeyWord |
| 803 | %token encode_base64KeyWord |
| 804 | %token decode_base64KeyWord |
| 805 | |
| 806 | /* Multi-character operators */ |
| 807 | |
| 808 | %token AssignmentChar ":=" |
| 809 | %token DotDot ".." |
| 810 | %token PortRedirectSymbol "->" |
| 811 | %token EQ "==" |
| 812 | %token NE "!=" |
| 813 | %token GE ">=" |
| 814 | %token LE "<=" |
| 815 | %token SL "<<" |
| 816 | %token SR ">>" |
| 817 | %token RL "<@" |
| 818 | %token _RR "@>" /* Name clash with bn.h:292 */ |
| 819 | |
| 820 | /********************************************************************* |
| 821 | * Semantic types of nonterminals |
| 822 | *********************************************************************/ |
| 823 | |
| 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 |
| 832 | |
| 833 | %type <typetype> PredefinedType |
| 834 | %type <portoperationmode> PortOperationMode |
| 835 | %type <operationtype> PredefinedOpKeyword1 PredefinedOpKeyword2 PredefinedOpKeyword3 |
| 836 | |
| 837 | %type <activateop> ActivateOp |
| 838 | %type <attribtype> AttribKeyword |
| 839 | |
| 840 | %type <altguard> CallBodyStatement AltGuard ElseStatement GuardStatement |
| 841 | InterleavedGuardElement |
| 842 | %type <altguards> AltGuardList CallBodyStatementList InterleavedGuardList |
| 843 | optPortCallBody |
| 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 |
| 915 | optReceiveParameter |
| 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 |
| 950 | |
| 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 |
| 956 | VarInstance |
| 957 | %type <stmt_list> FunctionStatementOrDef ControlStatementOrDef |
| 958 | |
| 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 |
| 1013 | |
| 1014 | /********************************************************************* |
| 1015 | * Destructors |
| 1016 | *********************************************************************/ |
| 1017 | |
| 1018 | %destructor { |
| 1019 | act_group = $$->get_parent_group(); |
| 1020 | } |
| 1021 | GroupDef |
| 1022 | GroupIdentifier |
| 1023 | |
| 1024 | %destructor {Free($$);} |
| 1025 | Cstring |
| 1026 | FreeText |
| 1027 | optLanguageSpec |
| 1028 | PatternChunk |
| 1029 | PatternChunkList |
| 1030 | |
| 1031 | %destructor { |
| 1032 | delete $$.ref_pard; |
| 1033 | delete $$.derefered_value; |
| 1034 | delete $$.ap_list; |
| 1035 | } |
| 1036 | ActivateOp |
| 1037 | |
| 1038 | %destructor {delete $$;} |
| 1039 | AddressRef |
| 1040 | AddressValue |
| 1041 | AliveOp |
| 1042 | AllOrTypeList |
| 1043 | AllPortsSpec |
| 1044 | AltConstruct |
| 1045 | AltGuard |
| 1046 | AltGuardChar |
| 1047 | AltGuardList |
| 1048 | AltstepDef |
| 1049 | AltstepInstance |
| 1050 | AltstepTypeDef |
| 1051 | ArrayBounds |
| 1052 | ArrayElementExpressionList |
| 1053 | ArrayElementSpec |
| 1054 | ArrayElementSpecList |
| 1055 | ArrayExpression |
| 1056 | ArrayIndex |
| 1057 | ArrayOrBitRef |
| 1058 | ArrayOrBitRefOrDash |
| 1059 | ArrayValueOrAttrib |
| 1060 | Assignment |
| 1061 | AssignmentList |
| 1062 | AttribSpec |
| 1063 | BasicStatements |
| 1064 | BehaviourStatements |
| 1065 | BitStringMatch |
| 1066 | BitStringValue |
| 1067 | BooleanExpression |
| 1068 | BooleanValue |
| 1069 | BreakStatement |
| 1070 | Bstring |
| 1071 | CallBodyOps |
| 1072 | CallBodyStatement |
| 1073 | CallBodyStatementList |
| 1074 | CallStatement |
| 1075 | CatchStatement |
| 1076 | CharStringMatch |
| 1077 | CharStringValue |
| 1078 | CheckStatement |
| 1079 | ClearStatement |
| 1080 | CommunicationStatements |
| 1081 | Complement |
| 1082 | ComponentDef |
| 1083 | ComponentElementDefList |
| 1084 | ComponentOrDefaultReference |
| 1085 | ComponentRef |
| 1086 | ComponentReferenceOrLiteral |
| 1087 | ComponentType |
| 1088 | ComponentTypeList |
| 1089 | CompoundExpression |
| 1090 | ConditionalConstruct |
| 1091 | ConfigurationOps |
| 1092 | ConfigurationStatements |
| 1093 | ConnectStatement |
| 1094 | ContinueStatement |
| 1095 | ControlStatement |
| 1096 | ControlStatementOrDefList |
| 1097 | CreateOp |
| 1098 | DeactivateStatement |
| 1099 | DefOrFieldRef |
| 1100 | DefOrFieldRefList |
| 1101 | DereferOp |
| 1102 | DerivedDef |
| 1103 | DerivedRefWithParList |
| 1104 | DisconnectStatement |
| 1105 | DoWhileStatement |
| 1106 | DoneStatement |
| 1107 | ElseIfClause |
| 1108 | ElseStatement |
| 1109 | EnumDef |
| 1110 | Enumeration |
| 1111 | EnumerationList |
| 1112 | ExceptionTypeList |
| 1113 | Expression |
| 1114 | FieldExpressionList |
| 1115 | FieldExpressionSpec |
| 1116 | FieldIdentifier |
| 1117 | FieldOrArrayReference |
| 1118 | FieldReference |
| 1119 | FieldSpec |
| 1120 | FieldSpecList |
| 1121 | Final |
| 1122 | ForStatement |
| 1123 | FormalTemplatePar |
| 1124 | FormalTimerPar |
| 1125 | FormalValuePar |
| 1126 | FromClause |
| 1127 | FullGroupIdentifier |
| 1128 | FunctionActualPar |
| 1129 | FunctionActualParList |
| 1130 | FunctionDef |
| 1131 | FunctionFormalPar |
| 1132 | FunctionFormalParList |
| 1133 | FunctionInstance |
| 1134 | FunctionStatement |
| 1135 | FunctionStatementOrDefList |
| 1136 | FunctionTypeDef |
| 1137 | GetCallStatement |
| 1138 | GetLocalVerdict |
| 1139 | GetReplyStatement |
| 1140 | GlobalModuleId |
| 1141 | GotoStatement |
| 1142 | GuardOp |
| 1143 | GuardStatement |
| 1144 | HaltStatement |
| 1145 | HexStringMatch |
| 1146 | HexStringValue |
| 1147 | Hstring |
| 1148 | IDentifier |
| 1149 | IdentifierOrAddressKeyword |
| 1150 | ImportFromSpec |
| 1151 | InLineTemplate |
| 1152 | int2enumStatement |
| 1153 | IntegerValue |
| 1154 | InterleavedConstruct |
| 1155 | InterleavedGuardElement |
| 1156 | InterleavedGuardList |
| 1157 | KillTCStatement |
| 1158 | KilledStatement |
| 1159 | LabelStatement |
| 1160 | LengthMatch |
| 1161 | LogItem |
| 1162 | LogItemList |
| 1163 | LogStatement |
| 1164 | String2TtcnStatement |
| 1165 | LoopConstruct |
| 1166 | LowerBound |
| 1167 | MTCOp |
| 1168 | MapStatement |
| 1169 | MatchOp |
| 1170 | MatchingSymbol |
| 1171 | ModuleControlBody |
| 1172 | ModuleId |
| 1173 | MultiWithAttrib |
| 1174 | NamedPart |
| 1175 | NameAndNumberForm |
| 1176 | NestedAltstepTypeDef |
| 1177 | NestedEnumDef |
| 1178 | NestedFunctionTypeDef |
| 1179 | NestedRecordDef |
| 1180 | NestedRecordOfDef |
| 1181 | NestedSetDef |
| 1182 | NestedSetOfDef |
| 1183 | NestedTestcaseTypeDef |
| 1184 | NestedTypeDef |
| 1185 | NestedUnionDef |
| 1186 | NotUsedOrExpression |
| 1187 | Number |
| 1188 | NumberForm |
| 1189 | ObjIdComponent |
| 1190 | ObjIdComponentList |
| 1191 | ObjectIdentifierValue |
| 1192 | OctetStringMatch |
| 1193 | OctetStringValue |
| 1194 | OmitValue |
| 1195 | OpCall |
| 1196 | Ostring |
| 1197 | ParamAssignmentList |
| 1198 | ParamSpec |
| 1199 | PermutationMatch |
| 1200 | Port |
| 1201 | PortDef |
| 1202 | PortDefAttribs |
| 1203 | PortDefBody |
| 1204 | PortOrAll |
| 1205 | PortOrAny |
| 1206 | PortType |
| 1207 | PredefOrIdentifier |
| 1208 | PredefinedOps |
| 1209 | PredefinedValue |
| 1210 | ProfilerRunningOp |
| 1211 | ProfilerStatement |
| 1212 | RaiseStatement |
| 1213 | Range |
| 1214 | ReadTimerOp |
| 1215 | ReceiveParameter |
| 1216 | ReceiveStatement |
| 1217 | RecordDef |
| 1218 | RecordOfDef |
| 1219 | ReferOp |
| 1220 | ReferencedType |
| 1221 | ReferencedValue |
| 1222 | RepeatStatement |
| 1223 | ReplyStatement |
| 1224 | ReturnStatement |
| 1225 | RunningOp |
| 1226 | RunningTimerOp |
| 1227 | RunsOnSpec |
| 1228 | SUTStatements |
| 1229 | SelfOp |
| 1230 | SendParameter |
| 1231 | SendStatement |
| 1232 | SenderSpec |
| 1233 | SetDef |
| 1234 | SetLocalVerdict |
| 1235 | SetOfDef |
| 1236 | Signature |
| 1237 | SignatureDef |
| 1238 | SignatureFormalPar |
| 1239 | SignatureFormalParList |
| 1240 | SimpleSpec |
| 1241 | SingleExpression |
| 1242 | SingleLowerBound |
| 1243 | SingleTimerInstance |
| 1244 | SingleValueOrAttrib |
| 1245 | SingleWithAttrib |
| 1246 | DecValueArg |
| 1247 | StartStatement |
| 1248 | StartTCStatement |
| 1249 | StartTimerStatement |
| 1250 | StatementBlock |
| 1251 | Step |
| 1252 | StopExecutionStatement |
| 1253 | StopTestcaseStatement |
| 1254 | StopStatement |
| 1255 | StopTCStatement |
| 1256 | StopTimerStatement |
| 1257 | StringLength |
| 1258 | StructFieldDef |
| 1259 | StructFieldDefList |
| 1260 | StructFieldRef |
| 1261 | StructuredTypeDef |
| 1262 | SubTypeDef |
| 1263 | SubsetMatch |
| 1264 | SupersetMatch |
| 1265 | SystemOp |
| 1266 | TemplateActualPar |
| 1267 | TemplateBody |
| 1268 | TemplateDef |
| 1269 | TemplateFormalPar |
| 1270 | TemplateFormalParList |
| 1271 | TemplateInstance |
| 1272 | TemplateOps |
| 1273 | TemplateRefWithParList |
| 1274 | /* TestcaseActualPar */ |
| 1275 | TestcaseActualParList |
| 1276 | TestcaseDef |
| 1277 | TestcaseFormalPar |
| 1278 | TestcaseFormalParList |
| 1279 | TestcaseTypeDef |
| 1280 | TimeoutStatement |
| 1281 | TimerOps |
| 1282 | TimerRef |
| 1283 | TimerRefOrAny |
| 1284 | TimerStatements |
| 1285 | TimerValue |
| 1286 | TriggerStatement |
| 1287 | Type |
| 1288 | TypeDef |
| 1289 | TypeDefBody |
| 1290 | TypeList |
| 1291 | TypeOrNestedTypeDef |
| 1292 | UnionDef |
| 1293 | UnionFieldDef |
| 1294 | UnionFieldDefList |
| 1295 | UnmapStatement |
| 1296 | UnnamedPart |
| 1297 | UpperBound |
| 1298 | Value |
| 1299 | ValueList |
| 1300 | ValueMatchSpec |
| 1301 | ValueOrAttribList |
| 1302 | ValueOrRange |
| 1303 | ValueSpec |
| 1304 | ValueofOp |
| 1305 | VariableAssignment |
| 1306 | VariableEntry |
| 1307 | VariableList |
| 1308 | VariableRef |
| 1309 | VerdictOps |
| 1310 | VerdictStatements |
| 1311 | VerdictValue |
| 1312 | WhileStatement |
| 1313 | WithAttribList |
| 1314 | WithStatement |
| 1315 | optAltstepFormalParList |
| 1316 | optAttribQualifier |
| 1317 | optComponentDefList |
| 1318 | optDerivedDef |
| 1319 | optElseClause |
| 1320 | optExceptionSpec |
| 1321 | optExtendsDef |
| 1322 | optFromClause |
| 1323 | optFunctionActualParList |
| 1324 | optFunctionFormalParList |
| 1325 | optParDefaultValue |
| 1326 | optPortCallBody |
| 1327 | optReceiveParameter |
| 1328 | optReplyValue |
| 1329 | optRunsOnSpec |
| 1330 | optSignatureFormalParList |
| 1331 | optStringLength |
| 1332 | optStructFieldDefList |
| 1333 | optSystemSpec |
| 1334 | optTemplateActualParList |
| 1335 | optTemplateFormalParList |
| 1336 | optTestcaseActualParList |
| 1337 | optTestcaseFormalParList |
| 1338 | optTestcaseTimerValue |
| 1339 | optToClause |
| 1340 | optWithStatement |
| 1341 | optWithStatementAndSemiColon |
| 1342 | seqElseIfClause |
| 1343 | seqFieldExpressionSpec |
| 1344 | seqFieldSpec |
| 1345 | seqTemplateActualPar |
| 1346 | seqTemplateInstance |
| 1347 | seqValueOrAttrib |
| 1348 | Quadruple |
| 1349 | |
| 1350 | %destructor { |
| 1351 | for (size_t i = 0; i < $$->size(); i++) delete (*$$)[i]; |
| 1352 | $$->clear(); |
| 1353 | delete $$; |
| 1354 | } |
| 1355 | AllowedValues |
| 1356 | optSubTypeSpec |
| 1357 | seqValueOrRange |
| 1358 | |
| 1359 | %destructor { |
| 1360 | for(size_t i=0; i<$$.nElements; i++) delete $$.elements[i]; |
| 1361 | Free($$.elements); |
| 1362 | } |
| 1363 | AltstepLocalDef |
| 1364 | AltstepLocalDefList |
| 1365 | ComponentElementDef |
| 1366 | ConstDef |
| 1367 | ControlStatementOrDef |
| 1368 | ExtConstDef |
| 1369 | FunctionLocalDef |
| 1370 | FunctionLocalInst |
| 1371 | FunctionStatementOrDef |
| 1372 | ModuleDef |
| 1373 | ModulePar |
| 1374 | ModuleParDef |
| 1375 | MultiTypedModuleParList |
| 1376 | PortInstance |
| 1377 | TimerInstance |
| 1378 | TimerList |
| 1379 | VarInstance |
| 1380 | optArrayDef |
| 1381 | optExtendedFieldReference |
| 1382 | FriendModuleDef |
| 1383 | |
| 1384 | %destructor { |
| 1385 | delete $$.lower; |
| 1386 | delete $$.upper; |
| 1387 | } |
| 1388 | RangeDef |
| 1389 | |
| 1390 | %destructor { |
| 1391 | delete $$.type; |
| 1392 | } |
| 1393 | optReturnType |
| 1394 | optReturnTypeOrNoBlockKeyword |
| 1395 | |
| 1396 | %destructor { |
| 1397 | delete $$.id; |
| 1398 | delete $$.cfm; |
| 1399 | } |
| 1400 | StructDefBody |
| 1401 | UnionDefBody |
| 1402 | |
| 1403 | %destructor { |
| 1404 | delete $$.type; |
| 1405 | delete $$.id; |
| 1406 | } |
| 1407 | StructOfDefBody |
| 1408 | |
| 1409 | %destructor { |
| 1410 | delete $$.in_list; |
| 1411 | delete $$.out_list; |
| 1412 | delete $$.inout_list; |
| 1413 | } |
| 1414 | PortDefList |
| 1415 | PortDefLists |
| 1416 | seqPortDefList |
| 1417 | |
| 1418 | %destructor { |
| 1419 | delete $$.ref; |
| 1420 | delete $$.id; |
| 1421 | } |
| 1422 | IschosenArg |
| 1423 | |
| 1424 | %destructor { |
| 1425 | delete $$.len_restr; |
| 1426 | } |
| 1427 | optExtraMatchingAttributes |
| 1428 | |
| 1429 | %destructor { |
| 1430 | delete $$.name; |
| 1431 | delete $$.type; |
| 1432 | delete $$.fp_list; |
| 1433 | } |
| 1434 | BaseTemplate |
| 1435 | |
| 1436 | %destructor { |
| 1437 | delete $$.modid; |
| 1438 | delete $$.id; |
| 1439 | } |
| 1440 | FunctionRef |
| 1441 | TemplateRef |
| 1442 | TestcaseRef |
| 1443 | |
| 1444 | %destructor { |
| 1445 | delete $$.ref_pard; |
| 1446 | delete $$.derefered_value; |
| 1447 | delete $$.ap_list; |
| 1448 | delete $$.value; |
| 1449 | } |
| 1450 | TestcaseInstance |
| 1451 | |
| 1452 | %destructor { |
| 1453 | delete $$.templ_inst; |
| 1454 | delete $$.val; |
| 1455 | } |
| 1456 | PortSendOp |
| 1457 | |
| 1458 | %destructor { |
| 1459 | delete $$.calltimerval; |
| 1460 | } |
| 1461 | CallTimerValue |
| 1462 | |
| 1463 | %destructor { |
| 1464 | delete $$.templ_inst; |
| 1465 | delete $$.calltimerval; |
| 1466 | delete $$.val; |
| 1467 | } |
| 1468 | PortCallOp CallParameters |
| 1469 | |
| 1470 | %destructor { |
| 1471 | delete $$.templ_inst; |
| 1472 | delete $$.replyval; |
| 1473 | delete $$.toclause; |
| 1474 | } |
| 1475 | PortReplyOp |
| 1476 | |
| 1477 | %destructor { |
| 1478 | delete $$.signature; |
| 1479 | delete $$.templ_inst; |
| 1480 | delete $$.toclause; |
| 1481 | } |
| 1482 | PortRaiseOp |
| 1483 | |
| 1484 | %destructor { |
| 1485 | delete $$.redirectval; |
| 1486 | delete $$.redirectsender; |
| 1487 | } |
| 1488 | optPortRedirect |
| 1489 | |
| 1490 | %destructor { |
| 1491 | delete $$.redirectparam; |
| 1492 | delete $$.redirectsender; |
| 1493 | } |
| 1494 | optPortRedirectWithParam |
| 1495 | |
| 1496 | %destructor { |
| 1497 | delete $$.redirectval; |
| 1498 | delete $$.redirectparam; |
| 1499 | delete $$.redirectsender; |
| 1500 | } |
| 1501 | optPortRedirectWithValueAndParam |
| 1502 | |
| 1503 | %destructor { |
| 1504 | delete $$.templ_inst; |
| 1505 | delete $$.valuematch; |
| 1506 | } |
| 1507 | optGetReplyParameter |
| 1508 | |
| 1509 | %destructor { |
| 1510 | delete $$.templ_inst; |
| 1511 | delete $$.fromclause; |
| 1512 | delete $$.redirectval; |
| 1513 | delete $$.redirectsender; |
| 1514 | } |
| 1515 | PortReceiveOp |
| 1516 | PortTriggerOp |
| 1517 | |
| 1518 | %destructor { |
| 1519 | delete $$.templ_inst; |
| 1520 | delete $$.fromclause; |
| 1521 | delete $$.redirectparam; |
| 1522 | delete $$.redirectsender; |
| 1523 | } |
| 1524 | PortGetCallOp |
| 1525 | |
| 1526 | %destructor { |
| 1527 | delete $$.templ_inst; |
| 1528 | delete $$.valuematch; |
| 1529 | delete $$.fromclause; |
| 1530 | delete $$.redirectval; |
| 1531 | delete $$.redirectparam; |
| 1532 | delete $$.redirectsender; |
| 1533 | } |
| 1534 | PortGetReplyOp |
| 1535 | |
| 1536 | %destructor { |
| 1537 | delete $$.signature; |
| 1538 | delete $$.templ_inst; |
| 1539 | } |
| 1540 | optCatchOpParameter |
| 1541 | CatchOpParameter |
| 1542 | |
| 1543 | %destructor { |
| 1544 | delete $$.signature; |
| 1545 | delete $$.templ_inst; |
| 1546 | delete $$.fromclause; |
| 1547 | delete $$.redirectval; |
| 1548 | delete $$.redirectsender; |
| 1549 | } |
| 1550 | PortCatchOp |
| 1551 | |
| 1552 | %destructor { |
| 1553 | delete $$.signature; |
| 1554 | delete $$.templ_inst; |
| 1555 | delete $$.valuematch; |
| 1556 | delete $$.fromclause; |
| 1557 | delete $$.redirectval; |
| 1558 | delete $$.redirectparam; |
| 1559 | delete $$.redirectsender; |
| 1560 | } |
| 1561 | optCheckParameter |
| 1562 | CheckParameter |
| 1563 | CheckPortOpsPresent |
| 1564 | FromClausePresent |
| 1565 | RedirectPresent |
| 1566 | |
| 1567 | %destructor { |
| 1568 | delete $$.compref; |
| 1569 | delete $$.portref; |
| 1570 | } |
| 1571 | PortRef |
| 1572 | AllConnectionsSpec |
| 1573 | |
| 1574 | %destructor { |
| 1575 | delete $$.compref1; |
| 1576 | delete $$.portref1; |
| 1577 | delete $$.compref2; |
| 1578 | delete $$.portref2; |
| 1579 | } |
| 1580 | SingleConnectionSpec |
| 1581 | SingleOrMultiConnectionSpec |
| 1582 | |
| 1583 | %destructor { |
| 1584 | delete $$.donematch; |
| 1585 | delete $$.redirect; |
| 1586 | } |
| 1587 | optDoneParameter |
| 1588 | |
| 1589 | %destructor { |
| 1590 | if ($$.is_ref) delete $$.ref; |
| 1591 | else delete $$.id; |
| 1592 | } |
| 1593 | Reference |
| 1594 | |
| 1595 | %destructor { |
| 1596 | delete $$.defs; |
| 1597 | delete $$.ass; |
| 1598 | } |
| 1599 | Initial |
| 1600 | |
| 1601 | %destructor { |
| 1602 | delete $$.runsonref; |
| 1603 | delete $$.systemref; |
| 1604 | } |
| 1605 | ConfigSpec |
| 1606 | |
| 1607 | %destructor { |
| 1608 | delete $$.name; |
| 1609 | delete $$.loc; |
| 1610 | } |
| 1611 | optCreateParameter |
| 1612 | |
| 1613 | %destructor { |
| 1614 | delete $$.value; |
| 1615 | delete $$.ap_list; |
| 1616 | } |
| 1617 | ApplyOp |
| 1618 | |
| 1619 | %destructor { |
| 1620 | for (size_t i = 0; i < $$.nElements; i++) delete $$.elements[i].id; |
| 1621 | Free($$.elements); |
| 1622 | } |
| 1623 | IdentifierList |
| 1624 | |
| 1625 | %destructor { |
| 1626 | delete $$.id; |
| 1627 | for (size_t i = 0; i < $$.arrays.nElements; i++) |
| 1628 | delete $$.arrays.elements[i]; |
| 1629 | Free($$.arrays.elements); |
| 1630 | delete $$.initial_value; |
| 1631 | } |
| 1632 | SingleConstDef |
| 1633 | SingleVarInstance |
| 1634 | SingleTempVarInstance |
| 1635 | |
| 1636 | %destructor { |
| 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; |
| 1643 | } |
| 1644 | Free($$.elements); |
| 1645 | } |
| 1646 | ConstList |
| 1647 | TempVarList |
| 1648 | VarList |
| 1649 | |
| 1650 | %destructor { |
| 1651 | delete $$.id; |
| 1652 | delete $$.defval; |
| 1653 | } |
| 1654 | SingleModulePar |
| 1655 | |
| 1656 | %destructor { |
| 1657 | delete $$.id; |
| 1658 | delete $$.deftempl; |
| 1659 | } |
| 1660 | SingleTemplateModulePar |
| 1661 | |
| 1662 | %destructor { |
| 1663 | for (size_t i = 0; i < $$.nElements; i++) { |
| 1664 | delete $$.elements[i].id; |
| 1665 | delete $$.elements[i].defval; |
| 1666 | } |
| 1667 | Free($$.elements); |
| 1668 | } |
| 1669 | ModuleParList |
| 1670 | |
| 1671 | %destructor { |
| 1672 | for (size_t i = 0; i < $$.nElements; i++) { |
| 1673 | delete $$.elements[i].id; |
| 1674 | delete $$.elements[i].deftempl; |
| 1675 | } |
| 1676 | Free($$.elements); |
| 1677 | } |
| 1678 | TemplateModuleParList |
| 1679 | |
| 1680 | %destructor { |
| 1681 | delete $$.id; |
| 1682 | delete $$.dims; |
| 1683 | } |
| 1684 | PortElement |
| 1685 | |
| 1686 | %destructor { |
| 1687 | for (size_t i = 0; i < $$.nElements; i++) { |
| 1688 | delete $$.elements[i].id; |
| 1689 | delete $$.elements[i].dims; |
| 1690 | } |
| 1691 | Free($$.elements); |
| 1692 | } |
| 1693 | PortElementList |
| 1694 | |
| 1695 | %destructor { |
| 1696 | delete $$.reference; |
| 1697 | } |
| 1698 | optRunsOnComprefOrSelf |
| 1699 | |
| 1700 | /********************************************************************* |
| 1701 | * Operator precedences (lowest first) |
| 1702 | *********************************************************************/ |
| 1703 | |
| 1704 | %left OrKeyword |
| 1705 | %left XorKeyword |
| 1706 | %left AndKeyword |
| 1707 | %left NotKeyword |
| 1708 | %left EQ NE |
| 1709 | %nonassoc '<' '>' GE LE |
| 1710 | %left SL SR RL _RR |
| 1711 | %left Or4bKeyword |
| 1712 | %left Xor4bKeyword |
| 1713 | %left And4bKeyword |
| 1714 | %left Not4bKeyword |
| 1715 | %left '+' '-' '&' |
| 1716 | %left '*' '/' ModKeyword RemKeyword |
| 1717 | %left UnarySign |
| 1718 | |
| 1719 | %expect 26 |
| 1720 | |
| 1721 | %start GrammarRoot |
| 1722 | |
| 1723 | /* |
| 1724 | XXX Source of conflicts (26 S/R): |
| 1725 | |
| 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 |
| 1730 | (reduce). |
| 1731 | |
| 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> [ |
| 1742 | - timer t <here> [ |
| 1743 | - var t v <here> [ |
| 1744 | - var t v := ref.objid{...}.subref <here> [ |
| 1745 | - var template t v <here> [ |
| 1746 | - var t v := function(...)<subrefs> <here> [ |
| 1747 | |
| 1748 | 3.) 1 conflict |
| 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). |
| 1752 | |
| 1753 | 4.) 1 conflict |
| 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. |
| 1758 | |
| 1759 | 5.) 5 conflicts in in three states, related to named parameters |
| 1760 | |
| 1761 | 6.) 1 Conflict due to pattern concatenation |
| 1762 | |
| 1763 | Note that the parser implemented by bison always chooses to shift instead of |
| 1764 | reduce in case of conflicts. |
| 1765 | */ |
| 1766 | |
| 1767 | %% |
| 1768 | |
| 1769 | /********************************************************************* |
| 1770 | * Grammar |
| 1771 | *********************************************************************/ |
| 1772 | |
| 1773 | /* The grammar of TTCN-3 */ |
| 1774 | /* The numbers correspond to ES 201 873-1 V4.1.2 (2009-07) */ |
| 1775 | |
| 1776 | GrammarRoot: |
| 1777 | TTCN3Module |
| 1778 | { |
| 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."); |
| 1784 | } |
| 1785 | } |
| 1786 | | TitanErroneousHackKeyword ErroneousAttributeSpec |
| 1787 | { |
| 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); |
| 1793 | } |
| 1794 | } |
| 1795 | | error |
| 1796 | ; |
| 1797 | |
| 1798 | ErroneousAttributeSpec: |
| 1799 | ErroneousIndicator AssignmentChar TemplateInstance optAllKeyword |
| 1800 | { |
| 1801 | act_ttcn3_erroneous_attr_spec = new ErroneousAttributeSpec($1.is_raw, $1.indicator, $3, $4); |
| 1802 | } |
| 1803 | ; |
| 1804 | |
| 1805 | ErroneousIndicator: |
| 1806 | ValueKeyword optErrValueRaw |
| 1807 | { |
| 1808 | $$.indicator = ErroneousAttributeSpec::I_VALUE; |
| 1809 | $$.is_raw = $2; |
| 1810 | } |
| 1811 | | IDentifier optErrValueRaw |
| 1812 | { |
| 1813 | if ($1->get_ttcnname()=="before") $$.indicator = ErroneousAttributeSpec::I_BEFORE; |
| 1814 | else if ($1->get_ttcnname()=="after") $$.indicator = ErroneousAttributeSpec::I_AFTER; |
| 1815 | else { |
| 1816 | Location loc(infile, @1); |
| 1817 | loc.error("Invalid indicator. Valid indicators are: " |
| 1818 | "`before', `value' and `after'"); |
| 1819 | $$.indicator = ErroneousAttributeSpec::I_INVALID; |
| 1820 | } |
| 1821 | delete $1; |
| 1822 | $$.is_raw = $2; |
| 1823 | } |
| 1824 | ; |
| 1825 | |
| 1826 | optAllKeyword: |
| 1827 | /* empty */ { $$ = false; } |
| 1828 | | AllKeyword { $$ = true; } |
| 1829 | ; |
| 1830 | |
| 1831 | optErrValueRaw: |
| 1832 | /* empty */ { $$ = false; } |
| 1833 | | '(' IDentifier ')' |
| 1834 | { |
| 1835 | if ($2->get_ttcnname()=="raw") $$ = true; |
| 1836 | else { |
| 1837 | Location loc(infile, @2); |
| 1838 | loc.error("Invalid keyword, only the optional `raw' keyword can be used here."); |
| 1839 | $$ = false; |
| 1840 | } |
| 1841 | delete $2; |
| 1842 | } |
| 1843 | ; |
| 1844 | |
| 1845 | |
| 1846 | /* A.1.6.0 TTCN Module */ |
| 1847 | |
| 1848 | TTCN3Module: // 1 |
| 1849 | TTCN3ModuleId ModuleBody optWithStatementAndSemiColon optError |
| 1850 | { |
| 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 |
| 1866 | } |
| 1867 | } |
| 1868 | ; |
| 1869 | |
| 1870 | TTCN3ModuleId: // 3 |
| 1871 | optError TTCN3ModuleKeyword IDentifier optDefinitiveIdentifier |
| 1872 | optLanguageSpec optError |
| 1873 | { |
| 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); |
| 1877 | Free($5); |
| 1878 | } |
| 1879 | ; |
| 1880 | |
| 1881 | ModuleId: // 4 |
| 1882 | GlobalModuleId optLanguageSpec |
| 1883 | { |
| 1884 | $$ = new ImpMod($1); |
| 1885 | $$->set_language_spec($2); |
| 1886 | Free($2); |
| 1887 | } |
| 1888 | ; |
| 1889 | |
| 1890 | GlobalModuleId: // 5 |
| 1891 | IDentifier { $$ = $1; } |
| 1892 | | IDentifier '.' ObjectIdentifierValue |
| 1893 | { $$ = $1; delete $3; } |
| 1894 | ; |
| 1895 | |
| 1896 | optLanguageSpec: |
| 1897 | /* empty */ { $$ = NULL; } |
| 1898 | | LanguageKeyword FreeText { $$ = $2; } // sort-of 7 LanguageSpec |
| 1899 | ; |
| 1900 | |
| 1901 | ModuleBody: |
| 1902 | '{' optErrorBlock '}' |
| 1903 | | '{' ModuleDefinitionsList optErrorBlock '}' |
| 1904 | | '{' ModuleDefinitionsList ModuleControlPart optErrorBlock '}' |
| 1905 | | '{' ModuleControlPart optErrorBlock '}' |
| 1906 | ; |
| 1907 | |
| 1908 | /* A.1.6.1 Module definitions part */ |
| 1909 | |
| 1910 | /* A.1.6.1.0 General */ |
| 1911 | |
| 1912 | ModuleDefinitionsList: // 10 |
| 1913 | ModuleDefinition optSemiColon |
| 1914 | | error ModuleDefinition optSemiColon |
| 1915 | | ModuleDefinitionsList optErrorBlock ModuleDefinition optSemiColon |
| 1916 | ; |
| 1917 | |
| 1918 | optVisibility: // 12 |
| 1919 | // /* empty */ { $$.visibility = PUBLIC;} |
| 1920 | /* empty */ { $$.visibility = NOCHANGE;} |
| 1921 | | PublicKeyword { $$.visibility = PUBLIC;} |
| 1922 | | PrivateKeyword { $$.visibility = PRIVATE;} |
| 1923 | | FriendKeyword { $$.visibility = FRIEND;} |
| 1924 | ; |
| 1925 | |
| 1926 | /* A definition _in_ the module, not a definition _of_ a module */ |
| 1927 | ModuleDefinition: // 11 |
| 1928 | optVisibility ModuleDef optWithStatement |
| 1929 | { |
| 1930 | for (size_t i = 0; i < $2.nElements; i++) { |
| 1931 | if ($3) { |
| 1932 | if (i == 0) $2.elements[i]->set_with_attr($3); |
| 1933 | else $2.elements[i]->set_with_attr($3->clone()); |
| 1934 | } |
| 1935 | if ($1.visibility != NOCHANGE) { |
| 1936 | $2.elements[i]->set_visibility($1.visibility); |
| 1937 | } |
| 1938 | act_ttcn3_module->add_ass($2.elements[i]); |
| 1939 | if (act_group) { |
| 1940 | $2.elements[i]->set_parent_path(act_group->get_attrib_path()); |
| 1941 | act_group->add_ass($2.elements[i]); |
| 1942 | } else { |
| 1943 | $2.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path()); |
| 1944 | } |
| 1945 | } |
| 1946 | Free($2.elements); |
| 1947 | } |
| 1948 | | optVisibility ImportDef optWithStatement |
| 1949 | { |
| 1950 | $2->set_with_attr($3); |
| 1951 | if ($1.visibility != NOCHANGE) { |
| 1952 | $2->set_visibility($1.visibility); |
| 1953 | } |
| 1954 | if (act_group) { |
| 1955 | $2->set_parent_path(act_group->get_attrib_path()); |
| 1956 | act_group->add_impmod($2); |
| 1957 | } else { |
| 1958 | $2->set_parent_path(act_ttcn3_module->get_attrib_path()); |
| 1959 | } |
| 1960 | act_ttcn3_module->add_impmod($2); |
| 1961 | } |
| 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(); |
| 1966 | } |
| 1967 | | GroupDef optWithStatement |
| 1968 | { // same code as above |
| 1969 | $1->set_with_attr($2); |
| 1970 | act_group = $1->get_parent_group(); |
| 1971 | } |
| 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++) { |
| 1975 | if ($3) { |
| 1976 | if (i == 0) $2.elements[i]->set_with_attr($3); |
| 1977 | else $2.elements[i]->set_with_attr($3->clone()); |
| 1978 | } |
| 1979 | act_ttcn3_module->add_friendmod($2.elements[i]); |
| 1980 | if (act_group) { |
| 1981 | $2.elements[i]->set_parent_path(act_group->get_attrib_path()); |
| 1982 | act_group->add_friendmod($2.elements[i]); |
| 1983 | } else { |
| 1984 | $2.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path()); |
| 1985 | } |
| 1986 | } |
| 1987 | Free($2.elements); |
| 1988 | } |
| 1989 | | FriendModuleDef optWithStatement |
| 1990 | { // same code as above |
| 1991 | for (size_t i = 0; i < $1.nElements; i++) { |
| 1992 | if ($2) { |
| 1993 | if (i == 0) $1.elements[i]->set_with_attr($2); |
| 1994 | else $1.elements[i]->set_with_attr($2->clone()); |
| 1995 | } |
| 1996 | act_ttcn3_module->add_friendmod($1.elements[i]); |
| 1997 | if (act_group) { |
| 1998 | $1.elements[i]->set_parent_path(act_group->get_attrib_path()); |
| 1999 | act_group->add_friendmod($1.elements[i]); |
| 2000 | } else { |
| 2001 | $1.elements[i]->set_parent_path(act_ttcn3_module->get_attrib_path()); |
| 2002 | } |
| 2003 | } |
| 2004 | Free($1.elements); |
| 2005 | } |
| 2006 | ; |
| 2007 | |
| 2008 | ModuleDef: |
| 2009 | ConstDef { $$ = $1; } |
| 2010 | | ModuleParDef { $$ = $1; } |
| 2011 | | TypeDef |
| 2012 | { |
| 2013 | $$.nElements = 1; |
| 2014 | $$.elements = (Ttcn::Definition**) |
| 2015 | Malloc(sizeof(*$$.elements)); |
| 2016 | $$.elements[0] = $1; |
| 2017 | } |
| 2018 | | TemplateDef |
| 2019 | { |
| 2020 | $$.nElements = 1; |
| 2021 | $$.elements = (Ttcn::Definition**) |
| 2022 | Malloc(sizeof(*$$.elements)); |
| 2023 | $$.elements[0] = $1; |
| 2024 | } |
| 2025 | | FunctionDef |
| 2026 | { |
| 2027 | $$.nElements = 1; |
| 2028 | $$.elements = (Ttcn::Definition**) |
| 2029 | Malloc(sizeof(*$$.elements)); |
| 2030 | $$.elements[0] = $1; |
| 2031 | } |
| 2032 | | SignatureDef |
| 2033 | { |
| 2034 | $$.nElements = 1; |
| 2035 | $$.elements = (Ttcn::Definition**) |
| 2036 | Malloc(sizeof(*$$.elements)); |
| 2037 | $$.elements[0] = $1; |
| 2038 | } |
| 2039 | | TestcaseDef |
| 2040 | { |
| 2041 | $$.nElements = 1; |
| 2042 | $$.elements = (Ttcn::Definition**) |
| 2043 | Malloc(sizeof(*$$.elements)); |
| 2044 | $$.elements[0] = $1; |
| 2045 | } |
| 2046 | | AltstepDef |
| 2047 | { |
| 2048 | $$.nElements = 1; |
| 2049 | $$.elements = (Ttcn::Definition**) |
| 2050 | Malloc(sizeof(*$$.elements)); |
| 2051 | $$.elements[0] = $1; |
| 2052 | } |
| 2053 | | ExtFunctionDef |
| 2054 | { |
| 2055 | $$.nElements = 1; |
| 2056 | $$.elements = (Ttcn::Definition**) |
| 2057 | Malloc(sizeof(*$$.elements)); |
| 2058 | $$.elements[0] = $1; |
| 2059 | } |
| 2060 | | ExtConstDef { $$ = $1; } |
| 2061 | ; |
| 2062 | |
| 2063 | /* A.1.6.1.1 Typedef definitions */ |
| 2064 | |
| 2065 | TypeDef: // 13 |
| 2066 | TypeDefKeyword TypeDefBody |
| 2067 | { |
| 2068 | $$ = $2; |
| 2069 | $$->set_location(infile, @$); |
| 2070 | } |
| 2071 | ; |
| 2072 | |
| 2073 | TypeDefBody: // 14 |
| 2074 | StructuredTypeDef { $$ = $1; } |
| 2075 | | SubTypeDef { $$ = $1; } |
| 2076 | ; |
| 2077 | |
| 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; } |
| 2090 | ; |
| 2091 | |
| 2092 | RecordDef: // 17 |
| 2093 | RecordKeyword StructDefBody |
| 2094 | { |
| 2095 | Type *type = new Type(Type::T_SEQ_T, $2.cfm); |
| 2096 | type->set_location(infile, @$); |
| 2097 | $$ = new Def_Type($2.id, type); |
| 2098 | } |
| 2099 | ; |
| 2100 | |
| 2101 | StructDefBody: // 19 |
| 2102 | IDentifier optStructDefFormalParList |
| 2103 | '{' optStructFieldDefList '}' |
| 2104 | { |
| 2105 | $$.id = $1; |
| 2106 | $$.cfm = $4; |
| 2107 | } |
| 2108 | | AddressKeyword '{' optStructFieldDefList '}' |
| 2109 | { |
| 2110 | $$.id = new Identifier(Identifier::ID_TTCN, string("address")); |
| 2111 | $$.cfm = $3; |
| 2112 | } |
| 2113 | ; |
| 2114 | |
| 2115 | optStructDefFormalParList: |
| 2116 | /* empty */ optError |
| 2117 | | '(' StructDefFormalParList optError ')' |
| 2118 | { |
| 2119 | Location loc(infile, @$); |
| 2120 | loc.error("Type parameterization is not currently supported"); |
| 2121 | } |
| 2122 | | '(' error ')' |
| 2123 | { |
| 2124 | Location loc(infile, @$); |
| 2125 | loc.error("Type parameterization is not currently supported"); |
| 2126 | } |
| 2127 | ; |
| 2128 | |
| 2129 | StructDefFormalParList: // -> 202 784 "Advanced Parameterization", 9 |
| 2130 | optError StructDefFormalPar |
| 2131 | | StructDefFormalParList optError ',' optError StructDefFormalPar |
| 2132 | | StructDefFormalParList optError ',' error |
| 2133 | ; |
| 2134 | |
| 2135 | StructDefFormalPar: // -> 202 784 "Advanced Parameterization", 10 |
| 2136 | FormalValuePar { delete $1; } |
| 2137 | ; |
| 2138 | |
| 2139 | optStructFieldDefList: |
| 2140 | /* empty */ optError { $$ = new CompFieldMap; } |
| 2141 | | StructFieldDefList optError { $$ = $1; } |
| 2142 | ; |
| 2143 | |
| 2144 | StructFieldDefList: |
| 2145 | optError StructFieldDef |
| 2146 | { |
| 2147 | $$ = new CompFieldMap; |
| 2148 | $$->add_comp($2); |
| 2149 | } |
| 2150 | | StructFieldDefList optError ',' optError StructFieldDef |
| 2151 | { |
| 2152 | $$ = $1; |
| 2153 | $$->add_comp($5); |
| 2154 | } |
| 2155 | | StructFieldDefList optError ',' error { $$ = $1; } |
| 2156 | ; |
| 2157 | |
| 2158 | StructFieldDef: // 21 |
| 2159 | TypeOrNestedTypeDef IDentifier optArrayDef optSubTypeSpec optOptionalKeyword |
| 2160 | { |
| 2161 | if ($4) { |
| 2162 | /* The subtype constraint belongs to the innermost embedded type of |
| 2163 | * possible nested 'record of' or 'set of' constructs. */ |
| 2164 | Type *t = $1; |
| 2165 | while (t->is_seof()) t = t->get_ofType(); |
| 2166 | t->set_parsed_restrictions($4); |
| 2167 | } |
| 2168 | Type *type = $1; |
| 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); |
| 2173 | } |
| 2174 | Free($3.elements); |
| 2175 | $$ = new CompField($2, type, $5); |
| 2176 | $$->set_location(infile, @$); |
| 2177 | } |
| 2178 | ; |
| 2179 | |
| 2180 | optOptionalKeyword: |
| 2181 | /* empty */ { $$ = false; } |
| 2182 | | OptionalKeyword { $$ = true; } |
| 2183 | ; |
| 2184 | |
| 2185 | TypeOrNestedTypeDef: |
| 2186 | Type { $$ = $1; } |
| 2187 | | NestedTypeDef { $$ = $1; } |
| 2188 | ; |
| 2189 | |
| 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; } |
| 2200 | ; |
| 2201 | |
| 2202 | NestedRecordDef: // 23 |
| 2203 | RecordKeyword '{' optStructFieldDefList '}' |
| 2204 | { |
| 2205 | $$ = new Type(Type::T_SEQ_T, $3); |
| 2206 | $$->set_location(infile, @$); |
| 2207 | } |
| 2208 | ; |
| 2209 | |
| 2210 | NestedUnionDef: // 24 |
| 2211 | UnionKeyword '{' UnionFieldDefList optError '}' |
| 2212 | { |
| 2213 | $$ = new Type(Type::T_CHOICE_T, $3); |
| 2214 | $$->set_location(infile, @$); |
| 2215 | } |
| 2216 | ; |
| 2217 | |
| 2218 | NestedSetDef: // 25 |
| 2219 | SetKeyword '{' optStructFieldDefList '}' |
| 2220 | { |
| 2221 | $$ = new Type(Type::T_SET_T, $3); |
| 2222 | $$->set_location(infile, @$); |
| 2223 | } |
| 2224 | ; |
| 2225 | |
| 2226 | NestedRecordOfDef: // 26 |
| 2227 | RecordKeyword optStringLength OfKeyword TypeOrNestedTypeDef |
| 2228 | { |
| 2229 | $$ = new Type(Type::T_SEQOF, $4); |
| 2230 | if ($2) { |
| 2231 | vector<SubTypeParse> *vstp = new vector<SubTypeParse>; |
| 2232 | SubTypeParse *stp = new SubTypeParse($2); |
| 2233 | vstp->add(stp); |
| 2234 | $$->set_parsed_restrictions(vstp); |
| 2235 | } |
| 2236 | $$->set_location(infile, @$); |
| 2237 | } |
| 2238 | ; |
| 2239 | |
| 2240 | NestedSetOfDef: // 27 |
| 2241 | SetKeyword optStringLength OfKeyword TypeOrNestedTypeDef |
| 2242 | { |
| 2243 | $$ = new Type(Type::T_SETOF, $4); |
| 2244 | if ($2) { |
| 2245 | vector<SubTypeParse> *vstp = new vector<SubTypeParse>; |
| 2246 | SubTypeParse *stp = new SubTypeParse($2); |
| 2247 | vstp->add(stp); |
| 2248 | $$->set_parsed_restrictions(vstp); |
| 2249 | } |
| 2250 | $$->set_location(infile, @$); |
| 2251 | } |
| 2252 | ; |
| 2253 | |
| 2254 | NestedEnumDef: // 28 |
| 2255 | EnumKeyword '{' EnumerationList optError '}' |
| 2256 | { |
| 2257 | $$ = new Type(Type::T_ENUM_T, $3); |
| 2258 | $$->set_location(infile, @$); |
| 2259 | } |
| 2260 | ; |
| 2261 | |
| 2262 | NestedFunctionTypeDef: |
| 2263 | FunctionKeyword '(' optFunctionFormalParList ')' |
| 2264 | optRunsOnComprefOrSelf optReturnType |
| 2265 | { |
| 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, @$); |
| 2270 | } |
| 2271 | ; |
| 2272 | |
| 2273 | NestedAltstepTypeDef: |
| 2274 | AltstepKeyword '(' optAltstepFormalParList ')' |
| 2275 | optRunsOnComprefOrSelf |
| 2276 | { |
| 2277 | $3->set_location(infile, @2, @4); |
| 2278 | $$ = new Type(Type::T_ALTSTEP, $3, $5.reference, $5.self); |
| 2279 | $$->set_location(infile, @$); |
| 2280 | } |
| 2281 | ; |
| 2282 | |
| 2283 | NestedTestcaseTypeDef: |
| 2284 | TestcaseKeyword '(' optTestcaseFormalParList ')' |
| 2285 | ConfigSpec |
| 2286 | { |
| 2287 | $3->set_location(infile, @2, @4); |
| 2288 | $$ = new Type(Type::T_TESTCASE, $3, $5.runsonref, |
| 2289 | $5.systemref); |
| 2290 | $$->set_location(infile, @$); |
| 2291 | } |
| 2292 | ; |
| 2293 | |
| 2294 | UnionDef: // 31 |
| 2295 | UnionKeyword UnionDefBody |
| 2296 | { |
| 2297 | Type *type = new Type(Type::T_CHOICE_T, $2.cfm); |
| 2298 | type->set_location(infile, @$); |
| 2299 | $$ = new Def_Type($2.id, type); |
| 2300 | } |
| 2301 | ; |
| 2302 | |
| 2303 | UnionDefBody: // 33 |
| 2304 | IDentifier optStructDefFormalParList |
| 2305 | '{' UnionFieldDefList optError '}' |
| 2306 | { |
| 2307 | $$.id = $1; |
| 2308 | $$.cfm = $4; |
| 2309 | } |
| 2310 | | AddressKeyword '{' UnionFieldDefList optError '}' |
| 2311 | { |
| 2312 | $$.id = new Identifier(Identifier::ID_TTCN, string("address")); |
| 2313 | $$.cfm = $3; |
| 2314 | } |
| 2315 | ; |
| 2316 | |
| 2317 | UnionFieldDefList: |
| 2318 | optError UnionFieldDef |
| 2319 | { |
| 2320 | $$ = new CompFieldMap; |
| 2321 | $$->add_comp($2); |
| 2322 | } |
| 2323 | | UnionFieldDefList optError ',' optError UnionFieldDef |
| 2324 | { |
| 2325 | $$ = $1; |
| 2326 | $$->add_comp($5); |
| 2327 | } |
| 2328 | | UnionFieldDefList optError ',' error { $$ = $1; } |
| 2329 | | error { $$ = new CompFieldMap; } |
| 2330 | ; |
| 2331 | |
| 2332 | UnionFieldDef: // 34 |
| 2333 | TypeOrNestedTypeDef IDentifier optArrayDef optSubTypeSpec |
| 2334 | { |
| 2335 | if ($4) { |
| 2336 | /* The subtype constraint belongs to the innermost embedded type of |
| 2337 | * possible nested 'record of' or 'set of' constructs. */ |
| 2338 | Type *t = $1; |
| 2339 | while (t->is_seof()) t = t->get_ofType(); |
| 2340 | t->set_parsed_restrictions($4); |
| 2341 | } |
| 2342 | Type *type = $1; |
| 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); |
| 2347 | } |
| 2348 | Free($3.elements); |
| 2349 | $$ = new CompField($2, type, false); |
| 2350 | $$->set_location(infile, @$); |
| 2351 | } |
| 2352 | ; |
| 2353 | |
| 2354 | SetDef: // 35 |
| 2355 | SetKeyword StructDefBody |
| 2356 | { |
| 2357 | Type *type = new Type(Type::T_SET_T, $2.cfm); |
| 2358 | type->set_location(infile, @$); |
| 2359 | $$ = new Def_Type($2.id, type); |
| 2360 | } |
| 2361 | ; |
| 2362 | |
| 2363 | RecordOfDef: // 37 |
| 2364 | RecordKeyword optStringLength OfKeyword StructOfDefBody |
| 2365 | { |
| 2366 | Type *type = new Type(Type::T_SEQOF, $4.type); |
| 2367 | if ($2) { |
| 2368 | vector<SubTypeParse> *vstp = new vector<SubTypeParse>; |
| 2369 | vstp->add(new SubTypeParse($2)); |
| 2370 | type->set_parsed_restrictions(vstp); |
| 2371 | } |
| 2372 | type->set_location(infile, @$); |
| 2373 | $$ = new Def_Type($4.id, type); |
| 2374 | } |
| 2375 | ; |
| 2376 | |
| 2377 | StructOfDefBody: // 39 |
| 2378 | TypeOrNestedTypeDef IdentifierOrAddressKeyword optSubTypeSpec |
| 2379 | { |
| 2380 | if ($3) { |
| 2381 | /* The subtype constraint belongs to the innermost embedded type of |
| 2382 | * possible nested 'record of' or 'set of' constructs. */ |
| 2383 | Type *t = $1; |
| 2384 | while (t->is_seof()) t = t->get_ofType(); |
| 2385 | t->set_parsed_restrictions($3); |
| 2386 | } |
| 2387 | $$.type = $1; |
| 2388 | $$.id = $2; |
| 2389 | } |
| 2390 | ; |
| 2391 | |
| 2392 | IdentifierOrAddressKeyword: |
| 2393 | IDentifier { $$ = $1; } |
| 2394 | | AddressKeyword |
| 2395 | { |
| 2396 | $$ = new Identifier(Identifier::ID_TTCN, string("address")); |
| 2397 | } |
| 2398 | ; |
| 2399 | |
| 2400 | SetOfDef: // 40 |
| 2401 | SetKeyword optStringLength OfKeyword StructOfDefBody |
| 2402 | { |
| 2403 | Type *type = new Type(Type::T_SETOF, $4.type); |
| 2404 | if ($2) { |
| 2405 | vector<SubTypeParse> *vstp = new vector<SubTypeParse>; |
| 2406 | vstp->add(new SubTypeParse($2)); |
| 2407 | type->set_parsed_restrictions(vstp); |
| 2408 | } |
| 2409 | type->set_location(infile, @$); |
| 2410 | $$ = new Def_Type($4.id, type); |
| 2411 | } |
| 2412 | ; |
| 2413 | |
| 2414 | EnumDef: // 41 |
| 2415 | EnumKeyword IdentifierOrAddressKeyword |
| 2416 | '{' EnumerationList optError '}' |
| 2417 | { |
| 2418 | Type *type = new Type(Type::T_ENUM_T, $4); |
| 2419 | type->set_location(infile, @$); |
| 2420 | $$ = new Def_Type($2, type); |
| 2421 | } |
| 2422 | ; |
| 2423 | |
| 2424 | EnumerationList: // 44 |
| 2425 | optError Enumeration |
| 2426 | { |
| 2427 | $$ = new EnumItems; |
| 2428 | $$->add_ei($2); |
| 2429 | } |
| 2430 | | EnumerationList optError ',' optError Enumeration |
| 2431 | { |
| 2432 | $$ = $1; |
| 2433 | $$->add_ei($5); |
| 2434 | } |
| 2435 | | EnumerationList optError ',' error { $$ = $1; } |
| 2436 | | error { $$ = new EnumItems; } |
| 2437 | ; |
| 2438 | |
| 2439 | Enumeration: // 45 |
| 2440 | IDentifier |
| 2441 | { |
| 2442 | $$ = new EnumItem($1, NULL); |
| 2443 | $$->set_location(infile, @$); |
| 2444 | } |
| 2445 | | IDentifier '(' Number optError ')' |
| 2446 | { |
| 2447 | Value *value = new Value(Value::V_INT, $3); |
| 2448 | value->set_location(infile, @3); |
| 2449 | $$ = new EnumItem($1, value); |
| 2450 | $$->set_location(infile, @$); |
| 2451 | } |
| 2452 | | IDentifier '(' '-' Number optError ')' |
| 2453 | { |
| 2454 | *$4 = -*$4; |
| 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, @$); |
| 2459 | } |
| 2460 | | IDentifier '(' error ')' |
| 2461 | { |
| 2462 | Value *value = new Value(Value::V_ERROR); |
| 2463 | value->set_location(infile, @3); |
| 2464 | $$ = new EnumItem($1, value); |
| 2465 | $$->set_location(infile, @$); |
| 2466 | } |
| 2467 | ; |
| 2468 | |
| 2469 | SubTypeDef: // 47 |
| 2470 | Type IdentifierOrAddressKeyword optArrayDef optSubTypeSpec |
| 2471 | { |
| 2472 | /* the subtype constraint belongs to the innermost type */ |
| 2473 | if ($4) $1->set_parsed_restrictions($4); |
| 2474 | Type *type = $1; |
| 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); |
| 2479 | } |
| 2480 | Free($3.elements); |
| 2481 | $$ = new Def_Type($2, type); |
| 2482 | } |
| 2483 | ; |
| 2484 | |
| 2485 | optSubTypeSpec: // [49] |
| 2486 | /* empty */ { $$ = 0; } |
| 2487 | | AllowedValues { $$ = $1; } |
| 2488 | | AllowedValues StringLength |
| 2489 | { |
| 2490 | $$ = $1; |
| 2491 | $$->add(new SubTypeParse($2)); |
| 2492 | } |
| 2493 | | StringLength |
| 2494 | { |
| 2495 | $$ = new vector<SubTypeParse>; |
| 2496 | $$->add(new SubTypeParse($1)); |
| 2497 | } |
| 2498 | ; |
| 2499 | |
| 2500 | AllowedValues: // 50 |
| 2501 | '(' seqValueOrRange optError ')' { $$ = $2; } |
| 2502 | | '(' CharStringMatch optError ')' |
| 2503 | { |
| 2504 | $$ = new vector<SubTypeParse>; |
| 2505 | $$->add(new SubTypeParse($2)); |
| 2506 | } |
| 2507 | | '(' error ')' { $$ = new vector<SubTypeParse>; } |
| 2508 | ; |
| 2509 | |
| 2510 | seqValueOrRange: |
| 2511 | optError ValueOrRange |
| 2512 | { |
| 2513 | $$ = new vector<SubTypeParse>; |
| 2514 | $$->add($2); |
| 2515 | } |
| 2516 | | seqValueOrRange optError ',' optError ValueOrRange |
| 2517 | { |
| 2518 | $$ = $1; |
| 2519 | $$->add($5); |
| 2520 | } |
| 2521 | | seqValueOrRange optError ',' error { $$ = $1; } |
| 2522 | ; |
| 2523 | |
| 2524 | ValueOrRange: // 51 |
| 2525 | RangeDef { $$ = new SubTypeParse($1.lower, $1.lower_exclusive, $1.upper, $1.upper_exclusive); } |
| 2526 | | Expression { $$ = new SubTypeParse($1); } |
| 2527 | ; |
| 2528 | |
| 2529 | RangeDef: // 52 |
| 2530 | LowerBound DotDot UpperBound |
| 2531 | { |
| 2532 | $$.lower_exclusive = false; |
| 2533 | $$.lower = $1; |
| 2534 | $$.upper_exclusive = false; |
| 2535 | $$.upper = $3; |
| 2536 | } |
| 2537 | | '!' LowerBound DotDot UpperBound |
| 2538 | { |
| 2539 | $$.lower_exclusive = true; |
| 2540 | $$.lower = $2; |
| 2541 | $$.upper_exclusive = false; |
| 2542 | $$.upper = $4; |
| 2543 | } |
| 2544 | | LowerBound DotDot '!' UpperBound |
| 2545 | { |
| 2546 | $$.lower_exclusive = false; |
| 2547 | $$.lower = $1; |
| 2548 | $$.upper_exclusive = true; |
| 2549 | $$.upper = $4; |
| 2550 | } |
| 2551 | | '!' LowerBound DotDot '!' UpperBound |
| 2552 | { |
| 2553 | $$.lower_exclusive = true; |
| 2554 | $$.lower = $2; |
| 2555 | $$.upper_exclusive = true; |
| 2556 | $$.upper = $5; |
| 2557 | } |
| 2558 | ; |
| 2559 | |
| 2560 | optStringLength: |
| 2561 | /* empty */ optError { $$ = 0; } |
| 2562 | | StringLength { $$ = $1; } |
| 2563 | ; |
| 2564 | |
| 2565 | StringLength: // 53 |
| 2566 | LengthKeyword '(' Expression optError ')' |
| 2567 | { |
| 2568 | $$ = new LengthRestriction($3); |
| 2569 | $$->set_location(infile, @$); |
| 2570 | } |
| 2571 | | LengthKeyword '(' Expression DotDot UpperBound optError ')' |
| 2572 | { |
| 2573 | $$ = new LengthRestriction($3, $5); |
| 2574 | $$->set_location(infile, @$); |
| 2575 | } |
| 2576 | | LengthKeyword '(' error ')' |
| 2577 | { |
| 2578 | Value *value = new Value(Value::V_ERROR); |
| 2579 | value->set_location(infile, @3); |
| 2580 | $$ = new LengthRestriction(value); |
| 2581 | $$->set_location(infile, @$); |
| 2582 | } |
| 2583 | ; |
| 2584 | |
| 2585 | PortType: // 55 |
| 2586 | IDentifier |
| 2587 | { |
| 2588 | $$ = new Ttcn::Reference($1); |
| 2589 | $$->set_location(infile, @$); |
| 2590 | } |
| 2591 | | IDentifier '.' IDentifier |
| 2592 | { |
| 2593 | $$ = new Ttcn::Reference($1, $3); |
| 2594 | $$->set_location(infile, @$); |
| 2595 | } |
| 2596 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier |
| 2597 | { |
| 2598 | $$ = new Ttcn::Reference($1, $5); |
| 2599 | $$->set_location(infile, @$); |
| 2600 | delete $3; |
| 2601 | } |
| 2602 | ; |
| 2603 | |
| 2604 | PortDef: // 56 |
| 2605 | PortKeyword PortDefBody { $$ = $2; } |
| 2606 | ; |
| 2607 | |
| 2608 | PortDefBody: // 57 |
| 2609 | IDentifier PortDefAttribs |
| 2610 | { |
| 2611 | $$ = new Def_Type($1, $2); |
| 2612 | } |
| 2613 | ; |
| 2614 | |
| 2615 | PortDefAttribs: // 60 |
| 2616 | PortOperationMode PortDefLists |
| 2617 | { |
| 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, @$); |
| 2624 | } |
| 2625 | ; |
| 2626 | |
| 2627 | PortOperationMode: |
| 2628 | MessageKeyword { $$ = PortTypeBody::PO_MESSAGE; } // 61 |
| 2629 | | ProcedureKeyword { $$ = PortTypeBody::PO_PROCEDURE; } // 68 |
| 2630 | | MixedKeyword { $$ = PortTypeBody::PO_MIXED; } // 73 |
| 2631 | | error { $$ = PortTypeBody::PO_MIXED; } |
| 2632 | ; |
| 2633 | |
| 2634 | PortDefLists: |
| 2635 | '{' seqPortDefList '}' { $$ = $2; } |
| 2636 | | '{' error '}' |
| 2637 | { |
| 2638 | $$.in_list = 0; |
| 2639 | $$.out_list = 0; |
| 2640 | $$.inout_list = 0; |
| 2641 | $$.in_all = false; |
| 2642 | $$.out_all = false; |
| 2643 | $$.inout_all = false; |
| 2644 | } |
| 2645 | ; |
| 2646 | |
| 2647 | seqPortDefList: |
| 2648 | optError PortDefList optSemiColon { $$ = $2; } |
| 2649 | | seqPortDefList PortDefList optSemiColon |
| 2650 | { |
| 2651 | $$ = $1; |
| 2652 | if ($2.in_list) { |
| 2653 | if ($$.in_list) { |
| 2654 | $$.in_list->steal_types($2.in_list); |
| 2655 | delete $2.in_list; |
| 2656 | } else $$.in_list = $2.in_list; |
| 2657 | } |
| 2658 | if ($2.out_list) { |
| 2659 | if ($$.out_list) { |
| 2660 | $$.out_list->steal_types($2.out_list); |
| 2661 | delete $2.out_list; |
| 2662 | } else $$.out_list = $2.out_list; |
| 2663 | } |
| 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; |
| 2669 | } |
| 2670 | if ($2.in_all) { |
| 2671 | if ($$.in_all) { |
| 2672 | Location loc(infile, @2); |
| 2673 | loc.warning("Duplicate directive `in all' in port type definition"); |
| 2674 | } else $$.in_all = true; |
| 2675 | } |
| 2676 | if ($2.out_all) { |
| 2677 | if ($$.out_all) { |
| 2678 | Location loc(infile, @2); |
| 2679 | loc.warning("Duplicate directive `out all' in port type definition"); |
| 2680 | } else $$.out_all = true; |
| 2681 | } |
| 2682 | if ($2.inout_all) { |
| 2683 | if ($$.inout_all) { |
| 2684 | Location loc(infile, @2); |
| 2685 | loc.warning("Duplicate directive `inout all' in port type definition"); |
| 2686 | } else $$.inout_all = true; |
| 2687 | } |
| 2688 | } |
| 2689 | ; |
| 2690 | |
| 2691 | PortDefList: |
| 2692 | InParKeyword AllOrTypeList |
| 2693 | { |
| 2694 | if ($2) { |
| 2695 | $$.in_list = $2; |
| 2696 | $$.in_list->set_location(infile, @$); |
| 2697 | $$.in_all = false; |
| 2698 | } else { |
| 2699 | $$.in_list = 0; |
| 2700 | $$.in_all = true; |
| 2701 | } |
| 2702 | $$.out_list = 0; |
| 2703 | $$.out_all = false; |
| 2704 | $$.inout_list = 0; |
| 2705 | $$.inout_all = false; |
| 2706 | } |
| 2707 | | OutParKeyword AllOrTypeList |
| 2708 | { |
| 2709 | $$.in_list = 0; |
| 2710 | $$.in_all = false; |
| 2711 | if ($2) { |
| 2712 | $$.out_list = $2; |
| 2713 | $$.out_list->set_location(infile, @$); |
| 2714 | $$.out_all = false; |
| 2715 | } else { |
| 2716 | $$.out_list = 0; |
| 2717 | $$.out_all = true; |
| 2718 | } |
| 2719 | $$.inout_list = 0; |
| 2720 | $$.inout_all = false; |
| 2721 | } |
| 2722 | | InOutParKeyword AllOrTypeList |
| 2723 | { |
| 2724 | $$.in_list = 0; |
| 2725 | $$.in_all = false; |
| 2726 | $$.out_list = 0; |
| 2727 | $$.out_all = false; |
| 2728 | if ($2) { |
| 2729 | $$.inout_list = $2; |
| 2730 | $$.inout_list->set_location(infile, @$); |
| 2731 | $$.inout_all = false; |
| 2732 | } else { |
| 2733 | $$.inout_list = 0; |
| 2734 | $$.inout_all = true; |
| 2735 | } |
| 2736 | } |
| 2737 | | InParKeyword error |
| 2738 | { |
| 2739 | $$.in_list = 0; |
| 2740 | $$.out_list = 0; |
| 2741 | $$.inout_list = 0; |
| 2742 | $$.in_all = false; |
| 2743 | $$.out_all = false; |
| 2744 | $$.inout_all = false; |
| 2745 | } |
| 2746 | | OutParKeyword error |
| 2747 | { |
| 2748 | $$.in_list = 0; |
| 2749 | $$.out_list = 0; |
| 2750 | $$.inout_list = 0; |
| 2751 | $$.in_all = false; |
| 2752 | $$.out_all = false; |
| 2753 | $$.inout_all = false; |
| 2754 | } |
| 2755 | | InOutParKeyword error |
| 2756 | { |
| 2757 | $$.in_list = 0; |
| 2758 | $$.out_list = 0; |
| 2759 | $$.inout_list = 0; |
| 2760 | $$.in_all = false; |
| 2761 | $$.out_all = false; |
| 2762 | $$.inout_all = false; |
| 2763 | } |
| 2764 | ; |
| 2765 | |
| 2766 | AllOrTypeList: // 65 |
| 2767 | AllKeyword { $$ = 0; } |
| 2768 | | TypeList { $$ = $1; } |
| 2769 | ; |
| 2770 | |
| 2771 | TypeList: // 67 |
| 2772 | optError Type |
| 2773 | { |
| 2774 | $$ = new Types; |
| 2775 | $$->add_type($2); |
| 2776 | } |
| 2777 | | TypeList optError ',' optError Type |
| 2778 | { |
| 2779 | $$ = $1; |
| 2780 | $$->add_type($5); |
| 2781 | } |
| 2782 | | TypeList optError ',' error { $$ = $1; } |
| 2783 | ; |
| 2784 | |
| 2785 | ComponentDef: // 78 |
| 2786 | ComponentKeyword IDentifier |
| 2787 | optExtendsDef |
| 2788 | '{' optComponentDefList '}' |
| 2789 | { |
| 2790 | $5->set_id($2); |
| 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); |
| 2796 | } |
| 2797 | ; |
| 2798 | |
| 2799 | optExtendsDef: |
| 2800 | /* empty */ optError { $$ = 0; } |
| 2801 | | ExtendsKeyword ComponentTypeList optError |
| 2802 | { |
| 2803 | $$ = $2; |
| 2804 | $$->set_location(infile, @1, @2); |
| 2805 | } |
| 2806 | | ExtendsKeyword error { $$ = 0; } |
| 2807 | ; |
| 2808 | |
| 2809 | ComponentTypeList: |
| 2810 | optError ComponentType |
| 2811 | { |
| 2812 | $$ = new CompTypeRefList(); |
| 2813 | $$->add_ref($2); |
| 2814 | } |
| 2815 | | ComponentTypeList optError ',' optError ComponentType |
| 2816 | { |
| 2817 | $$ = $1; |
| 2818 | $$->add_ref($5); |
| 2819 | } |
| 2820 | | ComponentTypeList optError ',' error { $$ = $1; } |
| 2821 | ; |
| 2822 | |
| 2823 | ComponentType: // 81 |
| 2824 | IDentifier |
| 2825 | { |
| 2826 | $$ = new Ttcn::Reference($1); |
| 2827 | $$->set_location(infile, @$); |
| 2828 | } |
| 2829 | | IDentifier '.' IDentifier |
| 2830 | { |
| 2831 | $$ = new Ttcn::Reference($1, $3); |
| 2832 | $$->set_location(infile, @$); |
| 2833 | } |
| 2834 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier |
| 2835 | { |
| 2836 | $$ = new Ttcn::Reference($1, $5); |
| 2837 | $$->set_location(infile, @$); |
| 2838 | delete $3; |
| 2839 | } |
| 2840 | ; |
| 2841 | |
| 2842 | optComponentDefList: |
| 2843 | optError /* empty */ { $$ = new ComponentTypeBody(); } |
| 2844 | | ComponentElementDefList optError { $$ = $1; } |
| 2845 | ; |
| 2846 | |
| 2847 | ComponentElementDefList: |
| 2848 | optError ComponentElementDef optSemiColon |
| 2849 | { |
| 2850 | $$ = new ComponentTypeBody(); |
| 2851 | for (size_t i = 0; i < $2.nElements; i++) |
| 2852 | $$->add_ass($2.elements[i]); |
| 2853 | Free($2.elements); |
| 2854 | } |
| 2855 | | ComponentElementDefList optError ComponentElementDef optSemiColon |
| 2856 | { |
| 2857 | $$ = $1; |
| 2858 | for (size_t i = 0; i < $3.nElements; i++) |
| 2859 | $$->add_ass($3.elements[i]); |
| 2860 | Free($3.elements); |
| 2861 | } |
| 2862 | ; |
| 2863 | |
| 2864 | ComponentElementVisibility: |
| 2865 | PublicKeyword { $$.visibility = PUBLIC;} |
| 2866 | | PrivateKeyword { $$.visibility = PRIVATE;} |
| 2867 | ; |
| 2868 | |
| 2869 | ComponentElementDef: // 84 |
| 2870 | PortInstance { $$ = $1; } |
| 2871 | | VarInstance { $$ = $1; } |
| 2872 | | TimerInstance { $$ = $1; } |
| 2873 | | ConstDef { $$ = $1; } |
| 2874 | | ComponentElementVisibility PortInstance |
| 2875 | { |
| 2876 | $$ = $2; |
| 2877 | for (size_t i = 0; i < $2.nElements; i++) { |
| 2878 | $2.elements[i]->set_visibility($1.visibility); |
| 2879 | } |
| 2880 | } |
| 2881 | | ComponentElementVisibility VarInstance |
| 2882 | { |
| 2883 | $$ = $2; |
| 2884 | for (size_t i = 0; i < $2.nElements; i++) { |
| 2885 | $2.elements[i]->set_visibility($1.visibility); |
| 2886 | } |
| 2887 | } |
| 2888 | | ComponentElementVisibility TimerInstance |
| 2889 | { |
| 2890 | $$ = $2; |
| 2891 | for (size_t i = 0; i < $2.nElements; i++) { |
| 2892 | $2.elements[i]->set_visibility($1.visibility); |
| 2893 | } |
| 2894 | } |
| 2895 | | ComponentElementVisibility ConstDef |
| 2896 | { |
| 2897 | $$ = $2; |
| 2898 | for (size_t i = 0; i < $2.nElements; i++) { |
| 2899 | $2.elements[i]->set_visibility($1.visibility); |
| 2900 | } |
| 2901 | } |
| 2902 | ; |
| 2903 | |
| 2904 | PortInstance: // 85 |
| 2905 | PortKeyword PortType PortElementList |
| 2906 | { |
| 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); |
| 2915 | } |
| 2916 | Free($3.elements); |
| 2917 | } |
| 2918 | ; |
| 2919 | |
| 2920 | PortElementList: |
| 2921 | optError PortElement |
| 2922 | { |
| 2923 | $$.nElements = 1; |
| 2924 | $$.elements = (YYSTYPE::portelement_t*)Malloc(sizeof(*$$.elements)); |
| 2925 | $$.elements[0] = $2; |
| 2926 | } |
| 2927 | | PortElementList ',' optError PortElement |
| 2928 | { |
| 2929 | $$.nElements = $1.nElements + 1; |
| 2930 | $$.elements = (YYSTYPE::portelement_t*) |
| 2931 | Realloc($1.elements, $$.nElements * sizeof(*$$.elements)); |
| 2932 | $$.elements[$$.nElements - 1] = $4; |
| 2933 | } |
| 2934 | | PortElementList ',' error { $$ = $1; } |
| 2935 | ; |
| 2936 | |
| 2937 | PortElement: // 86 |
| 2938 | IDentifier optArrayDef |
| 2939 | { |
| 2940 | $$.id = $1; |
| 2941 | if ($2.nElements > 0) { |
| 2942 | $$.dims = new ArrayDimensions; |
| 2943 | for (size_t i = 0; i < $2.nElements; i++) $$.dims->add($2.elements[i]); |
| 2944 | Free($2.elements); |
| 2945 | } else $$.dims = 0; |
| 2946 | $$.yyloc = @$; |
| 2947 | } |
| 2948 | ; |
| 2949 | |
| 2950 | /* A.1.6.1.2 Constant definitions */ |
| 2951 | |
| 2952 | ConstDef: // 88 |
| 2953 | ConstKeyword Type ConstList |
| 2954 | { |
| 2955 | $$.nElements = $3.nElements; |
| 2956 | $$.elements = (Ttcn::Definition**) |
| 2957 | Malloc($$.nElements*sizeof(*$$.elements)); |
| 2958 | for (size_t i = 0; i < $$.nElements; i++) { |
| 2959 | Type *type; |
| 2960 | if (i > 0) { |
| 2961 | type = new Type(Type::T_REFDSPEC, $2); |
| 2962 | type->set_location(*$2); |
| 2963 | } else type = $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); |
| 2969 | } |
| 2970 | Free($3.elements[i].arrays.elements); |
| 2971 | |
| 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); |
| 2976 | } |
| 2977 | Free($3.elements); |
| 2978 | } |
| 2979 | ; |
| 2980 | |
| 2981 | ConstList: // 98 |
| 2982 | optError SingleConstDef |
| 2983 | { |
| 2984 | $$.nElements = 1; |
| 2985 | $$.elements = (YYSTYPE::singlevarinst_t*)Malloc(sizeof(*$$.elements)); |
| 2986 | $$.elements[0] = $2; |
| 2987 | } |
| 2988 | | ConstList ',' optError SingleConstDef |
| 2989 | { |
| 2990 | $$.nElements = $1.nElements + 1; |
| 2991 | $$.elements = (YYSTYPE::singlevarinst_t*) |
| 2992 | Realloc($1.elements, $$.nElements * sizeof(*$$.elements)); |
| 2993 | $$.elements[$$.nElements - 1] = $4; |
| 2994 | } |
| 2995 | ; |
| 2996 | |
| 2997 | SingleConstDef: // 90 |
| 2998 | IDentifier optArrayDef AssignmentChar Expression |
| 2999 | { |
| 3000 | $$.id = $1; |
| 3001 | $$.arrays = $2; |
| 3002 | $$.initial_value = $4; |
| 3003 | $$.yyloc = @$; |
| 3004 | } |
| 3005 | ; |
| 3006 | |
| 3007 | FunctionTypeDef: |
| 3008 | FunctionKeyword IDentifier '(' optFunctionFormalParList ')' |
| 3009 | optRunsOnComprefOrSelf optReturnType |
| 3010 | { |
| 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, @$); |
| 3017 | } |
| 3018 | ; |
| 3019 | |
| 3020 | AltstepTypeDef: |
| 3021 | AltstepKeyword IDentifier '(' optAltstepFormalParList ')' |
| 3022 | optRunsOnComprefOrSelf |
| 3023 | { |
| 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, @$); |
| 3029 | } |
| 3030 | ; |
| 3031 | |
| 3032 | TestcaseTypeDef: |
| 3033 | TestcaseKeyword IDentifier '(' optTestcaseFormalParList ')' |
| 3034 | ConfigSpec |
| 3035 | { |
| 3036 | $4->set_location(infile, @3, @5); |
| 3037 | Type *type = new Type(Type::T_TESTCASE, $4, $6.runsonref, |
| 3038 | $6.systemref); |
| 3039 | type->set_location(infile, @$); |
| 3040 | $$ = new Ttcn::Def_Type($2, type); |
| 3041 | $$->set_location(infile, @$); |
| 3042 | } |
| 3043 | ; |
| 3044 | |
| 3045 | /* A.1.6.1.3 Template definitions */ |
| 3046 | |
| 3047 | TemplateDef: // 93 |
| 3048 | TemplateKeyword optTemplateRestriction BaseTemplate |
| 3049 | optDerivedDef AssignmentChar TemplateBody |
| 3050 | { |
| 3051 | $$ = new Def_Template($2, $3.name, $3.type, $3.fp_list, $4, $6); |
| 3052 | $$->set_location(infile, @$); |
| 3053 | } |
| 3054 | ; |
| 3055 | |
| 3056 | BaseTemplate: // 94 |
| 3057 | Type IDentifier optTemplateFormalParList |
| 3058 | { |
| 3059 | $$.name = $2; |
| 3060 | $$.type = $1; |
| 3061 | $$.fp_list = $3; |
| 3062 | } |
| 3063 | /* | Signature IDentifier optTemplateFormalParList -- covered by the previous |
| 3064 | rule */ |
| 3065 | ; |
| 3066 | |
| 3067 | optDerivedDef: |
| 3068 | /* empty */ { $$ = 0; } |
| 3069 | | DerivedDef { $$ = $1; } |
| 3070 | ; |
| 3071 | |
| 3072 | DerivedDef: // 97 |
| 3073 | ModifiesKeyword TemplateRef |
| 3074 | { |
| 3075 | $$ = new Ttcn::Reference($2.modid, $2.id); |
| 3076 | $$->set_location(infile, @$); |
| 3077 | } |
| 3078 | | ModifiesKeyword error { $$ = 0; } |
| 3079 | ; |
| 3080 | |
| 3081 | optTemplateFormalParList: |
| 3082 | /* empty */ optError { $$ = 0; } |
| 3083 | | '(' TemplateFormalParList optError ')' |
| 3084 | { |
| 3085 | $$ = $2; |
| 3086 | $$->set_location(infile, @$); |
| 3087 | } |
| 3088 | | '(' error ')' |
| 3089 | { |
| 3090 | $$ = new FormalParList; |
| 3091 | $$->set_location(infile, @$); |
| 3092 | } |
| 3093 | ; |
| 3094 | |
| 3095 | TemplateFormalParList: // 99 is a FormalParList* |
| 3096 | optError TemplateFormalPar |
| 3097 | { |
| 3098 | $$ = new FormalParList; |
| 3099 | $$->add_fp($2); |
| 3100 | } |
| 3101 | | TemplateFormalParList optError ',' optError TemplateFormalPar |
| 3102 | { |
| 3103 | $$ = $1; |
| 3104 | $$->add_fp($5); |
| 3105 | } |
| 3106 | | TemplateFormalParList optError ',' error { $$ = $1; } |
| 3107 | ; |
| 3108 | |
| 3109 | TemplateFormalPar: // 100 |
| 3110 | FormalValuePar { $$ = $1; } |
| 3111 | | FormalTemplatePar { $$ = $1; } |
| 3112 | ; |
| 3113 | |
| 3114 | TemplateBody: // 101 is a Template* |
| 3115 | SimpleSpec optExtraMatchingAttributes |
| 3116 | { |
| 3117 | $$ = $1; |
| 3118 | $$->set_length_restriction($2.len_restr); |
| 3119 | $$->set_ifpresent($2.is_ifpresent); |
| 3120 | } |
| 3121 | | FieldSpecList optExtraMatchingAttributes |
| 3122 | { |
| 3123 | $$ = $1; |
| 3124 | $$->set_length_restriction($2.len_restr); |
| 3125 | $$->set_ifpresent($2.is_ifpresent); |
| 3126 | } |
| 3127 | | ArraySpecList optExtraMatchingAttributes |
| 3128 | { |
| 3129 | $$ = $1; |
| 3130 | $$->set_length_restriction($2.len_restr); |
| 3131 | $$->set_ifpresent($2.is_ifpresent); |
| 3132 | } |
| 3133 | | ArrayValueOrAttrib optExtraMatchingAttributes |
| 3134 | { |
| 3135 | $$ = $1; |
| 3136 | $$->set_length_restriction($2.len_restr); |
| 3137 | $$->set_ifpresent($2.is_ifpresent); |
| 3138 | } |
| 3139 | ; |
| 3140 | |
| 3141 | SimpleSpec: // 102 |
| 3142 | SingleValueOrAttrib { $$ = $1; } |
| 3143 | ; |
| 3144 | |
| 3145 | FieldSpecList: // 103 |
| 3146 | '{' '}' |
| 3147 | { |
| 3148 | $$ = new Template(Template::TEMPLATE_LIST, new Templates()); |
| 3149 | $$->set_location(infile, @$); |
| 3150 | |
| 3151 | } |
| 3152 | | '{' seqFieldSpec optError '}' |
| 3153 | { |
| 3154 | $$ = new Template($2); // NAMED_TEMLATE_LIST |
| 3155 | $$->set_location(infile, @$); |
| 3156 | } |
| 3157 | | '{' error '}' |
| 3158 | { |
| 3159 | $$ = new Template(Template::TEMPLATE_ERROR); |
| 3160 | $$->set_location(infile, @$); |
| 3161 | } |
| 3162 | ; |
| 3163 | |
| 3164 | /* Sequence of FieldSpec. \note Cannot be empty */ |
| 3165 | seqFieldSpec: // a NamedTemplates* |
| 3166 | FieldSpec |
| 3167 | { |
| 3168 | $$ = new NamedTemplates(); |
| 3169 | $$->add_nt($1); |
| 3170 | } |
| 3171 | | error FieldSpec |
| 3172 | { |
| 3173 | $$ = new NamedTemplates(); |
| 3174 | $$->add_nt($2); |
| 3175 | } |
| 3176 | | seqFieldSpec optError ',' optError FieldSpec |
| 3177 | { |
| 3178 | $$=$1; |
| 3179 | $$->add_nt($5); |
| 3180 | } |
| 3181 | | seqFieldSpec optError ',' error { $$ = $1; } |
| 3182 | ; |
| 3183 | |
| 3184 | FieldSpec: // 104 a NamedTemplate* |
| 3185 | FieldReference AssignmentChar TemplateBody |
| 3186 | { |
| 3187 | $$ = new NamedTemplate($1, $3); |
| 3188 | $$->set_location(infile, @$); |
| 3189 | } |
| 3190 | | FieldReference AssignmentChar NotUsedSymbol |
| 3191 | { |
| 3192 | Template* temp = new Template(Template::TEMPLATE_NOTUSED); |
| 3193 | temp->set_location(infile, @3); |
| 3194 | $$ = new NamedTemplate($1, temp); |
| 3195 | $$->set_location(infile, @$); |
| 3196 | } |
| 3197 | ; |
| 3198 | |
| 3199 | FieldReference: // 105 |
| 3200 | StructFieldRef { $$ = $1; } |
| 3201 | /* | ArrayOrBitRef -- covered by ArraySpecList */ |
| 3202 | /* | ParRef -- covered by StructFieldRef */ |
| 3203 | ; |
| 3204 | |
| 3205 | StructFieldRef: // 106 (and 107. ParRef) |
| 3206 | PredefOrIdentifier { $$ = $1; } |
| 3207 | /* | TypeReference |
| 3208 | Note: Non-parameterized type references are covered by (StructField)Identifier. |
| 3209 | Parameterized type references are covered by FunctionInstance */ |
| 3210 | | FunctionInstance |
| 3211 | { |
| 3212 | Location loc(infile, @$); |
| 3213 | loc.error("Reference to a parameterized field of type `anytype' is " |
| 3214 | "not currently supported"); |
| 3215 | delete $1; |
| 3216 | $$ = new Identifier(Identifier::ID_TTCN, string("<error>")); |
| 3217 | } |
| 3218 | ; |
| 3219 | |
| 3220 | ArraySpecList: |
| 3221 | '{' seqArraySpec optError '}' |
| 3222 | { |
| 3223 | $$ = new Template($2); |
| 3224 | $$->set_location(infile, @$); |
| 3225 | } |
| 3226 | ; |
| 3227 | |
| 3228 | seqArraySpec: |
| 3229 | ArraySpec |
| 3230 | { |
| 3231 | $$ = new IndexedTemplates(); |
| 3232 | $$->add_it($1); |
| 3233 | } |
| 3234 | /* It was optError before. */ |
| 3235 | | error ArraySpec |
| 3236 | { |
| 3237 | $$ = new IndexedTemplates(); |
| 3238 | $$->add_it($2); |
| 3239 | } |
| 3240 | | seqArraySpec optError ',' optError ArraySpec |
| 3241 | { |
| 3242 | $$ = $1; |
| 3243 | $$->add_it($5); |
| 3244 | } |
| 3245 | | seqArraySpec optError ',' error { $$ = $1; } |
| 3246 | ; |
| 3247 | |
| 3248 | ArraySpec: |
| 3249 | ArrayOrBitRef AssignmentChar TemplateBody |
| 3250 | { |
| 3251 | $$ = new IndexedTemplate($1, $3); |
| 3252 | $$->set_location(infile, @$); |
| 3253 | } |
| 3254 | ; |
| 3255 | |
| 3256 | ArrayOrBitRef: // 109 |
| 3257 | '[' Expression ']' |
| 3258 | { |
| 3259 | $$ = new FieldOrArrayRef($2); |
| 3260 | $$->set_location(infile, @$); |
| 3261 | } |
| 3262 | | '[' error ']' |
| 3263 | { |
| 3264 | $$ = new FieldOrArrayRef(new Value(Value::V_ERROR)); |
| 3265 | $$->set_location(infile, @$); |
| 3266 | } |
| 3267 | ; |
| 3268 | |
| 3269 | SingleValueOrAttrib: // 111 |
| 3270 | MatchingSymbol { $$ = $1; } |
| 3271 | | SingleExpression |
| 3272 | { |
| 3273 | if ($1->get_valuetype() == Value::V_OMIT) { |
| 3274 | delete $1; |
| 3275 | $$ = new Template(Template::OMIT_VALUE); |
| 3276 | } else $$ = new Template($1); // SPECIFIC_VALUE; SingleExpr is a Template* |
| 3277 | $$->set_location(infile, @$); |
| 3278 | } |
| 3279 | /* | TemplateRefWithParList -- covered by SingleExpression */ |
| 3280 | ; |
| 3281 | |
| 3282 | ArrayValueOrAttrib: // 112 |
| 3283 | '{' ArrayElementSpecList optError '}' |
| 3284 | { |
| 3285 | $$ = new Template(Template::TEMPLATE_LIST, $2); |
| 3286 | $$->set_location(infile, @$); |
| 3287 | } |
| 3288 | ; |
| 3289 | |
| 3290 | ArrayElementSpecList: // 113 |
| 3291 | ArrayElementSpec |
| 3292 | { |
| 3293 | $$ = new Templates; |
| 3294 | $$->add_t($1); |
| 3295 | } |
| 3296 | | error ArrayElementSpec |
| 3297 | { |
| 3298 | $$ = new Templates; |
| 3299 | $$->add_t($2); |
| 3300 | } |
| 3301 | | ArrayElementSpecList optError ',' optError ArrayElementSpec |
| 3302 | { |
| 3303 | $$=$1; |
| 3304 | $$->add_t($5); |
| 3305 | } |
| 3306 | | ArrayElementSpecList optError ',' error { $$ = $1; } |
| 3307 | ; |
| 3308 | |
| 3309 | ArrayElementSpec: // 114 is a Template* |
| 3310 | NotUsedSymbol |
| 3311 | { |
| 3312 | $$ = new Template(Template::TEMPLATE_NOTUSED); |
| 3313 | $$->set_location(infile, @$); |
| 3314 | } |
| 3315 | | PermutationMatch |
| 3316 | { |
| 3317 | $$ = new Template(Template::PERMUTATION_MATCH, $1); |
| 3318 | $$->set_location(infile, @$); |
| 3319 | } |
| 3320 | | TemplateListElem { $$ = $1; } |
| 3321 | ; |
| 3322 | |
| 3323 | NotUsedSymbol: // 115 |
| 3324 | '-' |
| 3325 | ; |
| 3326 | |
| 3327 | MatchingSymbol: // 116 is a Template* |
| 3328 | Complement |
| 3329 | { |
| 3330 | $$ = new Template(Template::COMPLEMENTED_LIST, $1); |
| 3331 | $$->set_location(infile, @$); |
| 3332 | } |
| 3333 | | AnyValue |
| 3334 | { |
| 3335 | $$ = new Template(Template::ANY_VALUE); |
| 3336 | $$->set_location(infile, @$); |
| 3337 | } |
| 3338 | | AnyOrOmit |
| 3339 | { |
| 3340 | $$ = new Template(Template::ANY_OR_OMIT); |
| 3341 | $$->set_location(infile, @$); |
| 3342 | } |
| 3343 | | ValueOrAttribList |
| 3344 | { |
| 3345 | $$ = new Template(Template::VALUE_LIST, $1); |
| 3346 | $$->set_location(infile, @$); |
| 3347 | } |
| 3348 | | Range |
| 3349 | { |
| 3350 | $$ = new Template($1); |
| 3351 | $$->set_location(infile, @$); |
| 3352 | } |
| 3353 | | BitStringMatch |
| 3354 | { |
| 3355 | $$ = new Template(Template::BSTR_PATTERN, $1); |
| 3356 | $$->set_location(infile, @$); |
| 3357 | } |
| 3358 | | HexStringMatch |
| 3359 | { |
| 3360 | $$ = new Template(Template::HSTR_PATTERN, $1); |
| 3361 | $$->set_location(infile, @$); |
| 3362 | } |
| 3363 | | OctetStringMatch |
| 3364 | { |
| 3365 | $$ = new Template(Template::OSTR_PATTERN, $1); |
| 3366 | $$->set_location(infile, @$); |
| 3367 | } |
| 3368 | | CharStringMatch |
| 3369 | { |
| 3370 | $$ = new Template($1); |
| 3371 | $$->set_location(infile, @$); |
| 3372 | } |
| 3373 | | SubsetMatch |
| 3374 | { |
| 3375 | $$ = new Template(Template::SUBSET_MATCH, $1); |
| 3376 | $$->set_location(infile, @$); |
| 3377 | } |
| 3378 | | SupersetMatch |
| 3379 | { |
| 3380 | $$ = new Template(Template::SUPERSET_MATCH, $1); |
| 3381 | $$->set_location(infile, @$); |
| 3382 | } |
| 3383 | | '(' AllElementsFrom ')' |
| 3384 | { |
| 3385 | $$ = new Template(Template::VALUE_LIST_ALL_FROM, $2); |
| 3386 | $$->set_location(infile, @$); |
| 3387 | } |
| 3388 | ; |
| 3389 | |
| 3390 | optExtraMatchingAttributes: // [117] |
| 3391 | /* empty */ |
| 3392 | { |
| 3393 | $$.is_ifpresent = false; |
| 3394 | $$.len_restr = NULL; |
| 3395 | } |
| 3396 | | LengthMatch |
| 3397 | { |
| 3398 | $$.len_restr = $1; |
| 3399 | $$.is_ifpresent = false; |
| 3400 | } |
| 3401 | | IfPresentMatch |
| 3402 | { |
| 3403 | $$.len_restr = NULL; |
| 3404 | $$.is_ifpresent = true; |
| 3405 | } |
| 3406 | | LengthMatch IfPresentMatch |
| 3407 | { |
| 3408 | $$.len_restr = $1; |
| 3409 | $$.is_ifpresent = true; |
| 3410 | } |
| 3411 | ; |
| 3412 | |
| 3413 | CharStringMatch: // 124 |
| 3414 | PatternKeyword PatternChunkList |
| 3415 | { |
| 3416 | Location loc(infile, @2); |
| 3417 | $$ = parse_pattern($2, loc); |
| 3418 | Free($2); |
| 3419 | } |
| 3420 | ; |
| 3421 | |
| 3422 | PatternChunkList: |
| 3423 | PatternChunk |
| 3424 | { |
| 3425 | $$ = $1; |
| 3426 | } |
| 3427 | | PatternChunkList '&' PatternChunk |
| 3428 | { |
| 3429 | $$ = $1; |
| 3430 | $$ = mputstr($$, $3); |
| 3431 | Free($3); |
| 3432 | } |
| 3433 | ; |
| 3434 | |
| 3435 | PatternChunk: |
| 3436 | Cstring |
| 3437 | { |
| 3438 | $$ = $1; |
| 3439 | } |
| 3440 | | ReferencedValue |
| 3441 | { |
| 3442 | switch ($1->get_valuetype()) { |
| 3443 | case Value::V_REFD: { |
| 3444 | /* Pretend to be a reference. Let pstring_la.l discover the |
| 3445 | references. */ |
| 3446 | Common::Reference *ref = $1->get_reference(); |
| 3447 | $$ = mprintf("{%s}", (ref->get_dispname()).c_str()); |
| 3448 | break; } |
| 3449 | case Value::V_UNDEF_LOWERID: { |
| 3450 | const Common::Identifier *id = $1->get_val_id(); |
| 3451 | $$ = mprintf("{%s}", (id->get_dispname()).c_str()); |
| 3452 | break; } |
| 3453 | default: |
| 3454 | FATAL_ERROR("Internal error."); |
| 3455 | } |
| 3456 | /* Forget the Node. */ |
| 3457 | delete $1; |
| 3458 | } |
| 3459 | | Quadruple |
| 3460 | { |
| 3461 | ustring::universal_char& uc = $1->operator[](0); |
| 3462 | $$ = mprintf("\\q{%d,%d,%d,%d}", uc.group, uc.plane, uc.row, uc.cell); |
| 3463 | delete $1; |
| 3464 | } |
| 3465 | ; |
| 3466 | |
| 3467 | Complement: // 130 is a Templates* |
| 3468 | ComplementKeyword ValueList { $$ = $2; } |
| 3469 | ; |
| 3470 | |
| 3471 | ValueList: // 132 is a Templates* |
| 3472 | '(' seqValueOrAttrib optError ')' { $$ = $2; } |
| 3473 | | '(' error ')' { $$ = new Templates; } |
| 3474 | ; |
| 3475 | |
| 3476 | seqValueOrAttrib: // is a Templates* |
| 3477 | optError TemplateListElem |
| 3478 | { |
| 3479 | $$ = new Templates; |
| 3480 | $$->add_t($2); |
| 3481 | } |
| 3482 | | seqValueOrAttrib optError ',' optError TemplateListElem |
| 3483 | { |
| 3484 | $$ = $1; |
| 3485 | $$->add_t($5); |
| 3486 | } |
| 3487 | | seqValueOrAttrib optError ',' error { $$ = $1; } |
| 3488 | ; |
| 3489 | |
| 3490 | SubsetMatch: // 133 is a Templates* |
| 3491 | SubsetKeyword ValueList { $$ = $2; } |
| 3492 | ; |
| 3493 | |
| 3494 | SupersetMatch: // 135 is a Templates* |
| 3495 | SupersetKeyword ValueList { $$ = $2; } |
| 3496 | ; |
| 3497 | |
| 3498 | PermutationMatch: // 137 is a Templates* |
| 3499 | PermutationKeyword ValueList { $$ = $2; } |
| 3500 | ; |
| 3501 | |
| 3502 | AnyValue: // 140 |
| 3503 | '?' |
| 3504 | ; |
| 3505 | |
| 3506 | AnyOrOmit: // 141 |
| 3507 | '*' |
| 3508 | ; |
| 3509 | |
| 3510 | TemplateListElem: // is a Template* |
| 3511 | TemplateBody |
| 3512 | | AllElementsFrom |
| 3513 | ; |
| 3514 | |
| 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, @$); |
| 3520 | } |
| 3521 | ; |
| 3522 | |
| 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 |
| 3527 | * |
| 3528 | * The one-element list is reduced through |
| 3529 | * '(' SingleExpression ')' -> SingleExpression -> SingleValueOrAttrib */ |
| 3530 | '(' TemplateListElem optError ',' seqValueOrAttrib optError ')' |
| 3531 | { |
| 3532 | $$ = $5; |
| 3533 | $$->add_front_t($2); |
| 3534 | } |
| 3535 | | '(' error TemplateListElem optError ',' seqValueOrAttrib optError ')' |
| 3536 | { |
| 3537 | $$ = $6; |
| 3538 | $$->add_front_t($3); |
| 3539 | } |
| 3540 | ; |
| 3541 | |
| 3542 | LengthMatch: // 143 |
| 3543 | StringLength { $$ = $1; } |
| 3544 | ; |
| 3545 | |
| 3546 | IfPresentMatch: // 144 |
| 3547 | IfPresentKeyword |
| 3548 | ; |
| 3549 | |
| 3550 | Range: // 147 |
| 3551 | '(' SingleLowerBound DotDot UpperBound optError ')' |
| 3552 | { $$ = new ValueRange($2, $4); } |
| 3553 | ; |
| 3554 | |
| 3555 | SingleLowerBound: |
| 3556 | SingleExpression |
| 3557 | { |
| 3558 | if ($1->is_parsed_infinity()==-1) { |
| 3559 | /* the conflicting rule alternative faked here: '-' InfinityKeyword */ |
| 3560 | delete $1; |
| 3561 | $$ = 0; |
| 3562 | } else { |
| 3563 | $$ = $1; |
| 3564 | } |
| 3565 | } |
| 3566 | ; |
| 3567 | |
| 3568 | LowerBound: // 148 |
| 3569 | Expression |
| 3570 | { |
| 3571 | if ($1->is_parsed_infinity()==-1) { |
| 3572 | /* the conflicting rule alternative faked here: '-' InfinityKeyword */ |
| 3573 | delete $1; |
| 3574 | $$ = 0; |
| 3575 | } else { |
| 3576 | $$ = $1; |
| 3577 | } |
| 3578 | } |
| 3579 | ; |
| 3580 | |
| 3581 | UpperBound: // 149 |
| 3582 | Expression |
| 3583 | { |
| 3584 | if ($1->is_parsed_infinity()==1) { |
| 3585 | /* the conflicting rule alternative faked here: InfinityKeyword */ |
| 3586 | delete $1; |
| 3587 | $$ = 0; |
| 3588 | } else { |
| 3589 | $$ = $1; |
| 3590 | } |
| 3591 | } |
| 3592 | ; |
| 3593 | |
| 3594 | TemplateInstance: // 151 |
| 3595 | InLineTemplate { $$ = $1; } |
| 3596 | ; |
| 3597 | |
| 3598 | TemplateRefWithParList: /* refbase */ // 153 ? |
| 3599 | TemplateRef optTemplateActualParList |
| 3600 | { |
| 3601 | if ($2) { |
| 3602 | $$ = new Ttcn::Ref_pard($1.modid, $1.id, new ParsedActualParameters($2)); |
| 3603 | $$->set_location(infile, @$); |
| 3604 | } else { |
| 3605 | $$ = new Ttcn::Reference($1.modid, $1.id); |
| 3606 | $$->set_location(infile, @$); |
| 3607 | } |
| 3608 | } |
| 3609 | ; |
| 3610 | |
| 3611 | TemplateRef: // 154 |
| 3612 | IDentifier |
| 3613 | { |
| 3614 | $$.modid = 0; |
| 3615 | $$.id = $1; |
| 3616 | } |
| 3617 | | IDentifier '.' IDentifier |
| 3618 | { |
| 3619 | $$.modid = $1; |
| 3620 | $$.id = $3; |
| 3621 | } |
| 3622 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier |
| 3623 | { |
| 3624 | $$.modid = $1; |
| 3625 | $$.id = $5; |
| 3626 | delete $3; |
| 3627 | } |
| 3628 | ; |
| 3629 | |
| 3630 | InLineTemplate: // 155 |
| 3631 | TemplateBody |
| 3632 | { |
| 3633 | $$ = new TemplateInstance(0, 0, $1); |
| 3634 | $$->set_location(infile, @$); |
| 3635 | } |
| 3636 | | Type ':' TemplateBody |
| 3637 | { |
| 3638 | $$ = new TemplateInstance($1, 0, $3); |
| 3639 | $$->set_location(infile, @$); |
| 3640 | } |
| 3641 | /* | Signature ':' TemplateBody -- covered by the previous rule */ |
| 3642 | | DerivedRefWithParList AssignmentChar TemplateBody |
| 3643 | { |
| 3644 | $$ = new TemplateInstance(0, $1, $3); |
| 3645 | $$->set_location(infile, @$); |
| 3646 | } |
| 3647 | | Type ':' DerivedRefWithParList AssignmentChar TemplateBody |
| 3648 | { |
| 3649 | $$ = new TemplateInstance($1, $3, $5); |
| 3650 | $$->set_location(infile, @$); |
| 3651 | } |
| 3652 | /* | Signature ':' DerivedRefWithParList AssignmentChar TemplateBody |
| 3653 | -- covered by the previous rule */ |
| 3654 | ; |
| 3655 | |
| 3656 | DerivedRefWithParList: // 156 |
| 3657 | ModifiesKeyword TemplateRefWithParList { $$ = $2; } |
| 3658 | ; |
| 3659 | |
| 3660 | optTemplateActualParList: // [157] |
| 3661 | /* empty */ optError { $$ = 0; } |
| 3662 | | '(' seqTemplateActualPar optError ')' |
| 3663 | { |
| 3664 | $$ = $2; |
| 3665 | $$->set_location(infile, @$); |
| 3666 | } |
| 3667 | | '(' error ')' |
| 3668 | { |
| 3669 | $$ = new TemplateInstances; |
| 3670 | $$->set_location(infile, @$); |
| 3671 | } |
| 3672 | ; |
| 3673 | |
| 3674 | seqTemplateActualPar: |
| 3675 | optError TemplateActualPar |
| 3676 | { |
| 3677 | $$ = new TemplateInstances; |
| 3678 | $$->add_ti($2); |
| 3679 | } |
| 3680 | | seqTemplateActualPar optError ',' optError TemplateActualPar |
| 3681 | { |
| 3682 | $$ = $1; |
| 3683 | $$->add_ti($5); |
| 3684 | } |
| 3685 | | seqTemplateActualPar optError ',' error { $$ = $1; } |
| 3686 | ; |
| 3687 | |
| 3688 | TemplateActualPar: // 158 |
| 3689 | TemplateInstance { $$ = $1; } |
| 3690 | | NotUsedSymbol |
| 3691 | { |
| 3692 | Template *t = new Template(Template::TEMPLATE_NOTUSED); |
| 3693 | t->set_location(infile, @$); |
| 3694 | $$ = new TemplateInstance(0, 0, t); |
| 3695 | $$->set_location(infile, @$); |
| 3696 | } |
| 3697 | ; |
| 3698 | |
| 3699 | TemplateOps: // 159 |
| 3700 | MatchOp { $$ = $1; } |
| 3701 | | ValueofOp { $$ = $1; } |
| 3702 | ; |
| 3703 | |
| 3704 | MatchOp: // 160 |
| 3705 | MatchKeyword '(' optError Expression optError ',' optError TemplateInstance |
| 3706 | optError ')' |
| 3707 | { |
| 3708 | $$ = new Value(Value::OPTYPE_MATCH, $4, $8); |
| 3709 | $$->set_location(infile, @$); |
| 3710 | } |
| 3711 | | MatchKeyword '(' error ')' |
| 3712 | { |
| 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, @$); |
| 3721 | } |
| 3722 | ; |
| 3723 | |
| 3724 | ValueofOp: // 162 |
| 3725 | ValueofKeyword '(' optError TemplateInstance optError ')' |
| 3726 | { |
| 3727 | $$ = new Value(Value::OPTYPE_VALUEOF, $4); |
| 3728 | $$->set_location(infile, @$); |
| 3729 | } |
| 3730 | | ValueofKeyword '(' error ')' |
| 3731 | { |
| 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, @$); |
| 3738 | } |
| 3739 | ; |
| 3740 | |
| 3741 | /* A.1.6.1.4 Function definitions */ |
| 3742 | |
| 3743 | FunctionDef: // 164 |
| 3744 | FunctionKeyword IDentifier '(' optFunctionFormalParList ')' |
| 3745 | optRunsOnSpec optReturnType optError StatementBlock |
| 3746 | { |
| 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, @$); |
| 3751 | } |
| 3752 | ; |
| 3753 | |
| 3754 | optFunctionFormalParList: // [167] |
| 3755 | /* empty */ { $$ = new FormalParList; } |
| 3756 | | FunctionFormalParList { $$ = $1; } |
| 3757 | | error { $$ = new FormalParList; } |
| 3758 | ; |
| 3759 | |
| 3760 | FunctionFormalParList: // 167 |
| 3761 | optError FunctionFormalPar |
| 3762 | { |
| 3763 | $$ = new FormalParList; |
| 3764 | $$->add_fp($2); |
| 3765 | } |
| 3766 | | FunctionFormalParList optError ',' optError FunctionFormalPar |
| 3767 | { |
| 3768 | $$ = $1; |
| 3769 | $$->add_fp($5); |
| 3770 | } |
| 3771 | | FunctionFormalParList optError ',' error { $$ = $1; } |
| 3772 | ; |
| 3773 | |
| 3774 | FunctionFormalPar: // 168 |
| 3775 | FormalValuePar { $$ = $1; } |
| 3776 | | FormalTimerPar { $$ = $1; } |
| 3777 | | FormalTemplatePar { $$ = $1; } |
| 3778 | /*| FormalPortPar -- covered by FormalValuePar */ |
| 3779 | ; |
| 3780 | |
| 3781 | optReturnType: // [169] |
| 3782 | /* empty */ |
| 3783 | { |
| 3784 | $$.type = 0; |
| 3785 | $$.returns_template = false; |
| 3786 | $$.template_restriction = TR_NONE; |
| 3787 | } |
| 3788 | | ReturnKeyword Type |
| 3789 | { |
| 3790 | $$.type = $2; |
| 3791 | $$.returns_template = false; |
| 3792 | $$.template_restriction = TR_NONE; |
| 3793 | } |
| 3794 | | ReturnKeyword TemplateOptRestricted Type |
| 3795 | { |
| 3796 | $$.type = $3; |
| 3797 | $$.returns_template = true; |
| 3798 | $$.template_restriction = $2; |
| 3799 | } |
| 3800 | | ReturnKeyword error |
| 3801 | { |
| 3802 | $$.type = 0; |
| 3803 | $$.returns_template = false; |
| 3804 | $$.template_restriction = TR_NONE; |
| 3805 | } |
| 3806 | ; |
| 3807 | |
| 3808 | optRunsOnComprefOrSelf: |
| 3809 | optRunsOnSpec |
| 3810 | { |
| 3811 | $$.self = false; |
| 3812 | $$.reference = $1; |
| 3813 | } |
| 3814 | | RunsKeyword OnKeyword SelfKeyword |
| 3815 | { |
| 3816 | $$.self = true; |
| 3817 | $$.reference = 0; |
| 3818 | } |
| 3819 | ; |
| 3820 | |
| 3821 | optRunsOnSpec: |
| 3822 | /* empty */ { $$ = 0; } |
| 3823 | | RunsOnSpec { $$ = $1; } |
| 3824 | | RunsKeyword error { $$ = 0; } |
| 3825 | ; |
| 3826 | |
| 3827 | RunsOnSpec: // 171 |
| 3828 | RunsKeyword OnKeyword ComponentType { $$ = $3; } |
| 3829 | ; |
| 3830 | |
| 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 |
| 3834 | '{' optError '}' |
| 3835 | { |
| 3836 | $$ = new StatementBlock; |
| 3837 | $$->set_location(infile, @$); |
| 3838 | } |
| 3839 | | '{' FunctionStatementOrDefList optError '}' |
| 3840 | { |
| 3841 | $$ = $2; |
| 3842 | $$->set_location(infile, @$); |
| 3843 | } |
| 3844 | ; |
| 3845 | |
| 3846 | FunctionStatementOrDefList: // (171 in 3.2.1) |
| 3847 | optError FunctionStatementOrDef optSemiColon |
| 3848 | { |
| 3849 | $$ = new StatementBlock; |
| 3850 | for(size_t i=0; i<$2.nElements; i++) $$->add_stmt($2.elements[i]); |
| 3851 | Free($2.elements); |
| 3852 | } |
| 3853 | | FunctionStatementOrDefList optError FunctionStatementOrDef optSemiColon |
| 3854 | { |
| 3855 | $$=$1; |
| 3856 | for(size_t i=0; i<$3.nElements; i++) $$->add_stmt($3.elements[i]); |
| 3857 | Free($3.elements); |
| 3858 | } |
| 3859 | ; |
| 3860 | |
| 3861 | FunctionStatementOrDef: // (172 in 3.2.1) |
| 3862 | FunctionLocalDef // constant or template definition |
| 3863 | { |
| 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]); |
| 3869 | } |
| 3870 | Free($1.elements); |
| 3871 | } |
| 3872 | | FunctionLocalInst // variable or timer instance |
| 3873 | { |
| 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]); |
| 3879 | } |
| 3880 | Free($1.elements); |
| 3881 | } |
| 3882 | | FunctionStatement |
| 3883 | { |
| 3884 | $$.nElements=1; |
| 3885 | $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements)); |
| 3886 | $$.elements[0]=$1; |
| 3887 | } |
| 3888 | ; |
| 3889 | |
| 3890 | FunctionLocalInst: // 178 |
| 3891 | VarInstance { $$=$1; } |
| 3892 | | TimerInstance { $$=$1; } |
| 3893 | ; |
| 3894 | |
| 3895 | FunctionLocalDef: // 179 |
| 3896 | ConstDef { $$=$1; } |
| 3897 | | TemplateDef |
| 3898 | { |
| 3899 | $1->set_local(); |
| 3900 | $$.nElements = 1; |
| 3901 | $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements)); |
| 3902 | $$.elements[0] = $1; |
| 3903 | } |
| 3904 | ; |
| 3905 | |
| 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; } |
| 3918 | ; |
| 3919 | |
| 3920 | FunctionInstance: /* refpard */ // 181 |
| 3921 | FunctionRef '(' optFunctionActualParList ')' |
| 3922 | /* templateref templinsts */ |
| 3923 | { |
| 3924 | $3->set_location(infile, @2, @4); |
| 3925 | $$ = new Ttcn::Ref_pard($1.modid, $1.id, $3); |
| 3926 | $$->set_location(infile, @$); |
| 3927 | } |
| 3928 | ; |
| 3929 | |
| 3930 | FunctionRef: // 182 |
| 3931 | IDentifier |
| 3932 | { |
| 3933 | $$.modid = 0; |
| 3934 | $$.id = $1; |
| 3935 | } |
| 3936 | | IDentifier '.' IDentifier |
| 3937 | { |
| 3938 | $$.modid = $1; |
| 3939 | $$.id = $3; |
| 3940 | } |
| 3941 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier |
| 3942 | { |
| 3943 | $$.modid = $1; |
| 3944 | $$.id = $5; |
| 3945 | delete $3; |
| 3946 | } |
| 3947 | ; |
| 3948 | |
| 3949 | optFunctionActualParList: /* parsedpar */ // [185] |
| 3950 | /* empty */ optError { $$ = new ParsedActualParameters; } |
| 3951 | | FunctionActualParList optError { $$ = $1; } |
| 3952 | ; |
| 3953 | |
| 3954 | /* ***** this * can * not * be * empty ****************** */ |
| 3955 | FunctionActualParList: /* parsedpar */ // 184 |
| 3956 | UnnamedPart |
| 3957 | | NamedPart |
| 3958 | | UnnamedPart ',' NamedPart |
| 3959 | /* Splitting the NamedPart and UnnamedPart ensures that a named parameter |
| 3960 | * followed by an unnamed one causes a syntax error */ |
| 3961 | { |
| 3962 | /* UnnamedPart becomes the value */ |
| 3963 | $$ = $1; |
| 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) ); |
| 3968 | } |
| 3969 | delete $3; |
| 3970 | } |
| 3971 | ; |
| 3972 | |
| 3973 | UnnamedPart: /* parsedpar */ |
| 3974 | /*optError*/ FunctionActualPar |
| 3975 | { |
| 3976 | $$ = new ParsedActualParameters; |
| 3977 | $$->add_ti($1); |
| 3978 | } |
| 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 */ |
| 3983 | { |
| 3984 | $$ = $1; |
| 3985 | $$->add_ti($3); |
| 3986 | } |
| 3987 | | UnnamedPart optError ',' error { $$ = $1; } |
| 3988 | ; |
| 3989 | |
| 3990 | NamedPart: /* parsedpar */ |
| 3991 | seqFieldSpec /* namedtempls */ |
| 3992 | { |
| 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); |
| 4000 | $$->add_np(pnp); |
| 4001 | } |
| 4002 | delete $1; |
| 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. |
| 4008 | } |
| 4009 | ; |
| 4010 | |
| 4011 | FunctionActualPar: /* templinst */ // 185 |
| 4012 | /* TimerRef */ |
| 4013 | TemplateInstance { $$ = $1; } |
| 4014 | | NotUsedSymbol |
| 4015 | { |
| 4016 | Template *t = new Template(Template::TEMPLATE_NOTUSED); |
| 4017 | t->set_location(infile, @$); |
| 4018 | $$ = new TemplateInstance(0, 0, t); |
| 4019 | $$->set_location(infile, @$); |
| 4020 | } |
| 4021 | /* | Port |
| 4022 | | ComponentRef -- TemplateInstance covers all the others */ |
| 4023 | ; |
| 4024 | |
| 4025 | ApplyOp: |
| 4026 | Reference DotApplyKeyword '(' optFunctionActualParList ')' |
| 4027 | { |
| 4028 | if($1.is_ref) $$.value = new Value(Value::V_REFD, $1.ref); |
| 4029 | else { |
| 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); |
| 4033 | } |
| 4034 | $$.value->set_location(infile, @1); |
| 4035 | $$.ap_list = $4; |
| 4036 | $$.ap_list->set_location(infile, @3 , @5); |
| 4037 | } |
| 4038 | | FunctionInstance DotApplyKeyword '(' optFunctionActualParList ')' |
| 4039 | { |
| 4040 | $$.value = new Value(Value::V_REFD, $1); |
| 4041 | $$.value->set_location(infile, @1); |
| 4042 | $$.ap_list = $4; |
| 4043 | $$.ap_list->set_location(infile, @3 , @5); |
| 4044 | } |
| 4045 | | ApplyOp DotApplyKeyword '(' optFunctionActualParList ')' |
| 4046 | { |
| 4047 | $$.value = new Value(Value::V_INVOKE, $1.value, $1.ap_list); |
| 4048 | $$.value->set_location(infile, @1); |
| 4049 | $$.ap_list = $4; |
| 4050 | $$.ap_list->set_location(infile, @3 , @5); |
| 4051 | } |
| 4052 | ; |
| 4053 | |
| 4054 | DereferOp: |
| 4055 | DerefersKeyword '(' Expression ')' { $$ = $3; } |
| 4056 | ; |
| 4057 | |
| 4058 | /* A.1.6.1.5 Signature definitions */ |
| 4059 | |
| 4060 | SignatureDef: // 187 |
| 4061 | SignatureKeyword IDentifier |
| 4062 | '(' optSignatureFormalParList ')' optReturnTypeOrNoBlockKeyword |
| 4063 | optExceptionSpec |
| 4064 | { |
| 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, @$); |
| 4069 | } |
| 4070 | ; |
| 4071 | |
| 4072 | optSignatureFormalParList: // [190] |
| 4073 | /* empty */ { $$ = 0; } |
| 4074 | | SignatureFormalParList { $$ = $1; } |
| 4075 | | error { $$ = 0; } |
| 4076 | ; |
| 4077 | |
| 4078 | SignatureFormalParList: // 190 |
| 4079 | optError SignatureFormalPar |
| 4080 | { |
| 4081 | $$ = new SignatureParamList; |
| 4082 | $$->add_param($2); |
| 4083 | } |
| 4084 | | SignatureFormalParList optError ',' optError SignatureFormalPar |
| 4085 | { |
| 4086 | $$ = $1; |
| 4087 | $$->add_param($5); |
| 4088 | } |
| 4089 | | SignatureFormalParList optError ',' error { $$ = $1; } |
| 4090 | ; |
| 4091 | |
| 4092 | SignatureFormalPar: // 191 |
| 4093 | Type IDentifier |
| 4094 | { |
| 4095 | $$ = new SignatureParam(SignatureParam::PARAM_IN, $1, $2); |
| 4096 | $$->set_location(infile, @$); |
| 4097 | } |
| 4098 | | InParKeyword Type IDentifier |
| 4099 | { |
| 4100 | $$ = new SignatureParam(SignatureParam::PARAM_IN, $2, $3); |
| 4101 | $$->set_location(infile, @$); |
| 4102 | } |
| 4103 | | InOutParKeyword Type IDentifier |
| 4104 | { |
| 4105 | $$ = new SignatureParam(SignatureParam::PARAM_INOUT, $2, $3); |
| 4106 | $$->set_location(infile, @$); |
| 4107 | } |
| 4108 | | OutParKeyword Type IDentifier |
| 4109 | { |
| 4110 | $$ = new SignatureParam(SignatureParam::PARAM_OUT, $2, $3); |
| 4111 | $$->set_location(infile, @$); |
| 4112 | } |
| 4113 | ; |
| 4114 | |
| 4115 | optReturnTypeOrNoBlockKeyword: |
| 4116 | /* empty */ |
| 4117 | { |
| 4118 | $$.type = NULL; |
| 4119 | $$.no_block_kw = false; |
| 4120 | } |
| 4121 | | ReturnKeyword Type |
| 4122 | { |
| 4123 | $$.type = $2; |
| 4124 | $$.no_block_kw = false; |
| 4125 | } |
| 4126 | | NoBlockKeyword |
| 4127 | { |
| 4128 | $$.type = NULL; |
| 4129 | $$.no_block_kw = true; |
| 4130 | } |
| 4131 | ; |
| 4132 | |
| 4133 | optExceptionSpec: // [192] |
| 4134 | /* empty */ { $$ = NULL; } |
| 4135 | | ExceptionKeyword '(' error ')' { $$ = NULL; } |
| 4136 | | ExceptionKeyword '(' ExceptionTypeList optError ')' |
| 4137 | { |
| 4138 | $$ = $3; |
| 4139 | $$->set_location(infile, @$); |
| 4140 | } |
| 4141 | ; |
| 4142 | |
| 4143 | ExceptionTypeList: // 194 |
| 4144 | optError Type |
| 4145 | { |
| 4146 | $$ = new SignatureExceptions; |
| 4147 | $$->add_type($2); |
| 4148 | } |
| 4149 | | ExceptionTypeList optError ',' optError Type |
| 4150 | { |
| 4151 | $$ = $1; |
| 4152 | $$->add_type($5); |
| 4153 | } |
| 4154 | | ExceptionTypeList optError ',' error { $$ = $1; } |
| 4155 | ; |
| 4156 | |
| 4157 | Signature: // 196 |
| 4158 | IDentifier |
| 4159 | { |
| 4160 | $$ = new Ttcn::Reference($1); |
| 4161 | $$->set_location(infile, @$); |
| 4162 | } |
| 4163 | | IDentifier '.' IDentifier |
| 4164 | { |
| 4165 | $$ = new Ttcn::Reference($1, $3); |
| 4166 | $$->set_location(infile, @$); |
| 4167 | } |
| 4168 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier |
| 4169 | { |
| 4170 | $$ = new Ttcn::Reference($1, $5); |
| 4171 | $$->set_location(infile, @$); |
| 4172 | delete $3; |
| 4173 | } |
| 4174 | ; |
| 4175 | |
| 4176 | /* A.1.6.1.6 Testcase definitions */ |
| 4177 | |
| 4178 | TestcaseDef: // 197 |
| 4179 | TestcaseKeyword IDentifier '(' optTestcaseFormalParList ')' |
| 4180 | ConfigSpec optError StatementBlock |
| 4181 | { |
| 4182 | $4->set_location(infile, @3, @5); |
| 4183 | $$ = new Def_Testcase($2, $4, $6.runsonref, $6.systemref, $8); |
| 4184 | $$->set_location(infile, @$); |
| 4185 | } |
| 4186 | ; |
| 4187 | |
| 4188 | optTestcaseFormalParList: // [200] |
| 4189 | /* empty */ { $$ = new FormalParList; } |
| 4190 | | TestcaseFormalParList { $$ = $1; } |
| 4191 | | error { $$ = new FormalParList; } |
| 4192 | ; |
| 4193 | |
| 4194 | TestcaseFormalParList: // 200 |
| 4195 | optError TestcaseFormalPar |
| 4196 | { |
| 4197 | $$ = new FormalParList; |
| 4198 | $$->add_fp($2); |
| 4199 | } |
| 4200 | | TestcaseFormalParList optError ',' optError TestcaseFormalPar |
| 4201 | { |
| 4202 | $$ = $1; |
| 4203 | $$->add_fp($5); |
| 4204 | } |
| 4205 | | TestcaseFormalParList optError ',' error { $$ = $1; } |
| 4206 | ; |
| 4207 | |
| 4208 | TestcaseFormalPar: // 201 |
| 4209 | FormalValuePar { $$ = $1; } |
| 4210 | | FormalTemplatePar { $$ = $1; } |
| 4211 | ; |
| 4212 | |
| 4213 | ConfigSpec: // 202 |
| 4214 | RunsOnSpec optSystemSpec |
| 4215 | { |
| 4216 | $$.runsonref=$1; |
| 4217 | $$.systemref=$2; |
| 4218 | } |
| 4219 | ; |
| 4220 | |
| 4221 | optSystemSpec: // [203] |
| 4222 | /* empty */ { $$ = 0; } |
| 4223 | | SystemKeyword ComponentType { $$ = $2; } |
| 4224 | | SystemKeyword error { $$ = 0; } |
| 4225 | ; |
| 4226 | |
| 4227 | TestcaseInstance: // 205 |
| 4228 | ExecuteKeyword '(' TestcaseRef '(' optTestcaseActualParList ')' |
| 4229 | optTestcaseTimerValue optError ')' |
| 4230 | { |
| 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; |
| 4235 | $$.ap_list = $5; |
| 4236 | $$.value = $7; |
| 4237 | } |
| 4238 | | ExecuteKeyword '(' DereferOp '(' optTestcaseActualParList ')' |
| 4239 | optTestcaseTimerValue optError ')' |
| 4240 | { |
| 4241 | $5->set_location(infile, @4, @6); |
| 4242 | $$.ref_pard = 0; |
| 4243 | $$.derefered_value = $3; |
| 4244 | $$.ap_list = $5; |
| 4245 | $$.value = $7; |
| 4246 | } |
| 4247 | | ExecuteKeyword '(' error ')' |
| 4248 | { |
| 4249 | $$.ref_pard = 0; |
| 4250 | $$.derefered_value = 0; |
| 4251 | $$.ap_list = 0; |
| 4252 | $$.value = 0; |
| 4253 | } |
| 4254 | ; |
| 4255 | |
| 4256 | TestcaseRef: // 207 |
| 4257 | IDentifier |
| 4258 | { |
| 4259 | $$.modid = NULL; |
| 4260 | $$.id = $1; |
| 4261 | } |
| 4262 | | IDentifier '.' IDentifier |
| 4263 | { |
| 4264 | $$.modid = $1; |
| 4265 | $$.id = $3; |
| 4266 | } |
| 4267 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier |
| 4268 | { |
| 4269 | $$.modid = $1; |
| 4270 | $$.id = $5; |
| 4271 | delete $3; |
| 4272 | } |
| 4273 | ; |
| 4274 | |
| 4275 | optTestcaseTimerValue: |
| 4276 | /* empty */ { $$ = 0; } |
| 4277 | | ',' optError Expression { $$ = $3; } |
| 4278 | | ',' error |
| 4279 | { |
| 4280 | $$ = new Value(Value::V_ERROR); |
| 4281 | $$->set_location(infile, @$); |
| 4282 | } |
| 4283 | ; |
| 4284 | |
| 4285 | optTestcaseActualParList: // [202] |
| 4286 | /* empty */ optError { $$ = new ParsedActualParameters; } |
| 4287 | | TestcaseActualParList optError { $$ = $1; } |
| 4288 | ; |
| 4289 | |
| 4290 | TestcaseActualParList: // 208 |
| 4291 | UnnamedPart |
| 4292 | | NamedPart |
| 4293 | | UnnamedPart ',' NamedPart |
| 4294 | /* Splitting the NamedPart and UnnamedPart ensures that a named parameter |
| 4295 | * followed by an unnamed one causes a syntax error */ |
| 4296 | { |
| 4297 | /* UnnamedPart becomes the value */ |
| 4298 | $$ = $1; |
| 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) ); |
| 4303 | } |
| 4304 | delete $3; |
| 4305 | } |
| 4306 | |
| 4307 | /* |
| 4308 | optError TestcaseActualPar |
| 4309 | { |
| 4310 | $$ = new TemplateInstances; |
| 4311 | $$->add_ti($2); |
| 4312 | } |
| 4313 | | TestcaseActualParList optError ',' optError TestcaseActualPar |
| 4314 | { |
| 4315 | $$ = $1; |
| 4316 | $$->add_ti($5); |
| 4317 | } |
| 4318 | | TestcaseActualParList optError ',' error { $$ = $1; } |
| 4319 | */ |
| 4320 | ; |
| 4321 | |
| 4322 | /* |
| 4323 | TestcaseActualPar: |
| 4324 | TemplateInstance { $$ = $1; } |
| 4325 | | NotUsedSymbol |
| 4326 | { |
| 4327 | Template *t = new Template(Template::TEMPLATE_NOTUSED); |
| 4328 | t->set_location(infile, @$); |
| 4329 | $$ = new TemplateInstance(0, 0, t); |
| 4330 | $$->set_location(infile, @$); |
| 4331 | } |
| 4332 | ; |
| 4333 | */ |
| 4334 | |
| 4335 | /* A.1.6.1.7 Altstep definitions */ |
| 4336 | |
| 4337 | AltstepDef: // 211 |
| 4338 | AltstepKeyword IDentifier '(' optAltstepFormalParList ')' optRunsOnSpec |
| 4339 | optError '{' AltstepLocalDefList AltGuardList optError '}' |
| 4340 | { |
| 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]); |
| 4345 | sb->add_stmt(stmt); |
| 4346 | } |
| 4347 | Free($9.elements); |
| 4348 | $4->set_location(infile, @4); |
| 4349 | $$ = new Def_Altstep($2, $4, $6, sb, $10); |
| 4350 | $$->set_location(infile, @$); |
| 4351 | } |
| 4352 | ; |
| 4353 | |
| 4354 | optAltstepFormalParList: // [214] |
| 4355 | /* empty */ { $$ = new FormalParList; } |
| 4356 | | FunctionFormalParList { $$ = $1; } |
| 4357 | | error { $$ = new FormalParList; } |
| 4358 | ; |
| 4359 | |
| 4360 | AltstepLocalDefList: // 215 |
| 4361 | /* empty */ |
| 4362 | { |
| 4363 | $$.nElements = 0; |
| 4364 | $$.elements = 0; |
| 4365 | } |
| 4366 | | AltstepLocalDefList optError AltstepLocalDef optSemiColon |
| 4367 | { |
| 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)); |
| 4373 | Free($3.elements); |
| 4374 | } |
| 4375 | ; |
| 4376 | |
| 4377 | AltstepLocalDef: // 216 |
| 4378 | VarInstance { $$ = $1; } |
| 4379 | | TimerInstance { $$ = $1; } |
| 4380 | | ConstDef { $$ = $1; } |
| 4381 | | TemplateDef |
| 4382 | { |
| 4383 | $1->set_local(); |
| 4384 | $$.nElements = 1; |
| 4385 | $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements)); |
| 4386 | $$.elements[0] = $1; |
| 4387 | } |
| 4388 | ; |
| 4389 | |
| 4390 | AltstepInstance: /* refpard */ // 217 |
| 4391 | FunctionRef '(' optFunctionActualParList ')' |
| 4392 | { |
| 4393 | $3->set_location(infile, @2, @4); |
| 4394 | $$ = new Ttcn::Ref_pard($1.modid, $1.id, $3); |
| 4395 | $$->set_location(infile, @$); |
| 4396 | } |
| 4397 | ; |
| 4398 | |
| 4399 | /* Taken over by FunctionRef |
| 4400 | AltstepRef: // 211 |
| 4401 | IDentifier |
| 4402 | | IDentifier '.' IDentifier |
| 4403 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier |
| 4404 | ; |
| 4405 | */ |
| 4406 | |
| 4407 | /* A.1.6.1.8 Import definitions */ |
| 4408 | |
| 4409 | ImportDef: // 219 |
| 4410 | ImportKeyword ImportFromSpec AllWithExcepts |
| 4411 | { |
| 4412 | $2->set_imptype(ImpMod::I_ALL); |
| 4413 | $2->set_location(infile, @$); |
| 4414 | |
| 4415 | $$ = $2; |
| 4416 | } |
| 4417 | | ImportKeyword ImportFromSpec '{' ImportSpec '}' |
| 4418 | { |
| 4419 | Location loc(infile, @$); |
| 4420 | if ( $4 == ImpMod::I_IMPORTSPEC) { |
| 4421 | loc.warning("Unsupported selective import statement was treated as " |
| 4422 | "`import all'"); |
| 4423 | } |
| 4424 | $2->set_imptype($4); |
| 4425 | $2->set_location(infile, @$); |
| 4426 | |
| 4427 | $$ = $2; |
| 4428 | } |
| 4429 | ; |
| 4430 | |
| 4431 | AllWithExcepts: // 221 |
| 4432 | AllKeyword |
| 4433 | | AllKeyword ExceptsDef |
| 4434 | { |
| 4435 | Location loc(infile, @$); |
| 4436 | loc.warning("Unsupported selective import statement was treated as " |
| 4437 | "`import all'"); |
| 4438 | } |
| 4439 | ; |
| 4440 | |
| 4441 | ExceptsDef: // 222 |
| 4442 | ExceptKeyword '{' ExceptSpec '}' |
| 4443 | ; |
| 4444 | |
| 4445 | ExceptSpec: // 224 |
| 4446 | /* empty */ optError |
| 4447 | | ExceptSpec ExceptElement optSemiColon |
| 4448 | ; |
| 4449 | |
| 4450 | ExceptElement: // 225 |
| 4451 | ExceptGroupSpec |
| 4452 | | ExceptTypeDefSpec |
| 4453 | | ExceptTemplateSpec |
| 4454 | | ExceptConstSpec |
| 4455 | | ExceptTestcaseSpec |
| 4456 | | ExceptAltstepSpec |
| 4457 | | ExceptFunctionSpec |
| 4458 | | ExceptSignatureSpec |
| 4459 | | ExceptModuleParSpec |
| 4460 | ; |
| 4461 | |
| 4462 | ExceptGroupSpec: // 226 |
| 4463 | GroupKeyword ExceptGroupRefList |
| 4464 | | GroupKeyword AllKeyword |
| 4465 | ; |
| 4466 | |
| 4467 | ExceptTypeDefSpec: // 227 |
| 4468 | TypeDefKeyword TypeRefList |
| 4469 | | TypeDefKeyword AllKeyword |
| 4470 | ; |
| 4471 | |
| 4472 | ExceptTemplateSpec: // 228 |
| 4473 | TemplateKeyword TemplateRefList |
| 4474 | | TemplateKeyword AllKeyword |
| 4475 | ; |
| 4476 | |
| 4477 | ExceptConstSpec: // 229 |
| 4478 | ConstKeyword ConstRefList |
| 4479 | | ConstKeyword AllKeyword |
| 4480 | ; |
| 4481 | |
| 4482 | ExceptTestcaseSpec: // 230 |
| 4483 | TestcaseKeyword TestcaseRefList |
| 4484 | | TestcaseKeyword AllKeyword |
| 4485 | ; |
| 4486 | |
| 4487 | ExceptAltstepSpec: // 231 |
| 4488 | AltstepKeyword AltstepRefList |
| 4489 | | AltstepKeyword AllKeyword |
| 4490 | ; |
| 4491 | |
| 4492 | ExceptFunctionSpec: // 232 |
| 4493 | FunctionKeyword FunctionRefList |
| 4494 | | FunctionKeyword AllKeyword |
| 4495 | ; |
| 4496 | |
| 4497 | ExceptSignatureSpec: // 233 |
| 4498 | SignatureKeyword SignatureRefList |
| 4499 | | SignatureKeyword AllKeyword |
| 4500 | ; |
| 4501 | |
| 4502 | ExceptModuleParSpec: // 234 |
| 4503 | ModuleParKeyword ModuleParRefList |
| 4504 | | ModuleParKeyword AllKeyword |
| 4505 | ; |
| 4506 | |
| 4507 | ImportSpec: // 235 |
| 4508 | /* empty */ optError |
| 4509 | { $$ = ImpMod::I_ALL; } |
| 4510 | | ImportSpec ImportElement optSemiColon |
| 4511 | { |
| 4512 | switch ($$) { |
| 4513 | case ImpMod::I_ALL: // it was empty before |
| 4514 | $$ = $2; |
| 4515 | break; |
| 4516 | |
| 4517 | case ImpMod::I_IMPORTSPEC: |
| 4518 | switch ($2) { |
| 4519 | case ImpMod::I_IMPORTSPEC: |
| 4520 | // selective import followed by another selective import: NOP |
| 4521 | break; |
| 4522 | case ImpMod::I_IMPORTIMPORT: |
| 4523 | $$ = $2; // import of import wins over selective import |
| 4524 | break; |
| 4525 | default: // including I_ALL |
| 4526 | FATAL_ERROR("Selective import cannot be followed by import all"); |
| 4527 | } |
| 4528 | break; |
| 4529 | |
| 4530 | case ImpMod::I_IMPORTIMPORT: |
| 4531 | switch ($2) { |
| 4532 | case ImpMod::I_IMPORTSPEC: |
| 4533 | // import of import followed by selective import: NOP (import of import wins) |
| 4534 | break; |
| 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"); |
| 4538 | break; |
| 4539 | default: // including I_ALL |
| 4540 | FATAL_ERROR("Import of imports cannot be followed by import all"); |
| 4541 | } |
| 4542 | break; |
| 4543 | |
| 4544 | default: |
| 4545 | FATAL_ERROR("Invalid import type"); |
| 4546 | } |
| 4547 | } |
| 4548 | ; |
| 4549 | |
| 4550 | ImportElement: // 236 |
| 4551 | ImportGroupSpec |
| 4552 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4553 | | ImportTypeDefSpec |
| 4554 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4555 | | ImportTemplateSpec |
| 4556 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4557 | | ImportConstSpec |
| 4558 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4559 | | ImportTestcaseSpec |
| 4560 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4561 | | ImportAltstepSpec |
| 4562 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4563 | | ImportFunctionSpec |
| 4564 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4565 | | ImportSignatureSpec |
| 4566 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4567 | | ImportModuleParSpec |
| 4568 | { $$ = ImpMod::I_IMPORTSPEC; } |
| 4569 | | ImportImportSpec |
| 4570 | { $$ = ImpMod::I_IMPORTIMPORT; } |
| 4571 | ; |
| 4572 | |
| 4573 | ImportImportSpec: |
| 4574 | ImportKeyword AllKeyword |
| 4575 | |
| 4576 | ImportFromSpec: // 237 |
| 4577 | FromKeyword ModuleId { $$ = $2; } |
| 4578 | | FromKeyword ModuleId RecursiveKeyword // already deprecated in v3.2.1 |
| 4579 | { |
| 4580 | $$ = $2; |
| 4581 | $$->set_recursive(); |
| 4582 | } |
| 4583 | ; |
| 4584 | |
| 4585 | ImportGroupSpec: // 239 |
| 4586 | GroupKeyword GroupRefListWithExcept |
| 4587 | | GroupKeyword AllGroupsWithExcept |
| 4588 | | GroupKeyword error |
| 4589 | ; |
| 4590 | |
| 4591 | GroupRefList: // 240 |
| 4592 | optError FullGroupIdentifier { delete $2; } |
| 4593 | | GroupRefList optError ',' optError FullGroupIdentifier { delete $5; } |
| 4594 | | GroupRefList optError ',' error |
| 4595 | ; |
| 4596 | |
| 4597 | GroupRefListWithExcept: // 241 |
| 4598 | optError FullGroupIdentifierWithExcept |
| 4599 | | GroupRefListWithExcept optError ',' optError FullGroupIdentifierWithExcept |
| 4600 | | GroupRefListWithExcept optError ',' error |
| 4601 | ; |
| 4602 | |
| 4603 | AllGroupsWithExcept: // 242 |
| 4604 | AllKeyword |
| 4605 | | AllKeyword error |
| 4606 | | AllKeyword ExceptKeyword GroupRefList |
| 4607 | | AllKeyword ExceptKeyword error |
| 4608 | ; |
| 4609 | |
| 4610 | FullGroupIdentifier: // 243 |
| 4611 | IDentifier |
| 4612 | { |
| 4613 | $$ = new Qualifier(); |
| 4614 | $$->add(new FieldOrArrayRef($1)); |
| 4615 | $$->set_location(infile, @$); |
| 4616 | } |
| 4617 | | FullGroupIdentifier '.' IDentifier |
| 4618 | { |
| 4619 | $$ = $1; |
| 4620 | $$->add(new FieldOrArrayRef($3)); |
| 4621 | $$->set_location(infile, @$); |
| 4622 | } |
| 4623 | ; |
| 4624 | |
| 4625 | FullGroupIdentifierWithExcept: // 244 |
| 4626 | FullGroupIdentifier { delete $1; } |
| 4627 | | FullGroupIdentifier ExceptsDef { delete $1; } |
| 4628 | ; |
| 4629 | |
| 4630 | ExceptGroupRefList: // 245 |
| 4631 | optError ExceptFullGroupIdentifier |
| 4632 | | ExceptGroupRefList optError ',' optError ExceptFullGroupIdentifier |
| 4633 | | ExceptGroupRefList optError ',' error |
| 4634 | ; |
| 4635 | |
| 4636 | ExceptFullGroupIdentifier: // 246 |
| 4637 | FullGroupIdentifier { delete $1;} |
| 4638 | ; |
| 4639 | |
| 4640 | ImportTypeDefSpec: // 247 |
| 4641 | TypeDefKeyword TypeRefList |
| 4642 | | TypeDefKeyword AllTypesWithExcept |
| 4643 | | TypeDefKeyword error |
| 4644 | ; |
| 4645 | |
| 4646 | TypeRefList: // 248 |
| 4647 | optError IDentifier { delete $2; } |
| 4648 | | TypeRefList optError ',' optError IDentifier { delete $5; } |
| 4649 | | TypeRefList optError ',' error |
| 4650 | ; |
| 4651 | |
| 4652 | AllTypesWithExcept: // 249 |
| 4653 | AllKeyword |
| 4654 | | AllKeyword error |
| 4655 | | AllKeyword ExceptKeyword TypeRefList |
| 4656 | | AllKeyword ExceptKeyword error |
| 4657 | ; |
| 4658 | |
| 4659 | /* 250. TypeDefIdentifier is replaced by IDentifier */ |
| 4660 | |
| 4661 | ImportTemplateSpec: // 251 |
| 4662 | TemplateKeyword TemplateRefList |
| 4663 | | TemplateKeyword AllTemplsWithExcept |
| 4664 | | TemplateKeyword error |
| 4665 | ; |
| 4666 | |
| 4667 | TemplateRefList: // 252 |
| 4668 | optError IDentifier { delete $2; } |
| 4669 | | TemplateRefList optError ',' optError IDentifier { delete $5; } |
| 4670 | | TemplateRefList optError ',' error |
| 4671 | ; |
| 4672 | |
| 4673 | AllTemplsWithExcept: // 253 |
| 4674 | AllKeyword |
| 4675 | | AllKeyword error |
| 4676 | | AllKeyword ExceptKeyword TemplateRefList |
| 4677 | | AllKeyword ExceptKeyword error |
| 4678 | ; |
| 4679 | |
| 4680 | ImportConstSpec: // 254 |
| 4681 | ConstKeyword ConstRefList |
| 4682 | | ConstKeyword AllConstsWithExcept |
| 4683 | | ConstKeyword error |
| 4684 | ; |
| 4685 | |
| 4686 | ConstRefList: // 255 |
| 4687 | optError IDentifier { delete $2; } |
| 4688 | | ConstRefList optError ',' optError IDentifier { delete $5; } |
| 4689 | | ConstRefList optError ',' error |
| 4690 | ; |
| 4691 | |
| 4692 | AllConstsWithExcept: // 256 |
| 4693 | AllKeyword |
| 4694 | | AllKeyword error |
| 4695 | | AllKeyword ExceptKeyword ConstRefList |
| 4696 | | AllKeyword ExceptKeyword error |
| 4697 | ; |
| 4698 | |
| 4699 | ImportAltstepSpec: // 257 |
| 4700 | AltstepKeyword AltstepRefList |
| 4701 | | AltstepKeyword AllAltstepsWithExcept |
| 4702 | | AltstepKeyword error |
| 4703 | ; |
| 4704 | |
| 4705 | AltstepRefList: // 258 |
| 4706 | optError IDentifier { delete $2; } |
| 4707 | | AltstepRefList optError ',' optError IDentifier { delete $5; } |
| 4708 | | AltstepRefList optError ',' error |
| 4709 | ; |
| 4710 | |
| 4711 | AllAltstepsWithExcept: // 259 |
| 4712 | AllKeyword |
| 4713 | | AllKeyword error |
| 4714 | | AllKeyword ExceptKeyword AltstepRefList |
| 4715 | | AllKeyword ExceptKeyword error |
| 4716 | ; |
| 4717 | |
| 4718 | ImportTestcaseSpec: // 260 |
| 4719 | TestcaseKeyword TestcaseRefList |
| 4720 | | TestcaseKeyword AllTestcasesWithExcept |
| 4721 | | TestcaseKeyword error |
| 4722 | ; |
| 4723 | |
| 4724 | TestcaseRefList: // 261 |
| 4725 | optError IDentifier { delete $2; } |
| 4726 | | TestcaseRefList optError ',' optError IDentifier { delete $5; } |
| 4727 | | TestcaseRefList optError ',' error |
| 4728 | ; |
| 4729 | |
| 4730 | AllTestcasesWithExcept: // 262 |
| 4731 | AllKeyword |
| 4732 | | AllKeyword error |
| 4733 | | AllKeyword ExceptKeyword TestcaseRefList |
| 4734 | | AllKeyword ExceptKeyword error |
| 4735 | ; |
| 4736 | |
| 4737 | ImportFunctionSpec: // 263 |
| 4738 | FunctionKeyword FunctionRefList |
| 4739 | | FunctionKeyword AllFunctionsWithExcept |
| 4740 | | FunctionKeyword error |
| 4741 | ; |
| 4742 | |
| 4743 | FunctionRefList: // 264 |
| 4744 | optError IDentifier { delete $2; } |
| 4745 | | FunctionRefList optError ',' optError IDentifier { delete $5; } |
| 4746 | | FunctionRefList optError ',' error |
| 4747 | ; |
| 4748 | |
| 4749 | AllFunctionsWithExcept: // 265 |
| 4750 | AllKeyword |
| 4751 | | AllKeyword error |
| 4752 | | AllKeyword ExceptKeyword FunctionRefList |
| 4753 | | AllKeyword ExceptKeyword error |
| 4754 | ; |
| 4755 | |
| 4756 | ImportSignatureSpec: // 266 |
| 4757 | SignatureKeyword SignatureRefList |
| 4758 | | SignatureKeyword AllSignaturesWithExcept |
| 4759 | | SignatureKeyword error |
| 4760 | ; |
| 4761 | |
| 4762 | SignatureRefList: // 267 |
| 4763 | optError IDentifier { delete $2; } |
| 4764 | | SignatureRefList optError ',' optError IDentifier { delete $5; } |
| 4765 | | SignatureRefList optError ',' error |
| 4766 | ; |
| 4767 | |
| 4768 | AllSignaturesWithExcept: // 268 |
| 4769 | AllKeyword |
| 4770 | | AllKeyword error |
| 4771 | | AllKeyword ExceptKeyword SignatureRefList |
| 4772 | | AllKeyword ExceptKeyword error |
| 4773 | ; |
| 4774 | |
| 4775 | ImportModuleParSpec: // 269 |
| 4776 | ModuleParKeyword ModuleParRefList |
| 4777 | | ModuleParKeyword AllModuleParWithExcept |
| 4778 | | ModuleParKeyword error |
| 4779 | ; |
| 4780 | |
| 4781 | ModuleParRefList: // 270 |
| 4782 | optError IDentifier { delete $2; } |
| 4783 | | ModuleParRefList optError ',' optError IDentifier { delete $5; } |
| 4784 | | ModuleParRefList optError ',' error |
| 4785 | ; |
| 4786 | |
| 4787 | AllModuleParWithExcept: // 271 |
| 4788 | AllKeyword |
| 4789 | | AllKeyword error |
| 4790 | | AllKeyword ExceptKeyword ModuleParRefList |
| 4791 | | AllKeyword ExceptKeyword error |
| 4792 | ; |
| 4793 | |
| 4794 | // 272 ImportImportSpec: ImportKeyword AllKeyword |
| 4795 | |
| 4796 | /* A.1.6.1.9 Group definitions */ |
| 4797 | |
| 4798 | GroupDef: // 273 |
| 4799 | GroupIdentifier '{' optErrorBlock '}' |
| 4800 | { |
| 4801 | $$ = $1; |
| 4802 | $$->set_location(infile, @$); |
| 4803 | } |
| 4804 | | GroupIdentifier '{' ModuleDefinitionsList optErrorBlock '}' |
| 4805 | { |
| 4806 | $$ = $1; |
| 4807 | $$->set_location(infile, @$); |
| 4808 | } |
| 4809 | ; |
| 4810 | |
| 4811 | GroupIdentifier: // 274 (followed by) 275. |
| 4812 | GroupKeyword IDentifier |
| 4813 | { |
| 4814 | $$ = new Group($2); |
| 4815 | $$->set_parent_group(act_group); |
| 4816 | $$->set_location(infile, @$); |
| 4817 | if (act_group) { |
| 4818 | act_group->add_group($$); |
| 4819 | $$->set_parent_path(act_group->get_attrib_path()); |
| 4820 | } else { |
| 4821 | act_ttcn3_module->add_group($$); |
| 4822 | $$->set_parent_path(act_ttcn3_module->get_attrib_path()); |
| 4823 | } |
| 4824 | act_group = $$; |
| 4825 | } |
| 4826 | ; |
| 4827 | |
| 4828 | /* A.1.6.1.10 External function definitions */ |
| 4829 | |
| 4830 | ExtFunctionDef: // 276 |
| 4831 | ExtKeyword FunctionKeyword IDentifier |
| 4832 | '(' optFunctionFormalParList ')' optReturnType |
| 4833 | { |
| 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, @$); |
| 4838 | } |
| 4839 | ; |
| 4840 | |
| 4841 | /* A.1.6.1.11 External constant definitions */ |
| 4842 | |
| 4843 | ExtConstDef: // 279 |
| 4844 | ExtKeyword ConstKeyword Type IdentifierList |
| 4845 | { |
| 4846 | $$.nElements = $4.nElements; |
| 4847 | $$.elements = (Ttcn::Definition**) |
| 4848 | Malloc($$.nElements * sizeof(*$$.elements)); |
| 4849 | for (size_t i = 0; i < $$.nElements; i++) { |
| 4850 | Type *type; |
| 4851 | if (i > 0) { |
| 4852 | type = new Type(Type::T_REFDSPEC, $3); |
| 4853 | type->set_location(*$3); |
| 4854 | } else type = $3; |
| 4855 | $$.elements[i] = new Ttcn::Def_ExtConst($4.elements[i].id, type); |
| 4856 | $$.elements[i]->set_location(infile, $4.elements[i].yyloc); |
| 4857 | } |
| 4858 | Free($4.elements); |
| 4859 | } |
| 4860 | ; |
| 4861 | |
| 4862 | IdentifierList: // 280 ExtConstIdentifierList |
| 4863 | optError IDentifier |
| 4864 | { |
| 4865 | $$.nElements = 1; |
| 4866 | $$.elements = (YYSTYPE::extconstidentifier_t*)Malloc(sizeof(*$$.elements)); |
| 4867 | $$.elements[0].id = $2; |
| 4868 | $$.elements[0].yyloc = @2; |
| 4869 | } |
| 4870 | | IdentifierList ',' optError IDentifier |
| 4871 | { |
| 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; |
| 4877 | } |
| 4878 | | IdentifierList ',' error { $$ = $1; } |
| 4879 | ; |
| 4880 | |
| 4881 | /* A.1.6.1.12 Module parameter definitions */ |
| 4882 | |
| 4883 | ModuleParDef: // 282 |
| 4884 | ModuleParKeyword ModulePar { $$ = $2; } |
| 4885 | | ModuleParKeyword '{' MultiTypedModuleParList optError '}' { $$ = $3; } |
| 4886 | | ModuleParKeyword '{' error '}' { $$.nElements = 0; $$.elements = NULL; } |
| 4887 | ; |
| 4888 | |
| 4889 | MultiTypedModuleParList: // 284 |
| 4890 | optError ModulePar optSemiColon { $$ = $2; } |
| 4891 | | MultiTypedModuleParList optError ModulePar optSemiColon |
| 4892 | { |
| 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)); |
| 4898 | Free($3.elements); |
| 4899 | } |
| 4900 | ; |
| 4901 | |
| 4902 | ModulePar: // 285 |
| 4903 | Type ModuleParList |
| 4904 | { |
| 4905 | $$.nElements = $2.nElements; |
| 4906 | $$.elements = (Ttcn::Definition**) |
| 4907 | Malloc($$.nElements * sizeof(*$$.elements)); |
| 4908 | for(size_t i = 0; i < $2.nElements; i++) { |
| 4909 | Type *type; |
| 4910 | if (i > 0) { |
| 4911 | type = new Type(Type::T_REFDSPEC, $1); |
| 4912 | type->set_location(*$1); |
| 4913 | } else type = $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); |
| 4917 | } |
| 4918 | Free($2.elements); |
| 4919 | } |
| 4920 | | TemplateKeyword Type TemplateModuleParList |
| 4921 | { |
| 4922 | $$.nElements = $3.nElements; |
| 4923 | $$.elements = (Ttcn::Definition**)Malloc($$.nElements * sizeof(*$$.elements)); |
| 4924 | for(size_t i = 0; i < $3.nElements; i++) { |
| 4925 | Type *type; |
| 4926 | if (i > 0) { |
| 4927 | type = new Type(Type::T_REFDSPEC, $2); |
| 4928 | type->set_location(*$2); |
| 4929 | } else type = $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); |
| 4932 | } |
| 4933 | Free($3.elements); |
| 4934 | } |
| 4935 | ; |
| 4936 | |
| 4937 | ModuleParList: // 287 |
| 4938 | optError SingleModulePar |
| 4939 | { |
| 4940 | $$.nElements = 1; |
| 4941 | $$.elements = (YYSTYPE::singlemodulepar_t*)Malloc(sizeof(*$$.elements)); |
| 4942 | $$.elements[0] = $2; |
| 4943 | } |
| 4944 | | ModuleParList ',' optError SingleModulePar |
| 4945 | { |
| 4946 | $$.nElements = $1.nElements + 1; |
| 4947 | $$.elements = (YYSTYPE::singlemodulepar_t*) |
| 4948 | Realloc($1.elements, $$.nElements * sizeof(*$$.elements)); |
| 4949 | $$.elements[$$.nElements - 1] = $4; |
| 4950 | } |
| 4951 | ; |
| 4952 | |
| 4953 | TemplateModuleParList: // 287 |
| 4954 | optError SingleTemplateModulePar |
| 4955 | { |
| 4956 | $$.nElements = 1; |
| 4957 | $$.elements = (YYSTYPE::singletemplatemodulepar_t*)Malloc(sizeof(*$$.elements)); |
| 4958 | $$.elements[0] = $2; |
| 4959 | } |
| 4960 | | TemplateModuleParList ',' optError SingleTemplateModulePar |
| 4961 | { |
| 4962 | $$.nElements = $1.nElements + 1; |
| 4963 | $$.elements = (YYSTYPE::singletemplatemodulepar_t*) |
| 4964 | Realloc($1.elements, $$.nElements * sizeof(*$$.elements)); |
| 4965 | $$.elements[$$.nElements - 1] = $4; |
| 4966 | } |
| 4967 | ; |
| 4968 | |
| 4969 | SingleModulePar: |
| 4970 | IDentifier |
| 4971 | { |
| 4972 | $$.id = $1; |
| 4973 | $$.defval = NULL; |
| 4974 | $$.yyloc = @$; |
| 4975 | } |
| 4976 | | IDentifier AssignmentChar Expression |
| 4977 | { |
| 4978 | $$.id = $1; |
| 4979 | $$.defval = $3; |
| 4980 | $$.yyloc = @$; |
| 4981 | } |
| 4982 | ; |
| 4983 | |
| 4984 | SingleTemplateModulePar: |
| 4985 | IDentifier |
| 4986 | { |
| 4987 | $$.id = $1; |
| 4988 | $$.deftempl = NULL; |
| 4989 | $$.yyloc = @$; |
| 4990 | } |
| 4991 | | IDentifier AssignmentChar TemplateBody |
| 4992 | { |
| 4993 | $$.id = $1; |
| 4994 | $$.deftempl = $3; |
| 4995 | $$.yyloc = @$; |
| 4996 | } |
| 4997 | ; |
| 4998 | |
| 4999 | /* A.1.6.1.13 */ |
| 5000 | FriendModuleDef: // 289 |
| 5001 | FriendKeyword TTCN3ModuleKeyword IdentifierList optSemiColon |
| 5002 | { |
| 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); |
| 5009 | } |
| 5010 | Free($3.elements); |
| 5011 | } |
| 5012 | ; |
| 5013 | |
| 5014 | /* A.1.6.2 Control part */ |
| 5015 | |
| 5016 | /* A.1.6.2.0 General */ |
| 5017 | |
| 5018 | ModuleControlPart: // 290 |
| 5019 | optError ControlKeyword |
| 5020 | '{' ModuleControlBody '}' |
| 5021 | optWithStatementAndSemiColon |
| 5022 | { |
| 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); |
| 5028 | } |
| 5029 | ; |
| 5030 | |
| 5031 | ModuleControlBody: // 292 |
| 5032 | /* empty */ optError { $$=new StatementBlock(); } |
| 5033 | | ControlStatementOrDefList { $$ = $1; } |
| 5034 | ; |
| 5035 | |
| 5036 | ControlStatementOrDefList: // 293 |
| 5037 | optError ControlStatementOrDef optSemiColon |
| 5038 | { |
| 5039 | $$=new StatementBlock(); |
| 5040 | for(size_t i=0; i<$2.nElements; i++) $$->add_stmt($2.elements[i]); |
| 5041 | Free($2.elements); |
| 5042 | } |
| 5043 | | ControlStatementOrDefList optError ControlStatementOrDef optSemiColon |
| 5044 | { |
| 5045 | $$=$1; |
| 5046 | for(size_t i=0; i<$3.nElements; i++) $$->add_stmt($3.elements[i]); |
| 5047 | Free($3.elements); |
| 5048 | } |
| 5049 | ; |
| 5050 | |
| 5051 | ControlStatementOrDef: // 294 |
| 5052 | FunctionLocalDef |
| 5053 | { |
| 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]); |
| 5059 | } |
| 5060 | Free($1.elements); |
| 5061 | } |
| 5062 | | FunctionLocalInst |
| 5063 | { |
| 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]); |
| 5069 | } |
| 5070 | Free($1.elements); |
| 5071 | } |
| 5072 | | ControlStatement |
| 5073 | { |
| 5074 | $$.nElements=1; |
| 5075 | $$.elements=(Statement**)Malloc($$.nElements*sizeof(*$$.elements)); |
| 5076 | $$.elements[0]=$1; |
| 5077 | } |
| 5078 | ; |
| 5079 | |
| 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; } |
| 5088 | ; |
| 5089 | |
| 5090 | /* A.1.6.2.1 Variable instantiation */ |
| 5091 | |
| 5092 | VarInstance: // 296 |
| 5093 | VarKeyword Type VarList |
| 5094 | { |
| 5095 | $$.nElements = $3.nElements; |
| 5096 | $$.elements = (Ttcn::Definition**) |
| 5097 | Malloc($$.nElements*sizeof(*$$.elements)); |
| 5098 | for (size_t i = 0; i < $$.nElements; i++) { |
| 5099 | Type *type; |
| 5100 | if (i > 0) { |
| 5101 | type = new Type(Type::T_REFDSPEC, $2); |
| 5102 | type->set_location(*$2); |
| 5103 | } else type = $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); |
| 5109 | } |
| 5110 | Free($3.elements[i].arrays.elements); |
| 5111 | |
| 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); |
| 5116 | } |
| 5117 | Free($3.elements); |
| 5118 | } |
| 5119 | | VarKeyword TemplateOptRestricted Type TempVarList |
| 5120 | { |
| 5121 | $$.nElements = $4.nElements; |
| 5122 | $$.elements = (Ttcn::Definition**) |
| 5123 | Malloc($$.nElements * sizeof(*$$.elements)); |
| 5124 | for (size_t i = 0; i < $$.nElements; i++) { |
| 5125 | Type *type; |
| 5126 | if (i > 0) { |
| 5127 | type = new Type(Type::T_REFDSPEC, $3); |
| 5128 | type->set_location(*$3); |
| 5129 | } else type = $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); |
| 5135 | } |
| 5136 | Free($4.elements[i].arrays.elements); |
| 5137 | |
| 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); |
| 5142 | } |
| 5143 | |
| 5144 | Free($4.elements); |
| 5145 | } |
| 5146 | ; |
| 5147 | |
| 5148 | VarList: // 297 |
| 5149 | optError SingleVarInstance |
| 5150 | { |
| 5151 | $$.nElements = 1; |
| 5152 | $$.elements = (YYSTYPE::singlevarinst_t*)Malloc(sizeof(*$$.elements)); |
| 5153 | $$.elements[0] = $2; |
| 5154 | } |
| 5155 | | VarList ',' optError SingleVarInstance |
| 5156 | { |
| 5157 | $$.nElements = $1.nElements + 1; |
| 5158 | $$.elements = (YYSTYPE::singlevarinst_t*) |
| 5159 | Realloc($1.elements, $$.nElements * sizeof(*$$.elements)); |
| 5160 | $$.elements[$$.nElements - 1] = $4; |
| 5161 | } |
| 5162 | ; |
| 5163 | |
| 5164 | SingleVarInstance: // 298 |
| 5165 | IDentifier optArrayDef |
| 5166 | { |
| 5167 | $$.id = $1; |
| 5168 | $$.arrays = $2; |
| 5169 | $$.initial_value = 0; |
| 5170 | $$.yyloc = @$; |
| 5171 | } |
| 5172 | | IDentifier optArrayDef AssignmentChar Expression |
| 5173 | { |
| 5174 | $$.id = $1; |
| 5175 | $$.arrays = $2; |
| 5176 | $$.initial_value = $4; |
| 5177 | $$.yyloc = @$; |
| 5178 | } |
| 5179 | ; |
| 5180 | |
| 5181 | TempVarList: // 302 |
| 5182 | optError SingleTempVarInstance |
| 5183 | { |
| 5184 | $$.nElements = 1; |
| 5185 | $$.elements = (YYSTYPE::singletempvarinst_t*)Malloc(sizeof(*$$.elements)); |
| 5186 | $$.elements[0] = $2; |
| 5187 | } |
| 5188 | | TempVarList ',' optError SingleTempVarInstance |
| 5189 | { |
| 5190 | $$.nElements = $1.nElements + 1; |
| 5191 | $$.elements = (YYSTYPE::singletempvarinst_t*) |
| 5192 | Realloc($1.elements, $$.nElements * sizeof(*$$.elements)); |
| 5193 | $$.elements[$$.nElements - 1] = $4; |
| 5194 | } |
| 5195 | ; |
| 5196 | |
| 5197 | SingleTempVarInstance: // 303 |
| 5198 | IDentifier optArrayDef |
| 5199 | { |
| 5200 | $$.id = $1; |
| 5201 | $$.arrays = $2; |
| 5202 | $$.initial_value = NULL; |
| 5203 | $$.yyloc = @$; |
| 5204 | } |
| 5205 | | IDentifier optArrayDef AssignmentChar TemplateBody |
| 5206 | { |
| 5207 | $$.id = $1; |
| 5208 | $$.arrays = $2; |
| 5209 | $$.initial_value = $4; |
| 5210 | $$.yyloc = @$; |
| 5211 | } |
| 5212 | ; |
| 5213 | |
| 5214 | VariableRef: // 305 |
| 5215 | Reference |
| 5216 | { |
| 5217 | if ($1.is_ref) $$ = $1.ref; |
| 5218 | else { |
| 5219 | $$ = new Ttcn::Reference($1.id); |
| 5220 | $$->set_location(infile, @$); |
| 5221 | } |
| 5222 | } |
| 5223 | ; |
| 5224 | |
| 5225 | /* A.1.6.2.2 Timer instantiation */ |
| 5226 | |
| 5227 | TimerInstance: // 306 |
| 5228 | TimerKeyword TimerList { $$ = $2; } |
| 5229 | ; |
| 5230 | |
| 5231 | TimerList: // 307 |
| 5232 | optError SingleTimerInstance |
| 5233 | { |
| 5234 | $$.nElements = 1; |
| 5235 | $$.elements = (Ttcn::Definition**)Malloc(sizeof(*$$.elements)); |
| 5236 | $$.elements[0] = $2; |
| 5237 | } |
| 5238 | | TimerList ',' optError SingleTimerInstance |
| 5239 | { |
| 5240 | $$.nElements = $1.nElements + 1; |
| 5241 | $$.elements = (Ttcn::Definition**) |
| 5242 | Realloc($1.elements, $$.nElements * sizeof(*$$.elements)); |
| 5243 | $$.elements[$$.nElements - 1] = $4; |
| 5244 | } |
| 5245 | ; |
| 5246 | |
| 5247 | SingleTimerInstance: // 308 |
| 5248 | IDentifier optArrayDef |
| 5249 | { |
| 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]); |
| 5254 | Free($2.elements); |
| 5255 | } else dims = 0; |
| 5256 | $$ = new Ttcn::Def_Timer($1, dims, 0); |
| 5257 | $$->set_location(infile, @$); |
| 5258 | } |
| 5259 | | IDentifier optArrayDef AssignmentChar TimerValue |
| 5260 | { |
| 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]); |
| 5265 | Free($2.elements); |
| 5266 | } else dims = 0; |
| 5267 | $$ = new Ttcn::Def_Timer($1, dims, $4); |
| 5268 | $$->set_location(infile, @$); |
| 5269 | } |
| 5270 | ; |
| 5271 | |
| 5272 | TimerValue: // 311 |
| 5273 | Expression { $$ = $1; } |
| 5274 | ; |
| 5275 | |
| 5276 | TimerRef: // 312 |
| 5277 | VariableRef { $$ = $1; } |
| 5278 | ; |
| 5279 | |
| 5280 | /* A.1.6.2.3 Component operations */ |
| 5281 | |
| 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; } |
| 5292 | ; |
| 5293 | |
| 5294 | ConfigurationOps: // 314 |
| 5295 | CreateOp {$$=$1;} |
| 5296 | | SelfOp {$$=$1;} |
| 5297 | | SystemOp {$$=$1;} |
| 5298 | | MTCOp {$$=$1;} |
| 5299 | | RunningOp {$$=$1;} |
| 5300 | | AliveOp { $$ = $1; } |
| 5301 | ; |
| 5302 | |
| 5303 | CreateOp: // 315 |
| 5304 | VariableRef DotCreateKeyword optCreateParameter optAliveKeyword |
| 5305 | { |
| 5306 | $$ = new Value(Value::OPTYPE_COMP_CREATE, $1, $3.name, $3.loc, $4); |
| 5307 | $$->set_location(infile, @$); |
| 5308 | } |
| 5309 | ; |
| 5310 | |
| 5311 | optCreateParameter: |
| 5312 | /* empty */ |
| 5313 | { |
| 5314 | $$.name=0; |
| 5315 | $$.loc=0; |
| 5316 | } |
| 5317 | | '(' optError Expression optError ')' |
| 5318 | { |
| 5319 | $$.name = $3; |
| 5320 | $$.loc = 0; |
| 5321 | } |
| 5322 | | '(' optError Expression optError ',' optError Expression optError ')' |
| 5323 | { |
| 5324 | $$.name = $3; |
| 5325 | $$.loc = $7; |
| 5326 | } |
| 5327 | | '(' optError NotUsedSymbol optError ',' optError Expression optError ')' |
| 5328 | { |
| 5329 | $$.name = 0; |
| 5330 | $$.loc = $7; |
| 5331 | } |
| 5332 | | '(' error ')' |
| 5333 | { |
| 5334 | $$.name = 0; |
| 5335 | $$.loc = 0; |
| 5336 | } |
| 5337 | ; |
| 5338 | |
| 5339 | optAliveKeyword: // [328] |
| 5340 | /* empty */ { $$ = false; } |
| 5341 | | AliveKeyword { $$ = true; } |
| 5342 | ; |
| 5343 | |
| 5344 | SystemOp: // 316 |
| 5345 | SystemKeyword |
| 5346 | { |
| 5347 | $$=new Value(Value::OPTYPE_COMP_SYSTEM); |
| 5348 | $$->set_location(infile, @$); |
| 5349 | } |
| 5350 | ; |
| 5351 | |
| 5352 | SelfOp: // 317 |
| 5353 | SelfKeyword |
| 5354 | { |
| 5355 | $$=new Value(Value::OPTYPE_COMP_SELF); |
| 5356 | $$->set_location(infile, @$); |
| 5357 | } |
| 5358 | ; |
| 5359 | |
| 5360 | MTCOp: // 318 |
| 5361 | MTCKeyword |
| 5362 | { |
| 5363 | $$=new Value(Value::OPTYPE_COMP_MTC); |
| 5364 | $$->set_location(infile, @$); |
| 5365 | } |
| 5366 | ; |
| 5367 | |
| 5368 | DoneStatement: // 319 |
| 5369 | ComponentOrDefaultReference DotDoneKeyword optDoneParameter |
| 5370 | { |
| 5371 | $$ = new Statement(Statement::S_DONE, $1, $3.donematch, $3.redirect); |
| 5372 | $$->set_location(infile, @$); |
| 5373 | } |
| 5374 | | AnyKeyword ComponentKeyword DotDoneKeyword |
| 5375 | { |
| 5376 | $$ = new Statement(Statement::S_DONE, Statement::C_ANY); |
| 5377 | $$->set_location(infile, @$); |
| 5378 | } |
| 5379 | | AllKeyword ComponentKeyword DotDoneKeyword |
| 5380 | { |
| 5381 | $$ = new Statement(Statement::S_DONE, Statement::C_ALL); |
| 5382 | $$->set_location(infile, @$); |
| 5383 | } |
| 5384 | ; |
| 5385 | |
| 5386 | optDoneParameter: |
| 5387 | optReceiveParameter |
| 5388 | { |
| 5389 | $$.donematch = $1; |
| 5390 | $$.redirect = 0; |
| 5391 | } |
| 5392 | | optReceiveParameter PortRedirectSymbol ValueSpec |
| 5393 | { |
| 5394 | $$.donematch = $1; |
| 5395 | $$.redirect = $3; |
| 5396 | } |
| 5397 | ; |
| 5398 | |
| 5399 | KilledStatement: // 320 |
| 5400 | ComponentOrDefaultReference DotKilledKeyword |
| 5401 | { |
| 5402 | $$ = new Statement(Statement::S_KILLED, $1); |
| 5403 | $$->set_location(infile, @$); |
| 5404 | } |
| 5405 | | AnyKeyword ComponentKeyword DotKilledKeyword |
| 5406 | { |
| 5407 | $$ = new Statement(Statement::S_KILLED, Statement::C_ANY); |
| 5408 | $$->set_location(infile, @$); |
| 5409 | } |
| 5410 | | AllKeyword ComponentKeyword DotKilledKeyword |
| 5411 | { |
| 5412 | $$ = new Statement(Statement::S_KILLED, Statement::C_ALL); |
| 5413 | $$->set_location(infile, @$); |
| 5414 | } |
| 5415 | ; |
| 5416 | |
| 5417 | /* |
| 5418 | ComponentId: // 321 |
| 5419 | ComponentOrDefaultReference |
| 5420 | | AnyKeyword ComponentKeyword |
| 5421 | | AllKeyword ComponentKeyword |
| 5422 | ; |
| 5423 | */ |
| 5424 | |
| 5425 | RunningOp: // 324 |
| 5426 | /* VariableRef DotRunningKeyword -- covered by RunningTimerOp */ |
| 5427 | FunctionInstance DotRunningKeyword |
| 5428 | { |
| 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, @$); |
| 5433 | } |
| 5434 | | ApplyOp DotRunningKeyword |
| 5435 | { |
| 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, @$); |
| 5440 | } |
| 5441 | | AnyKeyword ComponentKeyword DotRunningKeyword |
| 5442 | { |
| 5443 | $$ = new Value(Value::OPTYPE_COMP_RUNNING_ANY); |
| 5444 | $$->set_location(infile, @$); |
| 5445 | } |
| 5446 | | AllKeyword ComponentKeyword DotRunningKeyword |
| 5447 | { |
| 5448 | $$ = new Value(Value::OPTYPE_COMP_RUNNING_ALL); |
| 5449 | $$->set_location(infile, @$); |
| 5450 | } |
| 5451 | ; |
| 5452 | |
| 5453 | AliveOp: // 326 |
| 5454 | ComponentOrDefaultReference DotAliveKeyword |
| 5455 | { |
| 5456 | $$ = new Value(Value::OPTYPE_COMP_ALIVE, $1); |
| 5457 | $$->set_location(infile, @$); |
| 5458 | } |
| 5459 | | AnyKeyword ComponentKeyword DotAliveKeyword |
| 5460 | { |
| 5461 | $$ = new Value(Value::OPTYPE_COMP_ALIVE_ANY); |
| 5462 | $$->set_location(infile, @$); |
| 5463 | } |
| 5464 | | AllKeyword ComponentKeyword DotAliveKeyword |
| 5465 | { |
| 5466 | $$ = new Value(Value::OPTYPE_COMP_ALIVE_ALL); |
| 5467 | $$->set_location(infile, @$); |
| 5468 | } |
| 5469 | ; |
| 5470 | |
| 5471 | ConnectStatement: // 329 |
| 5472 | ConnectKeyword SingleConnectionSpec |
| 5473 | { |
| 5474 | $$=new Statement(Statement::S_CONNECT, |
| 5475 | $2.compref1, $2.portref1, $2.compref2, $2.portref2); |
| 5476 | $$->set_location(infile, @$); |
| 5477 | } |
| 5478 | ; |
| 5479 | |
| 5480 | SingleConnectionSpec: // 331 |
| 5481 | '(' PortRef optError ',' optError PortRef optError ')' |
| 5482 | { |
| 5483 | $$.compref1 = $2.compref; |
| 5484 | $$.portref1 = $2.portref; |
| 5485 | $$.compref2 = $6.compref; |
| 5486 | $$.portref2 = $6.portref; |
| 5487 | } |
| 5488 | ; |
| 5489 | |
| 5490 | PortRef: // 332 |
| 5491 | ComponentRef ':' Port |
| 5492 | { |
| 5493 | $$.compref = $1; |
| 5494 | $$.portref = $3; |
| 5495 | } |
| 5496 | ; |
| 5497 | |
| 5498 | ComponentRef: // 333 |
| 5499 | ComponentOrDefaultReference { $$ = $1; } |
| 5500 | | SystemOp { $$ = $1; } |
| 5501 | | SelfOp { $$ = $1; } |
| 5502 | | MTCOp { $$ = $1; } |
| 5503 | ; |
| 5504 | |
| 5505 | DisconnectStatement: // 335 |
| 5506 | DisconnectKeyword |
| 5507 | { |
| 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, @$); |
| 5513 | } |
| 5514 | | DisconnectKeyword SingleOrMultiConnectionSpec |
| 5515 | { |
| 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); |
| 5519 | } else { |
| 5520 | Location loc(infile, @$); |
| 5521 | loc.error("Disconnect operation on multiple connections is " |
| 5522 | "not currently supported"); |
| 5523 | delete $2.compref1; |
| 5524 | delete $2.portref1; |
| 5525 | delete $2.compref2; |
| 5526 | delete $2.portref2; |
| 5527 | $$ = new Statement(Statement::S_ERROR); |
| 5528 | } |
| 5529 | $$->set_location(infile, @$); |
| 5530 | } |
| 5531 | ; |
| 5532 | |
| 5533 | SingleOrMultiConnectionSpec: // 336 |
| 5534 | SingleConnectionSpec { $$ = $1; } |
| 5535 | | AllConnectionsSpec |
| 5536 | { |
| 5537 | $$.compref1 = $1.compref; |
| 5538 | $$.portref1 = $1.portref; |
| 5539 | $$.compref2 = 0; |
| 5540 | $$.portref2 = 0; |
| 5541 | } |
| 5542 | | AllPortsSpec |
| 5543 | { |
| 5544 | $$.compref1 = $1; |
| 5545 | $$.portref1 = 0; |
| 5546 | $$.compref2 = 0; |
| 5547 | $$.portref2 = 0; |
| 5548 | } |
| 5549 | | AllCompsAllPortsSpec |
| 5550 | { |
| 5551 | $$.compref1 = 0; |
| 5552 | $$.portref1 = 0; |
| 5553 | $$.compref2 = 0; |
| 5554 | $$.portref2 = 0; |
| 5555 | } |
| 5556 | ; |
| 5557 | |
| 5558 | AllConnectionsSpec: // 337 |
| 5559 | '(' PortRef optError ')' { $$ = $2; } |
| 5560 | ; |
| 5561 | |
| 5562 | AllPortsSpec: // 338 |
| 5563 | '(' ComponentRef ':' AllKeyword PortKeyword optError ')' { $$ = $2; } |
| 5564 | ; |
| 5565 | |
| 5566 | AllCompsAllPortsSpec: // 339 |
| 5567 | '(' AllKeyword ComponentKeyword ':' AllKeyword PortKeyword optError ')' |
| 5568 | ; |
| 5569 | |
| 5570 | MapStatement: // 341 |
| 5571 | MapKeyword SingleConnectionSpec |
| 5572 | { |
| 5573 | $$=new Statement(Statement::S_MAP, |
| 5574 | $2.compref1, $2.portref1, |
| 5575 | $2.compref2, $2.portref2); |
| 5576 | $$->set_location(infile, @$); |
| 5577 | } |
| 5578 | ; |
| 5579 | |
| 5580 | UnmapStatement: // 343 |
| 5581 | UnmapKeyword |
| 5582 | { |
| 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"); |
| 5588 | } |
| 5589 | | UnmapKeyword SingleOrMultiConnectionSpec |
| 5590 | { |
| 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); |
| 5594 | } else { |
| 5595 | Location loc(infile, @$); |
| 5596 | loc.error("Unmap operation on multiple mappings is " |
| 5597 | "not currently supported"); |
| 5598 | delete $2.compref1; |
| 5599 | delete $2.portref1; |
| 5600 | delete $2.compref2; |
| 5601 | delete $2.portref2; |
| 5602 | $$ = new Statement(Statement::S_ERROR); |
| 5603 | } |
| 5604 | $$->set_location(infile, @$); |
| 5605 | } |
| 5606 | ; |
| 5607 | |
| 5608 | StartTCStatement: // 345 |
| 5609 | /* VariableRef DotStartKeyword '(' FunctionInstance ')' |
| 5610 | -- covered by StartTimerStatement */ |
| 5611 | VariableRef DotStartKeyword '(' DereferOp '(' optFunctionActualParList ')' |
| 5612 | optError ')' |
| 5613 | { |
| 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, @$); |
| 5620 | } |
| 5621 | | FunctionInstance DotStartKeyword '(' FunctionInstance optError ')' |
| 5622 | { |
| 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, @$); |
| 5627 | } |
| 5628 | | FunctionInstance DotStartKeyword '(' DereferOp '(' |
| 5629 | optFunctionActualParList ')' optError ')' |
| 5630 | { |
| 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, @$); |
| 5636 | } |
| 5637 | | FunctionInstance DotStartKeyword '(' error ')' |
| 5638 | { |
| 5639 | delete $1; |
| 5640 | $$ = new Statement(Statement::S_ERROR); |
| 5641 | $$->set_location(infile, @$); |
| 5642 | } |
| 5643 | | ApplyOp DotStartKeyword '(' FunctionInstance ')' |
| 5644 | { |
| 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, @$); |
| 5649 | } |
| 5650 | | ApplyOp DotStartKeyword '(' DereferOp '(' optFunctionActualParList ')' |
| 5651 | optError ')' |
| 5652 | { |
| 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, @$); |
| 5658 | } |
| 5659 | | ApplyOp DotStartKeyword '(' error ')' |
| 5660 | { |
| 5661 | delete $1.value; |
| 5662 | delete $1.ap_list; |
| 5663 | $$ = new Statement(Statement::S_ERROR); |
| 5664 | $$->set_location(infile, @$); |
| 5665 | } |
| 5666 | ; |
| 5667 | |
| 5668 | StopTCStatement: // 337 |
| 5669 | /* VariableRef DotStopKeyword -- covered by StopTimerStatement */ |
| 5670 | FunctionInstance DotStopKeyword |
| 5671 | { |
| 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, @$); |
| 5676 | } |
| 5677 | | ApplyOp DotStopKeyword |
| 5678 | { |
| 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, @$); |
| 5683 | } |
| 5684 | | MTCOp DotStopKeyword |
| 5685 | { |
| 5686 | $$ = new Statement(Statement::S_STOP_COMP, $1); |
| 5687 | $$->set_location(infile, @$); |
| 5688 | } |
| 5689 | | SelfOp DotStopKeyword |
| 5690 | { |
| 5691 | $$ = new Statement(Statement::S_STOP_COMP, $1); |
| 5692 | $$->set_location(infile, @$); |
| 5693 | } |
| 5694 | | AllKeyword ComponentKeyword DotStopKeyword |
| 5695 | { |
| 5696 | $$ = new Statement(Statement::S_STOP_COMP, (Value*)0); |
| 5697 | $$->set_location(infile, @$); |
| 5698 | } |
| 5699 | ; |
| 5700 | |
| 5701 | ComponentReferenceOrLiteral: // 348 |
| 5702 | ComponentOrDefaultReference { $$ = $1; } |
| 5703 | | MTCOp { $$ = $1; } |
| 5704 | | SelfOp { $$ = $1; } |
| 5705 | ; |
| 5706 | |
| 5707 | KillTCStatement: // 349 |
| 5708 | KillKeyword |
| 5709 | { |
| 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, @$); |
| 5714 | } |
| 5715 | | ComponentReferenceOrLiteral DotKillKeyword |
| 5716 | { |
| 5717 | $$ = new Statement(Statement::S_KILL, $1); |
| 5718 | $$->set_location(infile, @$); |
| 5719 | } |
| 5720 | | AllKeyword ComponentKeyword DotKillKeyword |
| 5721 | { |
| 5722 | $$ = new Statement(Statement::S_KILL, (Value*)0); |
| 5723 | $$->set_location(infile, @$); |
| 5724 | } |
| 5725 | ; |
| 5726 | |
| 5727 | ComponentOrDefaultReference: // 350 |
| 5728 | VariableRef |
| 5729 | { |
| 5730 | $$ = new Value(Value::V_REFD, $1); |
| 5731 | $$->set_location(infile, @$); |
| 5732 | } |
| 5733 | | FunctionInstance |
| 5734 | { |
| 5735 | $$ = new Value(Value::V_REFD, $1); |
| 5736 | $$->set_location(infile, @$); |
| 5737 | } |
| 5738 | | ApplyOp |
| 5739 | { |
| 5740 | $$ = new Value(Value::V_INVOKE, $1.value, $1.ap_list); |
| 5741 | $$->set_location(infile, @$); |
| 5742 | } |
| 5743 | ; |
| 5744 | |
| 5745 | /* A.1.6.2.4 Port operations */ |
| 5746 | |
| 5747 | Port: // 325 |
| 5748 | VariableRef { $$ = $1; } |
| 5749 | ; |
| 5750 | |
| 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; } |
| 5766 | ; |
| 5767 | |
| 5768 | SendStatement: // 354 |
| 5769 | Port DotSendOpKeyword PortSendOp |
| 5770 | { |
| 5771 | $$ = new Statement(Statement::S_SEND, $1, $3.templ_inst, $3.val); |
| 5772 | $$->set_location(infile, @$); |
| 5773 | } |
| 5774 | ; |
| 5775 | |
| 5776 | PortSendOp: // 355 |
| 5777 | '(' SendParameter optError ')' optToClause |
| 5778 | { |
| 5779 | $$.templ_inst = $2; |
| 5780 | $$.val = $5; |
| 5781 | } |
| 5782 | | '(' error ')' optToClause |
| 5783 | { |
| 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); |
| 5788 | $$.val = $4; |
| 5789 | } |
| 5790 | ; |
| 5791 | |
| 5792 | SendParameter: // 357 |
| 5793 | TemplateInstance { $$=$1; } |
| 5794 | ; |
| 5795 | |
| 5796 | optToClause: // [3583] |
| 5797 | /* empty */ { $$ = 0; } |
| 5798 | | ToKeyword AddressRef |
| 5799 | { |
| 5800 | Template *templ = $2->get_Template(); |
| 5801 | if (!$2->get_Type() && !$2->get_DerivedRef() && templ->is_Value()) { |
| 5802 | $$ = templ->get_Value(); |
| 5803 | } else { |
| 5804 | Location loc(infile, @$); |
| 5805 | loc.error("Multicast communication is not currently supported"); |
| 5806 | $$ = 0; |
| 5807 | } |
| 5808 | delete $2; |
| 5809 | } |
| 5810 | /* | ToKeyword AddressRefList -- covered by the previous rule |
| 5811 | (as ValueOrAttribList) */ |
| 5812 | | ToKeyword AllKeyword ComponentKeyword |
| 5813 | { |
| 5814 | Location loc(infile, @$); |
| 5815 | loc.error("Broadcast communication is not currently supported"); |
| 5816 | $$ = 0; |
| 5817 | } |
| 5818 | | ToKeyword error { $$ = 0; } |
| 5819 | ; |
| 5820 | |
| 5821 | /* |
| 5822 | AddressRefList: // 359 |
| 5823 | '(' seqAddressRef ')' |
| 5824 | ; |
| 5825 | |
| 5826 | seqAddressRef: |
| 5827 | AddressRef |
| 5828 | | seqAddressRef ',' AddressRef |
| 5829 | ; |
| 5830 | */ |
| 5831 | |
| 5832 | AddressRef: // 361 |
| 5833 | TemplateInstance { $$ = $1; } |
| 5834 | ; |
| 5835 | |
| 5836 | CallStatement: // 362 |
| 5837 | Port DotCallOpKeyword PortCallOp optPortCallBody |
| 5838 | { |
| 5839 | $$ = new Statement(Statement::S_CALL, $1, $3.templ_inst, |
| 5840 | $3.calltimerval, $3.nowait, $3.val, $4); |
| 5841 | $$->set_location(infile, @$); |
| 5842 | } |
| 5843 | ; |
| 5844 | |
| 5845 | PortCallOp: // 363 |
| 5846 | '(' CallParameters optError ')' optToClause |
| 5847 | { |
| 5848 | $$.templ_inst = $2.templ_inst; |
| 5849 | $$.calltimerval = $2.calltimerval; |
| 5850 | $$.nowait = $2.nowait; |
| 5851 | $$.val = $5; |
| 5852 | } |
| 5853 | | '(' error ')' optToClause |
| 5854 | { |
| 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; |
| 5860 | $$.nowait = false; |
| 5861 | $$.val = $4; |
| 5862 | } |
| 5863 | ; |
| 5864 | |
| 5865 | CallParameters: // 365 |
| 5866 | TemplateInstance |
| 5867 | { |
| 5868 | $$.templ_inst=$1; |
| 5869 | $$.calltimerval=0; |
| 5870 | $$.nowait=false; |
| 5871 | } |
| 5872 | | TemplateInstance ',' optError CallTimerValue |
| 5873 | { |
| 5874 | $$.templ_inst=$1; |
| 5875 | $$.calltimerval=$4.calltimerval; |
| 5876 | $$.nowait=$4.nowait; |
| 5877 | } |
| 5878 | ; |
| 5879 | |
| 5880 | CallTimerValue: // 366 |
| 5881 | TimerValue |
| 5882 | { |
| 5883 | $$.calltimerval=$1; |
| 5884 | $$.nowait=false; |
| 5885 | } |
| 5886 | | NowaitKeyword |
| 5887 | { |
| 5888 | $$.calltimerval=0; |
| 5889 | $$.nowait=true; |
| 5890 | } |
| 5891 | ; |
| 5892 | |
| 5893 | optPortCallBody: // [368] |
| 5894 | /* empty */ { $$=0; } |
| 5895 | | '{' CallBodyStatementList optError '}' { $$=$2; } |
| 5896 | | '{' error '}' { $$ = new AltGuards; } |
| 5897 | ; |
| 5898 | |
| 5899 | CallBodyStatementList: // 369 |
| 5900 | optError CallBodyStatement |
| 5901 | { |
| 5902 | $$=new AltGuards(); |
| 5903 | $$->add_ag($2); |
| 5904 | } |
| 5905 | | CallBodyStatementList optError CallBodyStatement |
| 5906 | { |
| 5907 | $$=$1; |
| 5908 | $$->add_ag($3); |
| 5909 | } |
| 5910 | ; |
| 5911 | |
| 5912 | CallBodyStatement: // 370 and 371. rolled into one. |
| 5913 | AltGuardChar CallBodyOps ';' // This alternative is a TITAN extension |
| 5914 | { |
| 5915 | $$=new AltGuard($1, $2, new StatementBlock()); |
| 5916 | $$->set_location(infile, @$); |
| 5917 | } |
| 5918 | | AltGuardChar CallBodyOps optSemiColon StatementBlock optSemiColon |
| 5919 | { |
| 5920 | $$=new AltGuard($1, $2, $4); |
| 5921 | $$->set_location(infile, @$); |
| 5922 | } |
| 5923 | ; |
| 5924 | |
| 5925 | CallBodyOps: // 372 |
| 5926 | GetReplyStatement {$$=$1;} |
| 5927 | | CatchStatement {$$=$1;} |
| 5928 | ; |
| 5929 | |
| 5930 | ReplyStatement: // 373 |
| 5931 | Port DotReplyKeyword PortReplyOp |
| 5932 | { |
| 5933 | $$ = new Statement(Statement::S_REPLY, $1, $3.templ_inst, |
| 5934 | $3.replyval, $3.toclause); |
| 5935 | $$->set_location(infile, @$); |
| 5936 | } |
| 5937 | ; |
| 5938 | |
| 5939 | PortReplyOp: // 374 |
| 5940 | '(' TemplateInstance optReplyValue optError ')' optToClause |
| 5941 | { |
| 5942 | $$.templ_inst = $2; |
| 5943 | $$.replyval = $3; |
| 5944 | $$.toclause = $6; |
| 5945 | } |
| 5946 | | '(' error ')' optToClause |
| 5947 | { |
| 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); |
| 5952 | $$.replyval = 0; |
| 5953 | $$.toclause = $4; |
| 5954 | } |
| 5955 | ; |
| 5956 | |
| 5957 | optReplyValue: // [376] |
| 5958 | /* empty */ { $$=0; } |
| 5959 | | ValueKeyword Expression { $$=$2; } |
| 5960 | | ValueKeyword error { $$ = 0; } |
| 5961 | ; |
| 5962 | |
| 5963 | RaiseStatement: // 377 |
| 5964 | Port DotRaiseKeyword PortRaiseOp |
| 5965 | { |
| 5966 | if ($3.signature) $$ = new Statement(Statement::S_RAISE, $1, |
| 5967 | $3.signature, $3.templ_inst, $3.toclause); |
| 5968 | else { |
| 5969 | $$ = new Statement(Statement::S_ERROR); |
| 5970 | delete $1; |
| 5971 | delete $3.signature; |
| 5972 | delete $3.templ_inst; |
| 5973 | delete $3.toclause; |
| 5974 | } |
| 5975 | $$->set_location(infile, @$); |
| 5976 | } |
| 5977 | ; |
| 5978 | |
| 5979 | PortRaiseOp: // 378 |
| 5980 | '(' Signature optError ',' optError TemplateInstance optError ')' optToClause |
| 5981 | { |
| 5982 | $$.signature = $2; |
| 5983 | $$.templ_inst = $6; |
| 5984 | $$.toclause = $9; |
| 5985 | } |
| 5986 | | '(' error ')' optToClause |
| 5987 | { |
| 5988 | $$.signature = 0; |
| 5989 | $$.templ_inst = 0; |
| 5990 | $$.toclause = 0; |
| 5991 | delete $4; |
| 5992 | } |
| 5993 | ; |
| 5994 | |
| 5995 | ReceiveStatement: // 380 |
| 5996 | PortOrAny DotReceiveOpKeyword PortReceiveOp |
| 5997 | { |
| 5998 | $$ = new Statement(Statement::S_RECEIVE, $1, $3.templ_inst, |
| 5999 | $3.fromclause, $3.redirectval, $3.redirectsender); |
| 6000 | $$->set_location(infile, @$); |
| 6001 | } |
| 6002 | ; |
| 6003 | |
| 6004 | PortOrAny: // 381 |
| 6005 | Port { $$ = $1; } |
| 6006 | | AnyKeyword PortKeyword { $$ = 0; } |
| 6007 | ; |
| 6008 | |
| 6009 | PortReceiveOp: // 382 |
| 6010 | optReceiveParameter optFromClause optPortRedirect |
| 6011 | { |
| 6012 | $$.templ_inst = $1; |
| 6013 | $$.fromclause = $2; |
| 6014 | $$.redirectval = $3.redirectval; |
| 6015 | $$.redirectsender = $3.redirectsender; |
| 6016 | } |
| 6017 | ; |
| 6018 | |
| 6019 | optReceiveParameter: // [384] |
| 6020 | /* empty */ { $$ = 0; } |
| 6021 | | '(' ReceiveParameter optError ')' { $$ = $2; } |
| 6022 | | '(' error ')' |
| 6023 | { |
| 6024 | Template *t = new Template(Template::TEMPLATE_ERROR); |
| 6025 | t->set_location(infile, @2); |
| 6026 | $$ = new TemplateInstance(0, 0, t); |
| 6027 | $$->set_location(infile, @$); |
| 6028 | } |
| 6029 | ; |
| 6030 | |
| 6031 | ReceiveParameter: // 384 |
| 6032 | TemplateInstance { $$ = $1; } |
| 6033 | ; |
| 6034 | |
| 6035 | optFromClause: // [385] |
| 6036 | /* empty */ { $$=0; } |
| 6037 | | FromClause { $$=$1; } |
| 6038 | ; |
| 6039 | |
| 6040 | FromClause: // 385 |
| 6041 | FromKeyword AddressRef { $$=$2; } |
| 6042 | | FromKeyword error { $$ = 0; } |
| 6043 | ; |
| 6044 | |
| 6045 | optPortRedirect: // [387] |
| 6046 | /* empty */ |
| 6047 | { |
| 6048 | $$.redirectval=0; |
| 6049 | $$.redirectsender=0; |
| 6050 | } |
| 6051 | | PortRedirectSymbol ValueSpec |
| 6052 | { |
| 6053 | $$.redirectval=$2; |
| 6054 | $$.redirectsender=0; |
| 6055 | } |
| 6056 | | PortRedirectSymbol SenderSpec |
| 6057 | { |
| 6058 | $$.redirectval=0; |
| 6059 | $$.redirectsender=$2; |
| 6060 | } |
| 6061 | | PortRedirectSymbol ValueSpec SenderSpec |
| 6062 | { |
| 6063 | $$.redirectval=$2; |
| 6064 | $$.redirectsender=$3; |
| 6065 | } |
| 6066 | | PortRedirectSymbol error |
| 6067 | { |
| 6068 | $$.redirectval=0; |
| 6069 | $$.redirectsender=0; |
| 6070 | } |
| 6071 | ; |
| 6072 | |
| 6073 | ValueSpec: // 389 |
| 6074 | ValueKeyword VariableRef { $$ = $2; } |
| 6075 | | ValueKeyword error { $$ = 0; } |
| 6076 | ; |
| 6077 | |
| 6078 | SenderSpec: // 391 |
| 6079 | SenderKeyword VariableRef { $$ = $2; } |
| 6080 | | SenderKeyword error { $$ = 0; } |
| 6081 | ; |
| 6082 | |
| 6083 | TriggerStatement: // 393 |
| 6084 | PortOrAny DotTriggerOpKeyword PortTriggerOp |
| 6085 | { |
| 6086 | $$ = new Statement(Statement::S_TRIGGER, $1, $3.templ_inst, |
| 6087 | $3.fromclause, $3.redirectval, $3.redirectsender); |
| 6088 | $$->set_location(infile, @$); |
| 6089 | } |
| 6090 | ; |
| 6091 | |
| 6092 | PortTriggerOp: // 394 |
| 6093 | optReceiveParameter optFromClause optPortRedirect |
| 6094 | { |
| 6095 | $$.templ_inst = $1; |
| 6096 | $$.fromclause = $2; |
| 6097 | $$.redirectval = $3.redirectval; |
| 6098 | $$.redirectsender = $3.redirectsender; |
| 6099 | } |
| 6100 | ; |
| 6101 | |
| 6102 | GetCallStatement: // 396 |
| 6103 | PortOrAny DotGetCallOpKeyword PortGetCallOp |
| 6104 | { |
| 6105 | $$ = new Statement(Statement::S_GETCALL, $1, $3.templ_inst, |
| 6106 | $3.fromclause, $3.redirectparam, $3.redirectsender); |
| 6107 | $$->set_location(infile, @$); |
| 6108 | } |
| 6109 | ; |
| 6110 | |
| 6111 | PortGetCallOp: // 397 |
| 6112 | optReceiveParameter optFromClause optPortRedirectWithParam |
| 6113 | { |
| 6114 | $$.templ_inst = $1; |
| 6115 | $$.fromclause = $2; |
| 6116 | $$.redirectparam = $3.redirectparam; |
| 6117 | $$.redirectsender = $3.redirectsender; |
| 6118 | } |
| 6119 | ; |
| 6120 | |
| 6121 | optPortRedirectWithParam: // [399] |
| 6122 | /* empty */ |
| 6123 | { |
| 6124 | $$.redirectparam=0; |
| 6125 | $$.redirectsender=0; |
| 6126 | } |
| 6127 | | PortRedirectSymbol ParamSpec |
| 6128 | { |
| 6129 | $$.redirectparam=$2; |
| 6130 | $$.redirectsender=0; |
| 6131 | } |
| 6132 | | PortRedirectSymbol ParamSpec SenderSpec |
| 6133 | { |
| 6134 | $$.redirectparam=$2; |
| 6135 | $$.redirectsender=$3; |
| 6136 | } |
| 6137 | | PortRedirectSymbol SenderSpec |
| 6138 | { |
| 6139 | $$.redirectparam=0; |
| 6140 | $$.redirectsender=$2; |
| 6141 | } |
| 6142 | | PortRedirectSymbol error |
| 6143 | { |
| 6144 | $$.redirectparam=0; |
| 6145 | $$.redirectsender=0; |
| 6146 | } |
| 6147 | ; |
| 6148 | |
| 6149 | ParamSpec: // 401 |
| 6150 | ParamKeyword ParamAssignmentList { $$ = $2; } |
| 6151 | | ParamKeyword error { $$ = 0; } |
| 6152 | ; |
| 6153 | |
| 6154 | ParamAssignmentList: // 403 |
| 6155 | '(' AssignmentList optError ')' |
| 6156 | { |
| 6157 | $$=new ParamRedirect($2); |
| 6158 | $$->set_location(infile, @$); |
| 6159 | } |
| 6160 | | '(' VariableList optError ')' |
| 6161 | { |
| 6162 | $$=new ParamRedirect($2); |
| 6163 | $$->set_location(infile, @$); |
| 6164 | } |
| 6165 | | '(' error ')' |
| 6166 | { |
| 6167 | $$=new ParamRedirect(new ParamAssignments()); |
| 6168 | $$->set_location(infile, @$); |
| 6169 | } |
| 6170 | ; |
| 6171 | |
| 6172 | AssignmentList: // 404 |
| 6173 | VariableAssignment |
| 6174 | { |
| 6175 | $$ = new ParamAssignments(); |
| 6176 | $$->add_parass($1); |
| 6177 | } |
| 6178 | | error VariableAssignment |
| 6179 | { |
| 6180 | $$ = new ParamAssignments(); |
| 6181 | $$->add_parass($2); |
| 6182 | } |
| 6183 | | AssignmentList optError ',' optError VariableAssignment |
| 6184 | { |
| 6185 | $$ = $1; |
| 6186 | $$->add_parass($5); |
| 6187 | } |
| 6188 | | AssignmentList optError ',' error { $$ = $1; } |
| 6189 | ; |
| 6190 | |
| 6191 | VariableAssignment: // 405 |
| 6192 | VariableRef AssignmentChar IDentifier |
| 6193 | { |
| 6194 | $$ = new ParamAssignment($3, $1); |
| 6195 | $$->set_location(infile, @$); |
| 6196 | } |
| 6197 | ; |
| 6198 | |
| 6199 | VariableList: // 407 |
| 6200 | VariableEntry |
| 6201 | { |
| 6202 | $$ = new VariableEntries(); |
| 6203 | $$->add_ve($1); |
| 6204 | } |
| 6205 | | error VariableEntry |
| 6206 | { |
| 6207 | $$ = new VariableEntries(); |
| 6208 | $$->add_ve($2); |
| 6209 | } |
| 6210 | | VariableList optError ',' optError VariableEntry |
| 6211 | { |
| 6212 | $$ = $1; |
| 6213 | $$->add_ve($5); |
| 6214 | } |
| 6215 | | VariableList optError ',' error { $$ = $1; } |
| 6216 | ; |
| 6217 | |
| 6218 | VariableEntry: // 408 |
| 6219 | VariableRef |
| 6220 | { |
| 6221 | $$ = new VariableEntry($1); |
| 6222 | $$->set_location(infile, @$); |
| 6223 | } |
| 6224 | | NotUsedSymbol |
| 6225 | { |
| 6226 | $$ = new VariableEntry; |
| 6227 | $$->set_location(infile, @$); |
| 6228 | } |
| 6229 | ; |
| 6230 | |
| 6231 | GetReplyStatement: // 409 |
| 6232 | PortOrAny DotGetReplyOpKeyword PortGetReplyOp |
| 6233 | { |
| 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, @$); |
| 6238 | } |
| 6239 | ; |
| 6240 | |
| 6241 | PortGetReplyOp: // 410 |
| 6242 | optGetReplyParameter optFromClause optPortRedirectWithValueAndParam |
| 6243 | { |
| 6244 | $$.templ_inst = $1.templ_inst; |
| 6245 | $$.valuematch = $1.valuematch; |
| 6246 | $$.fromclause = $2; |
| 6247 | $$.redirectval = $3.redirectval; |
| 6248 | $$.redirectparam = $3.redirectparam; |
| 6249 | $$.redirectsender = $3.redirectsender; |
| 6250 | } |
| 6251 | ; |
| 6252 | |
| 6253 | optPortRedirectWithValueAndParam: // [411] |
| 6254 | /* empty */ |
| 6255 | { |
| 6256 | $$.redirectval=0; |
| 6257 | $$.redirectparam=0; |
| 6258 | $$.redirectsender=0; |
| 6259 | } |
| 6260 | | PortRedirectSymbol ValueSpec |
| 6261 | { |
| 6262 | $$.redirectval=$2; |
| 6263 | $$.redirectparam=0; |
| 6264 | $$.redirectsender=0; |
| 6265 | } |
| 6266 | | PortRedirectSymbol ValueSpec ParamSpec |
| 6267 | { |
| 6268 | $$.redirectval=$2; |
| 6269 | $$.redirectparam=$3; |
| 6270 | $$.redirectsender=0; |
| 6271 | } |
| 6272 | | PortRedirectSymbol ValueSpec SenderSpec |
| 6273 | { |
| 6274 | $$.redirectval=$2; |
| 6275 | $$.redirectparam=0; |
| 6276 | $$.redirectsender=$3; |
| 6277 | } |
| 6278 | | PortRedirectSymbol ValueSpec ParamSpec SenderSpec |
| 6279 | { |
| 6280 | $$.redirectval=$2; |
| 6281 | $$.redirectparam=$3; |
| 6282 | $$.redirectsender=$4; |
| 6283 | } |
| 6284 | | PortRedirectSymbol ParamSpec |
| 6285 | { |
| 6286 | $$.redirectval=0; |
| 6287 | $$.redirectparam=$2; |
| 6288 | $$.redirectsender=0; |
| 6289 | } |
| 6290 | | PortRedirectSymbol SenderSpec |
| 6291 | { |
| 6292 | $$.redirectval=0; |
| 6293 | $$.redirectparam=0; |
| 6294 | $$.redirectsender=$2; |
| 6295 | } |
| 6296 | | PortRedirectSymbol ParamSpec SenderSpec |
| 6297 | { |
| 6298 | $$.redirectval=0; |
| 6299 | $$.redirectparam=$2; |
| 6300 | $$.redirectsender=$3; |
| 6301 | } |
| 6302 | | PortRedirectSymbol error |
| 6303 | { |
| 6304 | $$.redirectval=0; |
| 6305 | $$.redirectparam=0; |
| 6306 | $$.redirectsender=0; |
| 6307 | } |
| 6308 | ; |
| 6309 | |
| 6310 | optGetReplyParameter: |
| 6311 | /* empty */ |
| 6312 | { |
| 6313 | $$.templ_inst=0; |
| 6314 | $$.valuematch=0; |
| 6315 | } |
| 6316 | | '(' ReceiveParameter optError ')' |
| 6317 | { |
| 6318 | $$.templ_inst=$2; |
| 6319 | $$.valuematch=0; |
| 6320 | } |
| 6321 | | '(' ReceiveParameter ValueMatchSpec optError ')' |
| 6322 | { |
| 6323 | $$.templ_inst=$2; |
| 6324 | $$.valuematch=$3; |
| 6325 | } |
| 6326 | | '(' error ')' |
| 6327 | { |
| 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); |
| 6332 | $$.valuematch = 0; |
| 6333 | } |
| 6334 | ; |
| 6335 | |
| 6336 | ValueMatchSpec: // 414 |
| 6337 | ValueKeyword TemplateInstance { $$=$2; } |
| 6338 | | ValueKeyword error { $$ = 0; } |
| 6339 | ; |
| 6340 | |
| 6341 | CheckStatement: // 415 |
| 6342 | PortOrAny DotCheckOpKeyword optCheckParameter |
| 6343 | { |
| 6344 | switch ($3.statementtype) { |
| 6345 | case Statement::S_CHECK: |
| 6346 | $$ = new Statement(Statement::S_CHECK, $1, $3.templ_inst, |
| 6347 | $3.redirectsender); |
| 6348 | break; |
| 6349 | case Statement::S_CHECK_RECEIVE: |
| 6350 | $$ = new Statement(Statement::S_CHECK_RECEIVE, $1, $3.templ_inst, |
| 6351 | $3.fromclause, $3.redirectval, $3.redirectsender); |
| 6352 | break; |
| 6353 | case Statement::S_CHECK_GETCALL: |
| 6354 | $$ = new Statement(Statement::S_CHECK_GETCALL, $1, $3.templ_inst, |
| 6355 | $3.fromclause, $3.redirectparam, $3.redirectsender); |
| 6356 | break; |
| 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); |
| 6361 | break; |
| 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); |
| 6366 | break; |
| 6367 | default: |
| 6368 | FATAL_ERROR("Internal error."); |
| 6369 | } // switch |
| 6370 | $$->set_location(infile, @$); |
| 6371 | } |
| 6372 | ; |
| 6373 | |
| 6374 | optCheckParameter: // [418] |
| 6375 | /* empty */ |
| 6376 | { |
| 6377 | $$.statementtype = Statement::S_CHECK; |
| 6378 | $$.signature = 0; |
| 6379 | $$.templ_inst = 0; |
| 6380 | $$.valuematch = 0; |
| 6381 | $$.timeout = false; |
| 6382 | $$.fromclause = 0; |
| 6383 | $$.redirectval = 0; |
| 6384 | $$.redirectparam = 0; |
| 6385 | $$.redirectsender = 0; |
| 6386 | } |
| 6387 | | '(' CheckParameter optError ')' { $$ = $2; } |
| 6388 | | '(' error ')' |
| 6389 | { |
| 6390 | $$.statementtype = Statement::S_CHECK; |
| 6391 | $$.signature = 0; |
| 6392 | $$.templ_inst = 0; |
| 6393 | $$.valuematch = 0; |
| 6394 | $$.timeout = false; |
| 6395 | $$.fromclause = 0; |
| 6396 | $$.redirectval = 0; |
| 6397 | $$.redirectparam = 0; |
| 6398 | $$.redirectsender = 0; |
| 6399 | } |
| 6400 | ; |
| 6401 | |
| 6402 | CheckParameter: // 418 |
| 6403 | CheckPortOpsPresent { $$ = $1; } |
| 6404 | | FromClausePresent { $$ = $1; } |
| 6405 | | RedirectPresent { $$ = $1; } |
| 6406 | ; |
| 6407 | |
| 6408 | FromClausePresent: // 419 |
| 6409 | FromClause |
| 6410 | { |
| 6411 | $$.statementtype = Statement::S_CHECK; |
| 6412 | $$.signature = 0; |
| 6413 | $$.templ_inst = $1; |
| 6414 | $$.valuematch = 0; |
| 6415 | $$.timeout = false; |
| 6416 | $$.fromclause = 0; |
| 6417 | $$.redirectval = 0; |
| 6418 | $$.redirectparam = 0; |
| 6419 | $$.redirectsender = 0; |
| 6420 | } |
| 6421 | | FromClause PortRedirectSymbol SenderSpec |
| 6422 | { |
| 6423 | $$.statementtype = Statement::S_CHECK; |
| 6424 | $$.signature = 0; |
| 6425 | $$.templ_inst = $1; |
| 6426 | $$.valuematch = 0; |
| 6427 | $$.timeout = false; |
| 6428 | $$.fromclause = 0; |
| 6429 | $$.redirectval = 0; |
| 6430 | $$.redirectparam = 0; |
| 6431 | $$.redirectsender = $3; |
| 6432 | } |
| 6433 | ; |
| 6434 | |
| 6435 | RedirectPresent: // 420 |
| 6436 | PortRedirectSymbol SenderSpec |
| 6437 | { |
| 6438 | $$.statementtype = Statement::S_CHECK; |
| 6439 | $$.signature = 0; |
| 6440 | $$.templ_inst = 0; |
| 6441 | $$.valuematch = 0; |
| 6442 | $$.timeout = false; |
| 6443 | $$.fromclause = 0; |
| 6444 | $$.redirectval = 0; |
| 6445 | $$.redirectparam = 0; |
| 6446 | $$.redirectsender = $2; |
| 6447 | } |
| 6448 | ; |
| 6449 | |
| 6450 | CheckPortOpsPresent: // 421 |
| 6451 | ReceiveOpKeyword PortReceiveOp |
| 6452 | { |
| 6453 | $$.statementtype = Statement::S_CHECK_RECEIVE; |
| 6454 | $$.signature = 0; |
| 6455 | $$.templ_inst = $2.templ_inst; |
| 6456 | $$.valuematch = 0; |
| 6457 | $$.timeout = false; |
| 6458 | $$.fromclause = $2.fromclause; |
| 6459 | $$.redirectval = $2.redirectval; |
| 6460 | $$.redirectparam = 0; |
| 6461 | $$.redirectsender = $2.redirectsender; |
| 6462 | } |
| 6463 | | GetCallOpKeyword PortGetCallOp |
| 6464 | { |
| 6465 | $$.statementtype = Statement::S_CHECK_GETCALL; |
| 6466 | $$.signature = 0; |
| 6467 | $$.templ_inst = $2.templ_inst; |
| 6468 | $$.valuematch = 0; |
| 6469 | $$.timeout = false; |
| 6470 | $$.fromclause = $2.fromclause; |
| 6471 | $$.redirectval = 0; |
| 6472 | $$.redirectparam = $2.redirectparam; |
| 6473 | $$.redirectsender = $2.redirectsender; |
| 6474 | } |
| 6475 | | GetReplyOpKeyword PortGetReplyOp |
| 6476 | { |
| 6477 | $$.statementtype = Statement::S_CHECK_GETREPLY; |
| 6478 | $$.signature = 0; |
| 6479 | $$.templ_inst = $2.templ_inst; |
| 6480 | $$.valuematch = $2.valuematch; |
| 6481 | $$.timeout = false; |
| 6482 | $$.fromclause = $2.fromclause; |
| 6483 | $$.redirectval = $2.redirectval; |
| 6484 | $$.redirectparam = $2.redirectparam; |
| 6485 | $$.redirectsender = $2.redirectsender; |
| 6486 | } |
| 6487 | | CatchOpKeyword PortCatchOp |
| 6488 | { |
| 6489 | $$.statementtype = Statement::S_CHECK_CATCH; |
| 6490 | $$.signature = $2.signature; |
| 6491 | $$.templ_inst = $2.templ_inst; |
| 6492 | $$.valuematch = 0; |
| 6493 | $$.timeout = $2.timeout; |
| 6494 | $$.fromclause = $2.fromclause; |
| 6495 | $$.redirectval = $2.redirectval; |
| 6496 | $$.redirectparam = 0; |
| 6497 | $$.redirectsender = $2.redirectsender; |
| 6498 | } |
| 6499 | ; |
| 6500 | |
| 6501 | CatchStatement: // 422 |
| 6502 | PortOrAny DotCatchOpKeyword PortCatchOp |
| 6503 | { |
| 6504 | $$ = new Statement(Statement::S_CATCH, $1, $3.signature, $3.templ_inst, |
| 6505 | $3.timeout, $3.fromclause, $3.redirectval, |
| 6506 | $3.redirectsender); |
| 6507 | $$->set_location(infile, @$); |
| 6508 | } |
| 6509 | ; |
| 6510 | |
| 6511 | PortCatchOp: // 423 |
| 6512 | optCatchOpParameter optFromClause optPortRedirect |
| 6513 | { |
| 6514 | $$.signature = $1.signature; |
| 6515 | $$.templ_inst = $1.templ_inst; |
| 6516 | $$.timeout = $1.timeout; |
| 6517 | $$.fromclause = $2; |
| 6518 | $$.redirectval = $3.redirectval; |
| 6519 | $$.redirectsender = $3.redirectsender; |
| 6520 | } |
| 6521 | ; |
| 6522 | |
| 6523 | optCatchOpParameter: // [425] |
| 6524 | /* empty */ |
| 6525 | { |
| 6526 | $$.signature = 0; |
| 6527 | $$.templ_inst = 0; |
| 6528 | $$.timeout = false; |
| 6529 | } |
| 6530 | | '(' CatchOpParameter optError ')' { $$ = $2; } |
| 6531 | | '(' error ')' |
| 6532 | { |
| 6533 | $$.signature = 0; |
| 6534 | $$.templ_inst = 0; |
| 6535 | $$.timeout = false; |
| 6536 | } |
| 6537 | ; |
| 6538 | |
| 6539 | CatchOpParameter: // 425 |
| 6540 | Signature optError ',' optError TemplateInstance |
| 6541 | { |
| 6542 | $$.signature = $1; |
| 6543 | $$.templ_inst = $5; |
| 6544 | $$.timeout = false; |
| 6545 | } |
| 6546 | | TimeoutKeyword |
| 6547 | { |
| 6548 | $$.signature = 0; |
| 6549 | $$.templ_inst = 0; |
| 6550 | $$.timeout = true; |
| 6551 | } |
| 6552 | ; |
| 6553 | |
| 6554 | ClearStatement: // 426 |
| 6555 | PortOrAll DotClearOpKeyword |
| 6556 | { |
| 6557 | $$ = new Statement(Statement::S_CLEAR, $1); |
| 6558 | $$->set_location(infile, @$); |
| 6559 | } |
| 6560 | ; |
| 6561 | |
| 6562 | PortOrAll: // 427 |
| 6563 | Port { $$ = $1; } |
| 6564 | | AllKeyword PortKeyword { $$ = 0; } |
| 6565 | ; |
| 6566 | |
| 6567 | StartStatement: // 430 |
| 6568 | /* Port DotPortStartKeyword -- covered by StartTimerStatement */ |
| 6569 | AllKeyword PortKeyword DotStartKeyword |
| 6570 | { |
| 6571 | $$=new Statement(Statement::S_START_PORT, (Ttcn::Reference*)0); |
| 6572 | $$->set_location(infile, @$); |
| 6573 | } |
| 6574 | ; |
| 6575 | |
| 6576 | StopStatement: // 432 |
| 6577 | /* Port DotPortStopKeyword -- covered by StopTimerStatement */ |
| 6578 | AllKeyword PortKeyword DotStopKeyword |
| 6579 | { |
| 6580 | $$=new Statement(Statement::S_STOP_PORT, (Ttcn::Reference*)0); |
| 6581 | $$->set_location(infile, @$); |
| 6582 | } |
| 6583 | ; |
| 6584 | |
| 6585 | HaltStatement: // 435 |
| 6586 | PortOrAll DotHaltKeyword |
| 6587 | { |
| 6588 | $$ = new Statement(Statement::S_HALT, $1); |
| 6589 | $$->set_location(infile, @$); |
| 6590 | } |
| 6591 | ; |
| 6592 | |
| 6593 | /* A.1.6.2.5 Timer operations */ |
| 6594 | |
| 6595 | TimerStatements: // 439 |
| 6596 | StartTimerStatement { $$ = $1; } |
| 6597 | | StopTimerStatement { $$ = $1; } |
| 6598 | | TimeoutStatement { $$ = $1; } |
| 6599 | ; |
| 6600 | |
| 6601 | TimerOps: // 440 |
| 6602 | ReadTimerOp { $$ = $1; } |
| 6603 | | RunningTimerOp { $$ = $1; } |
| 6604 | ; |
| 6605 | |
| 6606 | StartTimerStatement: // 441 |
| 6607 | VariableRef DotStartKeyword |
| 6608 | { |
| 6609 | $$ = new Statement(Statement::S_START_UNDEF, $1, (Value*)0); |
| 6610 | $$->set_location(infile, @$); |
| 6611 | } |
| 6612 | | VariableRef DotStartKeyword '(' Expression optError ')' |
| 6613 | { |
| 6614 | $$ = new Statement(Statement::S_START_UNDEF, $1, $4); |
| 6615 | $$->set_location(infile, @$); |
| 6616 | } |
| 6617 | | VariableRef DotStartKeyword '(' error ')' |
| 6618 | { |
| 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, @$); |
| 6623 | } |
| 6624 | ; |
| 6625 | |
| 6626 | StopTimerStatement: // 442 |
| 6627 | TimerRef DotStopKeyword |
| 6628 | { |
| 6629 | $$ = new Statement(Statement::S_STOP_UNDEF, $1, (Value*)0); |
| 6630 | $$->set_location(infile, @$); |
| 6631 | } |
| 6632 | | AllKeyword TimerKeyword DotStopKeyword |
| 6633 | { |
| 6634 | $$ = new Statement(Statement::S_STOP_TIMER, (Ttcn::Reference*)0); |
| 6635 | $$->set_location(infile, @$); |
| 6636 | } |
| 6637 | ; |
| 6638 | |
| 6639 | /* no separate rule, folded into StopTimerStatement |
| 6640 | TimerRefOrAll: // 443 |
| 6641 | TimerRef |
| 6642 | | AllKeyword TimerKeyword |
| 6643 | ; |
| 6644 | */ |
| 6645 | |
| 6646 | ReadTimerOp: // 444 |
| 6647 | TimerRef DotReadKeyword |
| 6648 | { |
| 6649 | $$ = new Value(Value::OPTYPE_TMR_READ, $1); |
| 6650 | $$->set_location(infile, @$); |
| 6651 | } |
| 6652 | ; |
| 6653 | |
| 6654 | RunningTimerOp: // 446 |
| 6655 | TimerRef DotRunningKeyword |
| 6656 | { |
| 6657 | $$ = new Value(Value::OPTYPE_UNDEF_RUNNING, $1); |
| 6658 | $$->set_location(infile, @$); |
| 6659 | } |
| 6660 | | AnyKeyword TimerKeyword DotRunningKeyword |
| 6661 | { |
| 6662 | $$ = new Value(Value::OPTYPE_TMR_RUNNING_ANY); |
| 6663 | $$->set_location(infile, @$); |
| 6664 | } |
| 6665 | ; |
| 6666 | |
| 6667 | TimeoutStatement: // 447 |
| 6668 | TimerRefOrAny DotTimeoutKeyword |
| 6669 | { |
| 6670 | $$ = new Statement(Statement::S_TIMEOUT, $1); |
| 6671 | $$->set_location(infile, @$); |
| 6672 | } |
| 6673 | ; |
| 6674 | |
| 6675 | TimerRefOrAny: // 448 |
| 6676 | TimerRef { $$ = $1; } |
| 6677 | | AnyKeyword TimerKeyword { $$ = 0; } |
| 6678 | ; |
| 6679 | |
| 6680 | /* A.1.6.3 Type */ |
| 6681 | |
| 6682 | Type: // 450 |
| 6683 | PredefinedType |
| 6684 | { |
| 6685 | $$ = new Type($1); |
| 6686 | $$->set_location(infile, @$); |
| 6687 | } |
| 6688 | | AnyTypeKeyword /* a predefined type with special treatment */ |
| 6689 | { |
| 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); |
| 6695 | } |
| 6696 | | ReferencedType { $$ = $1; } |
| 6697 | |
| 6698 | ; |
| 6699 | |
| 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 |
| 6706 | { |
| 6707 | Location loc(infile, @$); |
| 6708 | loc.warning("Obsolete type `char' was substituted with `charstring'"); |
| 6709 | $$ = Type::T_CSTR; |
| 6710 | } |
| 6711 | | UniversalChar // not in the standard anymore |
| 6712 | { |
| 6713 | Location loc(infile, @$); |
| 6714 | loc.warning("Obsolete type `universal char' was substituted with " |
| 6715 | "`universal charstring'"); |
| 6716 | $$ = Type::T_USTR; |
| 6717 | } |
| 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; } |
| 6726 | /* |
| 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) |
| 6733 | */ |
| 6734 | ; |
| 6735 | |
| 6736 | UniversalCharString: // 463 |
| 6737 | UniversalKeyword CharStringKeyword |
| 6738 | ; |
| 6739 | |
| 6740 | UniversalChar: |
| 6741 | UniversalKeyword CharKeyword |
| 6742 | ; |
| 6743 | |
| 6744 | ReferencedType: // 465 |
| 6745 | Reference |
| 6746 | { |
| 6747 | if ($1.is_ref) $$ = new Type(Type::T_REFD, $1.ref); |
| 6748 | else { |
| 6749 | Ttcn::Reference *ref = new Ttcn::Reference($1.id); |
| 6750 | ref->set_location(infile, @1); |
| 6751 | $$ = new Type(Type::T_REFD, ref); |
| 6752 | } |
| 6753 | $$->set_location(infile, @$); |
| 6754 | } |
| 6755 | | FunctionInstance optExtendedFieldReference |
| 6756 | /* covers all parameterized type references */ |
| 6757 | { |
| 6758 | Location loc(infile, @1); |
| 6759 | loc.error("Reference to parameterized type is not currently supported"); |
| 6760 | delete $1; |
| 6761 | for (size_t i = 0; i < $2.nElements; i++) delete $2.elements[i]; |
| 6762 | Free($2.elements); |
| 6763 | $$ = new Type(Type::T_ERROR); |
| 6764 | $$->set_location(infile, @$); |
| 6765 | } |
| 6766 | ; |
| 6767 | |
| 6768 | /* |
| 6769 | TypeReference: // 466 |
| 6770 | IDentifier |
| 6771 | | IDentifier TypeActualParList |
| 6772 | ; |
| 6773 | */ |
| 6774 | |
| 6775 | TypeActualParList: // -> 202 784 "Advanced Parameterization" |
| 6776 | '(' seqTypeActualPar optError ')' |
| 6777 | | '(' error ')' |
| 6778 | ; |
| 6779 | |
| 6780 | seqTypeActualPar: // -> 202 784 "Advanced Parameterization" |
| 6781 | optError TypeActualPar |
| 6782 | | seqTypeActualPar optError ',' optError TypeActualPar |
| 6783 | | seqTypeActualPar optError ',' error |
| 6784 | ; |
| 6785 | |
| 6786 | TypeActualPar: // -> 202 784 "Advanced Parameterization" |
| 6787 | Expression { delete $1; } |
| 6788 | ; |
| 6789 | |
| 6790 | optArrayDef: // [467] |
| 6791 | /* empty */ |
| 6792 | { |
| 6793 | $$.nElements = 0; |
| 6794 | $$.elements = 0; |
| 6795 | } |
| 6796 | | optArrayDef ArrayIndex |
| 6797 | { |
| 6798 | $$.nElements = $1.nElements + 1; |
| 6799 | $$.elements = (ArrayDimension**) |
| 6800 | Realloc($1.elements, $$.nElements * sizeof(*$$.elements)); |
| 6801 | $$.elements[$1.nElements] = $2; |
| 6802 | } |
| 6803 | ; |
| 6804 | |
| 6805 | ArrayIndex: |
| 6806 | '[' ArrayBounds ']' |
| 6807 | { |
| 6808 | $$ = new ArrayDimension($2); |
| 6809 | $$->set_location(infile, @$); |
| 6810 | } |
| 6811 | | '[' ArrayBounds DotDot ArrayBounds ']' |
| 6812 | { |
| 6813 | $$ = new ArrayDimension($2, $4); |
| 6814 | $$->set_location(infile, @$); |
| 6815 | } |
| 6816 | | '[' error ']' |
| 6817 | { |
| 6818 | Value *v = new Value(Value::V_ERROR); |
| 6819 | v->set_location(infile, @2); |
| 6820 | $$ = new ArrayDimension(v); |
| 6821 | $$->set_location(infile, @$); |
| 6822 | } |
| 6823 | ; |
| 6824 | |
| 6825 | ArrayBounds: // 468 |
| 6826 | Expression { $$ = $1; } |
| 6827 | ; |
| 6828 | |
| 6829 | /* A.1.6.4 Value */ |
| 6830 | |
| 6831 | Value: // 469 |
| 6832 | PredefinedValue { $$ = $1; } |
| 6833 | | ReferencedValue { $$ = $1; } |
| 6834 | ; |
| 6835 | |
| 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 |
| 6846 | { |
| 6847 | $$ = new Value(Value::V_REAL, $1); |
| 6848 | $$->set_location(infile, @$); |
| 6849 | } |
| 6850 | | AddressValue { $$ = $1; } |
| 6851 | | OmitValue { $$ = $1; } |
| 6852 | | NullValue |
| 6853 | { |
| 6854 | $$ = new Value(Value::V_NULL); |
| 6855 | $$->set_location(infile, @$); |
| 6856 | } |
| 6857 | | MacroValue |
| 6858 | { |
| 6859 | $$ = new Value(Value::V_MACRO, $1); |
| 6860 | $$->set_location(infile, @$); |
| 6861 | } |
| 6862 | | ObjectIdentifierValue { $$ = $1; } |
| 6863 | | TOK_errval |
| 6864 | { |
| 6865 | $$=new Value(Value::V_ERROR); |
| 6866 | $$->set_location(infile, @$); |
| 6867 | } |
| 6868 | ; |
| 6869 | |
| 6870 | BitStringValue: // 471 |
| 6871 | Bstring |
| 6872 | { |
| 6873 | $$ = new Value(Value::V_BSTR, $1); |
| 6874 | $$->set_location(infile, @$); |
| 6875 | } |
| 6876 | ; |
| 6877 | |
| 6878 | BooleanValue: // 472 |
| 6879 | TrueKeyword |
| 6880 | { |
| 6881 | $$ = new Value(Value::V_BOOL, true); |
| 6882 | $$->set_location(infile, @$); |
| 6883 | } |
| 6884 | | FalseKeyword |
| 6885 | { |
| 6886 | $$ = new Value(Value::V_BOOL, false); |
| 6887 | $$->set_location(infile, @$); |
| 6888 | } |
| 6889 | ; |
| 6890 | |
| 6891 | /* TTCN-3 core language V4.2.1 */ |
| 6892 | FloatOrSpecialFloatValue: |
| 6893 | FloatValue |
| 6894 | { |
| 6895 | $$ = $1; |
| 6896 | } |
| 6897 | | InfinityKeyword |
| 6898 | { |
| 6899 | $$ = REAL_INFINITY; |
| 6900 | } |
| 6901 | | NaNKeyword |
| 6902 | { |
| 6903 | $$ = REAL_NAN; |
| 6904 | } |
| 6905 | ; |
| 6906 | |
| 6907 | IntegerValue: // 473 |
| 6908 | Number |
| 6909 | { |
| 6910 | $$ = new Value(Value::V_INT, $1); |
| 6911 | $$->set_location(infile, @$); |
| 6912 | } |
| 6913 | ; |
| 6914 | |
| 6915 | OctetStringValue: // 474 |
| 6916 | Ostring |
| 6917 | { |
| 6918 | $$ = new Value(Value::V_OSTR, $1); |
| 6919 | $$->set_location(infile, @$); |
| 6920 | } |
| 6921 | ; |
| 6922 | |
| 6923 | HexStringValue: // 475 |
| 6924 | Hstring |
| 6925 | { |
| 6926 | $$ = new Value(Value::V_HSTR, $1); |
| 6927 | $$->set_location(infile, @$); |
| 6928 | } |
| 6929 | ; |
| 6930 | |
| 6931 | VerdictValue: // 476 VerdictTypeValue |
| 6932 | NoneKeyword |
| 6933 | { |
| 6934 | $$ = new Value(Value::V_VERDICT, Value::Verdict_NONE); |
| 6935 | $$->set_location(infile, @$); |
| 6936 | } |
| 6937 | | PassKeyword |
| 6938 | { |
| 6939 | $$ = new Value(Value::V_VERDICT, Value::Verdict_PASS); |
| 6940 | $$->set_location(infile, @$); |
| 6941 | } |
| 6942 | | InconcKeyword |
| 6943 | { |
| 6944 | $$ = new Value(Value::V_VERDICT, Value::Verdict_INCONC); |
| 6945 | $$->set_location(infile, @$); |
| 6946 | } |
| 6947 | | FailKeyword |
| 6948 | { |
| 6949 | $$ = new Value(Value::V_VERDICT, Value::Verdict_FAIL); |
| 6950 | $$->set_location(infile, @$); |
| 6951 | } |
| 6952 | | ErrorKeyword |
| 6953 | { |
| 6954 | $$ = new Value(Value::V_VERDICT, Value::Verdict_ERROR); |
| 6955 | $$->set_location(infile, @$); |
| 6956 | } |
| 6957 | ; |
| 6958 | |
| 6959 | CharStringValue: // 478 |
| 6960 | CstringList |
| 6961 | { |
| 6962 | if ($1->is_cstr()) $$ = new Value(Value::V_CSTR, $1); |
| 6963 | else { |
| 6964 | $$ = new Value(Value::V_USTR, new ustring(*$1)); |
| 6965 | delete $1; |
| 6966 | } |
| 6967 | $$->set_location(infile, @$); |
| 6968 | } |
| 6969 | | Quadruple |
| 6970 | { |
| 6971 | $$ = new Value(Value::V_USTR, new ustring(*$1)); |
| 6972 | delete $1; |
| 6973 | $$->set_location(infile, @$); |
| 6974 | } |
| 6975 | ; |
| 6976 | |
| 6977 | CstringList: |
| 6978 | Cstring |
| 6979 | { |
| 6980 | Location loc(infile, @1); |
| 6981 | $$ = parse_charstring_value($1, loc); |
| 6982 | Free($1); |
| 6983 | } |
| 6984 | ; |
| 6985 | |
| 6986 | Quadruple: // 479 |
| 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; } |
| 6991 | ; |
| 6992 | |
| 6993 | Group: // 481 |
| 6994 | Number |
| 6995 | { |
| 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; |
| 7001 | } else { |
| 7002 | $$ = $1->get_val(); |
| 7003 | } |
| 7004 | delete $1; |
| 7005 | } |
| 7006 | ; |
| 7007 | |
| 7008 | Plane: // 482 |
| 7009 | Number |
| 7010 | { |
| 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; |
| 7016 | } else { |
| 7017 | $$ = $1->get_val(); |
| 7018 | } |
| 7019 | delete $1; |
| 7020 | } |
| 7021 | ; |
| 7022 | |
| 7023 | Row: // 483 |
| 7024 | Number |
| 7025 | { |
| 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; |
| 7031 | } else { |
| 7032 | $$ = $1->get_val(); |
| 7033 | } |
| 7034 | delete $1; |
| 7035 | } |
| 7036 | ; |
| 7037 | |
| 7038 | Cell: // 484 |
| 7039 | Number |
| 7040 | { |
| 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; |
| 7046 | } else { |
| 7047 | $$ = $1->get_val(); |
| 7048 | } |
| 7049 | delete $1; |
| 7050 | } |
| 7051 | ; |
| 7052 | |
| 7053 | FreeText: // 509 |
| 7054 | Cstring { $$ = $1; } |
| 7055 | | FreeText Cstring |
| 7056 | { |
| 7057 | $$ = mputstr($1, $2); |
| 7058 | Free($2); |
| 7059 | } |
| 7060 | ; |
| 7061 | |
| 7062 | AddressValue: // 510 |
| 7063 | NullKeyword |
| 7064 | { |
| 7065 | $$ = new Value(Value::V_TTCN3_NULL); |
| 7066 | $$->set_location(infile, @$); |
| 7067 | } |
| 7068 | ; |
| 7069 | |
| 7070 | OmitValue: // 511 |
| 7071 | OmitKeyword |
| 7072 | { |
| 7073 | $$ = new Value(Value::V_OMIT); |
| 7074 | $$->set_location(infile, @$); |
| 7075 | } |
| 7076 | ; |
| 7077 | |
| 7078 | ReferencedValue: // 489 |
| 7079 | Reference |
| 7080 | { |
| 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, @$); |
| 7084 | } |
| 7085 | |
| 7086 | Reference: // 490 ValueReference |
| 7087 | IDentifier |
| 7088 | { |
| 7089 | $$.is_ref = false; |
| 7090 | $$.id = $1; |
| 7091 | } |
| 7092 | | IDentifier '.' PredefOrIdentifier optExtendedFieldReference |
| 7093 | { |
| 7094 | $$.is_ref = true; |
| 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]); |
| 7100 | Free($4.elements); |
| 7101 | $$.ref->set_location(infile, @$); |
| 7102 | } |
| 7103 | | IDentifier ArrayOrBitRef optExtendedFieldReference |
| 7104 | { |
| 7105 | $$.is_ref = true; |
| 7106 | $$.ref = new Ttcn::Reference($1); |
| 7107 | $$.ref->add($2); |
| 7108 | for (size_t i = 0; i < $3.nElements; i++) $$.ref->add($3.elements[i]); |
| 7109 | Free($3.elements); |
| 7110 | $$.ref->set_location(infile, @$); |
| 7111 | } |
| 7112 | | IDentifier '[' NotUsedSymbol ']' |
| 7113 | { |
| 7114 | $$.is_ref = true; |
| 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, @$); |
| 7120 | } |
| 7121 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier |
| 7122 | optExtendedFieldReference |
| 7123 | { |
| 7124 | $$.is_ref = true; |
| 7125 | $$.ref = new Ttcn::Reference($1, $5); |
| 7126 | delete $3; |
| 7127 | for (size_t i = 0; i < $6.nElements; i++) $$.ref->add($6.elements[i]); |
| 7128 | Free($6.elements); |
| 7129 | $$.ref->set_location(infile, @$); |
| 7130 | } |
| 7131 | ; |
| 7132 | |
| 7133 | /* A.1.6.5 Parameterization */ |
| 7134 | |
| 7135 | optLazyEval: |
| 7136 | /* empty */ { $$ = false; } |
| 7137 | | TitanSpecificLazyKeyword { $$ = true; } |
| 7138 | ; |
| 7139 | |
| 7140 | FormalValuePar: // 516 |
| 7141 | optLazyEval Type IDentifier optParDefaultValue |
| 7142 | { |
| 7143 | $$ = new FormalPar(Common::Assignment::A_PAR_VAL, $2, $3, $4, $1); |
| 7144 | $$->set_location(infile, @$); |
| 7145 | } |
| 7146 | | InParKeyword optLazyEval Type IDentifier optParDefaultValue |
| 7147 | { |
| 7148 | $$ = new FormalPar(Common::Assignment::A_PAR_VAL_IN, $3, $4, $5, $2); |
| 7149 | $$->set_location(infile, @$); |
| 7150 | } |
| 7151 | | InOutParKeyword Type IDentifier optParDefaultValue |
| 7152 | { |
| 7153 | $$ = new FormalPar(Common::Assignment::A_PAR_VAL_INOUT, $2, $3, $4); |
| 7154 | $$->set_location(infile, @$); |
| 7155 | } |
| 7156 | | OutParKeyword Type IDentifier optParDefaultValue |
| 7157 | { |
| 7158 | $$ = new FormalPar(Common::Assignment::A_PAR_VAL_OUT, $2, $3, $4); |
| 7159 | $$->set_location(infile, @$); |
| 7160 | } |
| 7161 | ; |
| 7162 | |
| 7163 | /* |
| 7164 | FormalPortPar: // 518 |
| 7165 | IDentifier IDentifier |
| 7166 | | InOutParKeyword IDentifier IDentifier |
| 7167 | ; |
| 7168 | */ |
| 7169 | |
| 7170 | FormalTimerPar: // 520 |
| 7171 | TimerKeyword IDentifier optParDefaultValue |
| 7172 | { |
| 7173 | $$ = new FormalPar(Common::Assignment::A_PAR_TIMER, $2, $3); |
| 7174 | $$->set_location(infile, @$); |
| 7175 | } |
| 7176 | | InOutParKeyword TimerKeyword IDentifier optParDefaultValue |
| 7177 | { |
| 7178 | $$ = new FormalPar(Common::Assignment::A_PAR_TIMER, $3, $4); |
| 7179 | $$->set_location(infile, @$); |
| 7180 | } |
| 7181 | ; |
| 7182 | |
| 7183 | FormalTemplatePar: // 522 |
| 7184 | TemplateOptRestricted optLazyEval Type IDentifier optParDefaultValue |
| 7185 | { |
| 7186 | $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_IN, $1, $3, $4, $5, $2); |
| 7187 | $$->set_location(infile, @$); |
| 7188 | } |
| 7189 | | InParKeyword TemplateOptRestricted optLazyEval Type IDentifier optParDefaultValue |
| 7190 | { |
| 7191 | $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_IN, $2, $4, $5, $6, $3); |
| 7192 | $$->set_location(infile, @$); |
| 7193 | } |
| 7194 | | InOutParKeyword TemplateOptRestricted Type IDentifier optParDefaultValue |
| 7195 | { |
| 7196 | $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_INOUT, $2, $3, $4, $5); |
| 7197 | $$->set_location(infile, @$); |
| 7198 | } |
| 7199 | | OutParKeyword TemplateOptRestricted Type IDentifier optParDefaultValue |
| 7200 | { |
| 7201 | $$ = new FormalPar(Common::Assignment::A_PAR_TEMPL_OUT, $2, $3, $4, $5); |
| 7202 | $$->set_location(infile, @$); |
| 7203 | } |
| 7204 | ; |
| 7205 | |
| 7206 | /* template with optional restriction */ |
| 7207 | TemplateOptRestricted: |
| 7208 | TemplateKeyword optTemplateRestriction |
| 7209 | { |
| 7210 | $$ = $2; |
| 7211 | } |
| 7212 | | OmitKeyword |
| 7213 | { |
| 7214 | $$ = TR_OMIT; |
| 7215 | } |
| 7216 | ; |
| 7217 | |
| 7218 | optTemplateRestriction: |
| 7219 | /* none */ { $$ = TR_NONE; } |
| 7220 | | TemplateRestriction { $$ = $1; } |
| 7221 | |
| 7222 | TemplateRestriction: |
| 7223 | '(' OmitKeyword ')' { $$ = TR_OMIT; } |
| 7224 | | '(' ValueKeyword ')' { $$ = TR_VALUE; } |
| 7225 | | '(' PresentKeyword ')' { $$ = TR_PRESENT; } |
| 7226 | ; |
| 7227 | |
| 7228 | optParDefaultValue: |
| 7229 | /* empty */ { $$ = NULL; } |
| 7230 | | AssignmentChar TemplateInstance { $$ = $2; } |
| 7231 | | AssignmentChar NotUsedSymbol |
| 7232 | { |
| 7233 | Template *t = new Template(Template::TEMPLATE_NOTUSED); |
| 7234 | t->set_location(infile, @$); |
| 7235 | $$ = new TemplateInstance(0, 0, t); |
| 7236 | $$->set_location(infile, @$); |
| 7237 | } |
| 7238 | ; |
| 7239 | |
| 7240 | /* A.1.6.6 With statement */ |
| 7241 | |
| 7242 | optWithStatement: // [526] |
| 7243 | /* empty */ { $$ = NULL; } |
| 7244 | | WithStatement { $$ = $1; } |
| 7245 | ; |
| 7246 | |
| 7247 | optWithStatementAndSemiColon: |
| 7248 | /* empty */ { $$ = NULL; } |
| 7249 | | WithStatement { $$ = $1; } |
| 7250 | | ';' { $$ = NULL; } |
| 7251 | | WithStatement ';' { $$ = $1; } |
| 7252 | ; |
| 7253 | |
| 7254 | WithStatement: // 526 |
| 7255 | WithKeyword WithAttribList { $$ = $2; } |
| 7256 | ; |
| 7257 | |
| 7258 | WithAttribList: // 528 |
| 7259 | '{' MultiWithAttrib optError '}' { $$ = $2; } |
| 7260 | | '{' error '}' { $$ = NULL; } |
| 7261 | ; |
| 7262 | |
| 7263 | MultiWithAttrib: // 529 |
| 7264 | optError SingleWithAttrib optSemiColon |
| 7265 | { |
| 7266 | $$ = new MultiWithAttrib; |
| 7267 | $$->set_location(infile, @$); |
| 7268 | $$->add_element($2); |
| 7269 | } |
| 7270 | | MultiWithAttrib optError SingleWithAttrib optSemiColon |
| 7271 | { |
| 7272 | $$ = $1; |
| 7273 | $$->add_element($3); |
| 7274 | } |
| 7275 | ; |
| 7276 | |
| 7277 | SingleWithAttrib: // 530 |
| 7278 | AttribKeyword optOverrideKeyword optAttribQualifier AttribSpec |
| 7279 | { |
| 7280 | $$ = new SingleWithAttrib($1,$2,$3,$4); |
| 7281 | $$->set_location(infile, @$); |
| 7282 | } |
| 7283 | ; |
| 7284 | |
| 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; } |
| 7291 | | IDentifier |
| 7292 | { |
| 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; |
| 7296 | else { |
| 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") |
| 7301 | loc.note("\n" |
| 7302 | " ________ _____ ________ ____ __ _ \n" |
| 7303 | "(___ ___) (_ _) (___ ___) ( ) / \\ / ) \n" |
| 7304 | " ) ) | | ) ) / /\\ \\ / /\\ \\ / / \n" |
| 7305 | " ( ( | | ( ( ( (__) ) ) ) ) ) ) ) \n" |
| 7306 | " ) ) | | ) ) ) ( ( ( ( ( ( ( \n" |
| 7307 | " ( ( _| |__ ( ( / /\\ \\ / / \\ \\/ / \n" |
| 7308 | " /__\\ /_____( /__\\ /__( )__\\ (_/ \\__/ \n"); |
| 7309 | $$ = SingleWithAttrib::AT_INVALID; |
| 7310 | } |
| 7311 | delete $1; |
| 7312 | } |
| 7313 | ; |
| 7314 | |
| 7315 | optOverrideKeyword: // [536] |
| 7316 | /* empty */ { $$ = false; } |
| 7317 | | OverrideKeyword { $$ = true; } |
| 7318 | ; |
| 7319 | |
| 7320 | optAttribQualifier: // [537] |
| 7321 | /* empty */ { $$ = NULL; } |
| 7322 | | '(' DefOrFieldRefList optError ')' { $$ = $2; } |
| 7323 | | '(' error ')' { $$ = NULL; } |
| 7324 | ; |
| 7325 | |
| 7326 | DefOrFieldRefList: // 538 |
| 7327 | optError DefOrFieldRef |
| 7328 | { |
| 7329 | $$ = new Qualifiers(); |
| 7330 | if ($2) $$->add_qualifier($2); |
| 7331 | } |
| 7332 | | DefOrFieldRefList optError ',' optError DefOrFieldRef |
| 7333 | { |
| 7334 | $$ = $1; |
| 7335 | if ($5) $$->add_qualifier($5); |
| 7336 | } |
| 7337 | | DefOrFieldRefList optError ',' error { $$ = $1; } |
| 7338 | ; |
| 7339 | |
| 7340 | ArrayOrBitRefOrDash: |
| 7341 | ArrayOrBitRef { $$ = $1; } |
| 7342 | | '[' NotUsedSymbol ']' |
| 7343 | { |
| 7344 | Value* novalue = new Value(Value::V_NOTUSED); |
| 7345 | novalue->set_location(infile, @2); |
| 7346 | $$ = new FieldOrArrayRef(novalue); |
| 7347 | $$->set_location(infile, @$); |
| 7348 | } |
| 7349 | |
| 7350 | DefOrFieldRef: // 539 |
| 7351 | IDentifier |
| 7352 | { |
| 7353 | $$ = new Qualifier(); |
| 7354 | $$->add(new FieldOrArrayRef($1)); |
| 7355 | $$->set_location(infile, @1); |
| 7356 | } |
| 7357 | | IDentifier '.' IDentifier optExtendedFieldReference |
| 7358 | { |
| 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]); |
| 7364 | } |
| 7365 | Free($4.elements); |
| 7366 | $$->set_location(infile, @$); |
| 7367 | } |
| 7368 | | IDentifier ArrayOrBitRefOrDash optExtendedFieldReference |
| 7369 | { |
| 7370 | $$ = new Qualifier(); |
| 7371 | $$->add(new FieldOrArrayRef($1)); |
| 7372 | $$->add($2); |
| 7373 | for(size_t i=0; i<$3.nElements; i++) { |
| 7374 | $$->add($3.elements[i]); |
| 7375 | } |
| 7376 | Free($3.elements); |
| 7377 | $$->set_location(infile, @$); |
| 7378 | } |
| 7379 | | ArrayOrBitRefOrDash optExtendedFieldReference |
| 7380 | { |
| 7381 | $$ = new Qualifier(); |
| 7382 | $$->add($1); |
| 7383 | for(size_t i=0; i<$2.nElements; i++) { |
| 7384 | $$->add($2.elements[i]); |
| 7385 | } |
| 7386 | Free($2.elements); |
| 7387 | $$->set_location(infile, @$); |
| 7388 | } |
| 7389 | | AllRef |
| 7390 | { |
| 7391 | Location loc(infile, @$); |
| 7392 | loc.error("Reference to multiple definitions in attribute qualifiers is " |
| 7393 | "not currently supported"); |
| 7394 | $$ = 0; |
| 7395 | } |
| 7396 | ; |
| 7397 | |
| 7398 | AllRef: // 541 |
| 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 '}' |
| 7417 | ; |
| 7418 | |
| 7419 | AttribSpec: // 542 |
| 7420 | FreeText |
| 7421 | { |
| 7422 | $$ = new AttributeSpec(string($1)); |
| 7423 | $$->set_location(infile, @$); |
| 7424 | Free($1); |
| 7425 | } |
| 7426 | ; |
| 7427 | |
| 7428 | /* A.1.6.7 Behaviour statements */ |
| 7429 | |
| 7430 | BehaviourStatements: // 543 |
| 7431 | TestcaseInstance |
| 7432 | { |
| 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); |
| 7438 | delete $1.ap_list; |
| 7439 | } |
| 7440 | else $$ = new Statement(Statement::S_ERROR); |
| 7441 | $$->set_location(infile, @$); |
| 7442 | } |
| 7443 | | FunctionInstance |
| 7444 | { |
| 7445 | $$ = new Statement(Statement::S_UNKNOWN_INSTANCE, $1); |
| 7446 | $$->set_location(infile, @$); |
| 7447 | } |
| 7448 | | ApplyOp |
| 7449 | { |
| 7450 | $$ = new Statement(Statement::S_UNKNOWN_INVOKED, $1.value, $1.ap_list); |
| 7451 | $$->set_location(infile, @$); |
| 7452 | } |
| 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 */ |
| 7463 | | ActivateOp |
| 7464 | { |
| 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, @$); |
| 7470 | } |
| 7471 | ; |
| 7472 | |
| 7473 | VerdictStatements: // 544 |
| 7474 | SetLocalVerdict { $$ = $1; } |
| 7475 | ; |
| 7476 | |
| 7477 | VerdictOps: // 545 |
| 7478 | GetLocalVerdict { $$ = $1; } |
| 7479 | ; |
| 7480 | |
| 7481 | SetLocalVerdict: // 546 |
| 7482 | SetVerdictKeyword '(' Expression optError ',' LogItemList optError ')' |
| 7483 | { |
| 7484 | $$=new Statement(Statement::S_SETVERDICT, $3, $6); |
| 7485 | $$->set_location(infile, @$); |
| 7486 | } |
| 7487 | | SetVerdictKeyword '(' Expression optError ')' |
| 7488 | { |
| 7489 | $$=new Statement(Statement::S_SETVERDICT, $3, (LogArguments*)0); |
| 7490 | $$->set_location(infile, @$); |
| 7491 | } |
| 7492 | | SetVerdictKeyword '(' error ')' |
| 7493 | { |
| 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, @$); |
| 7498 | } |
| 7499 | ; |
| 7500 | |
| 7501 | GetLocalVerdict: // 548 |
| 7502 | GetVerdictKeyword |
| 7503 | { |
| 7504 | $$=new Value(Value::OPTYPE_GETVERDICT); |
| 7505 | $$->set_location(infile, @$); |
| 7506 | } |
| 7507 | ; |
| 7508 | |
| 7509 | SUTStatements: // 549 |
| 7510 | ActionKeyword '(' ')' |
| 7511 | { |
| 7512 | $$=new Statement(Statement::S_ACTION, (LogArguments*)0); |
| 7513 | $$->set_location(infile, @$); |
| 7514 | } |
| 7515 | | ActionKeyword '(' LogItemList optError ')' |
| 7516 | { |
| 7517 | $$=new Statement(Statement::S_ACTION, $3); |
| 7518 | $$->set_location(infile, @$); |
| 7519 | } |
| 7520 | | ActionKeyword '(' error ')' |
| 7521 | { |
| 7522 | $$=new Statement(Statement::S_ACTION, new LogArguments()); |
| 7523 | $$->set_location(infile, @$); |
| 7524 | } |
| 7525 | ; |
| 7526 | |
| 7527 | StopExecutionStatement: |
| 7528 | StopKeyword |
| 7529 | { |
| 7530 | $$=new Statement(Statement::S_STOP_EXEC); |
| 7531 | $$->set_location(infile, @$); |
| 7532 | } |
| 7533 | ; |
| 7534 | |
| 7535 | StopTestcaseStatement: |
| 7536 | TestcaseKeyword DotStopKeyword |
| 7537 | { |
| 7538 | $$ = new Statement(Statement::S_STOP_TESTCASE, (LogArguments*)0); |
| 7539 | $$->set_location(infile, @$); |
| 7540 | } |
| 7541 | | TestcaseKeyword DotStopKeyword '(' LogItemList optError ')' |
| 7542 | { |
| 7543 | $$ = new Statement(Statement::S_STOP_TESTCASE, $4); |
| 7544 | $$->set_location(infile, @$); |
| 7545 | } |
| 7546 | ; |
| 7547 | |
| 7548 | /* these deliberately don't have their locations set */ |
| 7549 | ProfilerStatement: |
| 7550 | TitanSpecificProfilerKeyword DotStartKeyword |
| 7551 | { |
| 7552 | $$ = new Statement(Statement::S_START_PROFILER); |
| 7553 | } |
| 7554 | | TitanSpecificProfilerKeyword DotStopKeyword |
| 7555 | { |
| 7556 | $$ = new Statement(Statement::S_STOP_PROFILER); |
| 7557 | } |
| 7558 | ; |
| 7559 | |
| 7560 | int2enumStatement: |
| 7561 | int2enumKeyword '(' optError Expression optError ',' optError Reference optError ')' |
| 7562 | { |
| 7563 | Ttcn::Reference* out_ref; |
| 7564 | if ($8.is_ref) out_ref = $8.ref; |
| 7565 | else { |
| 7566 | out_ref = new Ttcn::Reference($8.id); |
| 7567 | out_ref->set_location(infile, @8); |
| 7568 | } |
| 7569 | $$ = new Statement(Statement::S_INT2ENUM, $4, out_ref); |
| 7570 | $$->set_location(infile, @$); |
| 7571 | } |
| 7572 | ; |
| 7573 | |
| 7574 | ProfilerRunningOp: |
| 7575 | TitanSpecificProfilerKeyword DotRunningKeyword |
| 7576 | { |
| 7577 | $$ = new Value(Value::OPTYPE_PROF_RUNNING); |
| 7578 | $$->set_location(infile, @$); |
| 7579 | } |
| 7580 | ; |
| 7581 | |
| 7582 | ReturnStatement: // 552 |
| 7583 | ReturnKeyword |
| 7584 | { |
| 7585 | $$=new Statement(Statement::S_RETURN, (Template*)0); |
| 7586 | $$->set_location(infile, @$); |
| 7587 | } |
| 7588 | | ReturnKeyword TemplateBody |
| 7589 | { |
| 7590 | $$=new Statement(Statement::S_RETURN, $2); |
| 7591 | $$->set_location(infile, @$); |
| 7592 | } |
| 7593 | ; |
| 7594 | |
| 7595 | AltConstruct: // 553 |
| 7596 | AltKeyword '{' AltGuardList optError '}' |
| 7597 | { |
| 7598 | $$=new Statement(Statement::S_ALT, $3); |
| 7599 | $$->set_location(infile, @$); |
| 7600 | } |
| 7601 | | AltKeyword '{' error '}' |
| 7602 | { |
| 7603 | $$=new Statement(Statement::S_ALT, new AltGuards()); |
| 7604 | $$->set_location(infile, @$); |
| 7605 | } |
| 7606 | ; |
| 7607 | |
| 7608 | AltGuardList: // 555 |
| 7609 | optError AltGuard |
| 7610 | { |
| 7611 | $$ = new AltGuards; |
| 7612 | $$->add_ag($2); |
| 7613 | } |
| 7614 | | AltGuardList optError AltGuard |
| 7615 | { |
| 7616 | $$ = $1; |
| 7617 | $$->add_ag($3); |
| 7618 | } |
| 7619 | ; |
| 7620 | |
| 7621 | AltGuard: |
| 7622 | GuardStatement { $$ = $1; } |
| 7623 | | ElseStatement { $$ = $1; } |
| 7624 | ; |
| 7625 | |
| 7626 | GuardStatement: // 556 |
| 7627 | AltGuardChar AltstepInstance optSemiColon |
| 7628 | { |
| 7629 | $$=new AltGuard($1, $2, 0); |
| 7630 | $$->set_location(infile, @$); |
| 7631 | } |
| 7632 | | AltGuardChar ApplyOp optSemiColon |
| 7633 | { |
| 7634 | $$=new AltGuard($1, $2.value, $2.ap_list->steal_tis(), 0); |
| 7635 | $$->set_location(infile, @$); |
| 7636 | delete $2.ap_list; |
| 7637 | } |
| 7638 | | AltGuardChar AltstepInstance optSemiColon StatementBlock optSemiColon |
| 7639 | { |
| 7640 | $$=new AltGuard($1, $2, $4); |
| 7641 | $$->set_location(infile, @$); |
| 7642 | } |
| 7643 | | AltGuardChar ApplyOp optSemiColon StatementBlock optSemiColon |
| 7644 | { |
| 7645 | $$= new AltGuard($1, $2.value, $2.ap_list->steal_tis(), $4); |
| 7646 | $$->set_location(infile, @$); |
| 7647 | delete $2.ap_list; |
| 7648 | } |
| 7649 | | AltGuardChar GuardOp ';' |
| 7650 | { |
| 7651 | $$=new AltGuard($1, $2, new StatementBlock()); |
| 7652 | $$->set_location(infile, @$); |
| 7653 | } |
| 7654 | | AltGuardChar GuardOp optSemiColon StatementBlock optSemiColon |
| 7655 | { |
| 7656 | $$=new AltGuard($1, $2, $4); |
| 7657 | $$->set_location(infile, @$); |
| 7658 | } |
| 7659 | ; |
| 7660 | |
| 7661 | ElseStatement: // 557 |
| 7662 | '[' ElseKeyword ']' StatementBlock optSemiColon |
| 7663 | { |
| 7664 | $$=new AltGuard($4); |
| 7665 | $$->set_location(infile, @$); |
| 7666 | } |
| 7667 | ; |
| 7668 | |
| 7669 | AltGuardChar: // 558 |
| 7670 | '[' ']' { $$=0; } |
| 7671 | | '[' BooleanExpression ']' { $$ = $2; } |
| 7672 | ; |
| 7673 | |
| 7674 | GuardOp: // 559 |
| 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; } |
| 7684 | ; |
| 7685 | |
| 7686 | InterleavedConstruct: // 560 |
| 7687 | InterleavedKeyword '{' InterleavedGuardList optError '}' |
| 7688 | { |
| 7689 | $$ = new Statement(Statement::S_INTERLEAVE, $3); |
| 7690 | $$->set_location(infile, @$); |
| 7691 | } |
| 7692 | | InterleavedKeyword '{' error '}' |
| 7693 | { |
| 7694 | $$ = new Statement(Statement::S_INTERLEAVE, new AltGuards()); |
| 7695 | $$->set_location(infile, @$); |
| 7696 | } |
| 7697 | ; |
| 7698 | |
| 7699 | InterleavedGuardList: // 562 |
| 7700 | optError InterleavedGuardElement |
| 7701 | { |
| 7702 | $$ = new AltGuards(); |
| 7703 | $$->add_ag($2); |
| 7704 | } |
| 7705 | | InterleavedGuardList optError InterleavedGuardElement |
| 7706 | { $$ = $1; $$->add_ag($3); } |
| 7707 | ; |
| 7708 | |
| 7709 | InterleavedGuardElement: // 563 |
| 7710 | '[' optError ']' GuardOp ';' |
| 7711 | { |
| 7712 | $$ = new AltGuard(0, $4, new StatementBlock()); |
| 7713 | $$->set_location(infile, @$); |
| 7714 | } |
| 7715 | | '[' optError ']' GuardOp optSemiColon StatementBlock optSemiColon |
| 7716 | { |
| 7717 | $$ = new AltGuard(0, $4, $6); |
| 7718 | $$->set_location(infile, @$); |
| 7719 | } |
| 7720 | ; |
| 7721 | |
| 7722 | /* The following were folded into the above rule: |
| 7723 | |
| 7724 | InterleavedGuardElement: // 563 |
| 7725 | InterleavedGuard InterleavedAction |
| 7726 | ; |
| 7727 | |
| 7728 | InterleavedGuard: // 564 |
| 7729 | '[' ']' GuardOp |
| 7730 | ; |
| 7731 | |
| 7732 | InterleavedAction: // 565 |
| 7733 | StatementBlock |
| 7734 | ; |
| 7735 | */ |
| 7736 | |
| 7737 | LabelStatement: // 566 |
| 7738 | LabelKeyword IDentifier |
| 7739 | { |
| 7740 | $$=new Statement(Statement::S_LABEL, $2); |
| 7741 | $$->set_location(infile, @$); |
| 7742 | } |
| 7743 | ; |
| 7744 | |
| 7745 | GotoStatement: // 569 |
| 7746 | GotoKeyword IDentifier |
| 7747 | { |
| 7748 | $$=new Statement(Statement::S_GOTO, $2); |
| 7749 | $$->set_location(infile, @$); |
| 7750 | } |
| 7751 | | GotoKeyword AltKeyword |
| 7752 | { |
| 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, @$); |
| 7757 | } |
| 7758 | ; |
| 7759 | |
| 7760 | RepeatStatement: // 571 |
| 7761 | RepeatKeyword |
| 7762 | { |
| 7763 | $$=new Statement(Statement::S_REPEAT); |
| 7764 | $$->set_location(infile, @$); |
| 7765 | } |
| 7766 | ; |
| 7767 | |
| 7768 | ActivateOp: // 572 |
| 7769 | ActivateKeyword '(' AltstepInstance optError ')' |
| 7770 | { |
| 7771 | $$.ref_pard = $3; |
| 7772 | $$.derefered_value = 0; |
| 7773 | $$.ap_list = 0; |
| 7774 | } |
| 7775 | | ActivateKeyword '(' DereferOp '(' optFunctionActualParList ')' optError ')' |
| 7776 | { |
| 7777 | $5->set_location(infile, @4, @6); |
| 7778 | $$.ref_pard = 0; |
| 7779 | $$.derefered_value = $3; |
| 7780 | $$.ap_list = $5->steal_tis(); /* XXX perhaps propagate the datatype instead ? */ |
| 7781 | delete $5; |
| 7782 | } |
| 7783 | | ActivateKeyword '(' error ')' |
| 7784 | { |
| 7785 | $$.ref_pard = 0; |
| 7786 | $$.derefered_value = 0; |
| 7787 | $$.ap_list = 0; |
| 7788 | } |
| 7789 | ; |
| 7790 | |
| 7791 | ReferOp: |
| 7792 | RefersKeyword '(' FunctionRef ')' |
| 7793 | { |
| 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, @$); |
| 7798 | } |
| 7799 | ; |
| 7800 | |
| 7801 | DeactivateStatement: // 574 |
| 7802 | DeactivateKeyword |
| 7803 | { |
| 7804 | $$=new Statement(Statement::S_DEACTIVATE, (Value*)0); |
| 7805 | $$->set_location(infile, @$); |
| 7806 | } |
| 7807 | | DeactivateKeyword '(' Expression optError ')' |
| 7808 | { |
| 7809 | $$=new Statement(Statement::S_DEACTIVATE, $3); |
| 7810 | $$->set_location(infile, @$); |
| 7811 | } |
| 7812 | | DeactivateKeyword '(' error ')' |
| 7813 | { |
| 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, @$); |
| 7818 | } |
| 7819 | ; |
| 7820 | |
| 7821 | BreakStatement: // 576 |
| 7822 | BreakKeyword |
| 7823 | { |
| 7824 | $$=new Statement(Statement::S_BREAK); |
| 7825 | $$->set_location(infile, @$); |
| 7826 | } |
| 7827 | ; |
| 7828 | |
| 7829 | ContinueStatement: // 577 |
| 7830 | ContinueKeyword |
| 7831 | { |
| 7832 | $$=new Statement(Statement::S_CONTINUE); |
| 7833 | $$->set_location(infile, @$); |
| 7834 | } |
| 7835 | ; |
| 7836 | |
| 7837 | /* A.1.6.8 Basic statements */ |
| 7838 | |
| 7839 | BasicStatements: // 578 |
| 7840 | Assignment |
| 7841 | { |
| 7842 | $$=new Statement(Statement::S_ASSIGNMENT, $1); |
| 7843 | $$->set_location(infile, @$); |
| 7844 | } |
| 7845 | | LogStatement { $$ = $1; } |
| 7846 | | String2TtcnStatement { $$ = $1; } |
| 7847 | | StatementBlock |
| 7848 | { |
| 7849 | $$ = new Statement(Statement::S_BLOCK, $1); |
| 7850 | $$->set_location(infile, @$); |
| 7851 | } |
| 7852 | | TitanSpecificTryKeyword StatementBlock |
| 7853 | { |
| 7854 | $$ = new Statement(Statement::S_BLOCK, $2); |
| 7855 | $2->set_exception_handling(StatementBlock::EH_TRY); |
| 7856 | $$->set_location(infile, @$); |
| 7857 | } |
| 7858 | | TitanSpecificCatchKeyword '(' IDentifier ')' StatementBlock |
| 7859 | { |
| 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, @$); |
| 7872 | } |
| 7873 | | LoopConstruct { $$ = $1; } |
| 7874 | | ConditionalConstruct { $$ = $1; } |
| 7875 | | SelectCaseConstruct { $$ = $1; } |
| 7876 | ; |
| 7877 | |
| 7878 | Expression: // 579 |
| 7879 | '(' optError Expression optError ')' { $$ = $3; } |
| 7880 | | '(' error ')' |
| 7881 | { |
| 7882 | $$ = new Value(Value::V_ERROR); |
| 7883 | $$->set_location(infile, @$); |
| 7884 | } |
| 7885 | | '+' Expression %prec UnarySign |
| 7886 | { |
| 7887 | $$ = new Value(Value::OPTYPE_UNARYPLUS, $2); |
| 7888 | $$->set_location(infile, @$); |
| 7889 | } |
| 7890 | | '-' Expression %prec UnarySign |
| 7891 | { |
| 7892 | $$ = new Value(Value::OPTYPE_UNARYMINUS, $2); |
| 7893 | $$->set_location(infile, @$); |
| 7894 | } |
| 7895 | | Expression '*' Expression |
| 7896 | { |
| 7897 | $$ = new Value(Value::OPTYPE_MULTIPLY, $1, $3); |
| 7898 | $$->set_location(infile, @$); |
| 7899 | } |
| 7900 | | Expression '/' Expression |
| 7901 | { |
| 7902 | $$ = new Value(Value::OPTYPE_DIVIDE, $1, $3); |
| 7903 | $$->set_location(infile, @$); |
| 7904 | } |
| 7905 | | Expression ModKeyword Expression |
| 7906 | { |
| 7907 | $$ = new Value(Value::OPTYPE_MOD, $1, $3); |
| 7908 | $$->set_location(infile, @$); |
| 7909 | } |
| 7910 | | Expression RemKeyword Expression |
| 7911 | { |
| 7912 | $$ = new Value(Value::OPTYPE_REM, $1, $3); |
| 7913 | $$->set_location(infile, @$); |
| 7914 | } |
| 7915 | | Expression '+' Expression |
| 7916 | { |
| 7917 | $$ = new Value(Value::OPTYPE_ADD, $1, $3); |
| 7918 | $$->set_location(infile, @$); |
| 7919 | } |
| 7920 | | Expression '-' Expression |
| 7921 | { |
| 7922 | $$ = new Value(Value::OPTYPE_SUBTRACT, $1, $3); |
| 7923 | $$->set_location(infile, @$); |
| 7924 | } |
| 7925 | | Expression '&' Expression |
| 7926 | { |
| 7927 | $$ = new Value(Value::OPTYPE_CONCAT, $1, $3); |
| 7928 | $$->set_location(infile, @$); |
| 7929 | } |
| 7930 | | Not4bKeyword Expression |
| 7931 | { |
| 7932 | $$ = new Value(Value::OPTYPE_NOT4B, $2); |
| 7933 | $$->set_location(infile, @$); |
| 7934 | } |
| 7935 | | Expression And4bKeyword Expression |
| 7936 | { |
| 7937 | $$ = new Value(Value::OPTYPE_AND4B, $1, $3); |
| 7938 | $$->set_location(infile, @$); |
| 7939 | } |
| 7940 | | Expression Xor4bKeyword Expression |
| 7941 | { |
| 7942 | $$ = new Value(Value::OPTYPE_XOR4B, $1, $3); |
| 7943 | $$->set_location(infile, @$); |
| 7944 | } |
| 7945 | | Expression Or4bKeyword Expression |
| 7946 | { |
| 7947 | $$ = new Value(Value::OPTYPE_OR4B, $1, $3); |
| 7948 | $$->set_location(infile, @$); |
| 7949 | } |
| 7950 | | Expression SL Expression |
| 7951 | { |
| 7952 | $$ = new Value(Value::OPTYPE_SHL, $1, $3); |
| 7953 | $$->set_location(infile, @$); |
| 7954 | } |
| 7955 | | Expression SR Expression |
| 7956 | { |
| 7957 | $$ = new Value(Value::OPTYPE_SHR, $1, $3); |
| 7958 | $$->set_location(infile, @$); |
| 7959 | } |
| 7960 | | Expression RL Expression |
| 7961 | { |
| 7962 | $$ = new Value(Value::OPTYPE_ROTL, $1, $3); |
| 7963 | $$->set_location(infile, @$); |
| 7964 | } |
| 7965 | | Expression _RR Expression |
| 7966 | { |
| 7967 | $$ = new Value(Value::OPTYPE_ROTR, $1, $3); |
| 7968 | $$->set_location(infile, @$); |
| 7969 | } |
| 7970 | | Expression '<' Expression |
| 7971 | { |
| 7972 | $$ = new Value(Value::OPTYPE_LT, $1, $3); |
| 7973 | $$->set_location(infile, @$); |
| 7974 | } |
| 7975 | | Expression '>' Expression |
| 7976 | { |
| 7977 | $$ = new Value(Value::OPTYPE_GT, $1, $3); |
| 7978 | $$->set_location(infile, @$); |
| 7979 | } |
| 7980 | | Expression LE Expression |
| 7981 | { |
| 7982 | $$ = new Value(Value::OPTYPE_LE, $1, $3); |
| 7983 | $$->set_location(infile, @$); |
| 7984 | } |
| 7985 | | Expression GE Expression |
| 7986 | { |
| 7987 | $$ = new Value(Value::OPTYPE_GE, $1, $3); |
| 7988 | $$->set_location(infile, @$); |
| 7989 | } |
| 7990 | | Expression EQ Expression |
| 7991 | { |
| 7992 | $$ = new Value(Value::OPTYPE_EQ, $1, $3); |
| 7993 | $$->set_location(infile, @$); |
| 7994 | } |
| 7995 | | Expression NE Expression |
| 7996 | { |
| 7997 | $$ = new Value(Value::OPTYPE_NE, $1, $3); |
| 7998 | $$->set_location(infile, @$); |
| 7999 | } |
| 8000 | | NotKeyword Expression |
| 8001 | { |
| 8002 | $$ = new Value(Value::OPTYPE_NOT, $2); |
| 8003 | $$->set_location(infile, @$); |
| 8004 | } |
| 8005 | | Expression AndKeyword Expression |
| 8006 | { |
| 8007 | $$ = new Value(Value::OPTYPE_AND, $1, $3); |
| 8008 | $$->set_location(infile, @$); |
| 8009 | } |
| 8010 | | Expression XorKeyword Expression |
| 8011 | { |
| 8012 | $$ = new Value(Value::OPTYPE_XOR, $1, $3); |
| 8013 | $$->set_location(infile, @$); |
| 8014 | } |
| 8015 | | Expression OrKeyword Expression |
| 8016 | { |
| 8017 | $$ = new Value(Value::OPTYPE_OR, $1, $3); |
| 8018 | $$->set_location(infile, @$); |
| 8019 | } |
| 8020 | | OpCall { $$ = $1; } |
| 8021 | | Value { $$ = $1; } |
| 8022 | | CompoundExpression { $$ = $1; } |
| 8023 | ; |
| 8024 | |
| 8025 | CompoundExpression: // 565 |
| 8026 | FieldExpressionList { $$ = $1; } |
| 8027 | | ArrayExpressionList { $$ = $1; } |
| 8028 | | ArrayExpression { $$ = $1; } |
| 8029 | ; |
| 8030 | |
| 8031 | FieldExpressionList: // 581 |
| 8032 | '{' seqFieldExpressionSpec optError '}' |
| 8033 | { |
| 8034 | $$ = new Value(Value::V_SEQ, $2); |
| 8035 | $$->set_location(infile, @$); |
| 8036 | } |
| 8037 | ; |
| 8038 | |
| 8039 | seqFieldExpressionSpec: |
| 8040 | FieldExpressionSpec |
| 8041 | { |
| 8042 | $$ = new NamedValues(); |
| 8043 | $$->add_nv($1); |
| 8044 | } |
| 8045 | | error FieldExpressionSpec |
| 8046 | { |
| 8047 | $$ = new NamedValues(); |
| 8048 | $$->add_nv($2); |
| 8049 | } |
| 8050 | | seqFieldExpressionSpec optError ',' optError FieldExpressionSpec |
| 8051 | { |
| 8052 | $$ = $1; |
| 8053 | $$->add_nv($5); |
| 8054 | } |
| 8055 | | seqFieldExpressionSpec optError ',' error { $$ = $1; } |
| 8056 | ; |
| 8057 | |
| 8058 | FieldExpressionSpec: // 582 |
| 8059 | FieldReference AssignmentChar NotUsedOrExpression |
| 8060 | { |
| 8061 | $$ = new NamedValue($1, $3); |
| 8062 | $$->set_location(infile, @$); |
| 8063 | } |
| 8064 | ; |
| 8065 | |
| 8066 | ArrayExpressionList: |
| 8067 | '{' seqArrayExpressionSpec optError '}' |
| 8068 | { |
| 8069 | $$ = new Value(Value::V_SEQOF, $2); |
| 8070 | $$->set_location(infile, @$); |
| 8071 | } |
| 8072 | ; |
| 8073 | |
| 8074 | seqArrayExpressionSpec: |
| 8075 | optError ArrayExpressionSpec |
| 8076 | { |
| 8077 | // The only place for indexed-list notation. |
| 8078 | $$ = new Values(true); |
| 8079 | $$->add_iv($2); |
| 8080 | } |
| 8081 | | seqArrayExpressionSpec optError ',' optError ArrayExpressionSpec |
| 8082 | { |
| 8083 | $$ = $1; |
| 8084 | $$->add_iv($5); |
| 8085 | } |
| 8086 | | seqArrayExpressionSpec optError ',' error { $$ = $1; } |
| 8087 | ; |
| 8088 | |
| 8089 | ArrayExpressionSpec: |
| 8090 | ArrayOrBitRef AssignmentChar Expression |
| 8091 | { |
| 8092 | $$ = new IndexedValue($1, $3); |
| 8093 | $$->set_location(infile, @$); |
| 8094 | } |
| 8095 | ; |
| 8096 | |
| 8097 | ArrayExpression: // 583 |
| 8098 | '{' '}' |
| 8099 | { |
| 8100 | $$ = new Value(Value::V_SEQOF, new Values); |
| 8101 | $$->set_location(infile, @$); |
| 8102 | } |
| 8103 | | '{' ArrayElementExpressionList optError '}' |
| 8104 | { |
| 8105 | $$ = new Value(Value::V_SEQOF, $2); |
| 8106 | $$->set_location(infile, @$); |
| 8107 | } |
| 8108 | | '{' error '}' |
| 8109 | { |
| 8110 | $$ = new Value(Value::V_ERROR); |
| 8111 | $$->set_location(infile, @$); |
| 8112 | } |
| 8113 | ; |
| 8114 | |
| 8115 | ArrayElementExpressionList: // 584 |
| 8116 | NotUsedOrExpression |
| 8117 | { |
| 8118 | $$ = new Values; |
| 8119 | $$->add_v($1); |
| 8120 | } |
| 8121 | | error NotUsedOrExpression |
| 8122 | { |
| 8123 | $$ = new Values; |
| 8124 | $$->add_v($2); |
| 8125 | } |
| 8126 | | ArrayElementExpressionList optError ',' optError NotUsedOrExpression |
| 8127 | { |
| 8128 | $$ = $1; |
| 8129 | $$->add_v($5); |
| 8130 | } |
| 8131 | | ArrayElementExpressionList optError ',' error { $$ = $1; } |
| 8132 | ; |
| 8133 | |
| 8134 | NotUsedOrExpression: // 585 |
| 8135 | Expression { $$ = $1; } |
| 8136 | | NotUsedSymbol |
| 8137 | { |
| 8138 | $$ = new Value(Value::V_NOTUSED); |
| 8139 | $$->set_location(infile, @$); |
| 8140 | } |
| 8141 | ; |
| 8142 | |
| 8143 | BooleanExpression: // 588 |
| 8144 | Expression { $$ = $1; } |
| 8145 | | error |
| 8146 | { |
| 8147 | $$ = new Value(Value::V_ERROR); |
| 8148 | $$->set_location(infile, @$); |
| 8149 | } |
| 8150 | ; |
| 8151 | |
| 8152 | Assignment: // 594 |
| 8153 | VariableRef AssignmentChar TemplateBody |
| 8154 | { |
| 8155 | $$ = new Ttcn::Assignment($1, $3); |
| 8156 | $$->set_location(infile, @$); |
| 8157 | } |
| 8158 | ; |
| 8159 | |
| 8160 | /* This can not be a single CompoundExpression (as opposed to Expression) */ |
| 8161 | SingleExpression: // 595 |
| 8162 | '(' SingleExpression ')' { $$ = $2; } |
| 8163 | | '(' error SingleExpression ')' { $$ = $3; } |
| 8164 | | '(' error ')' |
| 8165 | { |
| 8166 | $$ = new Value(Value::V_ERROR); |
| 8167 | $$->set_location(infile, @$); |
| 8168 | } |
| 8169 | | '+' Expression %prec UnarySign |
| 8170 | { |
| 8171 | $$ = new Value(Value::OPTYPE_UNARYPLUS, $2); |
| 8172 | $$->set_location(infile, @$); |
| 8173 | } |
| 8174 | | '-' Expression %prec UnarySign |
| 8175 | { |
| 8176 | $$ = new Value(Value::OPTYPE_UNARYMINUS, $2); |
| 8177 | $$->set_location(infile, @$); |
| 8178 | } |
| 8179 | | SingleExpression '*' Expression |
| 8180 | { |
| 8181 | $$ = new Value(Value::OPTYPE_MULTIPLY, $1, $3); |
| 8182 | $$->set_location(infile, @$); |
| 8183 | } |
| 8184 | | SingleExpression '/' Expression |
| 8185 | { |
| 8186 | $$ = new Value(Value::OPTYPE_DIVIDE, $1, $3); |
| 8187 | $$->set_location(infile, @$); |
| 8188 | } |
| 8189 | | SingleExpression ModKeyword Expression |
| 8190 | { |
| 8191 | $$ = new Value(Value::OPTYPE_MOD, $1, $3); |
| 8192 | $$->set_location(infile, @$); |
| 8193 | } |
| 8194 | | SingleExpression RemKeyword Expression |
| 8195 | { |
| 8196 | $$ = new Value(Value::OPTYPE_REM, $1, $3); |
| 8197 | $$->set_location(infile, @$); |
| 8198 | } |
| 8199 | | SingleExpression '+' Expression |
| 8200 | { |
| 8201 | $$ = new Value(Value::OPTYPE_ADD, $1, $3); |
| 8202 | $$->set_location(infile, @$); |
| 8203 | } |
| 8204 | | SingleExpression '-' Expression |
| 8205 | { |
| 8206 | $$ = new Value(Value::OPTYPE_SUBTRACT, $1, $3); |
| 8207 | $$->set_location(infile, @$); |
| 8208 | } |
| 8209 | | SingleExpression '&' Expression |
| 8210 | { |
| 8211 | $$ = new Value(Value::OPTYPE_CONCAT, $1, $3); |
| 8212 | $$->set_location(infile, @$); |
| 8213 | } |
| 8214 | | Not4bKeyword Expression |
| 8215 | { |
| 8216 | $$ = new Value(Value::OPTYPE_NOT4B, $2); |
| 8217 | $$->set_location(infile, @$); |
| 8218 | } |
| 8219 | | SingleExpression And4bKeyword Expression |
| 8220 | { |
| 8221 | $$ = new Value(Value::OPTYPE_AND4B, $1, $3); |
| 8222 | $$->set_location(infile, @$); |
| 8223 | } |
| 8224 | | SingleExpression Xor4bKeyword Expression |
| 8225 | { |
| 8226 | $$ = new Value(Value::OPTYPE_XOR4B, $1, $3); |
| 8227 | $$->set_location(infile, @$); |
| 8228 | } |
| 8229 | | SingleExpression Or4bKeyword Expression |
| 8230 | { |
| 8231 | $$ = new Value(Value::OPTYPE_OR4B, $1, $3); |
| 8232 | $$->set_location(infile, @$); |
| 8233 | } |
| 8234 | | SingleExpression SL Expression |
| 8235 | { |
| 8236 | $$ = new Value(Value::OPTYPE_SHL, $1, $3); |
| 8237 | $$->set_location(infile, @$); |
| 8238 | } |
| 8239 | | SingleExpression SR Expression |
| 8240 | { |
| 8241 | $$ = new Value(Value::OPTYPE_SHR, $1, $3); |
| 8242 | $$->set_location(infile, @$); |
| 8243 | } |
| 8244 | | SingleExpression RL Expression |
| 8245 | { |
| 8246 | $$ = new Value(Value::OPTYPE_ROTL, $1, $3); |
| 8247 | $$->set_location(infile, @$); |
| 8248 | } |
| 8249 | | SingleExpression _RR Expression |
| 8250 | { |
| 8251 | $$ = new Value(Value::OPTYPE_ROTR, $1, $3); |
| 8252 | $$->set_location(infile, @$); |
| 8253 | } |
| 8254 | | SingleExpression '<' Expression |
| 8255 | { |
| 8256 | $$ = new Value(Value::OPTYPE_LT, $1, $3); |
| 8257 | $$->set_location(infile, @$); |
| 8258 | } |
| 8259 | | SingleExpression '>' Expression |
| 8260 | { |
| 8261 | $$ = new Value(Value::OPTYPE_GT, $1, $3); |
| 8262 | $$->set_location(infile, @$); |
| 8263 | } |
| 8264 | | SingleExpression LE Expression |
| 8265 | { |
| 8266 | $$ = new Value(Value::OPTYPE_LE, $1, $3); |
| 8267 | $$->set_location(infile, @$); |
| 8268 | } |
| 8269 | | SingleExpression GE Expression |
| 8270 | { |
| 8271 | $$ = new Value(Value::OPTYPE_GE, $1, $3); |
| 8272 | $$->set_location(infile, @$); |
| 8273 | } |
| 8274 | | SingleExpression EQ Expression |
| 8275 | { |
| 8276 | $$ = new Value(Value::OPTYPE_EQ, $1, $3); |
| 8277 | $$->set_location(infile, @$); |
| 8278 | } |
| 8279 | | SingleExpression NE Expression |
| 8280 | { |
| 8281 | $$ = new Value(Value::OPTYPE_NE, $1, $3); |
| 8282 | $$->set_location(infile, @$); |
| 8283 | } |
| 8284 | | NotKeyword Expression |
| 8285 | { |
| 8286 | $$ = new Value(Value::OPTYPE_NOT, $2); |
| 8287 | $$->set_location(infile, @$); |
| 8288 | } |
| 8289 | | SingleExpression AndKeyword Expression |
| 8290 | { |
| 8291 | $$ = new Value(Value::OPTYPE_AND, $1, $3); |
| 8292 | $$->set_location(infile, @$); |
| 8293 | } |
| 8294 | | SingleExpression XorKeyword Expression |
| 8295 | { |
| 8296 | $$ = new Value(Value::OPTYPE_XOR, $1, $3); |
| 8297 | $$->set_location(infile, @$); |
| 8298 | } |
| 8299 | | SingleExpression OrKeyword Expression |
| 8300 | { |
| 8301 | $$ = new Value(Value::OPTYPE_OR, $1, $3); |
| 8302 | $$->set_location(infile, @$); |
| 8303 | } |
| 8304 | | OpCall { $$ = $1; } |
| 8305 | | Value { $$ = $1; } |
| 8306 | ; |
| 8307 | |
| 8308 | optExtendedFieldReference: |
| 8309 | // perhaps this should be called seqExtendedFieldReference, |
| 8310 | // but the convention appears to be that seq... can not be empty |
| 8311 | /* empty */ |
| 8312 | { |
| 8313 | $$.nElements = 0; |
| 8314 | $$.elements = 0; |
| 8315 | } |
| 8316 | | optExtendedFieldReference FieldOrArrayReference |
| 8317 | { |
| 8318 | $$.nElements = $1.nElements + 1; |
| 8319 | $$.elements = (FieldOrArrayRef**) |
| 8320 | Realloc($1.elements, ($$.nElements) * sizeof(*$$.elements)); |
| 8321 | $$.elements[$1.nElements] = $2; |
| 8322 | } |
| 8323 | ; |
| 8324 | |
| 8325 | FieldOrArrayReference: |
| 8326 | '.' FieldIdentifier |
| 8327 | { |
| 8328 | $$ = new FieldOrArrayRef($2); |
| 8329 | $$->set_location(infile, @$); |
| 8330 | } |
| 8331 | | ArrayOrBitRefOrDash { $$ = $1; } |
| 8332 | ; |
| 8333 | |
| 8334 | FieldIdentifier: |
| 8335 | PredefOrIdentifier { $$ = $1; } |
| 8336 | | IDentifier /* maybe PredefOrIdentifier here too */ TypeActualParList |
| 8337 | { |
| 8338 | Location loc(infile, @$); |
| 8339 | loc.error("Reference to a parameterized field of type `anytype' is " |
| 8340 | "not currently supported"); |
| 8341 | $$ = $1; |
| 8342 | } |
| 8343 | ; |
| 8344 | |
| 8345 | OpCall: // 611 |
| 8346 | ConfigurationOps { $$ = $1; } |
| 8347 | | VerdictOps { $$ = $1; } |
| 8348 | | TimerOps { $$ = $1; } |
| 8349 | | TestcaseInstance |
| 8350 | { |
| 8351 | if ($1.ref_pard) $$ = new Value(Value::OPTYPE_EXECUTE, $1.ref_pard, |
| 8352 | $1.value); |
| 8353 | else if($1.derefered_value) |
| 8354 | $$ = new Value(Value::OPTYPE_EXECUTE_REFD, $1.derefered_value, $1.ap_list, |
| 8355 | $1.value); |
| 8356 | else $$ = new Value(Value::V_ERROR); |
| 8357 | $$->set_location(infile, @$); |
| 8358 | } |
| 8359 | | FunctionInstance optExtendedFieldReference |
| 8360 | { |
| 8361 | for (size_t i = 0; i < $2.nElements; i++) $1->add($2.elements[i]); |
| 8362 | Free($2.elements); |
| 8363 | $$ = new Value(Value::V_REFD, $1); |
| 8364 | $$->set_location(infile, @$); |
| 8365 | } |
| 8366 | | ApplyOp |
| 8367 | { |
| 8368 | $$ = new Value(Value::V_INVOKE, $1.value, $1.ap_list); |
| 8369 | $$->set_location(infile, @$); |
| 8370 | } |
| 8371 | | TemplateOps { $$ = $1; } |
| 8372 | | PredefinedOps { $$ = $1; } |
| 8373 | | ReferOp { $$ = $1; } |
| 8374 | | ActivateOp |
| 8375 | { |
| 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, @$); |
| 8381 | } |
| 8382 | | ProfilerRunningOp { $$ = $1; } |
| 8383 | ; |
| 8384 | |
| 8385 | PredefinedOps: |
| 8386 | PredefinedOpKeyword1 '(' optError Expression optError ')' |
| 8387 | { |
| 8388 | $$ = new Value($1, $4); |
| 8389 | $$->set_location(infile, @$); |
| 8390 | } |
| 8391 | | PredefinedOpKeyword1 '(' error ')' |
| 8392 | { |
| 8393 | Value *v1 = new Value(Value::V_ERROR); |
| 8394 | v1->set_location(infile, @3); |
| 8395 | $$ = new Value($1, v1); |
| 8396 | $$->set_location(infile, @$); |
| 8397 | } |
| 8398 | | PredefinedOpKeyword2 '(' optError Expression optError ',' optError |
| 8399 | Expression optError ')' |
| 8400 | { |
| 8401 | $$ = new Value($1, $4, $8); |
| 8402 | $$->set_location(infile, @$); |
| 8403 | } |
| 8404 | | PredefinedOpKeyword2 '(' error ')' |
| 8405 | { |
| 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, @$); |
| 8412 | } |
| 8413 | | PredefinedOpKeyword3 '(' optError Expression optError ',' optError |
| 8414 | Expression optError ')' |
| 8415 | { |
| 8416 | $$ = new Value($1, $4, $8); |
| 8417 | $$->set_location(infile, @$); |
| 8418 | } |
| 8419 | | PredefinedOpKeyword3 '(' optError Expression optError ')' |
| 8420 | { |
| 8421 | $$ = new Value($1, $4, (Common::Value*)NULL); |
| 8422 | $$->set_location(infile, @$); |
| 8423 | } |
| 8424 | | PredefinedOpKeyword3 '(' error ')' |
| 8425 | { |
| 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, @$); |
| 8432 | } |
| 8433 | | decompKeyword '(' optError Expression optError ',' optError |
| 8434 | Expression optError ',' optError Expression optError ')' |
| 8435 | { |
| 8436 | $$ = new Value(Value::OPTYPE_DECOMP, $4, $8, $12); |
| 8437 | $$->set_location(infile, @$); |
| 8438 | } |
| 8439 | | decompKeyword '(' error ')' |
| 8440 | { |
| 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, @$); |
| 8449 | } |
| 8450 | | regexpKeyword '(' optError TemplateInstance optError ',' optError |
| 8451 | TemplateInstance optError ',' optError Expression optError ')' |
| 8452 | { |
| 8453 | $$ = new Value(Value::OPTYPE_REGEXP, $4, $8, $12); |
| 8454 | $$->set_location(infile, @$); |
| 8455 | } |
| 8456 | | regexpKeyword '(' error ')' |
| 8457 | { |
| 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, @$); |
| 8470 | } |
| 8471 | | encvalueKeyword '(' optError TemplateInstance optError ')' |
| 8472 | { |
| 8473 | $$ = new Value(Value::OPTYPE_ENCODE, $4); |
| 8474 | $$->set_location(infile, @$); |
| 8475 | } |
| 8476 | | encvalueKeyword '(' error ')' |
| 8477 | { |
| 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, @$); |
| 8484 | } |
| 8485 | | substrKeyword '(' optError TemplateInstance optError ',' optError |
| 8486 | Expression optError ',' optError Expression optError ')' |
| 8487 | { |
| 8488 | $$ = new Value(Value::OPTYPE_SUBSTR, $4, $8, $12); |
| 8489 | $$->set_location(infile, @$); |
| 8490 | } |
| 8491 | | substrKeyword '(' error ')' |
| 8492 | { |
| 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, @$); |
| 8503 | } |
| 8504 | | replaceKeyword '(' optError TemplateInstance optError ',' optError |
| 8505 | Expression optError ',' optError Expression optError ',' optError |
| 8506 | TemplateInstance optError ')' |
| 8507 | { |
| 8508 | $$ = new Value(Value::OPTYPE_REPLACE, $4, $8, $12, $16); |
| 8509 | $$->set_location(infile, @$); |
| 8510 | } |
| 8511 | | replaceKeyword '(' error ')' |
| 8512 | { |
| 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, @$); |
| 8527 | } |
| 8528 | | decvalueKeyword '(' optError DecValueArg optError ',' optError DecValueArg optError ')' |
| 8529 | { |
| 8530 | $$ = new Value(Value::OPTYPE_DECODE, $4, $8); |
| 8531 | $$->set_location(infile, @$); |
| 8532 | } |
| 8533 | | decvalueKeyword '(' error ')' |
| 8534 | { |
| 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, @$); |
| 8540 | } |
| 8541 | | isvalueKeyword '(' optError TemplateInstance optError ')' |
| 8542 | { |
| 8543 | $$ = new Value(Value::OPTYPE_ISVALUE, $4); |
| 8544 | $$->set_location(infile, @$); |
| 8545 | } |
| 8546 | | isvalueKeyword '(' error ')' |
| 8547 | { |
| 8548 | $$ = new Value(Value::V_ERROR); |
| 8549 | $$->set_location(infile, @$); |
| 8550 | } |
| 8551 | | isboundKeyword '(' optError TemplateInstance optError ')' |
| 8552 | { |
| 8553 | $$ = new Value(Value::OPTYPE_ISBOUND, $4); |
| 8554 | $$->set_location(infile, @$); |
| 8555 | } |
| 8556 | | isboundKeyword '(' error ')' |
| 8557 | { |
| 8558 | $$ = new Value(Value::V_ERROR); |
| 8559 | $$->set_location(infile, @$); |
| 8560 | } |
| 8561 | | ischosenKeyword '(' optError IschosenArg optError ')' |
| 8562 | { |
| 8563 | $$ = new Value(Value::OPTYPE_ISCHOSEN, $4.ref, $4.id); |
| 8564 | $$->set_location(infile, @$); |
| 8565 | } |
| 8566 | | ischosenKeyword '(' error ')' |
| 8567 | { |
| 8568 | $$ = new Value(Value::V_ERROR); |
| 8569 | $$->set_location(infile, @$); |
| 8570 | } |
| 8571 | | ispresentKeyword '(' optError TemplateInstance optError ')' |
| 8572 | { |
| 8573 | $$ = new Value(Value::OPTYPE_ISPRESENT, $4); |
| 8574 | $$->set_location(infile, @$); |
| 8575 | } |
| 8576 | | ispresentKeyword '(' error ')' |
| 8577 | { |
| 8578 | $$ = new Value(Value::V_ERROR); |
| 8579 | $$->set_location(infile, @$); |
| 8580 | } |
| 8581 | | lengthofKeyword '(' optError TemplateInstance optError ')' |
| 8582 | { |
| 8583 | $$ = new Value(Value::OPTYPE_LENGTHOF, $4); |
| 8584 | $$->set_location(infile, @$); |
| 8585 | } |
| 8586 | | lengthofKeyword '(' error ')' |
| 8587 | { |
| 8588 | $$ = new Value(Value::V_ERROR); |
| 8589 | $$->set_location(infile, @$); |
| 8590 | } |
| 8591 | | rndKeyword '(' ')' |
| 8592 | { |
| 8593 | $$ = new Value(Value::OPTYPE_RND); |
| 8594 | $$->set_location(infile, @$); |
| 8595 | } |
| 8596 | | rndKeyword '(' optError Expression optError ')' |
| 8597 | { |
| 8598 | $$ = new Value(Value::OPTYPE_RNDWITHVAL, $4); |
| 8599 | $$->set_location(infile, @$); |
| 8600 | } |
| 8601 | | rndKeyword '(' error ')' |
| 8602 | { |
| 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, @$); |
| 8607 | } |
| 8608 | | sizeofKeyword '(' optError TemplateInstance optError ')' |
| 8609 | { |
| 8610 | $$ = new Value(Value::OPTYPE_SIZEOF, $4); |
| 8611 | $$->set_location(infile, @$); |
| 8612 | } |
| 8613 | | sizeofKeyword '(' error ')' |
| 8614 | { |
| 8615 | $$ = new Value(Value::V_ERROR); |
| 8616 | $$->set_location(infile, @$); |
| 8617 | } |
| 8618 | | log2strKeyword '(' ')' |
| 8619 | { |
| 8620 | $$ = new Value(Value::OPTYPE_LOG2STR, new LogArguments()); |
| 8621 | $$->set_location(infile, @$); |
| 8622 | } |
| 8623 | | log2strKeyword '(' LogItemList optError ')' |
| 8624 | { |
| 8625 | $$ = new Value(Value::OPTYPE_LOG2STR, $3); |
| 8626 | $$->set_location(infile, @$); |
| 8627 | } |
| 8628 | | log2strKeyword '(' error ')' |
| 8629 | { |
| 8630 | $$ = new Value(Value::OPTYPE_LOG2STR, new LogArguments()); |
| 8631 | $$->set_location(infile, @$); |
| 8632 | } |
| 8633 | | testcasenameKeyword '(' ')' |
| 8634 | { |
| 8635 | $$ = new Value(Value::OPTYPE_TESTCASENAME); |
| 8636 | $$->set_location(infile, @$); |
| 8637 | } |
| 8638 | | ttcn2stringKeyword '(' optError TemplateInstance optError ')' |
| 8639 | { |
| 8640 | $$ = new Value(Value::OPTYPE_TTCN2STRING, $4); |
| 8641 | $$->set_location(infile, @$); |
| 8642 | } |
| 8643 | | ttcn2stringKeyword '(' error ')' |
| 8644 | { |
| 8645 | $$ = new Value(Value::V_ERROR); |
| 8646 | $$->set_location(infile, @$); |
| 8647 | } |
| 8648 | ; |
| 8649 | |
| 8650 | DecValueArg: |
| 8651 | Reference |
| 8652 | { |
| 8653 | if ($1.is_ref) $$ = $1.ref; |
| 8654 | else { |
| 8655 | $$ = new Ttcn::Reference($1.id); |
| 8656 | $$->set_location(infile, @$); |
| 8657 | } |
| 8658 | } |
| 8659 | | FunctionInstance { $$ = $1; } |
| 8660 | ; |
| 8661 | |
| 8662 | PredefOrIdentifier: |
| 8663 | IDentifier { $$ = $1; } |
| 8664 | | PredefinedType /* shall not be "anytype" */ |
| 8665 | { |
| 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)); |
| 8670 | |
| 8671 | $$ = new Identifier(Identifier::ID_TTCN, at_field); |
| 8672 | } |
| 8673 | |
| 8674 | IschosenArg: /* see also Reference... */ |
| 8675 | IDentifier '.' PredefOrIdentifier |
| 8676 | { |
| 8677 | $$.ref = new Ttcn::Reference($1); |
| 8678 | $$.ref->set_location(infile, @1); |
| 8679 | $$.id = $3; |
| 8680 | } |
| 8681 | | IDentifier '.' PredefOrIdentifier optExtendedFieldReference '.' PredefOrIdentifier |
| 8682 | { |
| 8683 | $$.ref = new Ttcn::Reference($1); |
| 8684 | FieldOrArrayRef *fieldref = new FieldOrArrayRef($3); |
| 8685 | fieldref->set_location(infile, @3); |
| 8686 | $$.ref->add(fieldref); |
| 8687 | for(size_t i=0; i<$4.nElements; i++) $$.ref->add($4.elements[i]); |
| 8688 | Free($4.elements); |
| 8689 | $$.ref->set_location(infile, @1, @4); |
| 8690 | $$.id = $6; |
| 8691 | } |
| 8692 | | IDentifier ArrayOrBitRef optExtendedFieldReference '.' PredefOrIdentifier |
| 8693 | { |
| 8694 | $$.ref = new Ttcn::Reference($1); |
| 8695 | $$.ref->add($2); |
| 8696 | for(size_t i=0; i<$3.nElements; i++) $$.ref->add($3.elements[i]); |
| 8697 | Free($3.elements); |
| 8698 | $$.ref->set_location(infile, @1, @3); |
| 8699 | $$.id = $5; |
| 8700 | } |
| 8701 | | IDentifier '.' ObjectIdentifierValue '.' IDentifier optExtendedFieldReference |
| 8702 | '.' PredefOrIdentifier |
| 8703 | { |
| 8704 | $$.ref = new Ttcn::Reference($1, $5); |
| 8705 | delete $3; |
| 8706 | for(size_t i=0; i<$6.nElements; i++) $$.ref->add($6.elements[i]); |
| 8707 | Free($6.elements); |
| 8708 | $$.ref->set_location(infile, @1, @6); |
| 8709 | $$.id = $8; |
| 8710 | } |
| 8711 | ; |
| 8712 | |
| 8713 | PredefinedOpKeyword1: |
| 8714 | bit2hexKeyword { $$ = Value::OPTYPE_BIT2HEX; } |
| 8715 | | bit2intKeyword { $$ = Value::OPTYPE_BIT2INT; } |
| 8716 | | bit2octKeyword { $$ = Value::OPTYPE_BIT2OCT; } |
| 8717 | | bit2strKeyword { $$ = Value::OPTYPE_BIT2STR; } |
| 8718 | | char2intKeyword { $$ = Value::OPTYPE_CHAR2INT; } |
| 8719 | | char2octKeyword { $$ = Value::OPTYPE_CHAR2OCT; } |
| 8720 | | float2intKeyword { $$ = Value::OPTYPE_FLOAT2INT; } |
| 8721 | | float2strKeyword { $$ = Value::OPTYPE_FLOAT2STR; } |
| 8722 | | hex2bitKeyword { $$ = Value::OPTYPE_HEX2BIT; } |
| 8723 | | hex2intKeyword { $$ = Value::OPTYPE_HEX2INT; } |
| 8724 | | hex2octKeyword { $$ = Value::OPTYPE_HEX2OCT; } |
| 8725 | | hex2strKeyword { $$ = Value::OPTYPE_HEX2STR; } |
| 8726 | | int2charKeyword { $$ = Value::OPTYPE_INT2CHAR; } |
| 8727 | | int2floatKeyword { $$ = Value::OPTYPE_INT2FLOAT; } |
| 8728 | | int2strKeyword { $$ = Value::OPTYPE_INT2STR; } |
| 8729 | | int2unicharKeyword { $$ = Value::OPTYPE_INT2UNICHAR; } |
| 8730 | | oct2bitKeyword { $$ = Value::OPTYPE_OCT2BIT; } |
| 8731 | | oct2charKeyword { $$ = Value::OPTYPE_OCT2CHAR; } |
| 8732 | | oct2hexKeyword { $$ = Value::OPTYPE_OCT2HEX; } |
| 8733 | | oct2intKeyword { $$ = Value::OPTYPE_OCT2INT; } |
| 8734 | | oct2strKeyword { $$ = Value::OPTYPE_OCT2STR; } |
| 8735 | | str2bitKeyword { $$ = Value::OPTYPE_STR2BIT; } |
| 8736 | | str2floatKeyword { $$ = Value::OPTYPE_STR2FLOAT; } |
| 8737 | | str2hexKeyword { $$ = Value::OPTYPE_STR2HEX; } |
| 8738 | | str2intKeyword { $$ = Value::OPTYPE_STR2INT; } |
| 8739 | | str2octKeyword { $$ = Value::OPTYPE_STR2OCT; } |
| 8740 | | unichar2intKeyword { $$ = Value::OPTYPE_UNICHAR2INT; } |
| 8741 | | unichar2charKeyword { $$ = Value::OPTYPE_UNICHAR2CHAR; } |
| 8742 | | enum2intKeyword { $$ = Value::OPTYPE_ENUM2INT; } |
| 8743 | | remove_bomKeyWord { $$ = Value::OPTYPE_REMOVE_BOM; } |
| 8744 | | get_stringencodingKeyWord { $$ = Value::OPTYPE_GET_STRINGENCODING; } |
| 8745 | | decode_base64KeyWord { $$ = Value::OPTYPE_DECODE_BASE64; } |
| 8746 | ; |
| 8747 | |
| 8748 | PredefinedOpKeyword2: |
| 8749 | int2bitKeyword { $$ = Value::OPTYPE_INT2BIT; } |
| 8750 | | int2hexKeyword { $$ = Value::OPTYPE_INT2HEX; } |
| 8751 | | int2octKeyword { $$ = Value::OPTYPE_INT2OCT; } |
| 8752 | ; |
| 8753 | |
| 8754 | PredefinedOpKeyword3: |
| 8755 | unichar2octKeyword { $$ = Value::OPTYPE_UNICHAR2OCT; } |
| 8756 | | oct2unicharKeyword { $$ = Value::OPTYPE_OCT2UNICHAR; } |
| 8757 | | encode_base64KeyWord { $$ = Value::OPTYPE_ENCODE_BASE64; } |
| 8758 | ; |
| 8759 | |
| 8760 | String2TtcnStatement: |
| 8761 | string2ttcnKeyword '(' optError Expression optError ',' optError Reference optError ')' |
| 8762 | { |
| 8763 | Ttcn::Reference* out_ref; |
| 8764 | if ($8.is_ref) out_ref = $8.ref; |
| 8765 | else { |
| 8766 | out_ref = new Ttcn::Reference($8.id); |
| 8767 | out_ref->set_location(infile, @8); |
| 8768 | } |
| 8769 | $$ = new Statement(Statement::S_STRING2TTCN, $4, out_ref); |
| 8770 | $$->set_location(infile, @$); |
| 8771 | } |
| 8772 | ; |
| 8773 | |
| 8774 | LogStatement: // 619 |
| 8775 | LogKeyword '(' ')' |
| 8776 | { |
| 8777 | $$=new Statement(Statement::S_LOG, (LogArguments*)0); |
| 8778 | $$->set_location(infile, @$); |
| 8779 | } |
| 8780 | | LogKeyword '(' LogItemList optError ')' |
| 8781 | { |
| 8782 | $$=new Statement(Statement::S_LOG, $3); |
| 8783 | $$->set_location(infile, @$); |
| 8784 | } |
| 8785 | | LogKeyword '(' error ')' |
| 8786 | { |
| 8787 | $$=new Statement(Statement::S_LOG, new LogArguments()); |
| 8788 | $$->set_location(infile, @$); |
| 8789 | } |
| 8790 | ; |
| 8791 | |
| 8792 | LogItemList: |
| 8793 | optError LogItem |
| 8794 | { |
| 8795 | $$ = new LogArguments(); |
| 8796 | $$->add_logarg($2); |
| 8797 | } |
| 8798 | | LogItemList optError ',' optError LogItem |
| 8799 | { |
| 8800 | $$ = $1; |
| 8801 | $$->add_logarg($5); |
| 8802 | } |
| 8803 | | LogItemList optError ',' error { $$ = $1; } |
| 8804 | ; |
| 8805 | |
| 8806 | LogItem: // 621 |
| 8807 | TemplateInstance |
| 8808 | { |
| 8809 | $$ = new LogArgument($1); |
| 8810 | $$->set_location(infile, @$); |
| 8811 | } |
| 8812 | ; |
| 8813 | |
| 8814 | LoopConstruct: // 622 |
| 8815 | ForStatement { $$ = $1; } |
| 8816 | | WhileStatement { $$ = $1; } |
| 8817 | | DoWhileStatement { $$ = $1; } |
| 8818 | ; |
| 8819 | |
| 8820 | ForStatement: // 623 |
| 8821 | ForKeyword '(' Initial ';' Final ';' Step optError ')' |
| 8822 | StatementBlock |
| 8823 | { |
| 8824 | $$ = new Statement(Statement::S_FOR, $3.defs, $3.ass, $5, $7, $10); |
| 8825 | $$->set_location(infile, @$); |
| 8826 | } |
| 8827 | ; |
| 8828 | |
| 8829 | Initial: // 625 |
| 8830 | VarInstance |
| 8831 | { |
| 8832 | $$.defs = new Definitions; |
| 8833 | for (size_t i = 0; i < $1.nElements; i++) $$.defs->add_ass($1.elements[i]); |
| 8834 | Free($1.elements); |
| 8835 | $$.ass = 0; |
| 8836 | } |
| 8837 | | Assignment |
| 8838 | { |
| 8839 | $$.defs = 0; |
| 8840 | $$.ass = $1; |
| 8841 | } |
| 8842 | | error |
| 8843 | { |
| 8844 | $$.defs = new Definitions; |
| 8845 | $$.ass = 0; |
| 8846 | } |
| 8847 | ; |
| 8848 | |
| 8849 | Final: // 626 |
| 8850 | BooleanExpression { $$ = $1; } |
| 8851 | ; |
| 8852 | |
| 8853 | Step: // 627 |
| 8854 | Assignment { $$ = $1; } |
| 8855 | /** \todo for-ban nem lehet null a step |
| 8856 | | error { $$=NULL; } |
| 8857 | */ |
| 8858 | ; |
| 8859 | |
| 8860 | WhileStatement: // 628 |
| 8861 | WhileKeyword '(' BooleanExpression ')' StatementBlock |
| 8862 | { |
| 8863 | $$=new Statement(Statement::S_WHILE, $3, $5); |
| 8864 | $$->set_location(infile, @$); |
| 8865 | } |
| 8866 | ; |
| 8867 | |
| 8868 | DoWhileStatement: // 630 |
| 8869 | DoKeyword StatementBlock |
| 8870 | WhileKeyword '(' BooleanExpression ')' |
| 8871 | { |
| 8872 | $$=new Statement(Statement::S_DOWHILE, $5, $2); |
| 8873 | $$->set_location(infile, @$); |
| 8874 | } |
| 8875 | ; |
| 8876 | |
| 8877 | ConditionalConstruct: // 632 |
| 8878 | IfKeyword '(' BooleanExpression ')' |
| 8879 | StatementBlock |
| 8880 | seqElseIfClause optElseClause |
| 8881 | { |
| 8882 | IfClause *ic=new IfClause($3, $5); |
| 8883 | ic->set_location(infile, @1, @5); |
| 8884 | $6->add_front_ic(ic); |
| 8885 | $$=new Statement(Statement::S_IF, $6, $7, |
| 8886 | $7 ? new Location(infile, @7) : 0); |
| 8887 | $$->set_location(infile, @$); |
| 8888 | } |
| 8889 | ; |
| 8890 | |
| 8891 | seqElseIfClause: |
| 8892 | /* empty */ { $$=new IfClauses(); } |
| 8893 | | seqElseIfClause ElseIfClause |
| 8894 | { |
| 8895 | $$=$1; |
| 8896 | $$->add_ic($2); |
| 8897 | } |
| 8898 | ; |
| 8899 | |
| 8900 | ElseIfClause: // 634 |
| 8901 | ElseKeyword IfKeyword '(' BooleanExpression ')' StatementBlock |
| 8902 | { |
| 8903 | $$=new IfClause($4, $6); |
| 8904 | $$->set_location(infile, @$); |
| 8905 | } |
| 8906 | ; |
| 8907 | |
| 8908 | optElseClause: // [636] |
| 8909 | /* empty */ { $$=0; } |
| 8910 | | ElseKeyword StatementBlock { $$=$2; } |
| 8911 | ; |
| 8912 | |
| 8913 | SelectCaseConstruct: // 637 |
| 8914 | SelectKeyword '(' Expression optError ')' SelectCaseBody |
| 8915 | { |
| 8916 | $$=new Statement(Statement::S_SELECT, $3, $6); |
| 8917 | $$->set_location(infile, @$); |
| 8918 | } |
| 8919 | | SelectKeyword '(' error ')' SelectCaseBody |
| 8920 | { |
| 8921 | Value *v = new Value(Value::V_ERROR); |
| 8922 | v->set_location(infile, @3); |
| 8923 | $$=new Statement(Statement::S_SELECT, v, $5); |
| 8924 | $$->set_location(infile, @$); |
| 8925 | } |
| 8926 | ; |
| 8927 | |
| 8928 | SelectCaseBody: // 639 |
| 8929 | '{' seqSelectCase optError '}' {$$=$2;} |
| 8930 | | '{' error '}' {$$=new SelectCases;} |
| 8931 | ; |
| 8932 | |
| 8933 | seqSelectCase: |
| 8934 | optError SelectCase |
| 8935 | { |
| 8936 | $$=new SelectCases; |
| 8937 | $$->add_sc($2); |
| 8938 | } |
| 8939 | | seqSelectCase optError SelectCase |
| 8940 | { |
| 8941 | $$=$1; |
| 8942 | $$->add_sc($3); |
| 8943 | } |
| 8944 | ; |
| 8945 | |
| 8946 | SelectCase: // 640 |
| 8947 | CaseKeyword '(' seqTemplateInstance optError ')' StatementBlock optSemiColon |
| 8948 | { |
| 8949 | $3->set_location(infile, @2, @5); |
| 8950 | $$=new SelectCase($3, $6); |
| 8951 | $$->set_location(infile, @$); |
| 8952 | } |
| 8953 | | CaseKeyword '(' error ')' StatementBlock optSemiColon |
| 8954 | { |
| 8955 | TemplateInstances *tis = new TemplateInstances; |
| 8956 | tis->set_location(infile, @2, @4); |
| 8957 | $$ = new SelectCase(tis, $5); |
| 8958 | $$->set_location(infile, @$); |
| 8959 | } |
| 8960 | | CaseKeyword ElseKeyword StatementBlock optSemiColon |
| 8961 | { |
| 8962 | $$=new SelectCase(0, $3); |
| 8963 | $$->set_location(infile, @$); |
| 8964 | } |
| 8965 | ; |
| 8966 | |
| 8967 | seqTemplateInstance: |
| 8968 | optError TemplateInstance |
| 8969 | { |
| 8970 | $$ = new TemplateInstances; |
| 8971 | $$->add_ti($2); |
| 8972 | } |
| 8973 | | seqTemplateInstance optError ',' optError TemplateInstance |
| 8974 | { |
| 8975 | $$ = $1; |
| 8976 | $$->add_ti($5); |
| 8977 | } |
| 8978 | | seqTemplateInstance optError ',' error { $$ = $1; } |
| 8979 | ; |
| 8980 | |
| 8981 | /* A.1.6.9 Miscellaneous productions */ |
| 8982 | |
| 8983 | optSemiColon: // [645] |
| 8984 | /* empty */ |
| 8985 | | ';' |
| 8986 | ; |
| 8987 | |
| 8988 | /* A.1 ASN.1 support, from ES 201 873-7 V3.1.1 (2005-06) */ |
| 8989 | |
| 8990 | optDefinitiveIdentifier: |
| 8991 | /* empty */ |
| 8992 | | DefinitiveIdentifier |
| 8993 | ; |
| 8994 | |
| 8995 | DefinitiveIdentifier: |
| 8996 | '.' ObjectIdentifierKeyword '{' DefinitiveObjIdComponentList optError '}' |
| 8997 | | '.' ObjectIdentifierKeyword '{' error '}' |
| 8998 | ; |
| 8999 | |
| 9000 | DefinitiveObjIdComponentList: |
| 9001 | optError DefinitiveObjIdComponent |
| 9002 | | DefinitiveObjIdComponentList optError DefinitiveObjIdComponent |
| 9003 | ; |
| 9004 | |
| 9005 | DefinitiveObjIdComponent: |
| 9006 | NameForm |
| 9007 | | DefinitiveNumberForm |
| 9008 | | DefinitiveNameAndNumberForm |
| 9009 | ; |
| 9010 | |
| 9011 | DefinitiveNumberForm: |
| 9012 | Number { delete $1; } |
| 9013 | ; |
| 9014 | |
| 9015 | DefinitiveNameAndNumberForm: |
| 9016 | IDentifier '(' Number optError ')' { delete $1; delete $3; } |
| 9017 | | IDentifier '(' error ')' { delete $1; } |
| 9018 | ; |
| 9019 | |
| 9020 | ObjectIdentifierValue: |
| 9021 | ObjectIdentifierKeyword '{' ObjIdComponentList optError '}' |
| 9022 | { |
| 9023 | $$ = $3; |
| 9024 | $$->set_location(infile, @$); |
| 9025 | } |
| 9026 | | ObjectIdentifierKeyword '{' error '}' |
| 9027 | { |
| 9028 | $$ = new Value(Value::V_ERROR); |
| 9029 | $$->set_location(infile, @$); |
| 9030 | } |
| 9031 | ; |
| 9032 | |
| 9033 | ObjIdComponentList: |
| 9034 | optError ObjIdComponent |
| 9035 | { |
| 9036 | $$ = new Value(Value::V_OID); |
| 9037 | $$->add_oid_comp($2); |
| 9038 | } |
| 9039 | | ObjIdComponentList optError ObjIdComponent |
| 9040 | { |
| 9041 | $$ = $1; |
| 9042 | $$->add_oid_comp($3); |
| 9043 | } |
| 9044 | ; |
| 9045 | |
| 9046 | ObjIdComponent: |
| 9047 | /* NameForm -- covered by NumberForm (as ReferencedValue) */ |
| 9048 | NumberForm { $$ = $1; } |
| 9049 | | NameAndNumberForm { $$ = $1; } |
| 9050 | ; |
| 9051 | |
| 9052 | NumberForm: |
| 9053 | Number |
| 9054 | { |
| 9055 | Value *v = new Value(Value::V_INT, $1); |
| 9056 | v->set_location(infile, @1); |
| 9057 | $$ = new OID_comp(0, v); |
| 9058 | $$->set_location(infile, @$); |
| 9059 | } |
| 9060 | | Reference |
| 9061 | { |
| 9062 | if ($1.is_ref) { |
| 9063 | /* it can be only a referenced value */ |
| 9064 | Value *v = new Value(Value::V_REFD, $1.ref); |
| 9065 | v->set_location(infile, @1); |
| 9066 | $$ = new OID_comp(v); |
| 9067 | } else { |
| 9068 | /* it can be either a name form or a referenced value */ |
| 9069 | $$ = new OID_comp($1.id, 0); |
| 9070 | } |
| 9071 | $$->set_location(infile, @$); |
| 9072 | } |
| 9073 | ; |
| 9074 | |
| 9075 | NameAndNumberForm: |
| 9076 | IDentifier '(' Number optError ')' |
| 9077 | { |
| 9078 | Value *v = new Value(Value::V_INT, $3); |
| 9079 | v->set_location(infile, @3); |
| 9080 | $$ = new OID_comp($1, v); |
| 9081 | $$->set_location(infile, @$); |
| 9082 | } |
| 9083 | | IDentifier '(' ReferencedValue optError ')' |
| 9084 | { |
| 9085 | $$ = new OID_comp($1, $3); |
| 9086 | $$->set_location(infile, @$); |
| 9087 | } |
| 9088 | | IDentifier '(' error ')' |
| 9089 | { |
| 9090 | Value *v = new Value(Value::V_ERROR); |
| 9091 | v->set_location(infile, @3); |
| 9092 | $$ = new OID_comp($1, v); |
| 9093 | $$->set_location(infile, @$); |
| 9094 | } |
| 9095 | ; |
| 9096 | |
| 9097 | NameForm: |
| 9098 | IDentifier { delete $1; } |
| 9099 | ; |
| 9100 | |
| 9101 | /* Rules for error recovery */ |
| 9102 | |
| 9103 | optError: |
| 9104 | /* empty */ |
| 9105 | | error |
| 9106 | ; |
| 9107 | |
| 9108 | optErrorBlock: |
| 9109 | optError |
| 9110 | | optErrorBlock ErrorBlock optError |
| 9111 | ; |
| 9112 | |
| 9113 | ErrorBlock: |
| 9114 | '{' error '}' |
| 9115 | | '{' optError ErrorBlock optError '}' |
| 9116 | ; |
| 9117 | |
| 9118 | %% |
| 9119 | |
| 9120 | static void ttcn3_error(const char *str) |
| 9121 | { |
| 9122 | Location loc(infile, ttcn3_lloc); |
| 9123 | if (*ttcn3_text) { |
| 9124 | // the most recently parsed token is known |
| 9125 | loc.error("at or before token `%s': %s", ttcn3_text, str); |
| 9126 | } else { |
| 9127 | // the most recently parsed token is unknown |
| 9128 | loc.error("%s", str); |
| 9129 | } |
| 9130 | } |
| 9131 | |
| 9132 | int ttcn3_parse_file(const char* filename, boolean generate_code) |
| 9133 | { |
| 9134 | anytype_access = false; |
| 9135 | ttcn3_in = fopen(filename, "r"); |
| 9136 | if (ttcn3_in == NULL) { |
| 9137 | ERROR("Cannot open input file `%s': %s", filename, strerror(errno)); |
| 9138 | return -1; |
| 9139 | } |
| 9140 | infile = filename; |
| 9141 | init_ttcn3_lex(); |
| 9142 | |
| 9143 | is_erroneous_parsed = false; |
| 9144 | NOTIFY("Parsing TTCN-3 module `%s'...", filename); |
| 9145 | |
| 9146 | int retval = ttcn3_parse(); |
| 9147 | |
| 9148 | free_ttcn3_lex(); // does fclose(ttcn3_in); |
| 9149 | |
| 9150 | if (act_ttcn3_module) { |
| 9151 | act_ttcn3_module->set_location(filename); |
| 9152 | set_md5_checksum(act_ttcn3_module); |
| 9153 | if (generate_code) act_ttcn3_module->set_gen_code(); |
| 9154 | modules->add_mod(act_ttcn3_module); |
| 9155 | act_ttcn3_module = 0; |
| 9156 | } |
| 9157 | |
| 9158 | act_group = 0; |
| 9159 | |
| 9160 | return retval; |
| 9161 | } |
| 9162 | |
| 9163 | Ttcn::ErroneousAttributeSpec* ttcn3_parse_erroneous_attr_spec_string( |
| 9164 | const char* p_str, const Common::Location& str_loc) |
| 9165 | { |
| 9166 | is_erroneous_parsed = true; |
| 9167 | act_ttcn3_erroneous_attr_spec = NULL; |
| 9168 | string titan_err_str("$#&&&(#TITANERRONEOUS$#&&^#% "); |
| 9169 | int hack_str_len = (int)titan_err_str.size(); |
| 9170 | string *parsed_string = parse_charstring_value(p_str, str_loc); |
| 9171 | titan_err_str += *parsed_string; |
| 9172 | delete parsed_string; |
| 9173 | init_erroneous_lex(str_loc.get_filename(), str_loc.get_first_line(), str_loc.get_first_column()-hack_str_len+1); |
| 9174 | yy_buffer_state *flex_buffer = ttcn3__scan_string(titan_err_str.c_str()); |
| 9175 | if (flex_buffer == NULL) { |
| 9176 | ERROR("Flex buffer creation failed."); |
| 9177 | return NULL; |
| 9178 | } |
| 9179 | yyparse(); |
| 9180 | ttcn3_lex_destroy(); |
| 9181 | free_dot_flag_stuff(); |
| 9182 | |
| 9183 | return act_ttcn3_erroneous_attr_spec; |
| 9184 | } |
| 9185 | |
| 9186 | #ifndef NDEBUG |
| 9187 | static void yyprint(FILE *file, int type, const YYSTYPE& value) |
| 9188 | { |
| 9189 | switch (type) { |
| 9190 | case IDentifier: |
| 9191 | fprintf(file, "``%s''", value.id->get_name().c_str()); |
| 9192 | break; |
| 9193 | case Number: |
| 9194 | fprintf(file, "%s", value.int_val->t_str().c_str()); |
| 9195 | break; |
| 9196 | case FloatValue: |
| 9197 | fprintf(file, "%f", value.float_val); |
| 9198 | break; |
| 9199 | case Bstring: |
| 9200 | case Hstring: |
| 9201 | case Ostring: |
| 9202 | case BitStringMatch: |
| 9203 | case HexStringMatch: |
| 9204 | case OctetStringMatch: |
| 9205 | fprintf(file, "``%s''", value.string_val->c_str()); |
| 9206 | break; |
| 9207 | case Cstring: |
| 9208 | fprintf(file, "``%s''", value.str); |
| 9209 | break; |
| 9210 | default: |
| 9211 | break; |
| 9212 | } |
| 9213 | } |
| 9214 | #endif |