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