1 2 /* A Bison parser, made by GNU Bison 2.4.1. */ 3 4 /* Skeleton implementation for Bison's Yacc-like parsers in C 5 6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 7 Free Software Foundation, Inc. 8 9 This program is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 21 22 /* As a special exception, you may create a larger work that contains 23 part or all of the Bison parser skeleton and distribute that work 24 under terms of your choice, so long as that work isn't itself a 25 parser generator using the skeleton or a modified version thereof 26 as a parser skeleton. Alternatively, if you modify or redistribute 27 the parser skeleton itself, you may (at your option) remove this 28 special exception, which will cause the skeleton and the resulting 29 Bison output files to be licensed under the GNU General Public 30 License without this special exception. 31 32 This special exception was added by the Free Software Foundation in 33 version 2.2 of Bison. */ 34 35 /* C LALR(1) parser skeleton written by Richard Stallman, by 36 simplifying the original so-called "semantic" parser. */ 37 38 /* All symbols defined below should begin with yy or YY, to avoid 39 infringing on user name space. This should be done even for local 40 variables, as they might otherwise be expanded by user macros. 41 There are some unavoidable exceptions within include files to 42 define necessary library symbols; they are noted "INFRINGES ON 43 USER NAME SPACE" below. */ 44 45 /* Identify Bison output. */ 46 #define YYBISON 1 47 48 /* Bison version. */ 49 #define YYBISON_VERSION "2.4.1" 50 51 /* Skeleton name. */ 52 #define YYSKELETON_NAME "yacc.c" 53 54 /* Pure parsers. */ 55 #define YYPURE 0 56 57 /* Push parsers. */ 58 #define YYPUSH 0 59 60 /* Pull parsers. */ 61 #define YYPULL 1 62 63 /* Using locations. */ 64 #define YYLSP_NEEDED 0 65 66 67 68 /* Copy the first part of user declarations. */ 69 70 /* Line 189 of yacc.c */ 71 #line 36 "ada-exp.y" 72 73 74 #include "defs.h" 75 #include "gdb_string.h" 76 #include <ctype.h> 77 #include "expression.h" 78 #include "value.h" 79 #include "parser-defs.h" 80 #include "language.h" 81 #include "ada-lang.h" 82 #include "bfd.h" /* Required by objfiles.h. */ 83 #include "symfile.h" /* Required by objfiles.h. */ 84 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ 85 #include "frame.h" 86 #include "block.h" 87 88 #define parse_type builtin_type (parse_gdbarch) 89 90 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), 91 as well as gratuitiously global symbol names, so we can have multiple 92 yacc generated parsers in gdb. These are only the variables 93 produced by yacc. If other parser generators (bison, byacc, etc) produce 94 additional global names that conflict at link time, then those parser 95 generators need to be fixed instead of adding those names to this list. */ 96 97 /* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix 98 options. I presume we are maintaining it to accommodate systems 99 without BISON? (PNH) */ 100 101 #define yymaxdepth ada_maxdepth 102 #define yyparse _ada_parse /* ada_parse calls this after initialization */ 103 #define yylex ada_lex 104 #define yyerror ada_error 105 #define yylval ada_lval 106 #define yychar ada_char 107 #define yydebug ada_debug 108 #define yypact ada_pact 109 #define yyr1 ada_r1 110 #define yyr2 ada_r2 111 #define yydef ada_def 112 #define yychk ada_chk 113 #define yypgo ada_pgo 114 #define yyact ada_act 115 #define yyexca ada_exca 116 #define yyerrflag ada_errflag 117 #define yynerrs ada_nerrs 118 #define yyps ada_ps 119 #define yypv ada_pv 120 #define yys ada_s 121 #define yy_yys ada_yys 122 #define yystate ada_state 123 #define yytmp ada_tmp 124 #define yyv ada_v 125 #define yy_yyv ada_yyv 126 #define yyval ada_val 127 #define yylloc ada_lloc 128 #define yyreds ada_reds /* With YYDEBUG defined */ 129 #define yytoks ada_toks /* With YYDEBUG defined */ 130 #define yyname ada_name /* With YYDEBUG defined */ 131 #define yyrule ada_rule /* With YYDEBUG defined */ 132 #define yyss ada_yyss 133 #define yysslim ada_yysslim 134 #define yyssp ada_yyssp 135 #define yystacksize ada_yystacksize 136 #define yyvs ada_yyvs 137 #define yyvsp ada_yyvsp 138 139 #ifndef YYDEBUG 140 #define YYDEBUG 1 /* Default to yydebug support */ 141 #endif 142 143 #define YYFPRINTF parser_fprintf 144 145 struct name_info { 146 struct symbol *sym; 147 struct minimal_symbol *msym; 148 struct block *block; 149 struct stoken stoken; 150 }; 151 152 static struct stoken empty_stoken = { "", 0 }; 153 154 /* If expression is in the context of TYPE'(...), then TYPE, else 155 * NULL. */ 156 static struct type *type_qualifier; 157 158 int yyparse (void); 159 160 static int yylex (void); 161 162 void yyerror (char *); 163 164 static struct stoken string_to_operator (struct stoken); 165 166 static void write_int (LONGEST, struct type *); 167 168 static void write_object_renaming (const struct block *, const char *, int, 169 const char *, int); 170 171 static struct type* write_var_or_type (const struct block *, struct stoken); 172 173 static void write_name_assoc (struct stoken); 174 175 static void write_exp_op_with_string (enum exp_opcode, struct stoken); 176 177 static struct block *block_lookup (struct block *, char *); 178 179 static LONGEST convert_char_literal (struct type *, LONGEST); 180 181 static void write_ambiguous_var (const struct block *, char *, int); 182 183 static struct type *type_int (void); 184 185 static struct type *type_long (void); 186 187 static struct type *type_long_long (void); 188 189 static struct type *type_float (void); 190 191 static struct type *type_double (void); 192 193 static struct type *type_long_double (void); 194 195 static struct type *type_char (void); 196 197 static struct type *type_boolean (void); 198 199 static struct type *type_system_address (void); 200 201 202 203 /* Line 189 of yacc.c */ 204 #line 205 "ada-exp.c" 205 206 /* Enabling traces. */ 207 #ifndef YYDEBUG 208 # define YYDEBUG 0 209 #endif 210 211 /* Enabling verbose error messages. */ 212 #ifdef YYERROR_VERBOSE 213 # undef YYERROR_VERBOSE 214 # define YYERROR_VERBOSE 1 215 #else 216 # define YYERROR_VERBOSE 0 217 #endif 218 219 /* Enabling the token table. */ 220 #ifndef YYTOKEN_TABLE 221 # define YYTOKEN_TABLE 0 222 #endif 223 224 225 /* Tokens. */ 226 #ifndef YYTOKENTYPE 227 # define YYTOKENTYPE 228 /* Put the tokens into the symbol table, so that GDB and other debuggers 229 know about them. */ 230 enum yytokentype { 231 INT = 258, 232 NULL_PTR = 259, 233 CHARLIT = 260, 234 FLOAT = 261, 235 TRUEKEYWORD = 262, 236 FALSEKEYWORD = 263, 237 COLONCOLON = 264, 238 STRING = 265, 239 NAME = 266, 240 DOT_ID = 267, 241 DOT_ALL = 268, 242 SPECIAL_VARIABLE = 269, 243 ASSIGN = 270, 244 ELSE = 271, 245 THEN = 272, 246 XOR = 273, 247 OR = 274, 248 _AND_ = 275, 249 DOTDOT = 276, 250 IN = 277, 251 GEQ = 278, 252 LEQ = 279, 253 NOTEQUAL = 280, 254 UNARY = 281, 255 REM = 282, 256 MOD = 283, 257 NOT = 284, 258 ABS = 285, 259 STARSTAR = 286, 260 VAR = 287, 261 ARROW = 288, 262 TICK_LENGTH = 289, 263 TICK_LAST = 290, 264 TICK_FIRST = 291, 265 TICK_ADDRESS = 292, 266 TICK_ACCESS = 293, 267 TICK_MODULUS = 294, 268 TICK_MIN = 295, 269 TICK_MAX = 296, 270 TICK_VAL = 297, 271 TICK_TAG = 298, 272 TICK_SIZE = 299, 273 TICK_RANGE = 300, 274 TICK_POS = 301, 275 NEW = 302, 276 OTHERS = 303 277 }; 278 #endif 279 /* Tokens. */ 280 #define INT 258 281 #define NULL_PTR 259 282 #define CHARLIT 260 283 #define FLOAT 261 284 #define TRUEKEYWORD 262 285 #define FALSEKEYWORD 263 286 #define COLONCOLON 264 287 #define STRING 265 288 #define NAME 266 289 #define DOT_ID 267 290 #define DOT_ALL 268 291 #define SPECIAL_VARIABLE 269 292 #define ASSIGN 270 293 #define ELSE 271 294 #define THEN 272 295 #define XOR 273 296 #define OR 274 297 #define _AND_ 275 298 #define DOTDOT 276 299 #define IN 277 300 #define GEQ 278 301 #define LEQ 279 302 #define NOTEQUAL 280 303 #define UNARY 281 304 #define REM 282 305 #define MOD 283 306 #define NOT 284 307 #define ABS 285 308 #define STARSTAR 286 309 #define VAR 287 310 #define ARROW 288 311 #define TICK_LENGTH 289 312 #define TICK_LAST 290 313 #define TICK_FIRST 291 314 #define TICK_ADDRESS 292 315 #define TICK_ACCESS 293 316 #define TICK_MODULUS 294 317 #define TICK_MIN 295 318 #define TICK_MAX 296 319 #define TICK_VAL 297 320 #define TICK_TAG 298 321 #define TICK_SIZE 299 322 #define TICK_RANGE 300 323 #define TICK_POS 301 324 #define NEW 302 325 #define OTHERS 303 326 327 328 329 330 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 331 typedef union YYSTYPE 332 { 333 334 /* Line 214 of yacc.c */ 335 #line 168 "ada-exp.y" 336 337 LONGEST lval; 338 struct { 339 LONGEST val; 340 struct type *type; 341 } typed_val; 342 struct { 343 DOUBLEST dval; 344 struct type *type; 345 } typed_val_float; 346 struct type *tval; 347 struct stoken sval; 348 struct block *bval; 349 struct internalvar *ivar; 350 351 352 353 /* Line 214 of yacc.c */ 354 #line 355 "ada-exp.c" 355 } YYSTYPE; 356 # define YYSTYPE_IS_TRIVIAL 1 357 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 358 # define YYSTYPE_IS_DECLARED 1 359 #endif 360 361 362 /* Copy the second part of user declarations. */ 363 364 365 /* Line 264 of yacc.c */ 366 #line 367 "ada-exp.c" 367 368 #ifdef short 369 # undef short 370 #endif 371 372 #ifdef YYTYPE_UINT8 373 typedef YYTYPE_UINT8 yytype_uint8; 374 #else 375 typedef unsigned char yytype_uint8; 376 #endif 377 378 #ifdef YYTYPE_INT8 379 typedef YYTYPE_INT8 yytype_int8; 380 #elif (defined __STDC__ || defined __C99__FUNC__ \ 381 || defined __cplusplus || defined _MSC_VER) 382 typedef signed char yytype_int8; 383 #else 384 typedef short int yytype_int8; 385 #endif 386 387 #ifdef YYTYPE_UINT16 388 typedef YYTYPE_UINT16 yytype_uint16; 389 #else 390 typedef unsigned short int yytype_uint16; 391 #endif 392 393 #ifdef YYTYPE_INT16 394 typedef YYTYPE_INT16 yytype_int16; 395 #else 396 typedef short int yytype_int16; 397 #endif 398 399 #ifndef YYSIZE_T 400 # ifdef __SIZE_TYPE__ 401 # define YYSIZE_T __SIZE_TYPE__ 402 # elif defined size_t 403 # define YYSIZE_T size_t 404 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 405 || defined __cplusplus || defined _MSC_VER) 406 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 407 # define YYSIZE_T size_t 408 # else 409 # define YYSIZE_T unsigned int 410 # endif 411 #endif 412 413 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 414 415 #ifndef YY_ 416 # if YYENABLE_NLS 417 # if ENABLE_NLS 418 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 419 # define YY_(msgid) dgettext ("bison-runtime", msgid) 420 # endif 421 # endif 422 # ifndef YY_ 423 # define YY_(msgid) msgid 424 # endif 425 #endif 426 427 /* Suppress unused-variable warnings by "using" E. */ 428 #if ! defined lint || defined __GNUC__ 429 # define YYUSE(e) ((void) (e)) 430 #else 431 # define YYUSE(e) /* empty */ 432 #endif 433 434 /* Identity function, used to suppress warnings about constant conditions. */ 435 #ifndef lint 436 # define YYID(n) (n) 437 #else 438 #if (defined __STDC__ || defined __C99__FUNC__ \ 439 || defined __cplusplus || defined _MSC_VER) 440 static int 441 YYID (int yyi) 442 #else 443 static int 444 YYID (yyi) 445 int yyi; 446 #endif 447 { 448 return yyi; 449 } 450 #endif 451 452 #if ! defined yyoverflow || YYERROR_VERBOSE 453 454 /* The parser invokes alloca or xmalloc; define the necessary symbols. */ 455 456 # ifdef YYSTACK_USE_ALLOCA 457 # if YYSTACK_USE_ALLOCA 458 # ifdef __GNUC__ 459 # define YYSTACK_ALLOC __builtin_alloca 460 # elif defined __BUILTIN_VA_ARG_INCR 461 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 462 # elif defined _AIX 463 # define YYSTACK_ALLOC __alloca 464 # elif defined _MSC_VER 465 # define alloca _alloca 466 # else 467 # define YYSTACK_ALLOC alloca 468 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 469 || defined __cplusplus || defined _MSC_VER) 470 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 471 # ifndef _STDLIB_H 472 # define _STDLIB_H 1 473 # endif 474 # endif 475 # endif 476 # endif 477 # endif 478 479 # ifdef YYSTACK_ALLOC 480 /* Pacify GCC's `empty if-body' warning. */ 481 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 482 # ifndef YYSTACK_ALLOC_MAXIMUM 483 /* The OS might guarantee only one guard page at the bottom of the stack, 484 and a page size can be as small as 4096 bytes. So we cannot safely 485 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 486 to allow for a few compiler-allocated temporary stack slots. */ 487 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 488 # endif 489 # else 490 # define YYSTACK_ALLOC YYMALLOC 491 # define YYSTACK_FREE YYFREE 492 # ifndef YYSTACK_ALLOC_MAXIMUM 493 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 494 # endif 495 # if (defined __cplusplus && ! defined _STDLIB_H \ 496 && ! ((defined YYMALLOC || defined xmalloc) \ 497 && (defined YYFREE || defined xfree))) 498 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 499 # ifndef _STDLIB_H 500 # define _STDLIB_H 1 501 # endif 502 # endif 503 # ifndef YYMALLOC 504 # define YYMALLOC xmalloc 505 # if ! defined xmalloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 506 || defined __cplusplus || defined _MSC_VER) 507 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 508 # endif 509 # endif 510 # ifndef YYFREE 511 # define YYFREE xfree 512 # if ! defined xfree && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 513 || defined __cplusplus || defined _MSC_VER) 514 void xfree (void *); /* INFRINGES ON USER NAME SPACE */ 515 # endif 516 # endif 517 # endif 518 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 519 520 521 #if (! defined yyoverflow \ 522 && (! defined __cplusplus \ 523 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 524 525 /* A type that is properly aligned for any stack member. */ 526 union yyalloc 527 { 528 yytype_int16 yyss_alloc; 529 YYSTYPE yyvs_alloc; 530 }; 531 532 /* The size of the maximum gap between one aligned stack and the next. */ 533 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 534 535 /* The size of an array large to enough to hold all stacks, each with 536 N elements. */ 537 # define YYSTACK_BYTES(N) \ 538 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 539 + YYSTACK_GAP_MAXIMUM) 540 541 /* Copy COUNT objects from FROM to TO. The source and destination do 542 not overlap. */ 543 # ifndef YYCOPY 544 # if defined __GNUC__ && 1 < __GNUC__ 545 # define YYCOPY(To, From, Count) \ 546 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 547 # else 548 # define YYCOPY(To, From, Count) \ 549 do \ 550 { \ 551 YYSIZE_T yyi; \ 552 for (yyi = 0; yyi < (Count); yyi++) \ 553 (To)[yyi] = (From)[yyi]; \ 554 } \ 555 while (YYID (0)) 556 # endif 557 # endif 558 559 /* Relocate STACK from its old location to the new one. The 560 local variables YYSIZE and YYSTACKSIZE give the old and new number of 561 elements in the stack, and YYPTR gives the new location of the 562 stack. Advance YYPTR to a properly aligned location for the next 563 stack. */ 564 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 565 do \ 566 { \ 567 YYSIZE_T yynewbytes; \ 568 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 569 Stack = &yyptr->Stack_alloc; \ 570 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 571 yyptr += yynewbytes / sizeof (*yyptr); \ 572 } \ 573 while (YYID (0)) 574 575 #endif 576 577 /* YYFINAL -- State number of the termination state. */ 578 #define YYFINAL 57 579 /* YYLAST -- Last index in YYTABLE. */ 580 #define YYLAST 770 581 582 /* YYNTOKENS -- Number of terminals. */ 583 #define YYNTOKENS 69 584 /* YYNNTS -- Number of nonterminals. */ 585 #define YYNNTS 31 586 /* YYNRULES -- Number of rules. */ 587 #define YYNRULES 122 588 /* YYNRULES -- Number of states. */ 589 #define YYNSTATES 233 590 591 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 592 #define YYUNDEFTOK 2 593 #define YYMAXUTOK 303 594 595 #define YYTRANSLATE(YYX) \ 596 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 597 598 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 599 static const yytype_uint8 yytranslate[] = 600 { 601 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 604 2, 2, 2, 2, 2, 2, 2, 2, 32, 64, 605 58, 63, 34, 30, 65, 31, 57, 35, 2, 2, 606 2, 2, 2, 2, 2, 2, 2, 2, 2, 62, 607 22, 21, 23, 2, 29, 2, 2, 2, 2, 2, 608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 610 2, 59, 2, 68, 2, 2, 2, 2, 2, 2, 611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 613 2, 2, 2, 66, 42, 67, 2, 2, 2, 2, 614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 626 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 627 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 628 15, 16, 17, 18, 19, 20, 24, 25, 26, 27, 629 28, 33, 36, 37, 38, 39, 40, 41, 43, 44, 630 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 631 55, 56, 60, 61 632 }; 633 634 #if YYDEBUG 635 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 636 YYRHS. */ 637 static const yytype_uint16 yyprhs[] = 638 { 639 0, 0, 3, 5, 7, 11, 15, 18, 21, 26, 640 31, 32, 40, 41, 48, 55, 59, 61, 63, 65, 641 67, 70, 73, 76, 79, 80, 82, 86, 90, 96, 642 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 643 139, 143, 147, 151, 157, 163, 167, 174, 181, 186, 644 190, 194, 198, 200, 202, 204, 206, 208, 210, 214, 645 218, 223, 228, 232, 236, 241, 246, 250, 254, 257, 646 260, 264, 268, 272, 275, 278, 286, 294, 300, 306, 647 309, 310, 314, 316, 318, 319, 321, 323, 325, 327, 648 329, 331, 333, 336, 338, 341, 344, 348, 351, 355, 649 359, 361, 364, 367, 370, 374, 376, 378, 382, 386, 650 388, 389, 394, 398, 399, 406, 407, 412, 416, 417, 651 424, 427, 430 652 }; 653 654 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 655 static const yytype_int8 yyrhs[] = 656 { 657 70, 0, -1, 71, -1, 78, -1, 71, 62, 78, 658 -1, 72, 15, 78, -1, 72, 13, -1, 72, 12, 659 -1, 72, 58, 76, 63, -1, 87, 58, 76, 63, 660 -1, -1, 87, 64, 74, 73, 58, 78, 63, -1, 661 -1, 72, 58, 75, 24, 75, 63, -1, 87, 58, 662 75, 24, 75, 63, -1, 58, 71, 63, -1, 87, 663 -1, 14, -1, 89, -1, 72, -1, 31, 75, -1, 664 30, 75, -1, 38, 75, -1, 39, 75, -1, -1, 665 78, -1, 11, 43, 78, -1, 76, 65, 78, -1, 666 76, 65, 11, 43, 78, -1, 66, 87, 67, 72, 667 -1, 75, 40, 75, -1, 75, 34, 75, -1, 75, 668 35, 75, -1, 75, 36, 75, -1, 75, 37, 75, 669 -1, 75, 29, 75, -1, 75, 30, 75, -1, 75, 670 32, 75, -1, 75, 31, 75, -1, 75, -1, 75, 671 21, 75, -1, 75, 28, 75, -1, 75, 27, 75, 672 -1, 75, 25, 75, 24, 75, -1, 75, 25, 72, 673 55, 84, -1, 75, 25, 87, -1, 75, 38, 25, 674 75, 24, 75, -1, 75, 38, 25, 72, 55, 84, 675 -1, 75, 38, 25, 87, -1, 75, 26, 75, -1, 676 75, 22, 75, -1, 75, 23, 75, -1, 77, -1, 677 79, -1, 80, -1, 81, -1, 82, -1, 83, -1, 678 77, 20, 77, -1, 79, 20, 77, -1, 77, 20, 679 17, 77, -1, 80, 20, 17, 77, -1, 77, 19, 680 77, -1, 81, 19, 77, -1, 77, 19, 16, 77, 681 -1, 82, 19, 16, 77, -1, 77, 18, 77, -1, 682 83, 18, 77, -1, 72, 48, -1, 72, 47, -1, 683 72, 46, 84, -1, 72, 45, 84, -1, 72, 44, 684 84, -1, 72, 54, -1, 72, 53, -1, 86, 50, 685 58, 78, 65, 78, 63, -1, 86, 51, 58, 78, 686 65, 78, 63, -1, 86, 56, 58, 78, 63, -1, 687 85, 52, 58, 78, 63, -1, 85, 49, -1, -1, 688 58, 3, 63, -1, 87, -1, 85, -1, -1, 3, 689 -1, 5, -1, 6, -1, 4, -1, 10, -1, 7, 690 -1, 8, -1, 60, 11, -1, 11, -1, 88, 11, 691 -1, 11, 48, -1, 88, 11, 48, -1, 11, 9, 692 -1, 88, 11, 9, -1, 58, 90, 63, -1, 92, 693 -1, 91, 78, -1, 91, 92, -1, 78, 65, -1, 694 91, 78, 65, -1, 93, -1, 94, -1, 94, 65, 695 92, -1, 61, 43, 78, -1, 95, -1, -1, 11, 696 43, 96, 78, -1, 75, 43, 78, -1, -1, 75, 697 24, 75, 43, 97, 78, -1, -1, 11, 42, 98, 698 95, -1, 75, 42, 95, -1, -1, 75, 24, 75, 699 42, 99, 95, -1, 34, 72, -1, 32, 72, -1, 700 72, 59, 78, 68, -1 701 }; 702 703 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 704 static const yytype_uint16 yyrline[] = 705 { 706 0, 233, 233, 237, 238, 240, 245, 249, 253, 259, 707 278, 278, 290, 294, 296, 304, 315, 325, 329, 332, 708 335, 339, 343, 347, 351, 354, 356, 358, 360, 364, 709 377, 381, 385, 389, 393, 397, 401, 405, 409, 413, 710 416, 420, 424, 428, 430, 435, 443, 447, 453, 464, 711 468, 472, 476, 477, 478, 479, 480, 481, 485, 487, 712 492, 494, 499, 501, 506, 508, 512, 514, 526, 528, 713 534, 537, 540, 543, 545, 547, 549, 551, 553, 555, 714 559, 561, 566, 576, 578, 584, 588, 595, 603, 607, 715 613, 615, 619, 623, 625, 627, 635, 646, 648, 653, 716 662, 663, 669, 674, 680, 689, 690, 691, 695, 700, 717 715, 714, 717, 720, 719, 725, 724, 727, 730, 729, 718 737, 739, 741 719 }; 720 #endif 721 722 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 723 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 724 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 725 static const char *const yytname[] = 726 { 727 "$end", "error", "$undefined", "INT", "NULL_PTR", "CHARLIT", "FLOAT", 728 "TRUEKEYWORD", "FALSEKEYWORD", "COLONCOLON", "STRING", "NAME", "DOT_ID", 729 "DOT_ALL", "SPECIAL_VARIABLE", "ASSIGN", "ELSE", "THEN", "XOR", "OR", 730 "_AND_", "'='", "'<'", "'>'", "DOTDOT", "IN", "GEQ", "LEQ", "NOTEQUAL", 731 "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'", "'/'", "REM", "MOD", "NOT", 732 "ABS", "STARSTAR", "VAR", "'|'", "ARROW", "TICK_LENGTH", "TICK_LAST", 733 "TICK_FIRST", "TICK_ADDRESS", "TICK_ACCESS", "TICK_MODULUS", "TICK_MIN", 734 "TICK_MAX", "TICK_VAL", "TICK_TAG", "TICK_SIZE", "TICK_RANGE", 735 "TICK_POS", "'.'", "'('", "'['", "NEW", "OTHERS", "';'", "')'", "'\\''", 736 "','", "'{'", "'}'", "']'", "$accept", "start", "exp1", "primary", "$@1", 737 "save_qualifier", "simple_exp", "arglist", "relation", "exp", "and_exp", 738 "and_then_exp", "or_exp", "or_else_exp", "xor_exp", "tick_arglist", 739 "type_prefix", "opt_type_prefix", "var_or_type", "block", "aggregate", 740 "aggregate_component_list", "positional_list", "component_groups", 741 "others", "component_group", "component_associations", "$@2", "$@3", 742 "$@4", "$@5", 0 743 }; 744 #endif 745 746 # ifdef YYPRINT 747 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 748 token YYLEX-NUM. */ 749 static const yytype_uint16 yytoknum[] = 750 { 751 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 752 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 753 275, 61, 60, 62, 276, 277, 278, 279, 280, 64, 754 43, 45, 38, 281, 42, 47, 282, 283, 284, 285, 755 286, 287, 124, 288, 289, 290, 291, 292, 293, 294, 756 295, 296, 297, 298, 299, 300, 301, 46, 40, 91, 757 302, 303, 59, 41, 39, 44, 123, 125, 93 758 }; 759 # endif 760 761 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 762 static const yytype_uint8 yyr1[] = 763 { 764 0, 69, 70, 71, 71, 71, 72, 72, 72, 72, 765 73, 72, 74, 72, 72, 72, 72, 72, 72, 75, 766 75, 75, 75, 75, 76, 76, 76, 76, 76, 72, 767 75, 75, 75, 75, 75, 75, 75, 75, 75, 77, 768 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 769 77, 77, 78, 78, 78, 78, 78, 78, 79, 79, 770 80, 80, 81, 81, 82, 82, 83, 83, 72, 72, 771 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 772 84, 84, 85, 86, 86, 72, 72, 72, 72, 72, 773 72, 72, 72, 87, 87, 87, 87, 88, 88, 89, 774 90, 90, 90, 91, 91, 92, 92, 92, 93, 94, 775 96, 95, 95, 97, 95, 98, 95, 95, 99, 95, 776 72, 72, 72 777 }; 778 779 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 780 static const yytype_uint8 yyr2[] = 781 { 782 0, 2, 1, 1, 3, 3, 2, 2, 4, 4, 783 0, 7, 0, 6, 6, 3, 1, 1, 1, 1, 784 2, 2, 2, 2, 0, 1, 3, 3, 5, 4, 785 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 786 3, 3, 3, 5, 5, 3, 6, 6, 4, 3, 787 3, 3, 1, 1, 1, 1, 1, 1, 3, 3, 788 4, 4, 3, 3, 4, 4, 3, 3, 2, 2, 789 3, 3, 3, 2, 2, 7, 7, 5, 5, 2, 790 0, 3, 1, 1, 0, 1, 1, 1, 1, 1, 791 1, 1, 2, 1, 2, 2, 3, 2, 3, 3, 792 1, 2, 2, 2, 3, 1, 1, 3, 3, 1, 793 0, 4, 3, 0, 6, 0, 4, 3, 0, 6, 794 2, 2, 4 795 }; 796 797 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 798 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 799 means the default is an error. */ 800 static const yytype_uint8 yydefact[] = 801 { 802 84, 85, 88, 86, 87, 90, 91, 89, 93, 17, 803 84, 84, 84, 84, 84, 84, 84, 0, 0, 0, 804 2, 19, 39, 52, 3, 53, 54, 55, 56, 57, 805 83, 0, 16, 0, 18, 97, 95, 19, 21, 20, 806 121, 120, 22, 23, 93, 0, 0, 39, 3, 0, 807 84, 100, 105, 106, 109, 92, 0, 1, 84, 7, 808 6, 84, 80, 80, 80, 69, 68, 74, 73, 84, 809 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 810 84, 84, 84, 84, 84, 84, 0, 84, 84, 84, 811 84, 84, 0, 84, 0, 84, 79, 0, 0, 0, 812 0, 84, 12, 94, 115, 110, 84, 15, 84, 84, 813 84, 103, 99, 101, 102, 84, 84, 4, 5, 0, 814 72, 71, 70, 93, 39, 0, 25, 0, 40, 50, 815 51, 19, 0, 16, 49, 42, 41, 35, 36, 38, 816 37, 31, 32, 33, 34, 84, 30, 66, 84, 62, 817 84, 58, 59, 84, 63, 84, 67, 84, 84, 84, 818 84, 39, 0, 10, 98, 96, 84, 84, 108, 0, 819 0, 117, 112, 104, 107, 29, 0, 84, 84, 8, 820 84, 122, 80, 84, 19, 0, 16, 64, 60, 61, 821 65, 0, 0, 0, 0, 84, 9, 0, 116, 111, 822 118, 113, 81, 26, 0, 93, 27, 44, 43, 80, 823 84, 78, 84, 84, 77, 0, 84, 84, 84, 13, 824 84, 47, 46, 0, 0, 14, 0, 119, 114, 28, 825 75, 76, 11 826 }; 827 828 /* YYDEFGOTO[NTERM-NUM]. */ 829 static const yytype_int16 yydefgoto[] = 830 { 831 -1, 19, 20, 37, 197, 163, 22, 125, 23, 126, 832 25, 26, 27, 28, 29, 120, 30, 31, 32, 33, 833 34, 49, 50, 51, 52, 53, 54, 167, 218, 166, 834 217 835 }; 836 837 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 838 STATE-NUM. */ 839 #define YYPACT_NINF -104 840 static const yytype_int16 yypact[] = 841 { 842 424, -104, -104, -104, -104, -104, -104, -104, 16, -104, 843 424, 424, 118, 118, 424, 424, 286, -7, 6, 31, 844 -26, 501, 674, 20, -104, 28, 32, 22, 34, 42, 845 -44, -21, 84, 57, -104, -104, -104, 558, 63, 63, 846 -3, -3, 63, 63, 23, 26, -36, 611, 9, 27, 847 286, -104, -104, 29, -104, -104, 25, -104, 424, -104, 848 -104, 424, 35, 35, 35, -104, -104, -104, -104, 274, 849 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 850 424, 424, 424, 424, 424, 424, 71, 424, 424, 350, 851 387, 424, 91, 424, 85, 424, -104, 53, 58, 59, 852 60, 274, -104, 19, -104, -104, 424, -104, 424, 461, 853 424, -104, -104, 50, -104, 286, 118, -104, -104, 124, 854 -104, -104, -104, 3, 634, -52, -104, 70, 719, 719, 855 719, 521, 166, 173, 719, 719, 719, 730, 63, 63, 856 63, 99, 99, 99, 99, 424, 99, -104, 424, -104, 857 424, -104, -104, 424, -104, 424, -104, 424, 424, 424, 858 424, 654, -41, -104, -104, -104, 461, 424, -104, 704, 859 689, -104, -104, -104, -104, -3, 68, 424, 424, -104, 860 498, -104, 35, 424, 538, 215, 208, -104, -104, -104, 861 -104, 78, 79, 80, 83, 424, -104, 93, -104, -104, 862 -104, -104, -104, -104, 339, 14, -104, -104, 719, 35, 863 424, -104, 424, 424, -104, 589, 424, 461, 424, -104, 864 424, -104, 719, 90, 92, -104, 98, -104, -104, -104, 865 -104, -104, -104 866 }; 867 868 /* YYPGOTO[NTERM-NUM]. */ 869 static const yytype_int8 yypgoto[] = 870 { 871 -104, -104, 127, 21, -104, -104, 4, 55, -46, 0, 872 -104, -104, -104, -104, -104, -62, -104, -104, -15, -104, 873 -104, -104, -104, -43, -104, -104, -103, -104, -104, -104, 874 -104 875 }; 876 877 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 878 positive, shift that token. If negative, reduce the rule which 879 number is the opposite. If zero, do what YYDEFACT says. 880 If YYTABLE_NINF, syntax error. */ 881 #define YYTABLE_NINF -83 882 static const yytype_int16 yytable[] = 883 { 884 24, 121, 122, 56, 55, 96, 171, 114, 97, 59, 885 60, 179, 35, 180, 38, 39, 48, 8, 42, 43, 886 47, 21, 196, 35, 180, 35, 58, 107, 164, 98, 887 99, 57, 35, 40, 41, 100, 58, 21, 88, 89, 888 90, 93, 147, 149, 151, 152, 177, 154, 91, 156, 889 113, 36, 92, 94, 47, 69, 70, 220, 117, 133, 890 95, 118, 36, 198, 36, 104, 105, 165, 103, 106, 891 127, 36, 174, 124, 111, 128, 129, 130, 132, 134, 892 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 893 112, 146, 116, 119, 115, 131, 145, 82, 83, 84, 894 85, 155, 187, 87, 188, 161, 168, 189, 153, 190, 895 172, 157, 169, 170, 227, 173, 158, 159, 160, 170, 896 207, 1, 2, 3, 4, 5, 6, 176, 7, 8, 897 186, 202, 9, -82, -82, -82, -82, 175, 181, 87, 898 -82, 211, 101, 46, 212, 213, 214, 221, 102, 185, 899 12, 216, 13, 230, 0, 231, 162, 191, 192, 193, 900 194, 232, 0, 0, 0, 0, 184, 199, 0, 0, 901 170, 0, 0, -45, 0, 0, 16, 203, 17, 0, 902 206, 0, 204, 0, 18, 0, 0, 208, 0, 0, 903 183, -45, -45, -45, 0, 78, 79, 80, 81, 215, 904 82, 83, 84, 85, 0, 0, 87, 0, -48, 0, 905 0, 0, 223, 224, 222, 0, 226, 0, 228, 0, 906 229, 170, -82, -82, -82, -82, -48, -48, -48, -82, 907 0, 101, 0, 0, 0, -45, -45, 102, -45, 210, 908 0, -45, 0, 0, 78, 79, 80, 81, 0, 82, 909 83, 84, 85, 0, 0, 87, 0, -82, -82, -82, 910 -82, 0, 0, 0, -82, 0, 101, 0, 0, 0, 911 -48, -48, 102, -48, 0, 0, -48, 1, 2, 3, 912 4, 5, 6, 0, 7, 123, 0, 0, 9, 1, 913 2, 3, 4, 5, 6, 0, 7, 44, 0, 0, 914 9, 0, 0, 0, 10, 11, 12, 0, 13, 0, 915 0, 0, 14, 15, 0, 0, 10, 11, 12, 0, 916 13, 0, 0, 0, 14, 15, 0, 0, 0, 0, 917 0, 0, 16, 0, 17, 0, 0, -24, 0, -24, 918 18, 0, 0, 0, 16, 0, 17, 45, 0, 0, 919 0, 0, 18, 1, 2, 3, 4, 5, 6, 0, 920 7, 8, 0, 0, 9, 0, 148, 0, 78, 79, 921 80, 81, 0, 82, 83, 84, 85, 0, 0, 87, 922 10, 11, 12, 0, 13, 0, 0, 0, 14, 15, 923 1, 2, 3, 4, 5, 6, 0, 7, 8, 0, 924 0, 9, 219, 0, 150, 0, 0, 0, 16, 0, 925 17, 0, 0, 0, 0, 0, 18, 10, 11, 12, 926 0, 13, 0, 0, 0, 14, 15, 1, 2, 3, 927 4, 5, 6, 0, 7, 8, 0, 0, 9, 0, 928 0, 0, 0, 0, 0, 16, 0, 17, 0, 0, 929 0, 0, 0, 18, 10, 11, 12, 0, 13, 0, 930 0, 0, 14, 15, 1, 2, 3, 4, 5, 6, 931 0, 7, 44, 0, 0, 9, 0, 0, 0, 0, 932 0, 0, 16, 0, 17, 0, 0, 0, 0, 0, 933 18, 10, 11, 12, 0, 13, 0, 0, 0, 14, 934 15, 1, 2, 3, 4, 5, 6, 0, 7, 205, 935 0, 0, 9, 59, 60, 0, 61, 0, 0, 16, 936 0, 17, 0, 0, 0, 0, 0, 18, 10, 11, 937 12, 0, 13, 59, 60, 0, 14, 15, 0, 0, 938 0, 0, 0, 0, 0, 62, 63, 64, 65, 66, 939 59, 60, 0, 0, 67, 68, 16, 0, 17, 69, 940 70, 0, 0, 0, 18, 62, 63, 64, 65, 66, 941 59, 60, 0, 0, 67, 68, 182, 0, 0, 69, 942 70, 0, 62, 63, 64, 65, 66, 0, 0, 0, 943 0, 67, 68, 209, 0, 0, 69, 70, 0, 0, 944 0, 0, 62, 63, 64, 65, 66, 0, 0, 0, 945 0, 67, 68, 0, 0, 0, 69, 70, 78, 79, 946 80, 81, 0, 82, 83, 84, 85, 0, 0, 87, 947 0, 0, 71, 72, 73, 108, 74, 75, 76, 77, 948 78, 79, 80, 81, 0, 82, 83, 84, 85, 86, 949 0, 87, 225, 109, 110, 71, 72, 73, 178, 74, 950 75, 76, 77, 78, 79, 80, 81, 0, 82, 83, 951 84, 85, 86, 0, 87, 71, 72, 73, 195, 74, 952 75, 76, 77, 78, 79, 80, 81, 0, 82, 83, 953 84, 85, 86, 0, 87, 71, 72, 73, 0, 74, 954 75, 76, 77, 78, 79, 80, 81, 0, 82, 83, 955 84, 85, 86, 108, 87, 0, 0, 0, 78, 79, 956 80, 81, 0, 82, 83, 84, 85, 0, 0, 87, 957 0, 109, 110, 78, 79, 80, 81, 0, 82, 83, 958 84, 85, 0, 0, 87, 0, 200, 201, 78, 79, 959 80, 81, 0, 82, 83, 84, 85, 0, 0, 87, 960 79, 80, 81, 0, 82, 83, 84, 85, 0, 0, 961 87 962 }; 963 964 static const yytype_int16 yycheck[] = 965 { 966 0, 63, 64, 18, 11, 49, 109, 50, 52, 12, 967 13, 63, 9, 65, 10, 11, 16, 11, 14, 15, 968 16, 0, 63, 9, 65, 9, 62, 63, 9, 50, 969 51, 0, 9, 12, 13, 56, 62, 16, 18, 19, 970 20, 19, 88, 89, 90, 91, 43, 93, 20, 95, 971 50, 48, 20, 19, 50, 58, 59, 43, 58, 74, 972 18, 61, 48, 166, 48, 42, 43, 48, 11, 43, 973 70, 48, 115, 69, 65, 71, 72, 73, 74, 75, 974 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 975 63, 87, 67, 58, 65, 74, 25, 34, 35, 36, 976 37, 16, 148, 40, 150, 101, 106, 153, 17, 155, 977 110, 58, 108, 109, 217, 65, 58, 58, 58, 115, 978 182, 3, 4, 5, 6, 7, 8, 3, 10, 11, 979 145, 63, 14, 49, 50, 51, 52, 116, 68, 40, 980 56, 63, 58, 16, 65, 65, 63, 209, 64, 145, 981 32, 58, 34, 63, -1, 63, 101, 157, 158, 159, 982 160, 63, -1, -1, -1, -1, 145, 167, -1, -1, 983 166, -1, -1, 0, -1, -1, 58, 177, 60, -1, 984 180, -1, 178, -1, 66, -1, -1, 183, -1, -1, 985 24, 18, 19, 20, -1, 29, 30, 31, 32, 195, 986 34, 35, 36, 37, -1, -1, 40, -1, 0, -1, 987 -1, -1, 212, 213, 210, -1, 216, -1, 218, -1, 988 220, 217, 49, 50, 51, 52, 18, 19, 20, 56, 989 -1, 58, -1, -1, -1, 62, 63, 64, 65, 24, 990 -1, 68, -1, -1, 29, 30, 31, 32, -1, 34, 991 35, 36, 37, -1, -1, 40, -1, 49, 50, 51, 992 52, -1, -1, -1, 56, -1, 58, -1, -1, -1, 993 62, 63, 64, 65, -1, -1, 68, 3, 4, 5, 994 6, 7, 8, -1, 10, 11, -1, -1, 14, 3, 995 4, 5, 6, 7, 8, -1, 10, 11, -1, -1, 996 14, -1, -1, -1, 30, 31, 32, -1, 34, -1, 997 -1, -1, 38, 39, -1, -1, 30, 31, 32, -1, 998 34, -1, -1, -1, 38, 39, -1, -1, -1, -1, 999 -1, -1, 58, -1, 60, -1, -1, 63, -1, 65, 1000 66, -1, -1, -1, 58, -1, 60, 61, -1, -1, 1001 -1, -1, 66, 3, 4, 5, 6, 7, 8, -1, 1002 10, 11, -1, -1, 14, -1, 16, -1, 29, 30, 1003 31, 32, -1, 34, 35, 36, 37, -1, -1, 40, 1004 30, 31, 32, -1, 34, -1, -1, -1, 38, 39, 1005 3, 4, 5, 6, 7, 8, -1, 10, 11, -1, 1006 -1, 14, 63, -1, 17, -1, -1, -1, 58, -1, 1007 60, -1, -1, -1, -1, -1, 66, 30, 31, 32, 1008 -1, 34, -1, -1, -1, 38, 39, 3, 4, 5, 1009 6, 7, 8, -1, 10, 11, -1, -1, 14, -1, 1010 -1, -1, -1, -1, -1, 58, -1, 60, -1, -1, 1011 -1, -1, -1, 66, 30, 31, 32, -1, 34, -1, 1012 -1, -1, 38, 39, 3, 4, 5, 6, 7, 8, 1013 -1, 10, 11, -1, -1, 14, -1, -1, -1, -1, 1014 -1, -1, 58, -1, 60, -1, -1, -1, -1, -1, 1015 66, 30, 31, 32, -1, 34, -1, -1, -1, 38, 1016 39, 3, 4, 5, 6, 7, 8, -1, 10, 11, 1017 -1, -1, 14, 12, 13, -1, 15, -1, -1, 58, 1018 -1, 60, -1, -1, -1, -1, -1, 66, 30, 31, 1019 32, -1, 34, 12, 13, -1, 38, 39, -1, -1, 1020 -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 1021 12, 13, -1, -1, 53, 54, 58, -1, 60, 58, 1022 59, -1, -1, -1, 66, 44, 45, 46, 47, 48, 1023 12, 13, -1, -1, 53, 54, 55, -1, -1, 58, 1024 59, -1, 44, 45, 46, 47, 48, -1, -1, -1, 1025 -1, 53, 54, 55, -1, -1, 58, 59, -1, -1, 1026 -1, -1, 44, 45, 46, 47, 48, -1, -1, -1, 1027 -1, 53, 54, -1, -1, -1, 58, 59, 29, 30, 1028 31, 32, -1, 34, 35, 36, 37, -1, -1, 40, 1029 -1, -1, 21, 22, 23, 24, 25, 26, 27, 28, 1030 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 1031 -1, 40, 63, 42, 43, 21, 22, 23, 24, 25, 1032 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 1033 36, 37, 38, -1, 40, 21, 22, 23, 24, 25, 1034 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 1035 36, 37, 38, -1, 40, 21, 22, 23, -1, 25, 1036 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 1037 36, 37, 38, 24, 40, -1, -1, -1, 29, 30, 1038 31, 32, -1, 34, 35, 36, 37, -1, -1, 40, 1039 -1, 42, 43, 29, 30, 31, 32, -1, 34, 35, 1040 36, 37, -1, -1, 40, -1, 42, 43, 29, 30, 1041 31, 32, -1, 34, 35, 36, 37, -1, -1, 40, 1042 30, 31, 32, -1, 34, 35, 36, 37, -1, -1, 1043 40 1044 }; 1045 1046 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 1047 symbol of state STATE-NUM. */ 1048 static const yytype_uint8 yystos[] = 1049 { 1050 0, 3, 4, 5, 6, 7, 8, 10, 11, 14, 1051 30, 31, 32, 34, 38, 39, 58, 60, 66, 70, 1052 71, 72, 75, 77, 78, 79, 80, 81, 82, 83, 1053 85, 86, 87, 88, 89, 9, 48, 72, 75, 75, 1054 72, 72, 75, 75, 11, 61, 71, 75, 78, 90, 1055 91, 92, 93, 94, 95, 11, 87, 0, 62, 12, 1056 13, 15, 44, 45, 46, 47, 48, 53, 54, 58, 1057 59, 21, 22, 23, 25, 26, 27, 28, 29, 30, 1058 31, 32, 34, 35, 36, 37, 38, 40, 18, 19, 1059 20, 20, 20, 19, 19, 18, 49, 52, 50, 51, 1060 56, 58, 64, 11, 42, 43, 43, 63, 24, 42, 1061 43, 65, 63, 78, 92, 65, 67, 78, 78, 58, 1062 84, 84, 84, 11, 75, 76, 78, 78, 75, 75, 1063 75, 72, 75, 87, 75, 75, 75, 75, 75, 75, 1064 75, 75, 75, 75, 75, 25, 75, 77, 16, 77, 1065 17, 77, 77, 17, 77, 16, 77, 58, 58, 58, 1066 58, 75, 76, 74, 9, 48, 98, 96, 78, 75, 1067 75, 95, 78, 65, 92, 72, 3, 43, 24, 63, 1068 65, 68, 55, 24, 72, 75, 87, 77, 77, 77, 1069 77, 78, 78, 78, 78, 24, 63, 73, 95, 78, 1070 42, 43, 63, 78, 75, 11, 78, 84, 75, 55, 1071 24, 63, 65, 65, 63, 75, 58, 99, 97, 63, 1072 43, 84, 75, 78, 78, 63, 78, 95, 78, 78, 1073 63, 63, 63 1074 }; 1075 1076 #define yyerrok (yyerrstatus = 0) 1077 #define yyclearin (yychar = YYEMPTY) 1078 #define YYEMPTY (-2) 1079 #define YYEOF 0 1080 1081 #define YYACCEPT goto yyacceptlab 1082 #define YYABORT goto yyabortlab 1083 #define YYERROR goto yyerrorlab 1084 1085 1086 /* Like YYERROR except do call yyerror. This remains here temporarily 1087 to ease the transition to the new meaning of YYERROR, for GCC. 1088 Once GCC version 2 has supplanted version 1, this can go. */ 1089 1090 #define YYFAIL goto yyerrlab 1091 1092 #define YYRECOVERING() (!!yyerrstatus) 1093 1094 #define YYBACKUP(Token, Value) \ 1095 do \ 1096 if (yychar == YYEMPTY && yylen == 1) \ 1097 { \ 1098 yychar = (Token); \ 1099 yylval = (Value); \ 1100 yytoken = YYTRANSLATE (yychar); \ 1101 YYPOPSTACK (1); \ 1102 goto yybackup; \ 1103 } \ 1104 else \ 1105 { \ 1106 yyerror (YY_("syntax error: cannot back up")); \ 1107 YYERROR; \ 1108 } \ 1109 while (YYID (0)) 1110 1111 1112 #define YYTERROR 1 1113 #define YYERRCODE 256 1114 1115 1116 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 1117 If N is 0, then set CURRENT to the empty location which ends 1118 the previous symbol: RHS[0] (always defined). */ 1119 1120 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 1121 #ifndef YYLLOC_DEFAULT 1122 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 1123 do \ 1124 if (YYID (N)) \ 1125 { \ 1126 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 1127 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 1128 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 1129 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 1130 } \ 1131 else \ 1132 { \ 1133 (Current).first_line = (Current).last_line = \ 1134 YYRHSLOC (Rhs, 0).last_line; \ 1135 (Current).first_column = (Current).last_column = \ 1136 YYRHSLOC (Rhs, 0).last_column; \ 1137 } \ 1138 while (YYID (0)) 1139 #endif 1140 1141 1142 /* YY_LOCATION_PRINT -- Print the location on the stream. 1143 This macro was not mandated originally: define only if we know 1144 we won't break user code: when these are the locations we know. */ 1145 1146 #ifndef YY_LOCATION_PRINT 1147 # if YYLTYPE_IS_TRIVIAL 1148 # define YY_LOCATION_PRINT(File, Loc) \ 1149 fprintf (File, "%d.%d-%d.%d", \ 1150 (Loc).first_line, (Loc).first_column, \ 1151 (Loc).last_line, (Loc).last_column) 1152 # else 1153 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 1154 # endif 1155 #endif 1156 1157 1158 /* YYLEX -- calling `yylex' with the right arguments. */ 1159 1160 #ifdef YYLEX_PARAM 1161 # define YYLEX yylex (YYLEX_PARAM) 1162 #else 1163 # define YYLEX yylex () 1164 #endif 1165 1166 /* Enable debugging if requested. */ 1167 #if YYDEBUG 1168 1169 # ifndef YYFPRINTF 1170 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 1171 # define YYFPRINTF fprintf 1172 # endif 1173 1174 # define YYDPRINTF(Args) \ 1175 do { \ 1176 if (yydebug) \ 1177 YYFPRINTF Args; \ 1178 } while (YYID (0)) 1179 1180 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 1181 do { \ 1182 if (yydebug) \ 1183 { \ 1184 YYFPRINTF (stderr, "%s ", Title); \ 1185 yy_symbol_print (stderr, \ 1186 Type, Value); \ 1187 YYFPRINTF (stderr, "\n"); \ 1188 } \ 1189 } while (YYID (0)) 1190 1191 1192 /*--------------------------------. 1193 | Print this symbol on YYOUTPUT. | 1194 `--------------------------------*/ 1195 1196 /*ARGSUSED*/ 1197 #if (defined __STDC__ || defined __C99__FUNC__ \ 1198 || defined __cplusplus || defined _MSC_VER) 1199 static void 1200 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 1201 #else 1202 static void 1203 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 1204 FILE *yyoutput; 1205 int yytype; 1206 YYSTYPE const * const yyvaluep; 1207 #endif 1208 { 1209 if (!yyvaluep) 1210 return; 1211 # ifdef YYPRINT 1212 if (yytype < YYNTOKENS) 1213 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 1214 # else 1215 YYUSE (yyoutput); 1216 # endif 1217 switch (yytype) 1218 { 1219 default: 1220 break; 1221 } 1222 } 1223 1224 1225 /*--------------------------------. 1226 | Print this symbol on YYOUTPUT. | 1227 `--------------------------------*/ 1228 1229 #if (defined __STDC__ || defined __C99__FUNC__ \ 1230 || defined __cplusplus || defined _MSC_VER) 1231 static void 1232 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 1233 #else 1234 static void 1235 yy_symbol_print (yyoutput, yytype, yyvaluep) 1236 FILE *yyoutput; 1237 int yytype; 1238 YYSTYPE const * const yyvaluep; 1239 #endif 1240 { 1241 if (yytype < YYNTOKENS) 1242 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 1243 else 1244 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 1245 1246 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 1247 YYFPRINTF (yyoutput, ")"); 1248 } 1249 1250 /*------------------------------------------------------------------. 1251 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 1252 | TOP (included). | 1253 `------------------------------------------------------------------*/ 1254 1255 #if (defined __STDC__ || defined __C99__FUNC__ \ 1256 || defined __cplusplus || defined _MSC_VER) 1257 static void 1258 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 1259 #else 1260 static void 1261 yy_stack_print (yybottom, yytop) 1262 yytype_int16 *yybottom; 1263 yytype_int16 *yytop; 1264 #endif 1265 { 1266 YYFPRINTF (stderr, "Stack now"); 1267 for (; yybottom <= yytop; yybottom++) 1268 { 1269 int yybot = *yybottom; 1270 YYFPRINTF (stderr, " %d", yybot); 1271 } 1272 YYFPRINTF (stderr, "\n"); 1273 } 1274 1275 # define YY_STACK_PRINT(Bottom, Top) \ 1276 do { \ 1277 if (yydebug) \ 1278 yy_stack_print ((Bottom), (Top)); \ 1279 } while (YYID (0)) 1280 1281 1282 /*------------------------------------------------. 1283 | Report that the YYRULE is going to be reduced. | 1284 `------------------------------------------------*/ 1285 1286 #if (defined __STDC__ || defined __C99__FUNC__ \ 1287 || defined __cplusplus || defined _MSC_VER) 1288 static void 1289 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 1290 #else 1291 static void 1292 yy_reduce_print (yyvsp, yyrule) 1293 YYSTYPE *yyvsp; 1294 int yyrule; 1295 #endif 1296 { 1297 int yynrhs = yyr2[yyrule]; 1298 int yyi; 1299 unsigned long int yylno = yyrline[yyrule]; 1300 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 1301 yyrule - 1, yylno); 1302 /* The symbols being reduced. */ 1303 for (yyi = 0; yyi < yynrhs; yyi++) 1304 { 1305 YYFPRINTF (stderr, " $%d = ", yyi + 1); 1306 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 1307 &(yyvsp[(yyi + 1) - (yynrhs)]) 1308 ); 1309 YYFPRINTF (stderr, "\n"); 1310 } 1311 } 1312 1313 # define YY_REDUCE_PRINT(Rule) \ 1314 do { \ 1315 if (yydebug) \ 1316 yy_reduce_print (yyvsp, Rule); \ 1317 } while (YYID (0)) 1318 1319 /* Nonzero means print parse trace. It is left uninitialized so that 1320 multiple parsers can coexist. */ 1321 int yydebug; 1322 #else /* !YYDEBUG */ 1323 # define YYDPRINTF(Args) 1324 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 1325 # define YY_STACK_PRINT(Bottom, Top) 1326 # define YY_REDUCE_PRINT(Rule) 1327 #endif /* !YYDEBUG */ 1328 1329 1330 /* YYINITDEPTH -- initial size of the parser's stacks. */ 1331 #ifndef YYINITDEPTH 1332 # define YYINITDEPTH 200 1333 #endif 1334 1335 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1336 if the built-in stack extension method is used). 1337 1338 Do not make this value too large; the results are undefined if 1339 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 1340 evaluated with infinite-precision integer arithmetic. */ 1341 1342 #ifndef YYMAXDEPTH 1343 # define YYMAXDEPTH 10000 1344 #endif 1345 1346 1347 1348 #if YYERROR_VERBOSE 1349 1350 # ifndef yystrlen 1351 # if defined __GLIBC__ && defined _STRING_H 1352 # define yystrlen strlen 1353 # else 1354 /* Return the length of YYSTR. */ 1355 #if (defined __STDC__ || defined __C99__FUNC__ \ 1356 || defined __cplusplus || defined _MSC_VER) 1357 static YYSIZE_T 1358 yystrlen (const char *yystr) 1359 #else 1360 static YYSIZE_T 1361 yystrlen (yystr) 1362 const char *yystr; 1363 #endif 1364 { 1365 YYSIZE_T yylen; 1366 for (yylen = 0; yystr[yylen]; yylen++) 1367 continue; 1368 return yylen; 1369 } 1370 # endif 1371 # endif 1372 1373 # ifndef yystpcpy 1374 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1375 # define yystpcpy stpcpy 1376 # else 1377 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1378 YYDEST. */ 1379 #if (defined __STDC__ || defined __C99__FUNC__ \ 1380 || defined __cplusplus || defined _MSC_VER) 1381 static char * 1382 yystpcpy (char *yydest, const char *yysrc) 1383 #else 1384 static char * 1385 yystpcpy (yydest, yysrc) 1386 char *yydest; 1387 const char *yysrc; 1388 #endif 1389 { 1390 char *yyd = yydest; 1391 const char *yys = yysrc; 1392 1393 while ((*yyd++ = *yys++) != '\0') 1394 continue; 1395 1396 return yyd - 1; 1397 } 1398 # endif 1399 # endif 1400 1401 # ifndef yytnamerr 1402 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1403 quotes and backslashes, so that it's suitable for yyerror. The 1404 heuristic is that double-quoting is unnecessary unless the string 1405 contains an apostrophe, a comma, or backslash (other than 1406 backslash-backslash). YYSTR is taken from yytname. If YYRES is 1407 null, do not copy; instead, return the length of what the result 1408 would have been. */ 1409 static YYSIZE_T 1410 yytnamerr (char *yyres, const char *yystr) 1411 { 1412 if (*yystr == '"') 1413 { 1414 YYSIZE_T yyn = 0; 1415 char const *yyp = yystr; 1416 1417 for (;;) 1418 switch (*++yyp) 1419 { 1420 case '\'': 1421 case ',': 1422 goto do_not_strip_quotes; 1423 1424 case '\\': 1425 if (*++yyp != '\\') 1426 goto do_not_strip_quotes; 1427 /* Fall through. */ 1428 default: 1429 if (yyres) 1430 yyres[yyn] = *yyp; 1431 yyn++; 1432 break; 1433 1434 case '"': 1435 if (yyres) 1436 yyres[yyn] = '\0'; 1437 return yyn; 1438 } 1439 do_not_strip_quotes: ; 1440 } 1441 1442 if (! yyres) 1443 return yystrlen (yystr); 1444 1445 return yystpcpy (yyres, yystr) - yyres; 1446 } 1447 # endif 1448 1449 /* Copy into YYRESULT an error message about the unexpected token 1450 YYCHAR while in state YYSTATE. Return the number of bytes copied, 1451 including the terminating null byte. If YYRESULT is null, do not 1452 copy anything; just return the number of bytes that would be 1453 copied. As a special case, return 0 if an ordinary "syntax error" 1454 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 1455 size calculation. */ 1456 static YYSIZE_T 1457 yysyntax_error (char *yyresult, int yystate, int yychar) 1458 { 1459 int yyn = yypact[yystate]; 1460 1461 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 1462 return 0; 1463 else 1464 { 1465 int yytype = YYTRANSLATE (yychar); 1466 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1467 YYSIZE_T yysize = yysize0; 1468 YYSIZE_T yysize1; 1469 int yysize_overflow = 0; 1470 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1471 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1472 int yyx; 1473 1474 # if 0 1475 /* This is so xgettext sees the translatable formats that are 1476 constructed on the fly. */ 1477 YY_("syntax error, unexpected %s"); 1478 YY_("syntax error, unexpected %s, expecting %s"); 1479 YY_("syntax error, unexpected %s, expecting %s or %s"); 1480 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1481 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1482 # endif 1483 char *yyfmt; 1484 char const *yyf; 1485 static char const yyunexpected[] = "syntax error, unexpected %s"; 1486 static char const yyexpecting[] = ", expecting %s"; 1487 static char const yyor[] = " or %s"; 1488 char yyformat[sizeof yyunexpected 1489 + sizeof yyexpecting - 1 1490 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1491 * (sizeof yyor - 1))]; 1492 char const *yyprefix = yyexpecting; 1493 1494 /* Start YYX at -YYN if negative to avoid negative indexes in 1495 YYCHECK. */ 1496 int yyxbegin = yyn < 0 ? -yyn : 0; 1497 1498 /* Stay within bounds of both yycheck and yytname. */ 1499 int yychecklim = YYLAST - yyn + 1; 1500 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1501 int yycount = 1; 1502 1503 yyarg[0] = yytname[yytype]; 1504 yyfmt = yystpcpy (yyformat, yyunexpected); 1505 1506 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1507 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 1508 { 1509 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1510 { 1511 yycount = 1; 1512 yysize = yysize0; 1513 yyformat[sizeof yyunexpected - 1] = '\0'; 1514 break; 1515 } 1516 yyarg[yycount++] = yytname[yyx]; 1517 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1518 yysize_overflow |= (yysize1 < yysize); 1519 yysize = yysize1; 1520 yyfmt = yystpcpy (yyfmt, yyprefix); 1521 yyprefix = yyor; 1522 } 1523 1524 yyf = YY_(yyformat); 1525 yysize1 = yysize + yystrlen (yyf); 1526 yysize_overflow |= (yysize1 < yysize); 1527 yysize = yysize1; 1528 1529 if (yysize_overflow) 1530 return YYSIZE_MAXIMUM; 1531 1532 if (yyresult) 1533 { 1534 /* Avoid sprintf, as that infringes on the user's name space. 1535 Don't have undefined behavior even if the translation 1536 produced a string with the wrong number of "%s"s. */ 1537 char *yyp = yyresult; 1538 int yyi = 0; 1539 while ((*yyp = *yyf) != '\0') 1540 { 1541 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1542 { 1543 yyp += yytnamerr (yyp, yyarg[yyi++]); 1544 yyf += 2; 1545 } 1546 else 1547 { 1548 yyp++; 1549 yyf++; 1550 } 1551 } 1552 } 1553 return yysize; 1554 } 1555 } 1556 #endif /* YYERROR_VERBOSE */ 1557 1558 1559 /*-----------------------------------------------. 1560 | Release the memory associated to this symbol. | 1561 `-----------------------------------------------*/ 1562 1563 /*ARGSUSED*/ 1564 #if (defined __STDC__ || defined __C99__FUNC__ \ 1565 || defined __cplusplus || defined _MSC_VER) 1566 static void 1567 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1568 #else 1569 static void 1570 yydestruct (yymsg, yytype, yyvaluep) 1571 const char *yymsg; 1572 int yytype; 1573 YYSTYPE *yyvaluep; 1574 #endif 1575 { 1576 YYUSE (yyvaluep); 1577 1578 if (!yymsg) 1579 yymsg = "Deleting"; 1580 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1581 1582 switch (yytype) 1583 { 1584 1585 default: 1586 break; 1587 } 1588 } 1589 1590 /* Prevent warnings from -Wmissing-prototypes. */ 1591 #ifdef YYPARSE_PARAM 1592 #if defined __STDC__ || defined __cplusplus 1593 int yyparse (void *YYPARSE_PARAM); 1594 #else 1595 int yyparse (); 1596 #endif 1597 #else /* ! YYPARSE_PARAM */ 1598 #if defined __STDC__ || defined __cplusplus 1599 int yyparse (void); 1600 #else 1601 int yyparse (); 1602 #endif 1603 #endif /* ! YYPARSE_PARAM */ 1604 1605 1606 /* The lookahead symbol. */ 1607 int yychar; 1608 1609 /* The semantic value of the lookahead symbol. */ 1610 YYSTYPE yylval; 1611 1612 /* Number of syntax errors so far. */ 1613 int yynerrs; 1614 1615 1616 1617 /*-------------------------. 1618 | yyparse or yypush_parse. | 1619 `-------------------------*/ 1620 1621 #ifdef YYPARSE_PARAM 1622 #if (defined __STDC__ || defined __C99__FUNC__ \ 1623 || defined __cplusplus || defined _MSC_VER) 1624 int 1625 yyparse (void *YYPARSE_PARAM) 1626 #else 1627 int 1628 yyparse (YYPARSE_PARAM) 1629 void *YYPARSE_PARAM; 1630 #endif 1631 #else /* ! YYPARSE_PARAM */ 1632 #if (defined __STDC__ || defined __C99__FUNC__ \ 1633 || defined __cplusplus || defined _MSC_VER) 1634 int 1635 yyparse (void) 1636 #else 1637 int 1638 yyparse () 1639 1640 #endif 1641 #endif 1642 { 1643 1644 1645 int yystate; 1646 /* Number of tokens to shift before error messages enabled. */ 1647 int yyerrstatus; 1648 1649 /* The stacks and their tools: 1650 `yyss': related to states. 1651 `yyvs': related to semantic values. 1652 1653 Refer to the stacks thru separate pointers, to allow yyoverflow 1654 to xreallocate them elsewhere. */ 1655 1656 /* The state stack. */ 1657 yytype_int16 yyssa[YYINITDEPTH]; 1658 yytype_int16 *yyss; 1659 yytype_int16 *yyssp; 1660 1661 /* The semantic value stack. */ 1662 YYSTYPE yyvsa[YYINITDEPTH]; 1663 YYSTYPE *yyvs; 1664 YYSTYPE *yyvsp; 1665 1666 YYSIZE_T yystacksize; 1667 1668 int yyn; 1669 int yyresult; 1670 /* Lookahead token as an internal (translated) token number. */ 1671 int yytoken; 1672 /* The variables used to return semantic value and location from the 1673 action routines. */ 1674 YYSTYPE yyval; 1675 1676 #if YYERROR_VERBOSE 1677 /* Buffer for error messages, and its allocated size. */ 1678 char yymsgbuf[128]; 1679 char *yymsg = yymsgbuf; 1680 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1681 #endif 1682 1683 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1684 1685 /* The number of symbols on the RHS of the reduced rule. 1686 Keep to zero when no symbol should be popped. */ 1687 int yylen = 0; 1688 1689 yytoken = 0; 1690 yyss = yyssa; 1691 yyvs = yyvsa; 1692 yystacksize = YYINITDEPTH; 1693 1694 YYDPRINTF ((stderr, "Starting parse\n")); 1695 1696 yystate = 0; 1697 yyerrstatus = 0; 1698 yynerrs = 0; 1699 yychar = YYEMPTY; /* Cause a token to be read. */ 1700 1701 /* Initialize stack pointers. 1702 Waste one element of value and location stack 1703 so that they stay on the same level as the state stack. 1704 The wasted elements are never initialized. */ 1705 yyssp = yyss; 1706 yyvsp = yyvs; 1707 1708 goto yysetstate; 1709 1710 /*------------------------------------------------------------. 1711 | yynewstate -- Push a new state, which is found in yystate. | 1712 `------------------------------------------------------------*/ 1713 yynewstate: 1714 /* In all cases, when you get here, the value and location stacks 1715 have just been pushed. So pushing a state here evens the stacks. */ 1716 yyssp++; 1717 1718 yysetstate: 1719 *yyssp = yystate; 1720 1721 if (yyss + yystacksize - 1 <= yyssp) 1722 { 1723 /* Get the current used size of the three stacks, in elements. */ 1724 YYSIZE_T yysize = yyssp - yyss + 1; 1725 1726 #ifdef yyoverflow 1727 { 1728 /* Give user a chance to xreallocate the stack. Use copies of 1729 these so that the &'s don't force the real ones into 1730 memory. */ 1731 YYSTYPE *yyvs1 = yyvs; 1732 yytype_int16 *yyss1 = yyss; 1733 1734 /* Each stack pointer address is followed by the size of the 1735 data in use in that stack, in bytes. This used to be a 1736 conditional around just the two extra args, but that might 1737 be undefined if yyoverflow is a macro. */ 1738 yyoverflow (YY_("memory exhausted"), 1739 &yyss1, yysize * sizeof (*yyssp), 1740 &yyvs1, yysize * sizeof (*yyvsp), 1741 &yystacksize); 1742 1743 yyss = yyss1; 1744 yyvs = yyvs1; 1745 } 1746 #else /* no yyoverflow */ 1747 # ifndef YYSTACK_RELOCATE 1748 goto yyexhaustedlab; 1749 # else 1750 /* Extend the stack our own way. */ 1751 if (YYMAXDEPTH <= yystacksize) 1752 goto yyexhaustedlab; 1753 yystacksize *= 2; 1754 if (YYMAXDEPTH < yystacksize) 1755 yystacksize = YYMAXDEPTH; 1756 1757 { 1758 yytype_int16 *yyss1 = yyss; 1759 union yyalloc *yyptr = 1760 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1761 if (! yyptr) 1762 goto yyexhaustedlab; 1763 YYSTACK_RELOCATE (yyss_alloc, yyss); 1764 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1765 # undef YYSTACK_RELOCATE 1766 if (yyss1 != yyssa) 1767 YYSTACK_FREE (yyss1); 1768 } 1769 # endif 1770 #endif /* no yyoverflow */ 1771 1772 yyssp = yyss + yysize - 1; 1773 yyvsp = yyvs + yysize - 1; 1774 1775 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1776 (unsigned long int) yystacksize)); 1777 1778 if (yyss + yystacksize - 1 <= yyssp) 1779 YYABORT; 1780 } 1781 1782 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1783 1784 if (yystate == YYFINAL) 1785 YYACCEPT; 1786 1787 goto yybackup; 1788 1789 /*-----------. 1790 | yybackup. | 1791 `-----------*/ 1792 yybackup: 1793 1794 /* Do appropriate processing given the current state. Read a 1795 lookahead token if we need one and don't already have one. */ 1796 1797 /* First try to decide what to do without reference to lookahead token. */ 1798 yyn = yypact[yystate]; 1799 if (yyn == YYPACT_NINF) 1800 goto yydefault; 1801 1802 /* Not known => get a lookahead token if don't already have one. */ 1803 1804 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1805 if (yychar == YYEMPTY) 1806 { 1807 YYDPRINTF ((stderr, "Reading a token: ")); 1808 yychar = YYLEX; 1809 } 1810 1811 if (yychar <= YYEOF) 1812 { 1813 yychar = yytoken = YYEOF; 1814 YYDPRINTF ((stderr, "Now at end of input.\n")); 1815 } 1816 else 1817 { 1818 yytoken = YYTRANSLATE (yychar); 1819 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1820 } 1821 1822 /* If the proper action on seeing token YYTOKEN is to reduce or to 1823 detect an error, take that action. */ 1824 yyn += yytoken; 1825 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1826 goto yydefault; 1827 yyn = yytable[yyn]; 1828 if (yyn <= 0) 1829 { 1830 if (yyn == 0 || yyn == YYTABLE_NINF) 1831 goto yyerrlab; 1832 yyn = -yyn; 1833 goto yyreduce; 1834 } 1835 1836 /* Count tokens shifted since error; after three, turn off error 1837 status. */ 1838 if (yyerrstatus) 1839 yyerrstatus--; 1840 1841 /* Shift the lookahead token. */ 1842 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1843 1844 /* Discard the shifted token. */ 1845 yychar = YYEMPTY; 1846 1847 yystate = yyn; 1848 *++yyvsp = yylval; 1849 1850 goto yynewstate; 1851 1852 1853 /*-----------------------------------------------------------. 1854 | yydefault -- do the default action for the current state. | 1855 `-----------------------------------------------------------*/ 1856 yydefault: 1857 yyn = yydefact[yystate]; 1858 if (yyn == 0) 1859 goto yyerrlab; 1860 goto yyreduce; 1861 1862 1863 /*-----------------------------. 1864 | yyreduce -- Do a reduction. | 1865 `-----------------------------*/ 1866 yyreduce: 1867 /* yyn is the number of a rule to reduce with. */ 1868 yylen = yyr2[yyn]; 1869 1870 /* If YYLEN is nonzero, implement the default value of the action: 1871 `$$ = $1'. 1872 1873 Otherwise, the following line sets YYVAL to garbage. 1874 This behavior is undocumented and Bison 1875 users should not rely upon it. Assigning to YYVAL 1876 unconditionally makes the parser a bit smaller, and it avoids a 1877 GCC warning that YYVAL may be used uninitialized. */ 1878 yyval = yyvsp[1-yylen]; 1879 1880 1881 YY_REDUCE_PRINT (yyn); 1882 switch (yyn) 1883 { 1884 case 4: 1885 1886 /* Line 1455 of yacc.c */ 1887 #line 239 "ada-exp.y" 1888 { write_exp_elt_opcode (BINOP_COMMA); } 1889 break; 1890 1891 case 5: 1892 1893 /* Line 1455 of yacc.c */ 1894 #line 241 "ada-exp.y" 1895 { write_exp_elt_opcode (BINOP_ASSIGN); } 1896 break; 1897 1898 case 6: 1899 1900 /* Line 1455 of yacc.c */ 1901 #line 246 "ada-exp.y" 1902 { write_exp_elt_opcode (UNOP_IND); } 1903 break; 1904 1905 case 7: 1906 1907 /* Line 1455 of yacc.c */ 1908 #line 250 "ada-exp.y" 1909 { write_exp_op_with_string (STRUCTOP_STRUCT, (yyvsp[(2) - (2)].sval)); } 1910 break; 1911 1912 case 8: 1913 1914 /* Line 1455 of yacc.c */ 1915 #line 254 "ada-exp.y" 1916 { 1917 write_exp_elt_opcode (OP_FUNCALL); 1918 write_exp_elt_longcst ((yyvsp[(3) - (4)].lval)); 1919 write_exp_elt_opcode (OP_FUNCALL); 1920 } 1921 break; 1922 1923 case 9: 1924 1925 /* Line 1455 of yacc.c */ 1926 #line 260 "ada-exp.y" 1927 { 1928 if ((yyvsp[(1) - (4)].tval) != NULL) 1929 { 1930 if ((yyvsp[(3) - (4)].lval) != 1) 1931 error (_("Invalid conversion")); 1932 write_exp_elt_opcode (UNOP_CAST); 1933 write_exp_elt_type ((yyvsp[(1) - (4)].tval)); 1934 write_exp_elt_opcode (UNOP_CAST); 1935 } 1936 else 1937 { 1938 write_exp_elt_opcode (OP_FUNCALL); 1939 write_exp_elt_longcst ((yyvsp[(3) - (4)].lval)); 1940 write_exp_elt_opcode (OP_FUNCALL); 1941 } 1942 } 1943 break; 1944 1945 case 10: 1946 1947 /* Line 1455 of yacc.c */ 1948 #line 278 "ada-exp.y" 1949 { type_qualifier = (yyvsp[(1) - (3)].tval); } 1950 break; 1951 1952 case 11: 1953 1954 /* Line 1455 of yacc.c */ 1955 #line 280 "ada-exp.y" 1956 { 1957 if ((yyvsp[(1) - (7)].tval) == NULL) 1958 error (_("Type required for qualification")); 1959 write_exp_elt_opcode (UNOP_QUAL); 1960 write_exp_elt_type ((yyvsp[(1) - (7)].tval)); 1961 write_exp_elt_opcode (UNOP_QUAL); 1962 type_qualifier = (yyvsp[(3) - (7)].tval); 1963 } 1964 break; 1965 1966 case 12: 1967 1968 /* Line 1455 of yacc.c */ 1969 #line 290 "ada-exp.y" 1970 { (yyval.tval) = type_qualifier; } 1971 break; 1972 1973 case 13: 1974 1975 /* Line 1455 of yacc.c */ 1976 #line 295 "ada-exp.y" 1977 { write_exp_elt_opcode (TERNOP_SLICE); } 1978 break; 1979 1980 case 14: 1981 1982 /* Line 1455 of yacc.c */ 1983 #line 297 "ada-exp.y" 1984 { if ((yyvsp[(1) - (6)].tval) == NULL) 1985 write_exp_elt_opcode (TERNOP_SLICE); 1986 else 1987 error (_("Cannot slice a type")); 1988 } 1989 break; 1990 1991 case 15: 1992 1993 /* Line 1455 of yacc.c */ 1994 #line 304 "ada-exp.y" 1995 { } 1996 break; 1997 1998 case 16: 1999 2000 /* Line 1455 of yacc.c */ 2001 #line 316 "ada-exp.y" 2002 { if ((yyvsp[(1) - (1)].tval) != NULL) 2003 { 2004 write_exp_elt_opcode (OP_TYPE); 2005 write_exp_elt_type ((yyvsp[(1) - (1)].tval)); 2006 write_exp_elt_opcode (OP_TYPE); 2007 } 2008 } 2009 break; 2010 2011 case 17: 2012 2013 /* Line 1455 of yacc.c */ 2014 #line 326 "ada-exp.y" 2015 { write_dollar_variable ((yyvsp[(1) - (1)].sval)); } 2016 break; 2017 2018 case 20: 2019 2020 /* Line 1455 of yacc.c */ 2021 #line 336 "ada-exp.y" 2022 { write_exp_elt_opcode (UNOP_NEG); } 2023 break; 2024 2025 case 21: 2026 2027 /* Line 1455 of yacc.c */ 2028 #line 340 "ada-exp.y" 2029 { write_exp_elt_opcode (UNOP_PLUS); } 2030 break; 2031 2032 case 22: 2033 2034 /* Line 1455 of yacc.c */ 2035 #line 344 "ada-exp.y" 2036 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } 2037 break; 2038 2039 case 23: 2040 2041 /* Line 1455 of yacc.c */ 2042 #line 348 "ada-exp.y" 2043 { write_exp_elt_opcode (UNOP_ABS); } 2044 break; 2045 2046 case 24: 2047 2048 /* Line 1455 of yacc.c */ 2049 #line 351 "ada-exp.y" 2050 { (yyval.lval) = 0; } 2051 break; 2052 2053 case 25: 2054 2055 /* Line 1455 of yacc.c */ 2056 #line 355 "ada-exp.y" 2057 { (yyval.lval) = 1; } 2058 break; 2059 2060 case 26: 2061 2062 /* Line 1455 of yacc.c */ 2063 #line 357 "ada-exp.y" 2064 { (yyval.lval) = 1; } 2065 break; 2066 2067 case 27: 2068 2069 /* Line 1455 of yacc.c */ 2070 #line 359 "ada-exp.y" 2071 { (yyval.lval) = (yyvsp[(1) - (3)].lval) + 1; } 2072 break; 2073 2074 case 28: 2075 2076 /* Line 1455 of yacc.c */ 2077 #line 361 "ada-exp.y" 2078 { (yyval.lval) = (yyvsp[(1) - (5)].lval) + 1; } 2079 break; 2080 2081 case 29: 2082 2083 /* Line 1455 of yacc.c */ 2084 #line 366 "ada-exp.y" 2085 { 2086 if ((yyvsp[(2) - (4)].tval) == NULL) 2087 error (_("Type required within braces in coercion")); 2088 write_exp_elt_opcode (UNOP_MEMVAL); 2089 write_exp_elt_type ((yyvsp[(2) - (4)].tval)); 2090 write_exp_elt_opcode (UNOP_MEMVAL); 2091 } 2092 break; 2093 2094 case 30: 2095 2096 /* Line 1455 of yacc.c */ 2097 #line 378 "ada-exp.y" 2098 { write_exp_elt_opcode (BINOP_EXP); } 2099 break; 2100 2101 case 31: 2102 2103 /* Line 1455 of yacc.c */ 2104 #line 382 "ada-exp.y" 2105 { write_exp_elt_opcode (BINOP_MUL); } 2106 break; 2107 2108 case 32: 2109 2110 /* Line 1455 of yacc.c */ 2111 #line 386 "ada-exp.y" 2112 { write_exp_elt_opcode (BINOP_DIV); } 2113 break; 2114 2115 case 33: 2116 2117 /* Line 1455 of yacc.c */ 2118 #line 390 "ada-exp.y" 2119 { write_exp_elt_opcode (BINOP_REM); } 2120 break; 2121 2122 case 34: 2123 2124 /* Line 1455 of yacc.c */ 2125 #line 394 "ada-exp.y" 2126 { write_exp_elt_opcode (BINOP_MOD); } 2127 break; 2128 2129 case 35: 2130 2131 /* Line 1455 of yacc.c */ 2132 #line 398 "ada-exp.y" 2133 { write_exp_elt_opcode (BINOP_REPEAT); } 2134 break; 2135 2136 case 36: 2137 2138 /* Line 1455 of yacc.c */ 2139 #line 402 "ada-exp.y" 2140 { write_exp_elt_opcode (BINOP_ADD); } 2141 break; 2142 2143 case 37: 2144 2145 /* Line 1455 of yacc.c */ 2146 #line 406 "ada-exp.y" 2147 { write_exp_elt_opcode (BINOP_CONCAT); } 2148 break; 2149 2150 case 38: 2151 2152 /* Line 1455 of yacc.c */ 2153 #line 410 "ada-exp.y" 2154 { write_exp_elt_opcode (BINOP_SUB); } 2155 break; 2156 2157 case 40: 2158 2159 /* Line 1455 of yacc.c */ 2160 #line 417 "ada-exp.y" 2161 { write_exp_elt_opcode (BINOP_EQUAL); } 2162 break; 2163 2164 case 41: 2165 2166 /* Line 1455 of yacc.c */ 2167 #line 421 "ada-exp.y" 2168 { write_exp_elt_opcode (BINOP_NOTEQUAL); } 2169 break; 2170 2171 case 42: 2172 2173 /* Line 1455 of yacc.c */ 2174 #line 425 "ada-exp.y" 2175 { write_exp_elt_opcode (BINOP_LEQ); } 2176 break; 2177 2178 case 43: 2179 2180 /* Line 1455 of yacc.c */ 2181 #line 429 "ada-exp.y" 2182 { write_exp_elt_opcode (TERNOP_IN_RANGE); } 2183 break; 2184 2185 case 44: 2186 2187 /* Line 1455 of yacc.c */ 2188 #line 431 "ada-exp.y" 2189 { write_exp_elt_opcode (BINOP_IN_BOUNDS); 2190 write_exp_elt_longcst ((LONGEST) (yyvsp[(5) - (5)].lval)); 2191 write_exp_elt_opcode (BINOP_IN_BOUNDS); 2192 } 2193 break; 2194 2195 case 45: 2196 2197 /* Line 1455 of yacc.c */ 2198 #line 436 "ada-exp.y" 2199 { 2200 if ((yyvsp[(3) - (3)].tval) == NULL) 2201 error (_("Right operand of 'in' must be type")); 2202 write_exp_elt_opcode (UNOP_IN_RANGE); 2203 write_exp_elt_type ((yyvsp[(3) - (3)].tval)); 2204 write_exp_elt_opcode (UNOP_IN_RANGE); 2205 } 2206 break; 2207 2208 case 46: 2209 2210 /* Line 1455 of yacc.c */ 2211 #line 444 "ada-exp.y" 2212 { write_exp_elt_opcode (TERNOP_IN_RANGE); 2213 write_exp_elt_opcode (UNOP_LOGICAL_NOT); 2214 } 2215 break; 2216 2217 case 47: 2218 2219 /* Line 1455 of yacc.c */ 2220 #line 448 "ada-exp.y" 2221 { write_exp_elt_opcode (BINOP_IN_BOUNDS); 2222 write_exp_elt_longcst ((LONGEST) (yyvsp[(6) - (6)].lval)); 2223 write_exp_elt_opcode (BINOP_IN_BOUNDS); 2224 write_exp_elt_opcode (UNOP_LOGICAL_NOT); 2225 } 2226 break; 2227 2228 case 48: 2229 2230 /* Line 1455 of yacc.c */ 2231 #line 454 "ada-exp.y" 2232 { 2233 if ((yyvsp[(4) - (4)].tval) == NULL) 2234 error (_("Right operand of 'in' must be type")); 2235 write_exp_elt_opcode (UNOP_IN_RANGE); 2236 write_exp_elt_type ((yyvsp[(4) - (4)].tval)); 2237 write_exp_elt_opcode (UNOP_IN_RANGE); 2238 write_exp_elt_opcode (UNOP_LOGICAL_NOT); 2239 } 2240 break; 2241 2242 case 49: 2243 2244 /* Line 1455 of yacc.c */ 2245 #line 465 "ada-exp.y" 2246 { write_exp_elt_opcode (BINOP_GEQ); } 2247 break; 2248 2249 case 50: 2250 2251 /* Line 1455 of yacc.c */ 2252 #line 469 "ada-exp.y" 2253 { write_exp_elt_opcode (BINOP_LESS); } 2254 break; 2255 2256 case 51: 2257 2258 /* Line 1455 of yacc.c */ 2259 #line 473 "ada-exp.y" 2260 { write_exp_elt_opcode (BINOP_GTR); } 2261 break; 2262 2263 case 58: 2264 2265 /* Line 1455 of yacc.c */ 2266 #line 486 "ada-exp.y" 2267 { write_exp_elt_opcode (BINOP_BITWISE_AND); } 2268 break; 2269 2270 case 59: 2271 2272 /* Line 1455 of yacc.c */ 2273 #line 488 "ada-exp.y" 2274 { write_exp_elt_opcode (BINOP_BITWISE_AND); } 2275 break; 2276 2277 case 60: 2278 2279 /* Line 1455 of yacc.c */ 2280 #line 493 "ada-exp.y" 2281 { write_exp_elt_opcode (BINOP_LOGICAL_AND); } 2282 break; 2283 2284 case 61: 2285 2286 /* Line 1455 of yacc.c */ 2287 #line 495 "ada-exp.y" 2288 { write_exp_elt_opcode (BINOP_LOGICAL_AND); } 2289 break; 2290 2291 case 62: 2292 2293 /* Line 1455 of yacc.c */ 2294 #line 500 "ada-exp.y" 2295 { write_exp_elt_opcode (BINOP_BITWISE_IOR); } 2296 break; 2297 2298 case 63: 2299 2300 /* Line 1455 of yacc.c */ 2301 #line 502 "ada-exp.y" 2302 { write_exp_elt_opcode (BINOP_BITWISE_IOR); } 2303 break; 2304 2305 case 64: 2306 2307 /* Line 1455 of yacc.c */ 2308 #line 507 "ada-exp.y" 2309 { write_exp_elt_opcode (BINOP_LOGICAL_OR); } 2310 break; 2311 2312 case 65: 2313 2314 /* Line 1455 of yacc.c */ 2315 #line 509 "ada-exp.y" 2316 { write_exp_elt_opcode (BINOP_LOGICAL_OR); } 2317 break; 2318 2319 case 66: 2320 2321 /* Line 1455 of yacc.c */ 2322 #line 513 "ada-exp.y" 2323 { write_exp_elt_opcode (BINOP_BITWISE_XOR); } 2324 break; 2325 2326 case 67: 2327 2328 /* Line 1455 of yacc.c */ 2329 #line 515 "ada-exp.y" 2330 { write_exp_elt_opcode (BINOP_BITWISE_XOR); } 2331 break; 2332 2333 case 68: 2334 2335 /* Line 1455 of yacc.c */ 2336 #line 527 "ada-exp.y" 2337 { write_exp_elt_opcode (UNOP_ADDR); } 2338 break; 2339 2340 case 69: 2341 2342 /* Line 1455 of yacc.c */ 2343 #line 529 "ada-exp.y" 2344 { write_exp_elt_opcode (UNOP_ADDR); 2345 write_exp_elt_opcode (UNOP_CAST); 2346 write_exp_elt_type (type_system_address ()); 2347 write_exp_elt_opcode (UNOP_CAST); 2348 } 2349 break; 2350 2351 case 70: 2352 2353 /* Line 1455 of yacc.c */ 2354 #line 535 "ada-exp.y" 2355 { write_int ((yyvsp[(3) - (3)].lval), type_int ()); 2356 write_exp_elt_opcode (OP_ATR_FIRST); } 2357 break; 2358 2359 case 71: 2360 2361 /* Line 1455 of yacc.c */ 2362 #line 538 "ada-exp.y" 2363 { write_int ((yyvsp[(3) - (3)].lval), type_int ()); 2364 write_exp_elt_opcode (OP_ATR_LAST); } 2365 break; 2366 2367 case 72: 2368 2369 /* Line 1455 of yacc.c */ 2370 #line 541 "ada-exp.y" 2371 { write_int ((yyvsp[(3) - (3)].lval), type_int ()); 2372 write_exp_elt_opcode (OP_ATR_LENGTH); } 2373 break; 2374 2375 case 73: 2376 2377 /* Line 1455 of yacc.c */ 2378 #line 544 "ada-exp.y" 2379 { write_exp_elt_opcode (OP_ATR_SIZE); } 2380 break; 2381 2382 case 74: 2383 2384 /* Line 1455 of yacc.c */ 2385 #line 546 "ada-exp.y" 2386 { write_exp_elt_opcode (OP_ATR_TAG); } 2387 break; 2388 2389 case 75: 2390 2391 /* Line 1455 of yacc.c */ 2392 #line 548 "ada-exp.y" 2393 { write_exp_elt_opcode (OP_ATR_MIN); } 2394 break; 2395 2396 case 76: 2397 2398 /* Line 1455 of yacc.c */ 2399 #line 550 "ada-exp.y" 2400 { write_exp_elt_opcode (OP_ATR_MAX); } 2401 break; 2402 2403 case 77: 2404 2405 /* Line 1455 of yacc.c */ 2406 #line 552 "ada-exp.y" 2407 { write_exp_elt_opcode (OP_ATR_POS); } 2408 break; 2409 2410 case 78: 2411 2412 /* Line 1455 of yacc.c */ 2413 #line 554 "ada-exp.y" 2414 { write_exp_elt_opcode (OP_ATR_VAL); } 2415 break; 2416 2417 case 79: 2418 2419 /* Line 1455 of yacc.c */ 2420 #line 556 "ada-exp.y" 2421 { write_exp_elt_opcode (OP_ATR_MODULUS); } 2422 break; 2423 2424 case 80: 2425 2426 /* Line 1455 of yacc.c */ 2427 #line 560 "ada-exp.y" 2428 { (yyval.lval) = 1; } 2429 break; 2430 2431 case 81: 2432 2433 /* Line 1455 of yacc.c */ 2434 #line 562 "ada-exp.y" 2435 { (yyval.lval) = (yyvsp[(2) - (3)].typed_val).val; } 2436 break; 2437 2438 case 82: 2439 2440 /* Line 1455 of yacc.c */ 2441 #line 567 "ada-exp.y" 2442 { 2443 if ((yyvsp[(1) - (1)].tval) == NULL) 2444 error (_("Prefix must be type")); 2445 write_exp_elt_opcode (OP_TYPE); 2446 write_exp_elt_type ((yyvsp[(1) - (1)].tval)); 2447 write_exp_elt_opcode (OP_TYPE); } 2448 break; 2449 2450 case 84: 2451 2452 /* Line 1455 of yacc.c */ 2453 #line 578 "ada-exp.y" 2454 { write_exp_elt_opcode (OP_TYPE); 2455 write_exp_elt_type (parse_type->builtin_void); 2456 write_exp_elt_opcode (OP_TYPE); } 2457 break; 2458 2459 case 85: 2460 2461 /* Line 1455 of yacc.c */ 2462 #line 585 "ada-exp.y" 2463 { write_int ((LONGEST) (yyvsp[(1) - (1)].typed_val).val, (yyvsp[(1) - (1)].typed_val).type); } 2464 break; 2465 2466 case 86: 2467 2468 /* Line 1455 of yacc.c */ 2469 #line 589 "ada-exp.y" 2470 { write_int (convert_char_literal (type_qualifier, (yyvsp[(1) - (1)].typed_val).val), 2471 (type_qualifier == NULL) 2472 ? (yyvsp[(1) - (1)].typed_val).type : type_qualifier); 2473 } 2474 break; 2475 2476 case 87: 2477 2478 /* Line 1455 of yacc.c */ 2479 #line 596 "ada-exp.y" 2480 { write_exp_elt_opcode (OP_DOUBLE); 2481 write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_float).type); 2482 write_exp_elt_dblcst ((yyvsp[(1) - (1)].typed_val_float).dval); 2483 write_exp_elt_opcode (OP_DOUBLE); 2484 } 2485 break; 2486 2487 case 88: 2488 2489 /* Line 1455 of yacc.c */ 2490 #line 604 "ada-exp.y" 2491 { write_int (0, type_int ()); } 2492 break; 2493 2494 case 89: 2495 2496 /* Line 1455 of yacc.c */ 2497 #line 608 "ada-exp.y" 2498 { 2499 write_exp_op_with_string (OP_STRING, (yyvsp[(1) - (1)].sval)); 2500 } 2501 break; 2502 2503 case 90: 2504 2505 /* Line 1455 of yacc.c */ 2506 #line 614 "ada-exp.y" 2507 { write_int (1, type_boolean ()); } 2508 break; 2509 2510 case 91: 2511 2512 /* Line 1455 of yacc.c */ 2513 #line 616 "ada-exp.y" 2514 { write_int (0, type_boolean ()); } 2515 break; 2516 2517 case 92: 2518 2519 /* Line 1455 of yacc.c */ 2520 #line 620 "ada-exp.y" 2521 { error (_("NEW not implemented.")); } 2522 break; 2523 2524 case 93: 2525 2526 /* Line 1455 of yacc.c */ 2527 #line 624 "ada-exp.y" 2528 { (yyval.tval) = write_var_or_type (NULL, (yyvsp[(1) - (1)].sval)); } 2529 break; 2530 2531 case 94: 2532 2533 /* Line 1455 of yacc.c */ 2534 #line 626 "ada-exp.y" 2535 { (yyval.tval) = write_var_or_type ((yyvsp[(1) - (2)].bval), (yyvsp[(2) - (2)].sval)); } 2536 break; 2537 2538 case 95: 2539 2540 /* Line 1455 of yacc.c */ 2541 #line 628 "ada-exp.y" 2542 { 2543 (yyval.tval) = write_var_or_type (NULL, (yyvsp[(1) - (2)].sval)); 2544 if ((yyval.tval) == NULL) 2545 write_exp_elt_opcode (UNOP_ADDR); 2546 else 2547 (yyval.tval) = lookup_pointer_type ((yyval.tval)); 2548 } 2549 break; 2550 2551 case 96: 2552 2553 /* Line 1455 of yacc.c */ 2554 #line 636 "ada-exp.y" 2555 { 2556 (yyval.tval) = write_var_or_type ((yyvsp[(1) - (3)].bval), (yyvsp[(2) - (3)].sval)); 2557 if ((yyval.tval) == NULL) 2558 write_exp_elt_opcode (UNOP_ADDR); 2559 else 2560 (yyval.tval) = lookup_pointer_type ((yyval.tval)); 2561 } 2562 break; 2563 2564 case 97: 2565 2566 /* Line 1455 of yacc.c */ 2567 #line 647 "ada-exp.y" 2568 { (yyval.bval) = block_lookup (NULL, (yyvsp[(1) - (2)].sval).ptr); } 2569 break; 2570 2571 case 98: 2572 2573 /* Line 1455 of yacc.c */ 2574 #line 649 "ada-exp.y" 2575 { (yyval.bval) = block_lookup ((yyvsp[(1) - (3)].bval), (yyvsp[(2) - (3)].sval).ptr); } 2576 break; 2577 2578 case 99: 2579 2580 /* Line 1455 of yacc.c */ 2581 #line 654 "ada-exp.y" 2582 { 2583 write_exp_elt_opcode (OP_AGGREGATE); 2584 write_exp_elt_longcst ((yyvsp[(2) - (3)].lval)); 2585 write_exp_elt_opcode (OP_AGGREGATE); 2586 } 2587 break; 2588 2589 case 100: 2590 2591 /* Line 1455 of yacc.c */ 2592 #line 662 "ada-exp.y" 2593 { (yyval.lval) = (yyvsp[(1) - (1)].lval); } 2594 break; 2595 2596 case 101: 2597 2598 /* Line 1455 of yacc.c */ 2599 #line 664 "ada-exp.y" 2600 { write_exp_elt_opcode (OP_POSITIONAL); 2601 write_exp_elt_longcst ((yyvsp[(1) - (2)].lval)); 2602 write_exp_elt_opcode (OP_POSITIONAL); 2603 (yyval.lval) = (yyvsp[(1) - (2)].lval) + 1; 2604 } 2605 break; 2606 2607 case 102: 2608 2609 /* Line 1455 of yacc.c */ 2610 #line 670 "ada-exp.y" 2611 { (yyval.lval) = (yyvsp[(1) - (2)].lval) + (yyvsp[(2) - (2)].lval); } 2612 break; 2613 2614 case 103: 2615 2616 /* Line 1455 of yacc.c */ 2617 #line 675 "ada-exp.y" 2618 { write_exp_elt_opcode (OP_POSITIONAL); 2619 write_exp_elt_longcst (0); 2620 write_exp_elt_opcode (OP_POSITIONAL); 2621 (yyval.lval) = 1; 2622 } 2623 break; 2624 2625 case 104: 2626 2627 /* Line 1455 of yacc.c */ 2628 #line 681 "ada-exp.y" 2629 { write_exp_elt_opcode (OP_POSITIONAL); 2630 write_exp_elt_longcst ((yyvsp[(1) - (3)].lval)); 2631 write_exp_elt_opcode (OP_POSITIONAL); 2632 (yyval.lval) = (yyvsp[(1) - (3)].lval) + 1; 2633 } 2634 break; 2635 2636 case 105: 2637 2638 /* Line 1455 of yacc.c */ 2639 #line 689 "ada-exp.y" 2640 { (yyval.lval) = 1; } 2641 break; 2642 2643 case 106: 2644 2645 /* Line 1455 of yacc.c */ 2646 #line 690 "ada-exp.y" 2647 { (yyval.lval) = 1; } 2648 break; 2649 2650 case 107: 2651 2652 /* Line 1455 of yacc.c */ 2653 #line 692 "ada-exp.y" 2654 { (yyval.lval) = (yyvsp[(3) - (3)].lval) + 1; } 2655 break; 2656 2657 case 108: 2658 2659 /* Line 1455 of yacc.c */ 2660 #line 696 "ada-exp.y" 2661 { write_exp_elt_opcode (OP_OTHERS); } 2662 break; 2663 2664 case 109: 2665 2666 /* Line 1455 of yacc.c */ 2667 #line 701 "ada-exp.y" 2668 { 2669 write_exp_elt_opcode (OP_CHOICES); 2670 write_exp_elt_longcst ((yyvsp[(1) - (1)].lval)); 2671 write_exp_elt_opcode (OP_CHOICES); 2672 } 2673 break; 2674 2675 case 110: 2676 2677 /* Line 1455 of yacc.c */ 2678 #line 715 "ada-exp.y" 2679 { write_name_assoc ((yyvsp[(1) - (2)].sval)); } 2680 break; 2681 2682 case 111: 2683 2684 /* Line 1455 of yacc.c */ 2685 #line 716 "ada-exp.y" 2686 { (yyval.lval) = 1; } 2687 break; 2688 2689 case 112: 2690 2691 /* Line 1455 of yacc.c */ 2692 #line 718 "ada-exp.y" 2693 { (yyval.lval) = 1; } 2694 break; 2695 2696 case 113: 2697 2698 /* Line 1455 of yacc.c */ 2699 #line 720 "ada-exp.y" 2700 { write_exp_elt_opcode (OP_DISCRETE_RANGE); 2701 write_exp_op_with_string (OP_NAME, empty_stoken); 2702 } 2703 break; 2704 2705 case 114: 2706 2707 /* Line 1455 of yacc.c */ 2708 #line 723 "ada-exp.y" 2709 { (yyval.lval) = 1; } 2710 break; 2711 2712 case 115: 2713 2714 /* Line 1455 of yacc.c */ 2715 #line 725 "ada-exp.y" 2716 { write_name_assoc ((yyvsp[(1) - (2)].sval)); } 2717 break; 2718 2719 case 116: 2720 2721 /* Line 1455 of yacc.c */ 2722 #line 726 "ada-exp.y" 2723 { (yyval.lval) = (yyvsp[(4) - (4)].lval) + 1; } 2724 break; 2725 2726 case 117: 2727 2728 /* Line 1455 of yacc.c */ 2729 #line 728 "ada-exp.y" 2730 { (yyval.lval) = (yyvsp[(3) - (3)].lval) + 1; } 2731 break; 2732 2733 case 118: 2734 2735 /* Line 1455 of yacc.c */ 2736 #line 730 "ada-exp.y" 2737 { write_exp_elt_opcode (OP_DISCRETE_RANGE); } 2738 break; 2739 2740 case 119: 2741 2742 /* Line 1455 of yacc.c */ 2743 #line 731 "ada-exp.y" 2744 { (yyval.lval) = (yyvsp[(6) - (6)].lval) + 1; } 2745 break; 2746 2747 case 120: 2748 2749 /* Line 1455 of yacc.c */ 2750 #line 738 "ada-exp.y" 2751 { write_exp_elt_opcode (UNOP_IND); } 2752 break; 2753 2754 case 121: 2755 2756 /* Line 1455 of yacc.c */ 2757 #line 740 "ada-exp.y" 2758 { write_exp_elt_opcode (UNOP_ADDR); } 2759 break; 2760 2761 case 122: 2762 2763 /* Line 1455 of yacc.c */ 2764 #line 742 "ada-exp.y" 2765 { write_exp_elt_opcode (BINOP_SUBSCRIPT); } 2766 break; 2767 2768 2769 2770 /* Line 1455 of yacc.c */ 2771 #line 2773 "ada-exp.c" 2772 default: break; 2773 } 2774 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2775 2776 YYPOPSTACK (yylen); 2777 yylen = 0; 2778 YY_STACK_PRINT (yyss, yyssp); 2779 2780 *++yyvsp = yyval; 2781 2782 /* Now `shift' the result of the reduction. Determine what state 2783 that goes to, based on the state we popped back to and the rule 2784 number reduced by. */ 2785 2786 yyn = yyr1[yyn]; 2787 2788 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2789 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2790 yystate = yytable[yystate]; 2791 else 2792 yystate = yydefgoto[yyn - YYNTOKENS]; 2793 2794 goto yynewstate; 2795 2796 2797 /*------------------------------------. 2798 | yyerrlab -- here on detecting error | 2799 `------------------------------------*/ 2800 yyerrlab: 2801 /* If not already recovering from an error, report this error. */ 2802 if (!yyerrstatus) 2803 { 2804 ++yynerrs; 2805 #if ! YYERROR_VERBOSE 2806 yyerror (YY_("syntax error")); 2807 #else 2808 { 2809 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 2810 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 2811 { 2812 YYSIZE_T yyalloc = 2 * yysize; 2813 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 2814 yyalloc = YYSTACK_ALLOC_MAXIMUM; 2815 if (yymsg != yymsgbuf) 2816 YYSTACK_FREE (yymsg); 2817 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 2818 if (yymsg) 2819 yymsg_alloc = yyalloc; 2820 else 2821 { 2822 yymsg = yymsgbuf; 2823 yymsg_alloc = sizeof yymsgbuf; 2824 } 2825 } 2826 2827 if (0 < yysize && yysize <= yymsg_alloc) 2828 { 2829 (void) yysyntax_error (yymsg, yystate, yychar); 2830 yyerror (yymsg); 2831 } 2832 else 2833 { 2834 yyerror (YY_("syntax error")); 2835 if (yysize != 0) 2836 goto yyexhaustedlab; 2837 } 2838 } 2839 #endif 2840 } 2841 2842 2843 2844 if (yyerrstatus == 3) 2845 { 2846 /* If just tried and failed to reuse lookahead token after an 2847 error, discard it. */ 2848 2849 if (yychar <= YYEOF) 2850 { 2851 /* Return failure if at end of input. */ 2852 if (yychar == YYEOF) 2853 YYABORT; 2854 } 2855 else 2856 { 2857 yydestruct ("Error: discarding", 2858 yytoken, &yylval); 2859 yychar = YYEMPTY; 2860 } 2861 } 2862 2863 /* Else will try to reuse lookahead token after shifting the error 2864 token. */ 2865 goto yyerrlab1; 2866 2867 2868 /*---------------------------------------------------. 2869 | yyerrorlab -- error raised explicitly by YYERROR. | 2870 `---------------------------------------------------*/ 2871 yyerrorlab: 2872 2873 /* Pacify compilers like GCC when the user code never invokes 2874 YYERROR and the label yyerrorlab therefore never appears in user 2875 code. */ 2876 if (/*CONSTCOND*/ 0) 2877 goto yyerrorlab; 2878 2879 /* Do not reclaim the symbols of the rule which action triggered 2880 this YYERROR. */ 2881 YYPOPSTACK (yylen); 2882 yylen = 0; 2883 YY_STACK_PRINT (yyss, yyssp); 2884 yystate = *yyssp; 2885 goto yyerrlab1; 2886 2887 2888 /*-------------------------------------------------------------. 2889 | yyerrlab1 -- common code for both syntax error and YYERROR. | 2890 `-------------------------------------------------------------*/ 2891 yyerrlab1: 2892 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2893 2894 for (;;) 2895 { 2896 yyn = yypact[yystate]; 2897 if (yyn != YYPACT_NINF) 2898 { 2899 yyn += YYTERROR; 2900 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2901 { 2902 yyn = yytable[yyn]; 2903 if (0 < yyn) 2904 break; 2905 } 2906 } 2907 2908 /* Pop the current state because it cannot handle the error token. */ 2909 if (yyssp == yyss) 2910 YYABORT; 2911 2912 2913 yydestruct ("Error: popping", 2914 yystos[yystate], yyvsp); 2915 YYPOPSTACK (1); 2916 yystate = *yyssp; 2917 YY_STACK_PRINT (yyss, yyssp); 2918 } 2919 2920 *++yyvsp = yylval; 2921 2922 2923 /* Shift the error token. */ 2924 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2925 2926 yystate = yyn; 2927 goto yynewstate; 2928 2929 2930 /*-------------------------------------. 2931 | yyacceptlab -- YYACCEPT comes here. | 2932 `-------------------------------------*/ 2933 yyacceptlab: 2934 yyresult = 0; 2935 goto yyreturn; 2936 2937 /*-----------------------------------. 2938 | yyabortlab -- YYABORT comes here. | 2939 `-----------------------------------*/ 2940 yyabortlab: 2941 yyresult = 1; 2942 goto yyreturn; 2943 2944 #if !defined(yyoverflow) || YYERROR_VERBOSE 2945 /*-------------------------------------------------. 2946 | yyexhaustedlab -- memory exhaustion comes here. | 2947 `-------------------------------------------------*/ 2948 yyexhaustedlab: 2949 yyerror (YY_("memory exhausted")); 2950 yyresult = 2; 2951 /* Fall through. */ 2952 #endif 2953 2954 yyreturn: 2955 if (yychar != YYEMPTY) 2956 yydestruct ("Cleanup: discarding lookahead", 2957 yytoken, &yylval); 2958 /* Do not reclaim the symbols of the rule which action triggered 2959 this YYABORT or YYACCEPT. */ 2960 YYPOPSTACK (yylen); 2961 YY_STACK_PRINT (yyss, yyssp); 2962 while (yyssp != yyss) 2963 { 2964 yydestruct ("Cleanup: popping", 2965 yystos[*yyssp], yyvsp); 2966 YYPOPSTACK (1); 2967 } 2968 #ifndef yyoverflow 2969 if (yyss != yyssa) 2970 YYSTACK_FREE (yyss); 2971 #endif 2972 #if YYERROR_VERBOSE 2973 if (yymsg != yymsgbuf) 2974 YYSTACK_FREE (yymsg); 2975 #endif 2976 /* Make sure YYID is used. */ 2977 return YYID (yyresult); 2978 } 2979 2980 2981 2982 /* Line 1675 of yacc.c */ 2983 #line 745 "ada-exp.y" 2984 2985 2986 /* yylex defined in ada-lex.c: Reads one token, getting characters */ 2987 /* through lexptr. */ 2988 2989 /* Remap normal flex interface names (yylex) as well as gratuitiously */ 2990 /* global symbol names, so we can have multiple flex-generated parsers */ 2991 /* in gdb. */ 2992 2993 /* (See note above on previous definitions for YACC.) */ 2994 2995 #define yy_create_buffer ada_yy_create_buffer 2996 #define yy_delete_buffer ada_yy_delete_buffer 2997 #define yy_init_buffer ada_yy_init_buffer 2998 #define yy_load_buffer_state ada_yy_load_buffer_state 2999 #define yy_switch_to_buffer ada_yy_switch_to_buffer 3000 #define yyrestart ada_yyrestart 3001 #define yytext ada_yytext 3002 #define yywrap ada_yywrap 3003 3004 static struct obstack temp_parse_space; 3005 3006 /* The following kludge was found necessary to prevent conflicts between */ 3007 /* defs.h and non-standard stdlib.h files. */ 3008 #define qsort __qsort__dummy 3009 #include "ada-lex.c" 3010 3011 int 3012 ada_parse (void) 3013 { 3014 lexer_init (yyin); /* (Re-)initialize lexer. */ 3015 type_qualifier = NULL; 3016 obstack_free (&temp_parse_space, NULL); 3017 obstack_init (&temp_parse_space); 3018 3019 return _ada_parse (); 3020 } 3021 3022 void 3023 yyerror (char *msg) 3024 { 3025 error (_("Error in expression, near `%s'."), lexptr); 3026 } 3027 3028 /* The operator name corresponding to operator symbol STRING (adds 3029 quotes and maps to lower-case). Destroys the previous contents of 3030 the array pointed to by STRING.ptr. Error if STRING does not match 3031 a valid Ada operator. Assumes that STRING.ptr points to a 3032 null-terminated string and that, if STRING is a valid operator 3033 symbol, the array pointed to by STRING.ptr contains at least 3034 STRING.length+3 characters. */ 3035 3036 static struct stoken 3037 string_to_operator (struct stoken string) 3038 { 3039 int i; 3040 3041 for (i = 0; ada_opname_table[i].encoded != NULL; i += 1) 3042 { 3043 if (string.length == strlen (ada_opname_table[i].decoded)-2 3044 && strncasecmp (string.ptr, ada_opname_table[i].decoded+1, 3045 string.length) == 0) 3046 { 3047 strncpy (string.ptr, ada_opname_table[i].decoded, 3048 string.length+2); 3049 string.length += 2; 3050 return string; 3051 } 3052 } 3053 error (_("Invalid operator symbol `%s'"), string.ptr); 3054 } 3055 3056 /* Emit expression to access an instance of SYM, in block BLOCK (if 3057 * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */ 3058 static void 3059 write_var_from_sym (const struct block *orig_left_context, 3060 const struct block *block, 3061 struct symbol *sym) 3062 { 3063 if (orig_left_context == NULL && symbol_read_needs_frame (sym)) 3064 { 3065 if (innermost_block == 0 3066 || contained_in (block, innermost_block)) 3067 innermost_block = block; 3068 } 3069 3070 write_exp_elt_opcode (OP_VAR_VALUE); 3071 write_exp_elt_block (block); 3072 write_exp_elt_sym (sym); 3073 write_exp_elt_opcode (OP_VAR_VALUE); 3074 } 3075 3076 /* Write integer or boolean constant ARG of type TYPE. */ 3077 3078 static void 3079 write_int (LONGEST arg, struct type *type) 3080 { 3081 write_exp_elt_opcode (OP_LONG); 3082 write_exp_elt_type (type); 3083 write_exp_elt_longcst (arg); 3084 write_exp_elt_opcode (OP_LONG); 3085 } 3086 3087 /* Write an OPCODE, string, OPCODE sequence to the current expression. */ 3088 static void 3089 write_exp_op_with_string (enum exp_opcode opcode, struct stoken token) 3090 { 3091 write_exp_elt_opcode (opcode); 3092 write_exp_string (token); 3093 write_exp_elt_opcode (opcode); 3094 } 3095 3096 /* Emit expression corresponding to the renamed object named 3097 * designated by RENAMED_ENTITY[0 .. RENAMED_ENTITY_LEN-1] in the 3098 * context of ORIG_LEFT_CONTEXT, to which is applied the operations 3099 * encoded by RENAMING_EXPR. MAX_DEPTH is the maximum number of 3100 * cascaded renamings to allow. If ORIG_LEFT_CONTEXT is null, it 3101 * defaults to the currently selected block. ORIG_SYMBOL is the 3102 * symbol that originally encoded the renaming. It is needed only 3103 * because its prefix also qualifies any index variables used to index 3104 * or slice an array. It should not be necessary once we go to the 3105 * new encoding entirely (FIXME pnh 7/20/2007). */ 3106 3107 static void 3108 write_object_renaming (const struct block *orig_left_context, 3109 const char *renamed_entity, int renamed_entity_len, 3110 const char *renaming_expr, int max_depth) 3111 { 3112 char *name; 3113 enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state; 3114 struct ada_symbol_info sym_info; 3115 3116 if (max_depth <= 0) 3117 error (_("Could not find renamed symbol")); 3118 3119 if (orig_left_context == NULL) 3120 orig_left_context = get_selected_block (NULL); 3121 3122 name = obstack_copy0 (&temp_parse_space, renamed_entity, renamed_entity_len); 3123 ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info); 3124 if (sym_info.sym == NULL) 3125 error (_("Could not find renamed variable: %s"), ada_decode (name)); 3126 else if (SYMBOL_CLASS (sym_info.sym) == LOC_TYPEDEF) 3127 /* We have a renaming of an old-style renaming symbol. Don't 3128 trust the block information. */ 3129 sym_info.block = orig_left_context; 3130 3131 { 3132 const char *inner_renamed_entity; 3133 int inner_renamed_entity_len; 3134 const char *inner_renaming_expr; 3135 3136 switch (ada_parse_renaming (sym_info.sym, &inner_renamed_entity, 3137 &inner_renamed_entity_len, 3138 &inner_renaming_expr)) 3139 { 3140 case ADA_NOT_RENAMING: 3141 write_var_from_sym (orig_left_context, sym_info.block, sym_info.sym); 3142 break; 3143 case ADA_OBJECT_RENAMING: 3144 write_object_renaming (sym_info.block, 3145 inner_renamed_entity, inner_renamed_entity_len, 3146 inner_renaming_expr, max_depth - 1); 3147 break; 3148 default: 3149 goto BadEncoding; 3150 } 3151 } 3152 3153 slice_state = SIMPLE_INDEX; 3154 while (*renaming_expr == 'X') 3155 { 3156 renaming_expr += 1; 3157 3158 switch (*renaming_expr) { 3159 case 'A': 3160 renaming_expr += 1; 3161 write_exp_elt_opcode (UNOP_IND); 3162 break; 3163 case 'L': 3164 slice_state = LOWER_BOUND; 3165 /* FALLTHROUGH */ 3166 case 'S': 3167 renaming_expr += 1; 3168 if (isdigit (*renaming_expr)) 3169 { 3170 char *next; 3171 long val = strtol (renaming_expr, &next, 10); 3172 if (next == renaming_expr) 3173 goto BadEncoding; 3174 renaming_expr = next; 3175 write_exp_elt_opcode (OP_LONG); 3176 write_exp_elt_type (type_int ()); 3177 write_exp_elt_longcst ((LONGEST) val); 3178 write_exp_elt_opcode (OP_LONG); 3179 } 3180 else 3181 { 3182 const char *end; 3183 char *index_name; 3184 struct ada_symbol_info index_sym_info; 3185 3186 end = strchr (renaming_expr, 'X'); 3187 if (end == NULL) 3188 end = renaming_expr + strlen (renaming_expr); 3189 3190 index_name = 3191 obstack_copy0 (&temp_parse_space, renaming_expr, 3192 end - renaming_expr); 3193 renaming_expr = end; 3194 3195 ada_lookup_encoded_symbol (index_name, NULL, VAR_DOMAIN, 3196 &index_sym_info); 3197 if (index_sym_info.sym == NULL) 3198 error (_("Could not find %s"), index_name); 3199 else if (SYMBOL_CLASS (index_sym_info.sym) == LOC_TYPEDEF) 3200 /* Index is an old-style renaming symbol. */ 3201 index_sym_info.block = orig_left_context; 3202 write_var_from_sym (NULL, index_sym_info.block, 3203 index_sym_info.sym); 3204 } 3205 if (slice_state == SIMPLE_INDEX) 3206 { 3207 write_exp_elt_opcode (OP_FUNCALL); 3208 write_exp_elt_longcst ((LONGEST) 1); 3209 write_exp_elt_opcode (OP_FUNCALL); 3210 } 3211 else if (slice_state == LOWER_BOUND) 3212 slice_state = UPPER_BOUND; 3213 else if (slice_state == UPPER_BOUND) 3214 { 3215 write_exp_elt_opcode (TERNOP_SLICE); 3216 slice_state = SIMPLE_INDEX; 3217 } 3218 break; 3219 3220 case 'R': 3221 { 3222 struct stoken field_name; 3223 const char *end; 3224 renaming_expr += 1; 3225 3226 if (slice_state != SIMPLE_INDEX) 3227 goto BadEncoding; 3228 end = strchr (renaming_expr, 'X'); 3229 if (end == NULL) 3230 end = renaming_expr + strlen (renaming_expr); 3231 field_name.length = end - renaming_expr; 3232 field_name.ptr = xmalloc (end - renaming_expr + 1); 3233 strncpy (field_name.ptr, renaming_expr, end - renaming_expr); 3234 field_name.ptr[end - renaming_expr] = '\000'; 3235 renaming_expr = end; 3236 write_exp_op_with_string (STRUCTOP_STRUCT, field_name); 3237 break; 3238 } 3239 3240 default: 3241 goto BadEncoding; 3242 } 3243 } 3244 if (slice_state == SIMPLE_INDEX) 3245 return; 3246 3247 BadEncoding: 3248 error (_("Internal error in encoding of renaming declaration")); 3249 } 3250 3251 static struct block* 3252 block_lookup (struct block *context, char *raw_name) 3253 { 3254 char *name; 3255 struct ada_symbol_info *syms; 3256 int nsyms; 3257 struct symtab *symtab; 3258 3259 if (raw_name[0] == '\'') 3260 { 3261 raw_name += 1; 3262 name = raw_name; 3263 } 3264 else 3265 name = ada_encode (raw_name); 3266 3267 nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms); 3268 if (context == NULL 3269 && (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK)) 3270 symtab = lookup_symtab (name); 3271 else 3272 symtab = NULL; 3273 3274 if (symtab != NULL) 3275 return BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK); 3276 else if (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK) 3277 { 3278 if (context == NULL) 3279 error (_("No file or function \"%s\"."), raw_name); 3280 else 3281 error (_("No function \"%s\" in specified context."), raw_name); 3282 } 3283 else 3284 { 3285 if (nsyms > 1) 3286 warning (_("Function name \"%s\" ambiguous here"), raw_name); 3287 return SYMBOL_BLOCK_VALUE (syms[0].sym); 3288 } 3289 } 3290 3291 static struct symbol* 3292 select_possible_type_sym (struct ada_symbol_info *syms, int nsyms) 3293 { 3294 int i; 3295 int preferred_index; 3296 struct type *preferred_type; 3297 3298 preferred_index = -1; preferred_type = NULL; 3299 for (i = 0; i < nsyms; i += 1) 3300 switch (SYMBOL_CLASS (syms[i].sym)) 3301 { 3302 case LOC_TYPEDEF: 3303 if (ada_prefer_type (SYMBOL_TYPE (syms[i].sym), preferred_type)) 3304 { 3305 preferred_index = i; 3306 preferred_type = SYMBOL_TYPE (syms[i].sym); 3307 } 3308 break; 3309 case LOC_REGISTER: 3310 case LOC_ARG: 3311 case LOC_REF_ARG: 3312 case LOC_REGPARM_ADDR: 3313 case LOC_LOCAL: 3314 case LOC_COMPUTED: 3315 return NULL; 3316 default: 3317 break; 3318 } 3319 if (preferred_type == NULL) 3320 return NULL; 3321 return syms[preferred_index].sym; 3322 } 3323 3324 static struct type* 3325 find_primitive_type (char *name) 3326 { 3327 struct type *type; 3328 type = language_lookup_primitive_type_by_name (parse_language, 3329 parse_gdbarch, 3330 name); 3331 if (type == NULL && strcmp ("system__address", name) == 0) 3332 type = type_system_address (); 3333 3334 if (type != NULL) 3335 { 3336 /* Check to see if we have a regular definition of this 3337 type that just didn't happen to have been read yet. */ 3338 struct symbol *sym; 3339 char *expanded_name = 3340 (char *) alloca (strlen (name) + sizeof ("standard__")); 3341 strcpy (expanded_name, "standard__"); 3342 strcat (expanded_name, name); 3343 sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN, NULL); 3344 if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) 3345 type = SYMBOL_TYPE (sym); 3346 } 3347 3348 return type; 3349 } 3350 3351 static int 3352 chop_selector (char *name, int end) 3353 { 3354 int i; 3355 for (i = end - 1; i > 0; i -= 1) 3356 if (name[i] == '.' || (name[i] == '_' && name[i+1] == '_')) 3357 return i; 3358 return -1; 3359 } 3360 3361 /* If NAME is a string beginning with a separator (either '__', or 3362 '.'), chop this separator and return the result; else, return 3363 NAME. */ 3364 3365 static char * 3366 chop_separator (char *name) 3367 { 3368 if (*name == '.') 3369 return name + 1; 3370 3371 if (name[0] == '_' && name[1] == '_') 3372 return name + 2; 3373 3374 return name; 3375 } 3376 3377 /* Given that SELS is a string of the form (<sep><identifier>)*, where 3378 <sep> is '__' or '.', write the indicated sequence of 3379 STRUCTOP_STRUCT expression operators. */ 3380 static void 3381 write_selectors (char *sels) 3382 { 3383 while (*sels != '\0') 3384 { 3385 struct stoken field_name; 3386 char *p = chop_separator (sels); 3387 sels = p; 3388 while (*sels != '\0' && *sels != '.' 3389 && (sels[0] != '_' || sels[1] != '_')) 3390 sels += 1; 3391 field_name.length = sels - p; 3392 field_name.ptr = p; 3393 write_exp_op_with_string (STRUCTOP_STRUCT, field_name); 3394 } 3395 } 3396 3397 /* Write a variable access (OP_VAR_VALUE) to ambiguous encoded name 3398 NAME[0..LEN-1], in block context BLOCK, to be resolved later. Writes 3399 a temporary symbol that is valid until the next call to ada_parse. 3400 */ 3401 static void 3402 write_ambiguous_var (const struct block *block, char *name, int len) 3403 { 3404 struct symbol *sym = 3405 obstack_alloc (&temp_parse_space, sizeof (struct symbol)); 3406 memset (sym, 0, sizeof (struct symbol)); 3407 SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN; 3408 SYMBOL_LINKAGE_NAME (sym) = obstack_copy0 (&temp_parse_space, name, len); 3409 SYMBOL_LANGUAGE (sym) = language_ada; 3410 3411 write_exp_elt_opcode (OP_VAR_VALUE); 3412 write_exp_elt_block (block); 3413 write_exp_elt_sym (sym); 3414 write_exp_elt_opcode (OP_VAR_VALUE); 3415 } 3416 3417 /* A convenient wrapper around ada_get_field_index that takes 3418 a non NUL-terminated FIELD_NAME0 and a FIELD_NAME_LEN instead 3419 of a NUL-terminated field name. */ 3420 3421 static int 3422 ada_nget_field_index (const struct type *type, const char *field_name0, 3423 int field_name_len, int maybe_missing) 3424 { 3425 char *field_name = alloca ((field_name_len + 1) * sizeof (char)); 3426 3427 strncpy (field_name, field_name0, field_name_len); 3428 field_name[field_name_len] = '\0'; 3429 return ada_get_field_index (type, field_name, maybe_missing); 3430 } 3431 3432 /* If encoded_field_name is the name of a field inside symbol SYM, 3433 then return the type of that field. Otherwise, return NULL. 3434 3435 This function is actually recursive, so if ENCODED_FIELD_NAME 3436 doesn't match one of the fields of our symbol, then try to see 3437 if ENCODED_FIELD_NAME could not be a succession of field names 3438 (in other words, the user entered an expression of the form 3439 TYPE_NAME.FIELD1.FIELD2.FIELD3), in which case we evaluate 3440 each field name sequentially to obtain the desired field type. 3441 In case of failure, we return NULL. */ 3442 3443 static struct type * 3444 get_symbol_field_type (struct symbol *sym, char *encoded_field_name) 3445 { 3446 char *field_name = encoded_field_name; 3447 char *subfield_name; 3448 struct type *type = SYMBOL_TYPE (sym); 3449 int fieldno; 3450 3451 if (type == NULL || field_name == NULL) 3452 return NULL; 3453 type = check_typedef (type); 3454 3455 while (field_name[0] != '\0') 3456 { 3457 field_name = chop_separator (field_name); 3458 3459 fieldno = ada_get_field_index (type, field_name, 1); 3460 if (fieldno >= 0) 3461 return TYPE_FIELD_TYPE (type, fieldno); 3462 3463 subfield_name = field_name; 3464 while (*subfield_name != '\0' && *subfield_name != '.' 3465 && (subfield_name[0] != '_' || subfield_name[1] != '_')) 3466 subfield_name += 1; 3467 3468 if (subfield_name[0] == '\0') 3469 return NULL; 3470 3471 fieldno = ada_nget_field_index (type, field_name, 3472 subfield_name - field_name, 1); 3473 if (fieldno < 0) 3474 return NULL; 3475 3476 type = TYPE_FIELD_TYPE (type, fieldno); 3477 field_name = subfield_name; 3478 } 3479 3480 return NULL; 3481 } 3482 3483 /* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or 3484 expression_block_context if NULL). If it denotes a type, return 3485 that type. Otherwise, write expression code to evaluate it as an 3486 object and return NULL. In this second case, NAME0 will, in general, 3487 have the form <name>(.<selector_name>)*, where <name> is an object 3488 or renaming encoded in the debugging data. Calls error if no 3489 prefix <name> matches a name in the debugging data (i.e., matches 3490 either a complete name or, as a wild-card match, the final 3491 identifier). */ 3492 3493 static struct type* 3494 write_var_or_type (const struct block *block, struct stoken name0) 3495 { 3496 int depth; 3497 char *encoded_name; 3498 int name_len; 3499 3500 if (block == NULL) 3501 block = expression_context_block; 3502 3503 encoded_name = ada_encode (name0.ptr); 3504 name_len = strlen (encoded_name); 3505 encoded_name = obstack_copy0 (&temp_parse_space, encoded_name, name_len); 3506 for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1) 3507 { 3508 int tail_index; 3509 3510 tail_index = name_len; 3511 while (tail_index > 0) 3512 { 3513 int nsyms; 3514 struct ada_symbol_info *syms; 3515 struct symbol *type_sym; 3516 struct symbol *renaming_sym; 3517 const char* renaming; 3518 int renaming_len; 3519 const char* renaming_expr; 3520 int terminator = encoded_name[tail_index]; 3521 3522 encoded_name[tail_index] = '\0'; 3523 nsyms = ada_lookup_symbol_list (encoded_name, block, 3524 VAR_DOMAIN, &syms); 3525 encoded_name[tail_index] = terminator; 3526 3527 /* A single symbol may rename a package or object. */ 3528 3529 /* This should go away when we move entirely to new version. 3530 FIXME pnh 7/20/2007. */ 3531 if (nsyms == 1) 3532 { 3533 struct symbol *ren_sym = 3534 ada_find_renaming_symbol (syms[0].sym, syms[0].block); 3535 3536 if (ren_sym != NULL) 3537 syms[0].sym = ren_sym; 3538 } 3539 3540 type_sym = select_possible_type_sym (syms, nsyms); 3541 3542 if (type_sym != NULL) 3543 renaming_sym = type_sym; 3544 else if (nsyms == 1) 3545 renaming_sym = syms[0].sym; 3546 else 3547 renaming_sym = NULL; 3548 3549 switch (ada_parse_renaming (renaming_sym, &renaming, 3550 &renaming_len, &renaming_expr)) 3551 { 3552 case ADA_NOT_RENAMING: 3553 break; 3554 case ADA_PACKAGE_RENAMING: 3555 case ADA_EXCEPTION_RENAMING: 3556 case ADA_SUBPROGRAM_RENAMING: 3557 { 3558 char *new_name 3559 = obstack_alloc (&temp_parse_space, 3560 renaming_len + name_len - tail_index + 1); 3561 strncpy (new_name, renaming, renaming_len); 3562 strcpy (new_name + renaming_len, encoded_name + tail_index); 3563 encoded_name = new_name; 3564 name_len = renaming_len + name_len - tail_index; 3565 goto TryAfterRenaming; 3566 } 3567 case ADA_OBJECT_RENAMING: 3568 write_object_renaming (block, renaming, renaming_len, 3569 renaming_expr, MAX_RENAMING_CHAIN_LENGTH); 3570 write_selectors (encoded_name + tail_index); 3571 return NULL; 3572 default: 3573 internal_error (__FILE__, __LINE__, 3574 _("impossible value from ada_parse_renaming")); 3575 } 3576 3577 if (type_sym != NULL) 3578 { 3579 struct type *field_type; 3580 3581 if (tail_index == name_len) 3582 return SYMBOL_TYPE (type_sym); 3583 3584 /* We have some extraneous characters after the type name. 3585 If this is an expression "TYPE_NAME.FIELD0.[...].FIELDN", 3586 then try to get the type of FIELDN. */ 3587 field_type 3588 = get_symbol_field_type (type_sym, encoded_name + tail_index); 3589 if (field_type != NULL) 3590 return field_type; 3591 else 3592 error (_("Invalid attempt to select from type: \"%s\"."), 3593 name0.ptr); 3594 } 3595 else if (tail_index == name_len && nsyms == 0) 3596 { 3597 struct type *type = find_primitive_type (encoded_name); 3598 3599 if (type != NULL) 3600 return type; 3601 } 3602 3603 if (nsyms == 1) 3604 { 3605 write_var_from_sym (block, syms[0].block, syms[0].sym); 3606 write_selectors (encoded_name + tail_index); 3607 return NULL; 3608 } 3609 else if (nsyms == 0) 3610 { 3611 struct minimal_symbol *msym 3612 = ada_lookup_simple_minsym (encoded_name); 3613 if (msym != NULL) 3614 { 3615 write_exp_msymbol (msym); 3616 /* Maybe cause error here rather than later? FIXME? */ 3617 write_selectors (encoded_name + tail_index); 3618 return NULL; 3619 } 3620 3621 if (tail_index == name_len 3622 && strncmp (encoded_name, "standard__", 3623 sizeof ("standard__") - 1) == 0) 3624 error (_("No definition of \"%s\" found."), name0.ptr); 3625 3626 tail_index = chop_selector (encoded_name, tail_index); 3627 } 3628 else 3629 { 3630 write_ambiguous_var (block, encoded_name, tail_index); 3631 write_selectors (encoded_name + tail_index); 3632 return NULL; 3633 } 3634 } 3635 3636 if (!have_full_symbols () && !have_partial_symbols () && block == NULL) 3637 error (_("No symbol table is loaded. Use the \"file\" command.")); 3638 if (block == expression_context_block) 3639 error (_("No definition of \"%s\" in current context."), name0.ptr); 3640 else 3641 error (_("No definition of \"%s\" in specified context."), name0.ptr); 3642 3643 TryAfterRenaming: ; 3644 } 3645 3646 error (_("Could not find renamed symbol \"%s\""), name0.ptr); 3647 3648 } 3649 3650 /* Write a left side of a component association (e.g., NAME in NAME => 3651 exp). If NAME has the form of a selected component, write it as an 3652 ordinary expression. If it is a simple variable that unambiguously 3653 corresponds to exactly one symbol that does not denote a type or an 3654 object renaming, also write it normally as an OP_VAR_VALUE. 3655 Otherwise, write it as an OP_NAME. 3656 3657 Unfortunately, we don't know at this point whether NAME is supposed 3658 to denote a record component name or the value of an array index. 3659 Therefore, it is not appropriate to disambiguate an ambiguous name 3660 as we normally would, nor to replace a renaming with its referent. 3661 As a result, in the (one hopes) rare case that one writes an 3662 aggregate such as (R => 42) where R renames an object or is an 3663 ambiguous name, one must write instead ((R) => 42). */ 3664 3665 static void 3666 write_name_assoc (struct stoken name) 3667 { 3668 if (strchr (name.ptr, '.') == NULL) 3669 { 3670 struct ada_symbol_info *syms; 3671 int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block, 3672 VAR_DOMAIN, &syms); 3673 if (nsyms != 1 || SYMBOL_CLASS (syms[0].sym) == LOC_TYPEDEF) 3674 write_exp_op_with_string (OP_NAME, name); 3675 else 3676 write_var_from_sym (NULL, syms[0].block, syms[0].sym); 3677 } 3678 else 3679 if (write_var_or_type (NULL, name) != NULL) 3680 error (_("Invalid use of type.")); 3681 } 3682 3683 /* Convert the character literal whose ASCII value would be VAL to the 3684 appropriate value of type TYPE, if there is a translation. 3685 Otherwise return VAL. Hence, in an enumeration type ('A', 'B'), 3686 the literal 'A' (VAL == 65), returns 0. */ 3687 3688 static LONGEST 3689 convert_char_literal (struct type *type, LONGEST val) 3690 { 3691 char name[7]; 3692 int f; 3693 3694 if (type == NULL) 3695 return val; 3696 type = check_typedef (type); 3697 if (TYPE_CODE (type) != TYPE_CODE_ENUM) 3698 return val; 3699 3700 xsnprintf (name, sizeof (name), "QU%02x", (int) val); 3701 for (f = 0; f < TYPE_NFIELDS (type); f += 1) 3702 { 3703 if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0) 3704 return TYPE_FIELD_ENUMVAL (type, f); 3705 } 3706 return val; 3707 } 3708 3709 static struct type * 3710 type_int (void) 3711 { 3712 return parse_type->builtin_int; 3713 } 3714 3715 static struct type * 3716 type_long (void) 3717 { 3718 return parse_type->builtin_long; 3719 } 3720 3721 static struct type * 3722 type_long_long (void) 3723 { 3724 return parse_type->builtin_long_long; 3725 } 3726 3727 static struct type * 3728 type_float (void) 3729 { 3730 return parse_type->builtin_float; 3731 } 3732 3733 static struct type * 3734 type_double (void) 3735 { 3736 return parse_type->builtin_double; 3737 } 3738 3739 static struct type * 3740 type_long_double (void) 3741 { 3742 return parse_type->builtin_long_double; 3743 } 3744 3745 static struct type * 3746 type_char (void) 3747 { 3748 return language_string_char_type (parse_language, parse_gdbarch); 3749 } 3750 3751 static struct type * 3752 type_boolean (void) 3753 { 3754 return parse_type->builtin_bool; 3755 } 3756 3757 static struct type * 3758 type_system_address (void) 3759 { 3760 struct type *type 3761 = language_lookup_primitive_type_by_name (parse_language, 3762 parse_gdbarch, 3763 "system__address"); 3764 return type != NULL ? type : parse_type->builtin_data_ptr; 3765 } 3766 3767 /* Provide a prototype to silence -Wmissing-prototypes. */ 3768 extern initialize_file_ftype _initialize_ada_exp; 3769 3770 void 3771 _initialize_ada_exp (void) 3772 { 3773 obstack_init (&temp_parse_space); 3774 } 3775 3776 /* FIXME: hilfingr/2004-10-05: Hack to remove warning. The function 3777 string_to_operator is supposed to be used for cases where one 3778 calls an operator function with prefix notation, as in 3779 "+" (a, b), but at some point, this code seems to have gone 3780 missing. */ 3781 3782 struct stoken (*dummy_string_to_ada_operator) (struct stoken) 3783 = string_to_operator; 3784 3785