1 /* A Bison parser, made by GNU Bison 1.875c. */ 2 3 /* Skeleton parser for Yacc-like parsing with Bison, 4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 59 Temple Place - Suite 330, 19 Boston, MA 02111-1307, USA. */ 20 21 /* As a special exception, when this file is copied by Bison into a 22 Bison output file, you may use that output file without restriction. 23 This special exception was added by the Free Software Foundation 24 in version 1.24 of Bison. */ 25 26 /* Written by Richard Stallman by simplifying the original so called 27 ``semantic'' parser. */ 28 29 /* All symbols defined below should begin with yy or YY, to avoid 30 infringing on user name space. This should be done even for local 31 variables, as they might otherwise be expanded by user macros. 32 There are some unavoidable exceptions within include files to 33 define necessary library symbols; they are noted "INFRINGES ON 34 USER NAME SPACE" below. */ 35 36 /* Identify Bison output. */ 37 #define YYBISON 1 38 39 /* Skeleton name. */ 40 #define YYSKELETON_NAME "yacc.c" 41 42 /* Pure parsers. */ 43 #define YYPURE 0 44 45 /* Using locations. */ 46 #define YYLSP_NEEDED 0 47 48 49 50 /* Tokens. */ 51 #ifndef YYTOKENTYPE 52 # define YYTOKENTYPE 53 /* Put the tokens into the symbol table, so that GDB and other debuggers 54 know about them. */ 55 enum yytokentype { 56 INT = 258, 57 NULL_PTR = 259, 58 CHARLIT = 260, 59 FLOAT = 261, 60 TYPENAME = 262, 61 BLOCKNAME = 263, 62 STRING = 264, 63 NAME = 265, 64 DOT_ID = 266, 65 OBJECT_RENAMING = 267, 66 DOT_ALL = 268, 67 SPECIAL_VARIABLE = 269, 68 ASSIGN = 270, 69 ELSE = 271, 70 THEN = 272, 71 XOR = 273, 72 OR = 274, 73 _AND_ = 275, 74 DOTDOT = 276, 75 IN = 277, 76 GEQ = 278, 77 LEQ = 279, 78 NOTEQUAL = 280, 79 UNARY = 281, 80 REM = 282, 81 MOD = 283, 82 NOT = 284, 83 ABS = 285, 84 STARSTAR = 286, 85 TICK_LENGTH = 287, 86 TICK_LAST = 288, 87 TICK_FIRST = 289, 88 TICK_ADDRESS = 290, 89 TICK_ACCESS = 291, 90 TICK_MODULUS = 292, 91 TICK_MIN = 293, 92 TICK_MAX = 294, 93 TICK_VAL = 295, 94 TICK_TAG = 296, 95 TICK_SIZE = 297, 96 TICK_RANGE = 298, 97 TICK_POS = 299, 98 ARROW = 300, 99 NEW = 301 100 }; 101 #endif 102 #define INT 258 103 #define NULL_PTR 259 104 #define CHARLIT 260 105 #define FLOAT 261 106 #define TYPENAME 262 107 #define BLOCKNAME 263 108 #define STRING 264 109 #define NAME 265 110 #define DOT_ID 266 111 #define OBJECT_RENAMING 267 112 #define DOT_ALL 268 113 #define SPECIAL_VARIABLE 269 114 #define ASSIGN 270 115 #define ELSE 271 116 #define THEN 272 117 #define XOR 273 118 #define OR 274 119 #define _AND_ 275 120 #define DOTDOT 276 121 #define IN 277 122 #define GEQ 278 123 #define LEQ 279 124 #define NOTEQUAL 280 125 #define UNARY 281 126 #define REM 282 127 #define MOD 283 128 #define NOT 284 129 #define ABS 285 130 #define STARSTAR 286 131 #define TICK_LENGTH 287 132 #define TICK_LAST 288 133 #define TICK_FIRST 289 134 #define TICK_ADDRESS 290 135 #define TICK_ACCESS 291 136 #define TICK_MODULUS 292 137 #define TICK_MIN 293 138 #define TICK_MAX 294 139 #define TICK_VAL 295 140 #define TICK_TAG 296 141 #define TICK_SIZE 297 142 #define TICK_RANGE 298 143 #define TICK_POS 299 144 #define ARROW 300 145 #define NEW 301 146 147 148 149 150 /* Copy the first part of user declarations. */ 151 #line 38 "ada-exp.y" 152 153 154 #include "defs.h" 155 #include "gdb_string.h" 156 #include <ctype.h> 157 #include "expression.h" 158 #include "value.h" 159 #include "parser-defs.h" 160 #include "language.h" 161 #include "ada-lang.h" 162 #include "bfd.h" /* Required by objfiles.h. */ 163 #include "symfile.h" /* Required by objfiles.h. */ 164 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ 165 #include "frame.h" 166 #include "block.h" 167 168 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), 169 as well as gratuitiously global symbol names, so we can have multiple 170 yacc generated parsers in gdb. These are only the variables 171 produced by yacc. If other parser generators (bison, byacc, etc) produce 172 additional global names that conflict at link time, then those parser 173 generators need to be fixed instead of adding those names to this list. */ 174 175 /* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix 176 options. I presume we are maintaining it to accommodate systems 177 without BISON? (PNH) */ 178 179 #define yymaxdepth ada_maxdepth 180 #define yyparse _ada_parse /* ada_parse calls this after initialization */ 181 #define yylex ada_lex 182 #define yyerror ada_error 183 #define yylval ada_lval 184 #define yychar ada_char 185 #define yydebug ada_debug 186 #define yypact ada_pact 187 #define yyr1 ada_r1 188 #define yyr2 ada_r2 189 #define yydef ada_def 190 #define yychk ada_chk 191 #define yypgo ada_pgo 192 #define yyact ada_act 193 #define yyexca ada_exca 194 #define yyerrflag ada_errflag 195 #define yynerrs ada_nerrs 196 #define yyps ada_ps 197 #define yypv ada_pv 198 #define yys ada_s 199 #define yy_yys ada_yys 200 #define yystate ada_state 201 #define yytmp ada_tmp 202 #define yyv ada_v 203 #define yy_yyv ada_yyv 204 #define yyval ada_val 205 #define yylloc ada_lloc 206 #define yyreds ada_reds /* With YYDEBUG defined */ 207 #define yytoks ada_toks /* With YYDEBUG defined */ 208 #define yyname ada_name /* With YYDEBUG defined */ 209 #define yyrule ada_rule /* With YYDEBUG defined */ 210 211 #ifndef YYDEBUG 212 #define YYDEBUG 1 /* Default to yydebug support */ 213 #endif 214 215 #define YYFPRINTF parser_fprintf 216 217 struct name_info { 218 struct symbol *sym; 219 struct minimal_symbol *msym; 220 struct block *block; 221 struct stoken stoken; 222 }; 223 224 /* If expression is in the context of TYPE'(...), then TYPE, else 225 * NULL. */ 226 static struct type *type_qualifier; 227 228 int yyparse (void); 229 230 static int yylex (void); 231 232 void yyerror (char *); 233 234 static struct stoken string_to_operator (struct stoken); 235 236 static void write_int (LONGEST, struct type *); 237 238 static void write_object_renaming (struct block *, struct symbol *, int); 239 240 static void write_var_from_name (struct block *, struct name_info); 241 242 static LONGEST convert_char_literal (struct type *, LONGEST); 243 244 static struct type *type_int (void); 245 246 static struct type *type_long (void); 247 248 static struct type *type_long_long (void); 249 250 static struct type *type_float (void); 251 252 static struct type *type_double (void); 253 254 static struct type *type_long_double (void); 255 256 static struct type *type_char (void); 257 258 static struct type *type_system_address (void); 259 260 261 /* Enabling traces. */ 262 #ifndef YYDEBUG 263 # define YYDEBUG 0 264 #endif 265 266 /* Enabling verbose error messages. */ 267 #ifdef YYERROR_VERBOSE 268 # undef YYERROR_VERBOSE 269 # define YYERROR_VERBOSE 1 270 #else 271 # define YYERROR_VERBOSE 0 272 #endif 273 274 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) 275 #line 148 "ada-exp.y" 276 typedef union YYSTYPE { 277 LONGEST lval; 278 struct { 279 LONGEST val; 280 struct type *type; 281 } typed_val; 282 struct { 283 DOUBLEST dval; 284 struct type *type; 285 } typed_val_float; 286 struct type *tval; 287 struct stoken sval; 288 struct name_info ssym; 289 int voidval; 290 struct block *bval; 291 struct internalvar *ivar; 292 293 } YYSTYPE; 294 /* Line 191 of yacc.c. */ 295 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 296 # define YYSTYPE_IS_DECLARED 1 297 # define YYSTYPE_IS_TRIVIAL 1 298 #endif 299 300 301 302 /* Copy the second part of user declarations. */ 303 304 305 /* Line 214 of yacc.c. */ 306 307 #if ! defined (yyoverflow) || YYERROR_VERBOSE 308 309 # ifndef YYFREE 310 # define YYFREE free 311 # endif 312 # ifndef YYMALLOC 313 # define YYMALLOC xmalloc 314 # endif 315 316 /* The parser invokes alloca or xmalloc; define the necessary symbols. */ 317 318 # ifdef YYSTACK_USE_ALLOCA 319 # if YYSTACK_USE_ALLOCA 320 # define YYSTACK_ALLOC alloca 321 # endif 322 # else 323 # if defined (alloca) || defined (_ALLOCA_H) 324 # define YYSTACK_ALLOC alloca 325 # else 326 # ifdef __GNUC__ 327 # define YYSTACK_ALLOC __builtin_alloca 328 # endif 329 # endif 330 # endif 331 332 # ifdef YYSTACK_ALLOC 333 /* Pacify GCC's `empty if-body' warning. */ 334 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 335 # else 336 # if defined (__STDC__) || defined (__cplusplus) 337 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 338 # define YYSIZE_T size_t 339 # endif 340 # define YYSTACK_ALLOC YYMALLOC 341 # define YYSTACK_FREE YYFREE 342 # endif 343 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ 344 345 346 #if (! defined (yyoverflow) \ 347 && (! defined (__cplusplus) \ 348 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) 349 350 /* A type that is properly aligned for any stack member. */ 351 union yyalloc 352 { 353 short yyss; 354 YYSTYPE yyvs; 355 }; 356 357 /* The size of the maximum gap between one aligned stack and the next. */ 358 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 359 360 /* The size of an array large to enough to hold all stacks, each with 361 N elements. */ 362 # define YYSTACK_BYTES(N) \ 363 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ 364 + YYSTACK_GAP_MAXIMUM) 365 366 /* Copy COUNT objects from FROM to TO. The source and destination do 367 not overlap. */ 368 # ifndef YYCOPY 369 # if defined (__GNUC__) && 1 < __GNUC__ 370 # define YYCOPY(To, From, Count) \ 371 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 372 # else 373 # define YYCOPY(To, From, Count) \ 374 do \ 375 { \ 376 register YYSIZE_T yyi; \ 377 for (yyi = 0; yyi < (Count); yyi++) \ 378 (To)[yyi] = (From)[yyi]; \ 379 } \ 380 while (0) 381 # endif 382 # endif 383 384 /* Relocate STACK from its old location to the new one. The 385 local variables YYSIZE and YYSTACKSIZE give the old and new number of 386 elements in the stack, and YYPTR gives the new location of the 387 stack. Advance YYPTR to a properly aligned location for the next 388 stack. */ 389 # define YYSTACK_RELOCATE(Stack) \ 390 do \ 391 { \ 392 YYSIZE_T yynewbytes; \ 393 YYCOPY (&yyptr->Stack, Stack, yysize); \ 394 Stack = &yyptr->Stack; \ 395 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 396 yyptr += yynewbytes / sizeof (*yyptr); \ 397 } \ 398 while (0) 399 400 #endif 401 402 #if defined (__STDC__) || defined (__cplusplus) 403 typedef signed char yysigned_char; 404 #else 405 typedef short yysigned_char; 406 #endif 407 408 /* YYFINAL -- State number of the termination state. */ 409 #define YYFINAL 42 410 /* YYLAST -- Last index in YYTABLE. */ 411 #define YYLAST 1041 412 413 /* YYNTOKENS -- Number of terminals. */ 414 #define YYNTOKENS 66 415 /* YYNNTS -- Number of nonterminals. */ 416 #define YYNNTS 15 417 /* YYNRULES -- Number of rules. */ 418 #define YYNRULES 96 419 /* YYNRULES -- Number of states. */ 420 #define YYNSTATES 182 421 422 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 423 #define YYUNDEFTOK 2 424 #define YYMAXUTOK 301 425 426 #define YYTRANSLATE(YYX) \ 427 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 428 429 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 430 static const unsigned char yytranslate[] = 431 { 432 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 435 2, 2, 2, 2, 2, 2, 2, 2, 32, 61, 436 55, 60, 34, 30, 62, 31, 54, 35, 2, 2, 437 2, 2, 2, 2, 2, 2, 2, 2, 2, 59, 438 22, 21, 23, 2, 29, 2, 2, 2, 2, 2, 439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 441 2, 56, 2, 65, 2, 2, 2, 2, 2, 2, 442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 444 2, 2, 2, 63, 2, 64, 2, 2, 2, 2, 445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 457 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 458 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 459 15, 16, 17, 18, 19, 20, 24, 25, 26, 27, 460 28, 33, 36, 37, 38, 39, 40, 41, 42, 43, 461 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 462 57, 58 463 }; 464 465 #if YYDEBUG 466 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 467 YYRHS. */ 468 static const unsigned short yyprhs[] = 469 { 470 0, 0, 3, 5, 7, 9, 13, 16, 19, 24, 471 29, 30, 38, 39, 46, 50, 52, 54, 56, 60, 472 63, 66, 69, 72, 73, 75, 79, 83, 89, 94, 473 98, 102, 106, 110, 114, 118, 122, 126, 130, 134, 474 138, 142, 148, 154, 158, 165, 172, 177, 181, 185, 475 189, 193, 198, 202, 207, 211, 214, 217, 221, 225, 476 229, 232, 235, 243, 251, 257, 261, 265, 269, 275, 477 278, 279, 283, 285, 287, 288, 290, 292, 294, 296, 478 298, 301, 303, 306, 308, 311, 313, 315, 317, 319, 479 322, 324, 327, 330, 334, 337, 340 480 }; 481 482 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 483 static const yysigned_char yyrhs[] = 484 { 485 67, 0, -1, 68, -1, 80, -1, 72, -1, 68, 486 59, 72, -1, 69, 13, -1, 69, 11, -1, 69, 487 55, 73, 60, -1, 80, 55, 72, 60, -1, -1, 488 80, 61, 71, 70, 55, 72, 60, -1, -1, 69, 489 55, 72, 24, 72, 60, -1, 55, 68, 60, -1, 490 77, -1, 14, -1, 69, -1, 72, 15, 72, -1, 491 31, 72, -1, 30, 72, -1, 38, 72, -1, 39, 492 72, -1, -1, 72, -1, 78, 57, 72, -1, 73, 493 62, 72, -1, 73, 62, 78, 57, 72, -1, 63, 494 80, 64, 72, -1, 72, 40, 72, -1, 72, 34, 495 72, -1, 72, 35, 72, -1, 72, 36, 72, -1, 496 72, 37, 72, -1, 72, 29, 72, -1, 72, 30, 497 72, -1, 72, 32, 72, -1, 72, 31, 72, -1, 498 72, 21, 72, -1, 72, 28, 72, -1, 72, 27, 499 72, -1, 72, 25, 72, 24, 72, -1, 72, 25, 500 72, 52, 74, -1, 72, 25, 7, -1, 72, 38, 501 25, 72, 24, 72, -1, 72, 38, 25, 72, 52, 502 74, -1, 72, 38, 25, 7, -1, 72, 26, 72, 503 -1, 72, 22, 72, -1, 72, 23, 72, -1, 72, 504 20, 72, -1, 72, 20, 17, 72, -1, 72, 19, 505 72, -1, 72, 19, 16, 72, -1, 72, 18, 72, 506 -1, 69, 45, -1, 69, 44, -1, 69, 43, 74, 507 -1, 69, 42, 74, -1, 69, 41, 74, -1, 69, 508 51, -1, 69, 50, -1, 76, 47, 55, 72, 62, 509 72, 60, -1, 76, 48, 55, 72, 62, 72, 60, 510 -1, 76, 53, 55, 72, 60, -1, 75, 43, 74, 511 -1, 75, 42, 74, -1, 75, 41, 74, -1, 75, 512 49, 55, 72, 60, -1, 75, 46, -1, -1, 55, 513 3, 60, -1, 7, -1, 75, -1, -1, 3, -1, 514 5, -1, 6, -1, 4, -1, 9, -1, 58, 7, 515 -1, 10, -1, 79, 10, -1, 12, -1, 79, 12, 516 -1, 10, -1, 7, -1, 12, -1, 8, -1, 79, 517 8, -1, 7, -1, 79, 7, -1, 7, 45, -1, 518 79, 7, 45, -1, 34, 72, -1, 32, 72, -1, 519 72, 56, 72, 65, -1 520 }; 521 522 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 523 static const unsigned short yyrline[] = 524 { 525 0, 217, 217, 218, 224, 225, 230, 234, 241, 249, 526 257, 257, 266, 270, 274, 277, 280, 284, 287, 291, 527 295, 299, 303, 307, 310, 312, 314, 316, 320, 330, 528 334, 338, 342, 346, 350, 354, 358, 362, 366, 370, 529 374, 378, 380, 385, 390, 394, 400, 408, 412, 416, 530 420, 424, 428, 432, 436, 440, 442, 448, 451, 454, 531 457, 459, 461, 463, 465, 467, 470, 473, 476, 478, 532 482, 484, 489, 496, 498, 504, 508, 515, 523, 527, 533 535, 539, 540, 542, 545, 550, 551, 552, 555, 557, 534 562, 563, 564, 566, 573, 575, 577 535 }; 536 #endif 537 538 #if YYDEBUG || YYERROR_VERBOSE 539 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 540 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 541 static const char *const yytname[] = 542 { 543 "$end", "error", "$undefined", "INT", "NULL_PTR", "CHARLIT", "FLOAT", 544 "TYPENAME", "BLOCKNAME", "STRING", "NAME", "DOT_ID", "OBJECT_RENAMING", 545 "DOT_ALL", "SPECIAL_VARIABLE", "ASSIGN", "ELSE", "THEN", "XOR", "OR", 546 "_AND_", "'='", "'<'", "'>'", "DOTDOT", "IN", "GEQ", "LEQ", "NOTEQUAL", 547 "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'", "'/'", "REM", "MOD", "NOT", 548 "ABS", "STARSTAR", "TICK_LENGTH", "TICK_LAST", "TICK_FIRST", 549 "TICK_ADDRESS", "TICK_ACCESS", "TICK_MODULUS", "TICK_MIN", "TICK_MAX", 550 "TICK_VAL", "TICK_TAG", "TICK_SIZE", "TICK_RANGE", "TICK_POS", "'.'", 551 "'('", "'['", "ARROW", "NEW", "';'", "')'", "'''", "','", "'{'", "'}'", 552 "']'", "$accept", "start", "exp1", "simple_exp", "@1", "save_qualifier", 553 "exp", "arglist", "tick_arglist", "type_prefix", "opt_type_prefix", 554 "variable", "any_name", "block", "type", 0 555 }; 556 #endif 557 558 # ifdef YYPRINT 559 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 560 token YYLEX-NUM. */ 561 static const unsigned short yytoknum[] = 562 { 563 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 564 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 565 275, 61, 60, 62, 276, 277, 278, 279, 280, 64, 566 43, 45, 38, 281, 42, 47, 282, 283, 284, 285, 567 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 568 296, 297, 298, 299, 46, 40, 91, 300, 301, 59, 569 41, 39, 44, 123, 125, 93 570 }; 571 # endif 572 573 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 574 static const unsigned char yyr1[] = 575 { 576 0, 66, 67, 67, 68, 68, 69, 69, 69, 69, 577 70, 69, 71, 69, 69, 69, 69, 72, 72, 72, 578 72, 72, 72, 73, 73, 73, 73, 73, 72, 72, 579 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 580 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 581 72, 72, 72, 72, 72, 69, 69, 69, 69, 69, 582 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 583 74, 74, 75, 76, 76, 72, 72, 72, 72, 72, 584 72, 77, 77, 77, 77, 78, 78, 78, 79, 79, 585 80, 80, 80, 80, 72, 72, 72 586 }; 587 588 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 589 static const unsigned char yyr2[] = 590 { 591 0, 2, 1, 1, 1, 3, 2, 2, 4, 4, 592 0, 7, 0, 6, 3, 1, 1, 1, 3, 2, 593 2, 2, 2, 0, 1, 3, 3, 5, 4, 3, 594 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 595 3, 5, 5, 3, 6, 6, 4, 3, 3, 3, 596 3, 4, 3, 4, 3, 2, 2, 3, 3, 3, 597 2, 2, 7, 7, 5, 3, 3, 3, 5, 2, 598 0, 3, 1, 1, 0, 1, 1, 1, 1, 1, 599 2, 1, 2, 1, 2, 1, 1, 1, 1, 2, 600 1, 2, 2, 3, 2, 2, 4 601 }; 602 603 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 604 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 605 means the default is an error. */ 606 static const unsigned char yydefact[] = 607 { 608 74, 75, 78, 76, 77, 72, 88, 79, 81, 83, 609 16, 74, 74, 74, 74, 74, 74, 74, 0, 0, 610 0, 2, 17, 4, 73, 0, 15, 0, 3, 92, 611 20, 0, 19, 95, 94, 21, 22, 0, 80, 90, 612 0, 0, 1, 74, 7, 6, 70, 70, 70, 56, 613 55, 61, 60, 74, 74, 74, 74, 74, 74, 74, 614 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 615 74, 74, 74, 0, 74, 74, 70, 70, 70, 69, 616 0, 0, 0, 0, 91, 89, 82, 84, 74, 12, 617 14, 74, 5, 0, 59, 58, 57, 72, 81, 83, 618 24, 0, 0, 18, 54, 74, 52, 74, 50, 38, 619 48, 49, 43, 0, 47, 40, 39, 34, 35, 37, 620 36, 30, 31, 32, 33, 74, 29, 0, 67, 66, 621 65, 74, 74, 74, 74, 93, 0, 10, 28, 0, 622 74, 8, 74, 74, 53, 51, 74, 70, 46, 0, 623 96, 0, 0, 0, 0, 9, 0, 71, 0, 26, 624 0, 25, 41, 42, 74, 70, 68, 74, 74, 64, 625 74, 13, 74, 44, 45, 0, 0, 0, 27, 62, 626 63, 11 627 }; 628 629 /* YYDEFGOTO[NTERM-NUM]. */ 630 static const short yydefgoto[] = 631 { 632 -1, 20, 21, 22, 156, 137, 23, 101, 94, 24, 633 25, 26, 102, 27, 31 634 }; 635 636 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 637 STATE-NUM. */ 638 #define YYPACT_NINF -52 639 static const short yypact[] = 640 { 641 233, -52, -52, -52, -52, 17, -52, -52, -52, -52, 642 -52, 233, 233, 233, 233, 233, 233, 233, 23, 26, 643 41, 15, 137, 923, 56, -22, -52, 118, -32, -52, 644 33, -32, 33, 19, 19, 33, 33, -21, -52, 31, 645 58, 29, -52, 233, -52, -52, 24, 24, 24, -52, 646 -52, -52, -52, 78, 233, 233, 159, 196, 233, 233, 647 233, 270, 233, 233, 233, 233, 233, 233, 233, 233, 648 233, 233, 233, 70, 233, 233, 24, 24, 24, -52, 649 45, 49, 60, 63, 66, -52, -52, -52, 233, -52, 650 -52, 233, 923, 110, -52, -52, -52, 46, 62, 77, 651 891, -51, 80, 955, 978, 233, 978, 233, 978, -16, 652 -16, -16, 980, 813, -16, -16, -16, 358, 33, 33, 653 33, -28, -28, -28, -28, 307, -28, 390, -52, -52, 654 -52, 233, 233, 233, 233, -52, 512, -52, 19, 67, 655 233, -52, 344, 233, 978, 978, 233, 24, 980, 852, 656 -52, 555, 422, 467, 598, -52, 84, -52, 641, 923, 657 85, 923, -16, -52, 233, 24, -52, 233, 233, -52, 658 233, -52, 233, -16, -52, 684, 727, 770, 923, -52, 659 -52, -52 660 }; 661 662 /* YYPGOTO[NTERM-NUM]. */ 663 static const yysigned_char yypgoto[] = 664 { 665 -52, -52, 126, -52, -52, -52, -11, -52, -41, -52, 666 -52, -52, 2, 127, 8 667 }; 668 669 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 670 positive, shift that token. If negative, reduce the rule which 671 number is the opposite. If zero, do what YYDEFACT says. 672 If YYTABLE_NINF, syntax error. */ 673 #define YYTABLE_NINF -91 674 static const short yytable[] = 675 { 676 30, 32, 33, 34, 35, 36, 95, 96, 28, 141, 677 73, 142, 74, 65, 66, 67, 68, -90, 69, 70, 678 71, 72, 73, 88, 74, 81, 82, 41, 75, 89, 679 38, 83, 92, 39, 6, 128, 129, 130, 43, 90, 680 75, 42, 100, 103, 104, 106, 108, 109, 110, 111, 681 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 682 123, 124, 29, 126, 127, 84, 85, 69, 70, 71, 683 72, 73, -90, 74, 43, 75, 29, 136, -90, 93, 684 138, 1, 2, 3, 4, 97, 6, 7, 98, 75, 685 99, 29, 10, 91, 144, 125, 145, 76, 77, 78, 686 131, -90, 79, -86, 132, 80, 163, -90, 11, 12, 687 13, 135, 14, 139, 149, 133, 15, 16, 134, -85, 688 151, 152, 153, 154, 174, 84, 85, 157, 86, 158, 689 87, 159, 161, 17, -87, 162, 18, 143, -23, 170, 690 -23, 19, 172, 37, 160, 0, 40, 0, 44, 0, 691 45, 0, 0, 173, 0, 0, 175, 176, 0, 177, 692 0, 178, 1, 2, 3, 4, 5, 6, 7, 8, 693 0, 9, 0, 10, 0, 105, 0, 0, 46, 47, 694 48, 49, 50, 0, 0, 0, 0, 51, 52, 11, 695 12, 13, 53, 14, 0, 0, 0, 15, 16, 1, 696 2, 3, 4, 5, 6, 7, 8, 0, 9, 0, 697 10, 0, 0, 107, 17, 0, 0, 18, 0, 0, 698 0, 0, 19, 0, 0, 0, 11, 12, 13, 0, 699 14, 0, 0, 0, 15, 16, 1, 2, 3, 4, 700 5, 6, 7, 8, 0, 9, 0, 10, 0, 0, 701 0, 17, 0, 0, 18, 0, 0, 0, 0, 19, 702 0, 0, 0, 11, 12, 13, 0, 14, 0, 0, 703 0, 15, 16, 1, 2, 3, 4, 112, 6, 7, 704 8, 0, 9, 0, 10, 0, 0, 0, 17, 0, 705 0, 18, 0, 0, 0, 0, 19, 0, 0, 0, 706 11, 12, 13, 0, 14, 0, 0, 0, 15, 16, 707 1, 2, 3, 4, 148, 6, 7, 8, 0, 9, 708 0, 10, 0, 0, 0, 17, 0, 0, 18, 0, 709 0, 0, 0, 19, 0, 0, 0, 11, 12, 13, 710 0, 14, 0, 0, 0, 15, 16, 1, 2, 3, 711 4, 97, 6, 7, 98, 0, 99, 0, 10, 0, 712 0, 0, 17, 0, 0, 18, 0, 0, 0, 0, 713 19, 0, 0, 0, 11, 12, 13, 0, 14, 0, 714 0, 0, 15, 16, 0, 0, 0, 0, 66, 67, 715 68, 0, 69, 70, 71, 72, 73, 0, 74, 17, 716 0, 0, 18, 0, 0, 54, 0, 19, 55, 56, 717 57, 58, 59, 60, 75, 61, 62, 63, 64, 65, 718 66, 67, 68, 0, 69, 70, 71, 72, 73, 0, 719 74, 0, 0, 0, 0, 0, 0, 54, 0, 0, 720 55, 56, 57, 58, 59, 60, 75, 61, 62, 63, 721 64, 65, 66, 67, 68, 150, 69, 70, 71, 72, 722 73, 0, 74, 0, 0, 0, 0, 0, 0, 0, 723 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 724 0, 0, 54, 0, 167, 55, 56, 57, 58, 59, 725 60, 0, 61, 62, 63, 64, 65, 66, 67, 68, 726 0, 69, 70, 71, 72, 73, 0, 74, 0, 0, 727 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 728 0, 0, 0, 75, 0, 0, 0, 54, 0, 168, 729 55, 56, 57, 58, 59, 60, 0, 61, 62, 63, 730 64, 65, 66, 67, 68, 0, 69, 70, 71, 72, 731 73, 0, 74, 0, 0, 0, 0, 0, 0, 0, 732 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 733 54, 0, 155, 55, 56, 57, 58, 59, 60, 0, 734 61, 62, 63, 64, 65, 66, 67, 68, 0, 69, 735 70, 71, 72, 73, 0, 74, 0, 0, 0, 0, 736 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 737 0, 75, 0, 54, 0, 166, 55, 56, 57, 58, 738 59, 60, 0, 61, 62, 63, 64, 65, 66, 67, 739 68, 0, 69, 70, 71, 72, 73, 0, 74, 0, 740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 741 0, 0, 0, 0, 75, 0, 54, 0, 169, 55, 742 56, 57, 58, 59, 60, 0, 61, 62, 63, 64, 743 65, 66, 67, 68, 0, 69, 70, 71, 72, 73, 744 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 745 0, 0, 0, 0, 0, 0, 0, 75, 0, 54, 746 0, 171, 55, 56, 57, 58, 59, 60, 0, 61, 747 62, 63, 64, 65, 66, 67, 68, 0, 69, 70, 748 71, 72, 73, 0, 74, 0, 0, 0, 0, 0, 749 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 750 75, 0, 54, 0, 179, 55, 56, 57, 58, 59, 751 60, 0, 61, 62, 63, 64, 65, 66, 67, 68, 752 0, 69, 70, 71, 72, 73, 0, 74, 0, 0, 753 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 754 0, 0, 0, 75, 0, 54, 0, 180, 55, 56, 755 57, 58, 59, 60, 0, 61, 62, 63, 64, 65, 756 66, 67, 68, 0, 69, 70, 71, 72, 73, 0, 757 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 758 0, 0, 0, 0, 0, 0, 75, 0, 54, 0, 759 181, 55, 56, 57, 58, 59, 60, 146, 61, 62, 760 63, 64, 65, 66, 67, 68, 0, 69, 70, 71, 761 72, 73, 0, 74, 0, 0, 0, 0, 0, 0, 762 0, 0, 0, 0, 0, 147, 0, 54, 0, 75, 763 55, 56, 57, 58, 59, 60, 164, 61, 62, 63, 764 64, 65, 66, 67, 68, 0, 69, 70, 71, 72, 765 73, 0, 74, 0, 0, 0, 0, 0, 0, 0, 766 0, 0, 0, 0, 165, 0, 54, 0, 75, 55, 767 56, 57, 58, 59, 60, 140, 61, 62, 63, 64, 768 65, 66, 67, 68, 0, 69, 70, 71, 72, 73, 769 0, 74, 0, 0, 0, 0, 0, 0, 54, 0, 770 0, 55, 56, 57, 58, 59, 60, 75, 61, 62, 771 63, 64, 65, 66, 67, 68, 0, 69, 70, 71, 772 72, 73, 0, 74, 0, 0, 0, 0, 0, 0, 773 -91, 0, 0, 55, 56, 57, 58, 59, 60, 75, 774 61, 62, 63, 64, 65, 66, 67, 68, 0, 69, 775 70, 71, 72, 73, 0, 74, 0, 0, 0, 58, 776 59, 60, 0, 61, 62, 63, 64, 65, 66, 67, 777 68, 75, 69, 70, 71, 72, 73, 0, 74, 0, 778 0, -72, -72, -72, 0, 29, -72, -72, -72, -72, 779 0, 0, 0, -72, 75, -90, 0, 0, 0, 0, 780 0, -90 781 }; 782 783 static const short yycheck[] = 784 { 785 11, 12, 13, 14, 15, 16, 47, 48, 0, 60, 786 38, 62, 40, 29, 30, 31, 32, 0, 34, 35, 787 36, 37, 38, 55, 40, 47, 48, 19, 56, 61, 788 7, 53, 43, 7, 8, 76, 77, 78, 59, 60, 789 56, 0, 53, 54, 55, 56, 57, 58, 59, 60, 790 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 791 71, 72, 45, 74, 75, 7, 8, 34, 35, 36, 792 37, 38, 55, 40, 59, 56, 45, 88, 61, 55, 793 91, 3, 4, 5, 6, 7, 8, 9, 10, 56, 794 12, 45, 14, 64, 105, 25, 107, 41, 42, 43, 795 55, 55, 46, 57, 55, 49, 147, 61, 30, 31, 796 32, 45, 34, 3, 125, 55, 38, 39, 55, 57, 797 131, 132, 133, 134, 165, 7, 8, 60, 10, 140, 798 12, 142, 143, 55, 57, 146, 58, 57, 60, 55, 799 62, 63, 57, 17, 142, -1, 19, -1, 11, -1, 800 13, -1, -1, 164, -1, -1, 167, 168, -1, 170, 801 -1, 172, 3, 4, 5, 6, 7, 8, 9, 10, 802 -1, 12, -1, 14, -1, 16, -1, -1, 41, 42, 803 43, 44, 45, -1, -1, -1, -1, 50, 51, 30, 804 31, 32, 55, 34, -1, -1, -1, 38, 39, 3, 805 4, 5, 6, 7, 8, 9, 10, -1, 12, -1, 806 14, -1, -1, 17, 55, -1, -1, 58, -1, -1, 807 -1, -1, 63, -1, -1, -1, 30, 31, 32, -1, 808 34, -1, -1, -1, 38, 39, 3, 4, 5, 6, 809 7, 8, 9, 10, -1, 12, -1, 14, -1, -1, 810 -1, 55, -1, -1, 58, -1, -1, -1, -1, 63, 811 -1, -1, -1, 30, 31, 32, -1, 34, -1, -1, 812 -1, 38, 39, 3, 4, 5, 6, 7, 8, 9, 813 10, -1, 12, -1, 14, -1, -1, -1, 55, -1, 814 -1, 58, -1, -1, -1, -1, 63, -1, -1, -1, 815 30, 31, 32, -1, 34, -1, -1, -1, 38, 39, 816 3, 4, 5, 6, 7, 8, 9, 10, -1, 12, 817 -1, 14, -1, -1, -1, 55, -1, -1, 58, -1, 818 -1, -1, -1, 63, -1, -1, -1, 30, 31, 32, 819 -1, 34, -1, -1, -1, 38, 39, 3, 4, 5, 820 6, 7, 8, 9, 10, -1, 12, -1, 14, -1, 821 -1, -1, 55, -1, -1, 58, -1, -1, -1, -1, 822 63, -1, -1, -1, 30, 31, 32, -1, 34, -1, 823 -1, -1, 38, 39, -1, -1, -1, -1, 30, 31, 824 32, -1, 34, 35, 36, 37, 38, -1, 40, 55, 825 -1, -1, 58, -1, -1, 15, -1, 63, 18, 19, 826 20, 21, 22, 23, 56, 25, 26, 27, 28, 29, 827 30, 31, 32, -1, 34, 35, 36, 37, 38, -1, 828 40, -1, -1, -1, -1, -1, -1, 15, -1, -1, 829 18, 19, 20, 21, 22, 23, 56, 25, 26, 27, 830 28, 29, 30, 31, 32, 65, 34, 35, 36, 37, 831 38, -1, 40, -1, -1, -1, -1, -1, -1, -1, 832 -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, 833 -1, -1, 15, -1, 62, 18, 19, 20, 21, 22, 834 23, -1, 25, 26, 27, 28, 29, 30, 31, 32, 835 -1, 34, 35, 36, 37, 38, -1, 40, -1, -1, 836 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 837 -1, -1, -1, 56, -1, -1, -1, 15, -1, 62, 838 18, 19, 20, 21, 22, 23, -1, 25, 26, 27, 839 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, 840 38, -1, 40, -1, -1, -1, -1, -1, -1, -1, 841 -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, 842 15, -1, 60, 18, 19, 20, 21, 22, 23, -1, 843 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, 844 35, 36, 37, 38, -1, 40, -1, -1, -1, -1, 845 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 846 -1, 56, -1, 15, -1, 60, 18, 19, 20, 21, 847 22, 23, -1, 25, 26, 27, 28, 29, 30, 31, 848 32, -1, 34, 35, 36, 37, 38, -1, 40, -1, 849 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 850 -1, -1, -1, -1, 56, -1, 15, -1, 60, 18, 851 19, 20, 21, 22, 23, -1, 25, 26, 27, 28, 852 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 853 -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, 854 -1, -1, -1, -1, -1, -1, -1, 56, -1, 15, 855 -1, 60, 18, 19, 20, 21, 22, 23, -1, 25, 856 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 857 36, 37, 38, -1, 40, -1, -1, -1, -1, -1, 858 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 859 56, -1, 15, -1, 60, 18, 19, 20, 21, 22, 860 23, -1, 25, 26, 27, 28, 29, 30, 31, 32, 861 -1, 34, 35, 36, 37, 38, -1, 40, -1, -1, 862 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 863 -1, -1, -1, 56, -1, 15, -1, 60, 18, 19, 864 20, 21, 22, 23, -1, 25, 26, 27, 28, 29, 865 30, 31, 32, -1, 34, 35, 36, 37, 38, -1, 866 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, 867 -1, -1, -1, -1, -1, -1, 56, -1, 15, -1, 868 60, 18, 19, 20, 21, 22, 23, 24, 25, 26, 869 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, 870 37, 38, -1, 40, -1, -1, -1, -1, -1, -1, 871 -1, -1, -1, -1, -1, 52, -1, 15, -1, 56, 872 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 873 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, 874 38, -1, 40, -1, -1, -1, -1, -1, -1, -1, 875 -1, -1, -1, -1, 52, -1, 15, -1, 56, 18, 876 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 877 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 878 -1, 40, -1, -1, -1, -1, -1, -1, 15, -1, 879 -1, 18, 19, 20, 21, 22, 23, 56, 25, 26, 880 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, 881 37, 38, -1, 40, -1, -1, -1, -1, -1, -1, 882 15, -1, -1, 18, 19, 20, 21, 22, 23, 56, 883 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, 884 35, 36, 37, 38, -1, 40, -1, -1, -1, 21, 885 22, 23, -1, 25, 26, 27, 28, 29, 30, 31, 886 32, 56, 34, 35, 36, 37, 38, -1, 40, -1, 887 -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, 888 -1, -1, -1, 53, 56, 55, -1, -1, -1, -1, 889 -1, 61 890 }; 891 892 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 893 symbol of state STATE-NUM. */ 894 static const unsigned char yystos[] = 895 { 896 0, 3, 4, 5, 6, 7, 8, 9, 10, 12, 897 14, 30, 31, 32, 34, 38, 39, 55, 58, 63, 898 67, 68, 69, 72, 75, 76, 77, 79, 80, 45, 899 72, 80, 72, 72, 72, 72, 72, 68, 7, 7, 900 79, 80, 0, 59, 11, 13, 41, 42, 43, 44, 901 45, 50, 51, 55, 15, 18, 19, 20, 21, 22, 902 23, 25, 26, 27, 28, 29, 30, 31, 32, 34, 903 35, 36, 37, 38, 40, 56, 41, 42, 43, 46, 904 49, 47, 48, 53, 7, 8, 10, 12, 55, 61, 905 60, 64, 72, 55, 74, 74, 74, 7, 10, 12, 906 72, 73, 78, 72, 72, 16, 72, 17, 72, 72, 907 72, 72, 7, 72, 72, 72, 72, 72, 72, 72, 908 72, 72, 72, 72, 72, 25, 72, 72, 74, 74, 909 74, 55, 55, 55, 55, 45, 72, 71, 72, 3, 910 24, 60, 62, 57, 72, 72, 24, 52, 7, 72, 911 65, 72, 72, 72, 72, 60, 70, 60, 72, 72, 912 78, 72, 72, 74, 24, 52, 60, 62, 62, 60, 913 55, 60, 57, 72, 74, 72, 72, 72, 72, 60, 914 60, 60 915 }; 916 917 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 918 # define YYSIZE_T __SIZE_TYPE__ 919 #endif 920 #if ! defined (YYSIZE_T) && defined (size_t) 921 # define YYSIZE_T size_t 922 #endif 923 #if ! defined (YYSIZE_T) 924 # if defined (__STDC__) || defined (__cplusplus) 925 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 926 # define YYSIZE_T size_t 927 # endif 928 #endif 929 #if ! defined (YYSIZE_T) 930 # define YYSIZE_T unsigned int 931 #endif 932 933 #define yyerrok (yyerrstatus = 0) 934 #define yyclearin (yychar = YYEMPTY) 935 #define YYEMPTY (-2) 936 #define YYEOF 0 937 938 #define YYACCEPT goto yyacceptlab 939 #define YYABORT goto yyabortlab 940 #define YYERROR goto yyerrorlab 941 942 943 /* Like YYERROR except do call yyerror. This remains here temporarily 944 to ease the transition to the new meaning of YYERROR, for GCC. 945 Once GCC version 2 has supplanted version 1, this can go. */ 946 947 #define YYFAIL goto yyerrlab 948 949 #define YYRECOVERING() (!!yyerrstatus) 950 951 #define YYBACKUP(Token, Value) \ 952 do \ 953 if (yychar == YYEMPTY && yylen == 1) \ 954 { \ 955 yychar = (Token); \ 956 yylval = (Value); \ 957 yytoken = YYTRANSLATE (yychar); \ 958 YYPOPSTACK; \ 959 goto yybackup; \ 960 } \ 961 else \ 962 { \ 963 yyerror ("syntax error: cannot back up");\ 964 YYERROR; \ 965 } \ 966 while (0) 967 968 #define YYTERROR 1 969 #define YYERRCODE 256 970 971 /* YYLLOC_DEFAULT -- Compute the default location (before the actions 972 are run). */ 973 974 #ifndef YYLLOC_DEFAULT 975 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 976 ((Current).first_line = (Rhs)[1].first_line, \ 977 (Current).first_column = (Rhs)[1].first_column, \ 978 (Current).last_line = (Rhs)[N].last_line, \ 979 (Current).last_column = (Rhs)[N].last_column) 980 #endif 981 982 /* YYLEX -- calling `yylex' with the right arguments. */ 983 984 #ifdef YYLEX_PARAM 985 # define YYLEX yylex (YYLEX_PARAM) 986 #else 987 # define YYLEX yylex () 988 #endif 989 990 /* Enable debugging if requested. */ 991 #if YYDEBUG 992 993 # ifndef YYFPRINTF 994 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 995 # define YYFPRINTF fprintf 996 # endif 997 998 # define YYDPRINTF(Args) \ 999 do { \ 1000 if (yydebug) \ 1001 YYFPRINTF Args; \ 1002 } while (0) 1003 1004 # define YYDSYMPRINT(Args) \ 1005 do { \ 1006 if (yydebug) \ 1007 yysymprint Args; \ 1008 } while (0) 1009 1010 # define YYDSYMPRINTF(Title, Token, Value, Location) \ 1011 do { \ 1012 if (yydebug) \ 1013 { \ 1014 YYFPRINTF (stderr, "%s ", Title); \ 1015 yysymprint (stderr, \ 1016 Token, Value); \ 1017 YYFPRINTF (stderr, "\n"); \ 1018 } \ 1019 } while (0) 1020 1021 /*------------------------------------------------------------------. 1022 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 1023 | TOP (included). | 1024 `------------------------------------------------------------------*/ 1025 1026 #if defined (__STDC__) || defined (__cplusplus) 1027 static void 1028 yy_stack_print (short *bottom, short *top) 1029 #else 1030 static void 1031 yy_stack_print (bottom, top) 1032 short *bottom; 1033 short *top; 1034 #endif 1035 { 1036 YYFPRINTF (stderr, "Stack now"); 1037 for (/* Nothing. */; bottom <= top; ++bottom) 1038 YYFPRINTF (stderr, " %d", *bottom); 1039 YYFPRINTF (stderr, "\n"); 1040 } 1041 1042 # define YY_STACK_PRINT(Bottom, Top) \ 1043 do { \ 1044 if (yydebug) \ 1045 yy_stack_print ((Bottom), (Top)); \ 1046 } while (0) 1047 1048 1049 /*------------------------------------------------. 1050 | Report that the YYRULE is going to be reduced. | 1051 `------------------------------------------------*/ 1052 1053 #if defined (__STDC__) || defined (__cplusplus) 1054 static void 1055 yy_reduce_print (int yyrule) 1056 #else 1057 static void 1058 yy_reduce_print (yyrule) 1059 int yyrule; 1060 #endif 1061 { 1062 int yyi; 1063 unsigned int yylno = yyrline[yyrule]; 1064 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", 1065 yyrule - 1, yylno); 1066 /* Print the symbols being reduced, and their result. */ 1067 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) 1068 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); 1069 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); 1070 } 1071 1072 # define YY_REDUCE_PRINT(Rule) \ 1073 do { \ 1074 if (yydebug) \ 1075 yy_reduce_print (Rule); \ 1076 } while (0) 1077 1078 /* Nonzero means print parse trace. It is left uninitialized so that 1079 multiple parsers can coexist. */ 1080 int yydebug; 1081 #else /* !YYDEBUG */ 1082 # define YYDPRINTF(Args) 1083 # define YYDSYMPRINT(Args) 1084 # define YYDSYMPRINTF(Title, Token, Value, Location) 1085 # define YY_STACK_PRINT(Bottom, Top) 1086 # define YY_REDUCE_PRINT(Rule) 1087 #endif /* !YYDEBUG */ 1088 1089 1090 /* YYINITDEPTH -- initial size of the parser's stacks. */ 1091 #ifndef YYINITDEPTH 1092 # define YYINITDEPTH 200 1093 #endif 1094 1095 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1096 if the built-in stack extension method is used). 1097 1098 Do not make this value too large; the results are undefined if 1099 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) 1100 evaluated with infinite-precision integer arithmetic. */ 1101 1102 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 1103 # undef YYMAXDEPTH 1104 #endif 1105 1106 #ifndef YYMAXDEPTH 1107 # define YYMAXDEPTH 10000 1108 #endif 1109 1110 1111 1112 #if YYERROR_VERBOSE 1113 1114 # ifndef yystrlen 1115 # if defined (__GLIBC__) && defined (_STRING_H) 1116 # define yystrlen strlen 1117 # else 1118 /* Return the length of YYSTR. */ 1119 static YYSIZE_T 1120 # if defined (__STDC__) || defined (__cplusplus) 1121 yystrlen (const char *yystr) 1122 # else 1123 yystrlen (yystr) 1124 const char *yystr; 1125 # endif 1126 { 1127 register const char *yys = yystr; 1128 1129 while (*yys++ != '\0') 1130 continue; 1131 1132 return yys - yystr - 1; 1133 } 1134 # endif 1135 # endif 1136 1137 # ifndef yystpcpy 1138 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) 1139 # define yystpcpy stpcpy 1140 # else 1141 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1142 YYDEST. */ 1143 static char * 1144 # if defined (__STDC__) || defined (__cplusplus) 1145 yystpcpy (char *yydest, const char *yysrc) 1146 # else 1147 yystpcpy (yydest, yysrc) 1148 char *yydest; 1149 const char *yysrc; 1150 # endif 1151 { 1152 register char *yyd = yydest; 1153 register const char *yys = yysrc; 1154 1155 while ((*yyd++ = *yys++) != '\0') 1156 continue; 1157 1158 return yyd - 1; 1159 } 1160 # endif 1161 # endif 1162 1163 #endif /* !YYERROR_VERBOSE */ 1164 1165 1166 1167 #if YYDEBUG 1168 /*--------------------------------. 1169 | Print this symbol on YYOUTPUT. | 1170 `--------------------------------*/ 1171 1172 #if defined (__STDC__) || defined (__cplusplus) 1173 static void 1174 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) 1175 #else 1176 static void 1177 yysymprint (yyoutput, yytype, yyvaluep) 1178 FILE *yyoutput; 1179 int yytype; 1180 YYSTYPE *yyvaluep; 1181 #endif 1182 { 1183 /* Pacify ``unused variable'' warnings. */ 1184 (void) yyvaluep; 1185 1186 if (yytype < YYNTOKENS) 1187 { 1188 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 1189 # ifdef YYPRINT 1190 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 1191 # endif 1192 } 1193 else 1194 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 1195 1196 switch (yytype) 1197 { 1198 default: 1199 break; 1200 } 1201 YYFPRINTF (yyoutput, ")"); 1202 } 1203 1204 #endif /* ! YYDEBUG */ 1205 /*-----------------------------------------------. 1206 | Release the memory associated to this symbol. | 1207 `-----------------------------------------------*/ 1208 1209 #if defined (__STDC__) || defined (__cplusplus) 1210 static void 1211 yydestruct (int yytype, YYSTYPE *yyvaluep) 1212 #else 1213 static void 1214 yydestruct (yytype, yyvaluep) 1215 int yytype; 1216 YYSTYPE *yyvaluep; 1217 #endif 1218 { 1219 /* Pacify ``unused variable'' warnings. */ 1220 (void) yyvaluep; 1221 1222 switch (yytype) 1223 { 1224 1225 default: 1226 break; 1227 } 1228 } 1229 1230 1231 /* Prevent warnings from -Wmissing-prototypes. */ 1232 1233 #ifdef YYPARSE_PARAM 1234 # if defined (__STDC__) || defined (__cplusplus) 1235 int yyparse (void *YYPARSE_PARAM); 1236 # else 1237 int yyparse (); 1238 # endif 1239 #else /* ! YYPARSE_PARAM */ 1240 #if defined (__STDC__) || defined (__cplusplus) 1241 int yyparse (void); 1242 #else 1243 int yyparse (); 1244 #endif 1245 #endif /* ! YYPARSE_PARAM */ 1246 1247 1248 1249 /* The lookahead symbol. */ 1250 int yychar; 1251 1252 /* The semantic value of the lookahead symbol. */ 1253 YYSTYPE yylval; 1254 1255 /* Number of syntax errors so far. */ 1256 int yynerrs; 1257 1258 1259 1260 /*----------. 1261 | yyparse. | 1262 `----------*/ 1263 1264 #ifdef YYPARSE_PARAM 1265 # if defined (__STDC__) || defined (__cplusplus) 1266 int yyparse (void *YYPARSE_PARAM) 1267 # else 1268 int yyparse (YYPARSE_PARAM) 1269 void *YYPARSE_PARAM; 1270 # endif 1271 #else /* ! YYPARSE_PARAM */ 1272 #if defined (__STDC__) || defined (__cplusplus) 1273 int 1274 yyparse (void) 1275 #else 1276 int 1277 yyparse () 1278 1279 #endif 1280 #endif 1281 { 1282 1283 register int yystate; 1284 register int yyn; 1285 int yyresult; 1286 /* Number of tokens to shift before error messages enabled. */ 1287 int yyerrstatus; 1288 /* Lookahead token as an internal (translated) token number. */ 1289 int yytoken = 0; 1290 1291 /* Three stacks and their tools: 1292 `yyss': related to states, 1293 `yyvs': related to semantic values, 1294 `yyls': related to locations. 1295 1296 Refer to the stacks thru separate pointers, to allow yyoverflow 1297 to xreallocate them elsewhere. */ 1298 1299 /* The state stack. */ 1300 short yyssa[YYINITDEPTH]; 1301 short *yyss = yyssa; 1302 register short *yyssp; 1303 1304 /* The semantic value stack. */ 1305 YYSTYPE yyvsa[YYINITDEPTH]; 1306 YYSTYPE *yyvs = yyvsa; 1307 register YYSTYPE *yyvsp; 1308 1309 1310 1311 #define YYPOPSTACK (yyvsp--, yyssp--) 1312 1313 YYSIZE_T yystacksize = YYINITDEPTH; 1314 1315 /* The variables used to return semantic value and location from the 1316 action routines. */ 1317 YYSTYPE yyval; 1318 1319 1320 /* When reducing, the number of symbols on the RHS of the reduced 1321 rule. */ 1322 int yylen; 1323 1324 YYDPRINTF ((stderr, "Starting parse\n")); 1325 1326 yystate = 0; 1327 yyerrstatus = 0; 1328 yynerrs = 0; 1329 yychar = YYEMPTY; /* Cause a token to be read. */ 1330 1331 /* Initialize stack pointers. 1332 Waste one element of value and location stack 1333 so that they stay on the same level as the state stack. 1334 The wasted elements are never initialized. */ 1335 1336 yyssp = yyss; 1337 yyvsp = yyvs; 1338 1339 goto yysetstate; 1340 1341 /*------------------------------------------------------------. 1342 | yynewstate -- Push a new state, which is found in yystate. | 1343 `------------------------------------------------------------*/ 1344 yynewstate: 1345 /* In all cases, when you get here, the value and location stacks 1346 have just been pushed. so pushing a state here evens the stacks. 1347 */ 1348 yyssp++; 1349 1350 yysetstate: 1351 *yyssp = yystate; 1352 1353 if (yyss + yystacksize - 1 <= yyssp) 1354 { 1355 /* Get the current used size of the three stacks, in elements. */ 1356 YYSIZE_T yysize = yyssp - yyss + 1; 1357 1358 #ifdef yyoverflow 1359 { 1360 /* Give user a chance to xreallocate the stack. Use copies of 1361 these so that the &'s don't force the real ones into 1362 memory. */ 1363 YYSTYPE *yyvs1 = yyvs; 1364 short *yyss1 = yyss; 1365 1366 1367 /* Each stack pointer address is followed by the size of the 1368 data in use in that stack, in bytes. This used to be a 1369 conditional around just the two extra args, but that might 1370 be undefined if yyoverflow is a macro. */ 1371 yyoverflow ("parser stack overflow", 1372 &yyss1, yysize * sizeof (*yyssp), 1373 &yyvs1, yysize * sizeof (*yyvsp), 1374 1375 &yystacksize); 1376 1377 yyss = yyss1; 1378 yyvs = yyvs1; 1379 } 1380 #else /* no yyoverflow */ 1381 # ifndef YYSTACK_RELOCATE 1382 goto yyoverflowlab; 1383 # else 1384 /* Extend the stack our own way. */ 1385 if (YYMAXDEPTH <= yystacksize) 1386 goto yyoverflowlab; 1387 yystacksize *= 2; 1388 if (YYMAXDEPTH < yystacksize) 1389 yystacksize = YYMAXDEPTH; 1390 1391 { 1392 short *yyss1 = yyss; 1393 union yyalloc *yyptr = 1394 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1395 if (! yyptr) 1396 goto yyoverflowlab; 1397 YYSTACK_RELOCATE (yyss); 1398 YYSTACK_RELOCATE (yyvs); 1399 1400 # undef YYSTACK_RELOCATE 1401 if (yyss1 != yyssa) 1402 YYSTACK_FREE (yyss1); 1403 } 1404 # endif 1405 #endif /* no yyoverflow */ 1406 1407 yyssp = yyss + yysize - 1; 1408 yyvsp = yyvs + yysize - 1; 1409 1410 1411 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1412 (unsigned long int) yystacksize)); 1413 1414 if (yyss + yystacksize - 1 <= yyssp) 1415 YYABORT; 1416 } 1417 1418 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1419 1420 goto yybackup; 1421 1422 /*-----------. 1423 | yybackup. | 1424 `-----------*/ 1425 yybackup: 1426 1427 /* Do appropriate processing given the current state. */ 1428 /* Read a lookahead token if we need one and don't already have one. */ 1429 /* yyresume: */ 1430 1431 /* First try to decide what to do without reference to lookahead token. */ 1432 1433 yyn = yypact[yystate]; 1434 if (yyn == YYPACT_NINF) 1435 goto yydefault; 1436 1437 /* Not known => get a lookahead token if don't already have one. */ 1438 1439 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1440 if (yychar == YYEMPTY) 1441 { 1442 YYDPRINTF ((stderr, "Reading a token: ")); 1443 yychar = YYLEX; 1444 } 1445 1446 if (yychar <= YYEOF) 1447 { 1448 yychar = yytoken = YYEOF; 1449 YYDPRINTF ((stderr, "Now at end of input.\n")); 1450 } 1451 else 1452 { 1453 yytoken = YYTRANSLATE (yychar); 1454 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); 1455 } 1456 1457 /* If the proper action on seeing token YYTOKEN is to reduce or to 1458 detect an error, take that action. */ 1459 yyn += yytoken; 1460 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1461 goto yydefault; 1462 yyn = yytable[yyn]; 1463 if (yyn <= 0) 1464 { 1465 if (yyn == 0 || yyn == YYTABLE_NINF) 1466 goto yyerrlab; 1467 yyn = -yyn; 1468 goto yyreduce; 1469 } 1470 1471 if (yyn == YYFINAL) 1472 YYACCEPT; 1473 1474 /* Shift the lookahead token. */ 1475 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); 1476 1477 /* Discard the token being shifted unless it is eof. */ 1478 if (yychar != YYEOF) 1479 yychar = YYEMPTY; 1480 1481 *++yyvsp = yylval; 1482 1483 1484 /* Count tokens shifted since error; after three, turn off error 1485 status. */ 1486 if (yyerrstatus) 1487 yyerrstatus--; 1488 1489 yystate = yyn; 1490 goto yynewstate; 1491 1492 1493 /*-----------------------------------------------------------. 1494 | yydefault -- do the default action for the current state. | 1495 `-----------------------------------------------------------*/ 1496 yydefault: 1497 yyn = yydefact[yystate]; 1498 if (yyn == 0) 1499 goto yyerrlab; 1500 goto yyreduce; 1501 1502 1503 /*-----------------------------. 1504 | yyreduce -- Do a reduction. | 1505 `-----------------------------*/ 1506 yyreduce: 1507 /* yyn is the number of a rule to reduce with. */ 1508 yylen = yyr2[yyn]; 1509 1510 /* If YYLEN is nonzero, implement the default value of the action: 1511 `$$ = $1'. 1512 1513 Otherwise, the following line sets YYVAL to garbage. 1514 This behavior is undocumented and Bison 1515 users should not rely upon it. Assigning to YYVAL 1516 unconditionally makes the parser a bit smaller, and it avoids a 1517 GCC warning that YYVAL may be used uninitialized. */ 1518 yyval = yyvsp[1-yylen]; 1519 1520 1521 YY_REDUCE_PRINT (yyn); 1522 switch (yyn) 1523 { 1524 case 3: 1525 #line 218 "ada-exp.y" 1526 { write_exp_elt_opcode (OP_TYPE); 1527 write_exp_elt_type (yyvsp[0].tval); 1528 write_exp_elt_opcode (OP_TYPE); } 1529 break; 1530 1531 case 5: 1532 #line 226 "ada-exp.y" 1533 { write_exp_elt_opcode (BINOP_COMMA); } 1534 break; 1535 1536 case 6: 1537 #line 231 "ada-exp.y" 1538 { write_exp_elt_opcode (UNOP_IND); } 1539 break; 1540 1541 case 7: 1542 #line 235 "ada-exp.y" 1543 { write_exp_elt_opcode (STRUCTOP_STRUCT); 1544 write_exp_string (yyvsp[0].ssym.stoken); 1545 write_exp_elt_opcode (STRUCTOP_STRUCT); 1546 } 1547 break; 1548 1549 case 8: 1550 #line 242 "ada-exp.y" 1551 { 1552 write_exp_elt_opcode (OP_FUNCALL); 1553 write_exp_elt_longcst (yyvsp[-1].lval); 1554 write_exp_elt_opcode (OP_FUNCALL); 1555 } 1556 break; 1557 1558 case 9: 1559 #line 250 "ada-exp.y" 1560 { 1561 write_exp_elt_opcode (UNOP_CAST); 1562 write_exp_elt_type (yyvsp[-3].tval); 1563 write_exp_elt_opcode (UNOP_CAST); 1564 } 1565 break; 1566 1567 case 10: 1568 #line 257 "ada-exp.y" 1569 { type_qualifier = yyvsp[-2].tval; } 1570 break; 1571 1572 case 11: 1573 #line 258 "ada-exp.y" 1574 { 1575 write_exp_elt_opcode (UNOP_QUAL); 1576 write_exp_elt_type (yyvsp[-6].tval); 1577 write_exp_elt_opcode (UNOP_QUAL); 1578 type_qualifier = yyvsp[-4].tval; 1579 } 1580 break; 1581 1582 case 12: 1583 #line 266 "ada-exp.y" 1584 { yyval.tval = type_qualifier; } 1585 break; 1586 1587 case 13: 1588 #line 271 "ada-exp.y" 1589 { write_exp_elt_opcode (TERNOP_SLICE); } 1590 break; 1591 1592 case 14: 1593 #line 274 "ada-exp.y" 1594 { } 1595 break; 1596 1597 case 16: 1598 #line 281 "ada-exp.y" 1599 { write_dollar_variable (yyvsp[0].sval); } 1600 break; 1601 1602 case 18: 1603 #line 288 "ada-exp.y" 1604 { write_exp_elt_opcode (BINOP_ASSIGN); } 1605 break; 1606 1607 case 19: 1608 #line 292 "ada-exp.y" 1609 { write_exp_elt_opcode (UNOP_NEG); } 1610 break; 1611 1612 case 20: 1613 #line 296 "ada-exp.y" 1614 { write_exp_elt_opcode (UNOP_PLUS); } 1615 break; 1616 1617 case 21: 1618 #line 300 "ada-exp.y" 1619 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } 1620 break; 1621 1622 case 22: 1623 #line 304 "ada-exp.y" 1624 { write_exp_elt_opcode (UNOP_ABS); } 1625 break; 1626 1627 case 23: 1628 #line 307 "ada-exp.y" 1629 { yyval.lval = 0; } 1630 break; 1631 1632 case 24: 1633 #line 311 "ada-exp.y" 1634 { yyval.lval = 1; } 1635 break; 1636 1637 case 25: 1638 #line 313 "ada-exp.y" 1639 { yyval.lval = 1; } 1640 break; 1641 1642 case 26: 1643 #line 315 "ada-exp.y" 1644 { yyval.lval = yyvsp[-2].lval + 1; } 1645 break; 1646 1647 case 27: 1648 #line 317 "ada-exp.y" 1649 { yyval.lval = yyvsp[-4].lval + 1; } 1650 break; 1651 1652 case 28: 1653 #line 322 "ada-exp.y" 1654 { write_exp_elt_opcode (UNOP_MEMVAL); 1655 write_exp_elt_type (yyvsp[-2].tval); 1656 write_exp_elt_opcode (UNOP_MEMVAL); 1657 } 1658 break; 1659 1660 case 29: 1661 #line 331 "ada-exp.y" 1662 { write_exp_elt_opcode (BINOP_EXP); } 1663 break; 1664 1665 case 30: 1666 #line 335 "ada-exp.y" 1667 { write_exp_elt_opcode (BINOP_MUL); } 1668 break; 1669 1670 case 31: 1671 #line 339 "ada-exp.y" 1672 { write_exp_elt_opcode (BINOP_DIV); } 1673 break; 1674 1675 case 32: 1676 #line 343 "ada-exp.y" 1677 { write_exp_elt_opcode (BINOP_REM); } 1678 break; 1679 1680 case 33: 1681 #line 347 "ada-exp.y" 1682 { write_exp_elt_opcode (BINOP_MOD); } 1683 break; 1684 1685 case 34: 1686 #line 351 "ada-exp.y" 1687 { write_exp_elt_opcode (BINOP_REPEAT); } 1688 break; 1689 1690 case 35: 1691 #line 355 "ada-exp.y" 1692 { write_exp_elt_opcode (BINOP_ADD); } 1693 break; 1694 1695 case 36: 1696 #line 359 "ada-exp.y" 1697 { write_exp_elt_opcode (BINOP_CONCAT); } 1698 break; 1699 1700 case 37: 1701 #line 363 "ada-exp.y" 1702 { write_exp_elt_opcode (BINOP_SUB); } 1703 break; 1704 1705 case 38: 1706 #line 367 "ada-exp.y" 1707 { write_exp_elt_opcode (BINOP_EQUAL); } 1708 break; 1709 1710 case 39: 1711 #line 371 "ada-exp.y" 1712 { write_exp_elt_opcode (BINOP_NOTEQUAL); } 1713 break; 1714 1715 case 40: 1716 #line 375 "ada-exp.y" 1717 { write_exp_elt_opcode (BINOP_LEQ); } 1718 break; 1719 1720 case 41: 1721 #line 379 "ada-exp.y" 1722 { write_exp_elt_opcode (TERNOP_IN_RANGE); } 1723 break; 1724 1725 case 42: 1726 #line 381 "ada-exp.y" 1727 { write_exp_elt_opcode (BINOP_IN_BOUNDS); 1728 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); 1729 write_exp_elt_opcode (BINOP_IN_BOUNDS); 1730 } 1731 break; 1732 1733 case 43: 1734 #line 386 "ada-exp.y" 1735 { write_exp_elt_opcode (UNOP_IN_RANGE); 1736 write_exp_elt_type (yyvsp[0].tval); 1737 write_exp_elt_opcode (UNOP_IN_RANGE); 1738 } 1739 break; 1740 1741 case 44: 1742 #line 391 "ada-exp.y" 1743 { write_exp_elt_opcode (TERNOP_IN_RANGE); 1744 write_exp_elt_opcode (UNOP_LOGICAL_NOT); 1745 } 1746 break; 1747 1748 case 45: 1749 #line 395 "ada-exp.y" 1750 { write_exp_elt_opcode (BINOP_IN_BOUNDS); 1751 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); 1752 write_exp_elt_opcode (BINOP_IN_BOUNDS); 1753 write_exp_elt_opcode (UNOP_LOGICAL_NOT); 1754 } 1755 break; 1756 1757 case 46: 1758 #line 401 "ada-exp.y" 1759 { write_exp_elt_opcode (UNOP_IN_RANGE); 1760 write_exp_elt_type (yyvsp[0].tval); 1761 write_exp_elt_opcode (UNOP_IN_RANGE); 1762 write_exp_elt_opcode (UNOP_LOGICAL_NOT); 1763 } 1764 break; 1765 1766 case 47: 1767 #line 409 "ada-exp.y" 1768 { write_exp_elt_opcode (BINOP_GEQ); } 1769 break; 1770 1771 case 48: 1772 #line 413 "ada-exp.y" 1773 { write_exp_elt_opcode (BINOP_LESS); } 1774 break; 1775 1776 case 49: 1777 #line 417 "ada-exp.y" 1778 { write_exp_elt_opcode (BINOP_GTR); } 1779 break; 1780 1781 case 50: 1782 #line 421 "ada-exp.y" 1783 { write_exp_elt_opcode (BINOP_BITWISE_AND); } 1784 break; 1785 1786 case 51: 1787 #line 425 "ada-exp.y" 1788 { write_exp_elt_opcode (BINOP_LOGICAL_AND); } 1789 break; 1790 1791 case 52: 1792 #line 429 "ada-exp.y" 1793 { write_exp_elt_opcode (BINOP_BITWISE_IOR); } 1794 break; 1795 1796 case 53: 1797 #line 433 "ada-exp.y" 1798 { write_exp_elt_opcode (BINOP_LOGICAL_OR); } 1799 break; 1800 1801 case 54: 1802 #line 437 "ada-exp.y" 1803 { write_exp_elt_opcode (BINOP_BITWISE_XOR); } 1804 break; 1805 1806 case 55: 1807 #line 441 "ada-exp.y" 1808 { write_exp_elt_opcode (UNOP_ADDR); } 1809 break; 1810 1811 case 56: 1812 #line 443 "ada-exp.y" 1813 { write_exp_elt_opcode (UNOP_ADDR); 1814 write_exp_elt_opcode (UNOP_CAST); 1815 write_exp_elt_type (type_system_address ()); 1816 write_exp_elt_opcode (UNOP_CAST); 1817 } 1818 break; 1819 1820 case 57: 1821 #line 449 "ada-exp.y" 1822 { write_int (yyvsp[0].lval, type_int ()); 1823 write_exp_elt_opcode (OP_ATR_FIRST); } 1824 break; 1825 1826 case 58: 1827 #line 452 "ada-exp.y" 1828 { write_int (yyvsp[0].lval, type_int ()); 1829 write_exp_elt_opcode (OP_ATR_LAST); } 1830 break; 1831 1832 case 59: 1833 #line 455 "ada-exp.y" 1834 { write_int (yyvsp[0].lval, type_int ()); 1835 write_exp_elt_opcode (OP_ATR_LENGTH); } 1836 break; 1837 1838 case 60: 1839 #line 458 "ada-exp.y" 1840 { write_exp_elt_opcode (OP_ATR_SIZE); } 1841 break; 1842 1843 case 61: 1844 #line 460 "ada-exp.y" 1845 { write_exp_elt_opcode (OP_ATR_TAG); } 1846 break; 1847 1848 case 62: 1849 #line 462 "ada-exp.y" 1850 { write_exp_elt_opcode (OP_ATR_MIN); } 1851 break; 1852 1853 case 63: 1854 #line 464 "ada-exp.y" 1855 { write_exp_elt_opcode (OP_ATR_MAX); } 1856 break; 1857 1858 case 64: 1859 #line 466 "ada-exp.y" 1860 { write_exp_elt_opcode (OP_ATR_POS); } 1861 break; 1862 1863 case 65: 1864 #line 468 "ada-exp.y" 1865 { write_int (yyvsp[0].lval, type_int ()); 1866 write_exp_elt_opcode (OP_ATR_FIRST); } 1867 break; 1868 1869 case 66: 1870 #line 471 "ada-exp.y" 1871 { write_int (yyvsp[0].lval, type_int ()); 1872 write_exp_elt_opcode (OP_ATR_LAST); } 1873 break; 1874 1875 case 67: 1876 #line 474 "ada-exp.y" 1877 { write_int (yyvsp[0].lval, type_int ()); 1878 write_exp_elt_opcode (OP_ATR_LENGTH); } 1879 break; 1880 1881 case 68: 1882 #line 477 "ada-exp.y" 1883 { write_exp_elt_opcode (OP_ATR_VAL); } 1884 break; 1885 1886 case 69: 1887 #line 479 "ada-exp.y" 1888 { write_exp_elt_opcode (OP_ATR_MODULUS); } 1889 break; 1890 1891 case 70: 1892 #line 483 "ada-exp.y" 1893 { yyval.lval = 1; } 1894 break; 1895 1896 case 71: 1897 #line 485 "ada-exp.y" 1898 { yyval.lval = yyvsp[-1].typed_val.val; } 1899 break; 1900 1901 case 72: 1902 #line 490 "ada-exp.y" 1903 { write_exp_elt_opcode (OP_TYPE); 1904 write_exp_elt_type (yyvsp[0].tval); 1905 write_exp_elt_opcode (OP_TYPE); } 1906 break; 1907 1908 case 74: 1909 #line 498 "ada-exp.y" 1910 { write_exp_elt_opcode (OP_TYPE); 1911 write_exp_elt_type (builtin_type_void); 1912 write_exp_elt_opcode (OP_TYPE); } 1913 break; 1914 1915 case 75: 1916 #line 505 "ada-exp.y" 1917 { write_int ((LONGEST) yyvsp[0].typed_val.val, yyvsp[0].typed_val.type); } 1918 break; 1919 1920 case 76: 1921 #line 509 "ada-exp.y" 1922 { write_int (convert_char_literal (type_qualifier, yyvsp[0].typed_val.val), 1923 (type_qualifier == NULL) 1924 ? yyvsp[0].typed_val.type : type_qualifier); 1925 } 1926 break; 1927 1928 case 77: 1929 #line 516 "ada-exp.y" 1930 { write_exp_elt_opcode (OP_DOUBLE); 1931 write_exp_elt_type (yyvsp[0].typed_val_float.type); 1932 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval); 1933 write_exp_elt_opcode (OP_DOUBLE); 1934 } 1935 break; 1936 1937 case 78: 1938 #line 524 "ada-exp.y" 1939 { write_int (0, type_int ()); } 1940 break; 1941 1942 case 79: 1943 #line 528 "ada-exp.y" 1944 { 1945 write_exp_elt_opcode (OP_STRING); 1946 write_exp_string (yyvsp[0].sval); 1947 write_exp_elt_opcode (OP_STRING); 1948 } 1949 break; 1950 1951 case 80: 1952 #line 536 "ada-exp.y" 1953 { error ("NEW not implemented."); } 1954 break; 1955 1956 case 81: 1957 #line 539 "ada-exp.y" 1958 { write_var_from_name (NULL, yyvsp[0].ssym); } 1959 break; 1960 1961 case 82: 1962 #line 541 "ada-exp.y" 1963 { write_var_from_name (yyvsp[-1].bval, yyvsp[0].ssym); } 1964 break; 1965 1966 case 83: 1967 #line 543 "ada-exp.y" 1968 { write_object_renaming (NULL, yyvsp[0].ssym.sym, 1969 MAX_RENAMING_CHAIN_LENGTH); } 1970 break; 1971 1972 case 84: 1973 #line 546 "ada-exp.y" 1974 { write_object_renaming (yyvsp[-1].bval, yyvsp[0].ssym.sym, 1975 MAX_RENAMING_CHAIN_LENGTH); } 1976 break; 1977 1978 case 85: 1979 #line 550 "ada-exp.y" 1980 { } 1981 break; 1982 1983 case 86: 1984 #line 551 "ada-exp.y" 1985 { } 1986 break; 1987 1988 case 87: 1989 #line 552 "ada-exp.y" 1990 { } 1991 break; 1992 1993 case 88: 1994 #line 556 "ada-exp.y" 1995 { yyval.bval = yyvsp[0].bval; } 1996 break; 1997 1998 case 89: 1999 #line 558 "ada-exp.y" 2000 { yyval.bval = yyvsp[0].bval; } 2001 break; 2002 2003 case 90: 2004 #line 562 "ada-exp.y" 2005 { yyval.tval = yyvsp[0].tval; } 2006 break; 2007 2008 case 91: 2009 #line 563 "ada-exp.y" 2010 { yyval.tval = yyvsp[0].tval; } 2011 break; 2012 2013 case 92: 2014 #line 565 "ada-exp.y" 2015 { yyval.tval = lookup_pointer_type (yyvsp[-1].tval); } 2016 break; 2017 2018 case 93: 2019 #line 567 "ada-exp.y" 2020 { yyval.tval = lookup_pointer_type (yyvsp[-1].tval); } 2021 break; 2022 2023 case 94: 2024 #line 574 "ada-exp.y" 2025 { write_exp_elt_opcode (UNOP_IND); } 2026 break; 2027 2028 case 95: 2029 #line 576 "ada-exp.y" 2030 { write_exp_elt_opcode (UNOP_ADDR); } 2031 break; 2032 2033 case 96: 2034 #line 578 "ada-exp.y" 2035 { write_exp_elt_opcode (BINOP_SUBSCRIPT); } 2036 break; 2037 2038 2039 } 2040 2041 /* Line 1000 of yacc.c. */ 2042 2043 yyvsp -= yylen; 2044 yyssp -= yylen; 2045 2046 2047 YY_STACK_PRINT (yyss, yyssp); 2048 2049 *++yyvsp = yyval; 2050 2051 2052 /* Now `shift' the result of the reduction. Determine what state 2053 that goes to, based on the state we popped back to and the rule 2054 number reduced by. */ 2055 2056 yyn = yyr1[yyn]; 2057 2058 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2059 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2060 yystate = yytable[yystate]; 2061 else 2062 yystate = yydefgoto[yyn - YYNTOKENS]; 2063 2064 goto yynewstate; 2065 2066 2067 /*------------------------------------. 2068 | yyerrlab -- here on detecting error | 2069 `------------------------------------*/ 2070 yyerrlab: 2071 /* If not already recovering from an error, report this error. */ 2072 if (!yyerrstatus) 2073 { 2074 ++yynerrs; 2075 #if YYERROR_VERBOSE 2076 yyn = yypact[yystate]; 2077 2078 if (YYPACT_NINF < yyn && yyn < YYLAST) 2079 { 2080 YYSIZE_T yysize = 0; 2081 int yytype = YYTRANSLATE (yychar); 2082 const char* yyprefix; 2083 char *yymsg; 2084 int yyx; 2085 2086 /* Start YYX at -YYN if negative to avoid negative indexes in 2087 YYCHECK. */ 2088 int yyxbegin = yyn < 0 ? -yyn : 0; 2089 2090 /* Stay within bounds of both yycheck and yytname. */ 2091 int yychecklim = YYLAST - yyn; 2092 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 2093 int yycount = 0; 2094 2095 yyprefix = ", expecting "; 2096 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 2097 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 2098 { 2099 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); 2100 yycount += 1; 2101 if (yycount == 5) 2102 { 2103 yysize = 0; 2104 break; 2105 } 2106 } 2107 yysize += (sizeof ("syntax error, unexpected ") 2108 + yystrlen (yytname[yytype])); 2109 yymsg = (char *) YYSTACK_ALLOC (yysize); 2110 if (yymsg != 0) 2111 { 2112 char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); 2113 yyp = yystpcpy (yyp, yytname[yytype]); 2114 2115 if (yycount < 5) 2116 { 2117 yyprefix = ", expecting "; 2118 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 2119 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 2120 { 2121 yyp = yystpcpy (yyp, yyprefix); 2122 yyp = yystpcpy (yyp, yytname[yyx]); 2123 yyprefix = " or "; 2124 } 2125 } 2126 yyerror (yymsg); 2127 YYSTACK_FREE (yymsg); 2128 } 2129 else 2130 yyerror ("syntax error; also virtual memory exhausted"); 2131 } 2132 else 2133 #endif /* YYERROR_VERBOSE */ 2134 yyerror ("syntax error"); 2135 } 2136 2137 2138 2139 if (yyerrstatus == 3) 2140 { 2141 /* If just tried and failed to reuse lookahead token after an 2142 error, discard it. */ 2143 2144 if (yychar <= YYEOF) 2145 { 2146 /* If at end of input, pop the error token, 2147 then the rest of the stack, then return failure. */ 2148 if (yychar == YYEOF) 2149 for (;;) 2150 { 2151 YYPOPSTACK; 2152 if (yyssp == yyss) 2153 YYABORT; 2154 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); 2155 yydestruct (yystos[*yyssp], yyvsp); 2156 } 2157 } 2158 else 2159 { 2160 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); 2161 yydestruct (yytoken, &yylval); 2162 yychar = YYEMPTY; 2163 2164 } 2165 } 2166 2167 /* Else will try to reuse lookahead token after shifting the error 2168 token. */ 2169 goto yyerrlab1; 2170 2171 2172 /*---------------------------------------------------. 2173 | yyerrorlab -- error raised explicitly by YYERROR. | 2174 `---------------------------------------------------*/ 2175 yyerrorlab: 2176 2177 #ifdef __GNUC__ 2178 /* Pacify GCC when the user code never invokes YYERROR and the label 2179 yyerrorlab therefore never appears in user code. */ 2180 if (0) 2181 goto yyerrorlab; 2182 #endif 2183 2184 yyvsp -= yylen; 2185 yyssp -= yylen; 2186 yystate = *yyssp; 2187 goto yyerrlab1; 2188 2189 2190 /*-------------------------------------------------------------. 2191 | yyerrlab1 -- common code for both syntax error and YYERROR. | 2192 `-------------------------------------------------------------*/ 2193 yyerrlab1: 2194 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2195 2196 for (;;) 2197 { 2198 yyn = yypact[yystate]; 2199 if (yyn != YYPACT_NINF) 2200 { 2201 yyn += YYTERROR; 2202 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2203 { 2204 yyn = yytable[yyn]; 2205 if (0 < yyn) 2206 break; 2207 } 2208 } 2209 2210 /* Pop the current state because it cannot handle the error token. */ 2211 if (yyssp == yyss) 2212 YYABORT; 2213 2214 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); 2215 yydestruct (yystos[yystate], yyvsp); 2216 YYPOPSTACK; 2217 yystate = *yyssp; 2218 YY_STACK_PRINT (yyss, yyssp); 2219 } 2220 2221 if (yyn == YYFINAL) 2222 YYACCEPT; 2223 2224 YYDPRINTF ((stderr, "Shifting error token, ")); 2225 2226 *++yyvsp = yylval; 2227 2228 2229 yystate = yyn; 2230 goto yynewstate; 2231 2232 2233 /*-------------------------------------. 2234 | yyacceptlab -- YYACCEPT comes here. | 2235 `-------------------------------------*/ 2236 yyacceptlab: 2237 yyresult = 0; 2238 goto yyreturn; 2239 2240 /*-----------------------------------. 2241 | yyabortlab -- YYABORT comes here. | 2242 `-----------------------------------*/ 2243 yyabortlab: 2244 yyresult = 1; 2245 goto yyreturn; 2246 2247 #ifndef yyoverflow 2248 /*----------------------------------------------. 2249 | yyoverflowlab -- parser overflow comes here. | 2250 `----------------------------------------------*/ 2251 yyoverflowlab: 2252 yyerror ("parser stack overflow"); 2253 yyresult = 2; 2254 /* Fall through. */ 2255 #endif 2256 2257 yyreturn: 2258 #ifndef yyoverflow 2259 if (yyss != yyssa) 2260 YYSTACK_FREE (yyss); 2261 #endif 2262 return yyresult; 2263 } 2264 2265 2266 #line 581 "ada-exp.y" 2267 2268 2269 /* yylex defined in ada-lex.c: Reads one token, getting characters */ 2270 /* through lexptr. */ 2271 2272 /* Remap normal flex interface names (yylex) as well as gratuitiously */ 2273 /* global symbol names, so we can have multiple flex-generated parsers */ 2274 /* in gdb. */ 2275 2276 /* (See note above on previous definitions for YACC.) */ 2277 2278 #define yy_create_buffer ada_yy_create_buffer 2279 #define yy_delete_buffer ada_yy_delete_buffer 2280 #define yy_init_buffer ada_yy_init_buffer 2281 #define yy_load_buffer_state ada_yy_load_buffer_state 2282 #define yy_switch_to_buffer ada_yy_switch_to_buffer 2283 #define yyrestart ada_yyrestart 2284 #define yytext ada_yytext 2285 #define yywrap ada_yywrap 2286 2287 static struct obstack temp_parse_space; 2288 2289 /* The following kludge was found necessary to prevent conflicts between */ 2290 /* defs.h and non-standard stdlib.h files. */ 2291 #define qsort __qsort__dummy 2292 #include "ada-lex.c" 2293 2294 int 2295 ada_parse (void) 2296 { 2297 lexer_init (yyin); /* (Re-)initialize lexer. */ 2298 left_block_context = NULL; 2299 type_qualifier = NULL; 2300 obstack_free (&temp_parse_space, NULL); 2301 obstack_init (&temp_parse_space); 2302 2303 return _ada_parse (); 2304 } 2305 2306 void 2307 yyerror (char *msg) 2308 { 2309 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr); 2310 } 2311 2312 /* The operator name corresponding to operator symbol STRING (adds 2313 quotes and maps to lower-case). Destroys the previous contents of 2314 the array pointed to by STRING.ptr. Error if STRING does not match 2315 a valid Ada operator. Assumes that STRING.ptr points to a 2316 null-terminated string and that, if STRING is a valid operator 2317 symbol, the array pointed to by STRING.ptr contains at least 2318 STRING.length+3 characters. */ 2319 2320 static struct stoken 2321 string_to_operator (struct stoken string) 2322 { 2323 int i; 2324 2325 for (i = 0; ada_opname_table[i].encoded != NULL; i += 1) 2326 { 2327 if (string.length == strlen (ada_opname_table[i].decoded)-2 2328 && strncasecmp (string.ptr, ada_opname_table[i].decoded+1, 2329 string.length) == 0) 2330 { 2331 strncpy (string.ptr, ada_opname_table[i].decoded, 2332 string.length+2); 2333 string.length += 2; 2334 return string; 2335 } 2336 } 2337 error ("Invalid operator symbol `%s'", string.ptr); 2338 } 2339 2340 /* Emit expression to access an instance of SYM, in block BLOCK (if 2341 * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */ 2342 static void 2343 write_var_from_sym (struct block *orig_left_context, 2344 struct block *block, 2345 struct symbol *sym) 2346 { 2347 if (orig_left_context == NULL && symbol_read_needs_frame (sym)) 2348 { 2349 if (innermost_block == 0 2350 || contained_in (block, innermost_block)) 2351 innermost_block = block; 2352 } 2353 2354 write_exp_elt_opcode (OP_VAR_VALUE); 2355 write_exp_elt_block (block); 2356 write_exp_elt_sym (sym); 2357 write_exp_elt_opcode (OP_VAR_VALUE); 2358 } 2359 2360 /* Emit expression to access an instance of NAME in :: context 2361 * ORIG_LEFT_CONTEXT. If no unique symbol for NAME has been found, 2362 * output a dummy symbol (good to the next call of ada_parse) for NAME 2363 * in the UNDEF_DOMAIN, for later resolution by ada_resolve. */ 2364 static void 2365 write_var_from_name (struct block *orig_left_context, 2366 struct name_info name) 2367 { 2368 if (name.msym != NULL) 2369 { 2370 write_exp_msymbol (name.msym, 2371 lookup_function_type (type_int ()), 2372 type_int ()); 2373 } 2374 else if (name.sym == NULL) 2375 { 2376 /* Multiple matches: record name and starting block for later 2377 resolution by ada_resolve. */ 2378 char *encoded_name = ada_encode (name.stoken.ptr); 2379 struct symbol *sym = 2380 obstack_alloc (&temp_parse_space, sizeof (struct symbol)); 2381 memset (sym, 0, sizeof (struct symbol)); 2382 SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN; 2383 SYMBOL_LINKAGE_NAME (sym) 2384 = obsavestring (encoded_name, strlen (encoded_name), &temp_parse_space); 2385 SYMBOL_LANGUAGE (sym) = language_ada; 2386 2387 write_exp_elt_opcode (OP_VAR_VALUE); 2388 write_exp_elt_block (name.block); 2389 write_exp_elt_sym (sym); 2390 write_exp_elt_opcode (OP_VAR_VALUE); 2391 } 2392 else 2393 write_var_from_sym (orig_left_context, name.block, name.sym); 2394 } 2395 2396 /* Write integer constant ARG of type TYPE. */ 2397 2398 static void 2399 write_int (LONGEST arg, struct type *type) 2400 { 2401 write_exp_elt_opcode (OP_LONG); 2402 write_exp_elt_type (type); 2403 write_exp_elt_longcst (arg); 2404 write_exp_elt_opcode (OP_LONG); 2405 } 2406 2407 /* Emit expression corresponding to the renamed object designated by 2408 * the type RENAMING, which must be the referent of an object renaming 2409 * type, in the context of ORIG_LEFT_CONTEXT. MAX_DEPTH is the maximum 2410 * number of cascaded renamings to allow. */ 2411 static void 2412 write_object_renaming (struct block *orig_left_context, 2413 struct symbol *renaming, int max_depth) 2414 { 2415 const char *qualification = SYMBOL_LINKAGE_NAME (renaming); 2416 const char *simple_tail; 2417 const char *expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0); 2418 const char *suffix; 2419 char *name; 2420 struct symbol *sym; 2421 enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state; 2422 2423 if (max_depth <= 0) 2424 error ("Could not find renamed symbol"); 2425 2426 /* if orig_left_context is null, then use the currently selected 2427 block; otherwise we might fail our symbol lookup below. */ 2428 if (orig_left_context == NULL) 2429 orig_left_context = get_selected_block (NULL); 2430 2431 for (simple_tail = qualification + strlen (qualification); 2432 simple_tail != qualification; simple_tail -= 1) 2433 { 2434 if (*simple_tail == '.') 2435 { 2436 simple_tail += 1; 2437 break; 2438 } 2439 else if (strncmp (simple_tail, "__", 2) == 0) 2440 { 2441 simple_tail += 2; 2442 break; 2443 } 2444 } 2445 2446 suffix = strstr (expr, "___XE"); 2447 if (suffix == NULL) 2448 goto BadEncoding; 2449 2450 name = (char *) obstack_alloc (&temp_parse_space, suffix - expr + 1); 2451 strncpy (name, expr, suffix-expr); 2452 name[suffix-expr] = '\000'; 2453 sym = lookup_symbol (name, orig_left_context, VAR_DOMAIN, 0, NULL); 2454 if (sym == NULL) 2455 error ("Could not find renamed variable: %s", ada_decode (name)); 2456 if (ada_is_object_renaming (sym)) 2457 write_object_renaming (orig_left_context, sym, max_depth-1); 2458 else 2459 write_var_from_sym (orig_left_context, block_found, sym); 2460 2461 suffix += 5; 2462 slice_state = SIMPLE_INDEX; 2463 while (*suffix == 'X') 2464 { 2465 suffix += 1; 2466 2467 switch (*suffix) { 2468 case 'A': 2469 suffix += 1; 2470 write_exp_elt_opcode (UNOP_IND); 2471 break; 2472 case 'L': 2473 slice_state = LOWER_BOUND; 2474 case 'S': 2475 suffix += 1; 2476 if (isdigit (*suffix)) 2477 { 2478 char *next; 2479 long val = strtol (suffix, &next, 10); 2480 if (next == suffix) 2481 goto BadEncoding; 2482 suffix = next; 2483 write_exp_elt_opcode (OP_LONG); 2484 write_exp_elt_type (type_int ()); 2485 write_exp_elt_longcst ((LONGEST) val); 2486 write_exp_elt_opcode (OP_LONG); 2487 } 2488 else 2489 { 2490 const char *end; 2491 char *index_name; 2492 int index_len; 2493 struct symbol *index_sym; 2494 2495 end = strchr (suffix, 'X'); 2496 if (end == NULL) 2497 end = suffix + strlen (suffix); 2498 2499 index_len = simple_tail - qualification + 2 + (suffix - end) + 1; 2500 index_name 2501 = (char *) obstack_alloc (&temp_parse_space, index_len); 2502 memset (index_name, '\000', index_len); 2503 strncpy (index_name, qualification, simple_tail - qualification); 2504 index_name[simple_tail - qualification] = '\000'; 2505 strncat (index_name, suffix, suffix-end); 2506 suffix = end; 2507 2508 index_sym = 2509 lookup_symbol (index_name, NULL, VAR_DOMAIN, 0, NULL); 2510 if (index_sym == NULL) 2511 error ("Could not find %s", index_name); 2512 write_var_from_sym (NULL, block_found, sym); 2513 } 2514 if (slice_state == SIMPLE_INDEX) 2515 { 2516 write_exp_elt_opcode (OP_FUNCALL); 2517 write_exp_elt_longcst ((LONGEST) 1); 2518 write_exp_elt_opcode (OP_FUNCALL); 2519 } 2520 else if (slice_state == LOWER_BOUND) 2521 slice_state = UPPER_BOUND; 2522 else if (slice_state == UPPER_BOUND) 2523 { 2524 write_exp_elt_opcode (TERNOP_SLICE); 2525 slice_state = SIMPLE_INDEX; 2526 } 2527 break; 2528 2529 case 'R': 2530 { 2531 struct stoken field_name; 2532 const char *end; 2533 suffix += 1; 2534 2535 if (slice_state != SIMPLE_INDEX) 2536 goto BadEncoding; 2537 end = strchr (suffix, 'X'); 2538 if (end == NULL) 2539 end = suffix + strlen (suffix); 2540 field_name.length = end - suffix; 2541 field_name.ptr = xmalloc (end - suffix + 1); 2542 strncpy (field_name.ptr, suffix, end - suffix); 2543 field_name.ptr[end - suffix] = '\000'; 2544 suffix = end; 2545 write_exp_elt_opcode (STRUCTOP_STRUCT); 2546 write_exp_string (field_name); 2547 write_exp_elt_opcode (STRUCTOP_STRUCT); 2548 break; 2549 } 2550 2551 default: 2552 goto BadEncoding; 2553 } 2554 } 2555 if (slice_state == SIMPLE_INDEX) 2556 return; 2557 2558 BadEncoding: 2559 error ("Internal error in encoding of renaming declaration: %s", 2560 SYMBOL_LINKAGE_NAME (renaming)); 2561 } 2562 2563 /* Convert the character literal whose ASCII value would be VAL to the 2564 appropriate value of type TYPE, if there is a translation. 2565 Otherwise return VAL. Hence, in an enumeration type ('A', 'B'), 2566 the literal 'A' (VAL == 65), returns 0. */ 2567 static LONGEST 2568 convert_char_literal (struct type *type, LONGEST val) 2569 { 2570 char name[7]; 2571 int f; 2572 2573 if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM) 2574 return val; 2575 sprintf (name, "QU%02x", (int) val); 2576 for (f = 0; f < TYPE_NFIELDS (type); f += 1) 2577 { 2578 if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0) 2579 return TYPE_FIELD_BITPOS (type, f); 2580 } 2581 return val; 2582 } 2583 2584 static struct type * 2585 type_int (void) 2586 { 2587 return builtin_type (current_gdbarch)->builtin_int; 2588 } 2589 2590 static struct type * 2591 type_long (void) 2592 { 2593 return builtin_type (current_gdbarch)->builtin_long; 2594 } 2595 2596 static struct type * 2597 type_long_long (void) 2598 { 2599 return builtin_type (current_gdbarch)->builtin_long_long; 2600 } 2601 2602 static struct type * 2603 type_float (void) 2604 { 2605 return builtin_type (current_gdbarch)->builtin_float; 2606 } 2607 2608 static struct type * 2609 type_double (void) 2610 { 2611 return builtin_type (current_gdbarch)->builtin_double; 2612 } 2613 2614 static struct type * 2615 type_long_double (void) 2616 { 2617 return builtin_type (current_gdbarch)->builtin_long_double; 2618 } 2619 2620 static struct type * 2621 type_char (void) 2622 { 2623 return language_string_char_type (current_language, current_gdbarch); 2624 } 2625 2626 static struct type * 2627 type_system_address (void) 2628 { 2629 struct type *type 2630 = language_lookup_primitive_type_by_name (current_language, 2631 current_gdbarch, 2632 "system__address"); 2633 return type != NULL ? type : lookup_pointer_type (builtin_type_void); 2634 } 2635 2636 void 2637 _initialize_ada_exp (void) 2638 { 2639 obstack_init (&temp_parse_space); 2640 } 2641 2642 /* FIXME: hilfingr/2004-10-05: Hack to remove warning. The function 2643 string_to_operator is supposed to be used for cases where one 2644 calls an operator function with prefix notation, as in 2645 "+" (a, b), but at some point, this code seems to have gone 2646 missing. */ 2647 2648 struct stoken (*dummy_string_to_ada_operator) (struct stoken) 2649 = string_to_operator; 2650 2651 2652 2653