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 = 260, 59 NSSTRING = 261, 60 SELECTOR = 262, 61 NAME = 263, 62 TYPENAME = 264, 63 CLASSNAME = 265, 64 NAME_OR_INT = 266, 65 STRUCT = 267, 66 CLASS = 268, 67 UNION = 269, 68 ENUM = 270, 69 SIZEOF = 271, 70 UNSIGNED = 272, 71 COLONCOLON = 273, 72 TEMPLATE = 274, 73 ERROR = 275, 74 SIGNED_KEYWORD = 276, 75 LONG = 277, 76 SHORT = 278, 77 INT_KEYWORD = 279, 78 CONST_KEYWORD = 280, 79 VOLATILE_KEYWORD = 281, 80 DOUBLE_KEYWORD = 282, 81 VARIABLE = 283, 82 ASSIGN_MODIFY = 284, 83 ABOVE_COMMA = 285, 84 OROR = 286, 85 ANDAND = 287, 86 NOTEQUAL = 288, 87 EQUAL = 289, 88 GEQ = 290, 89 LEQ = 291, 90 RSH = 292, 91 LSH = 293, 92 DECREMENT = 294, 93 INCREMENT = 295, 94 UNARY = 296, 95 ARROW = 297, 96 BLOCKNAME = 298 97 }; 98#endif 99#define INT 258 100#define FLOAT 259 101#define STRING 260 102#define NSSTRING 261 103#define SELECTOR 262 104#define NAME 263 105#define TYPENAME 264 106#define CLASSNAME 265 107#define NAME_OR_INT 266 108#define STRUCT 267 109#define CLASS 268 110#define UNION 269 111#define ENUM 270 112#define SIZEOF 271 113#define UNSIGNED 272 114#define COLONCOLON 273 115#define TEMPLATE 274 116#define ERROR 275 117#define SIGNED_KEYWORD 276 118#define LONG 277 119#define SHORT 278 120#define INT_KEYWORD 279 121#define CONST_KEYWORD 280 122#define VOLATILE_KEYWORD 281 123#define DOUBLE_KEYWORD 282 124#define VARIABLE 283 125#define ASSIGN_MODIFY 284 126#define ABOVE_COMMA 285 127#define OROR 286 128#define ANDAND 287 129#define NOTEQUAL 288 130#define EQUAL 289 131#define GEQ 290 132#define LEQ 291 133#define RSH 292 134#define LSH 293 135#define DECREMENT 294 136#define INCREMENT 295 137#define UNARY 296 138#define ARROW 297 139#define BLOCKNAME 298 140 141 142 143 144/* Copy the first part of user declarations. */ 145#line 35 "objc-exp.y" 146 147 148#include "defs.h" 149#include "gdb_string.h" 150#include <ctype.h> 151#include "expression.h" 152 153#include "objc-lang.h" /* For objc language constructs. */ 154 155#include "value.h" 156#include "parser-defs.h" 157#include "language.h" 158#include "c-lang.h" 159#include "bfd.h" /* Required by objfiles.h. */ 160#include "symfile.h" /* Required by objfiles.h. */ 161#include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */ 162#include "top.h" 163#include "completer.h" /* For skip_quoted(). */ 164#include "block.h" 165 166#define parse_type builtin_type (parse_gdbarch) 167 168/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, 169 etc), as well as gratuitiously global symbol names, so we can have 170 multiple yacc generated parsers in gdb. Note that these are only 171 the variables produced by yacc. If other parser generators (bison, 172 byacc, etc) produce additional global names that conflict at link 173 time, then those parser generators need to be fixed instead of 174 adding those names to this list. */ 175 176#define yymaxdepth objc_maxdepth 177#define yyparse objc_parse 178#define yylex objc_lex 179#define yyerror objc_error 180#define yylval objc_lval 181#define yychar objc_char 182#define yydebug objc_debug 183#define yypact objc_pact 184#define yyr1 objc_r1 185#define yyr2 objc_r2 186#define yydef objc_def 187#define yychk objc_chk 188#define yypgo objc_pgo 189#define yyact objc_act 190#define yyexca objc_exca 191#define yyerrflag objc_errflag 192#define yynerrs objc_nerrs 193#define yyps objc_ps 194#define yypv objc_pv 195#define yys objc_s 196#define yy_yys objc_yys 197#define yystate objc_state 198#define yytmp objc_tmp 199#define yyv objc_v 200#define yy_yyv objc_yyv 201#define yyval objc_val 202#define yylloc objc_lloc 203#define yyreds objc_reds /* With YYDEBUG defined */ 204#define yytoks objc_toks /* With YYDEBUG defined */ 205#define yyname objc_name /* With YYDEBUG defined */ 206#define yyrule objc_rule /* With YYDEBUG defined */ 207#define yylhs objc_yylhs 208#define yylen objc_yylen 209#define yydefred objc_yydefred 210#define yydgoto objc_yydgoto 211#define yysindex objc_yysindex 212#define yyrindex objc_yyrindex 213#define yygindex objc_yygindex 214#define yytable objc_yytable 215#define yycheck objc_yycheck 216 217#ifndef YYDEBUG 218#define YYDEBUG 0 /* Default to no yydebug support. */ 219#endif 220 221int yyparse (void); 222 223static int yylex (void); 224 225void yyerror (char *); 226 227 228 229/* Enabling traces. */ 230#ifndef YYDEBUG 231# define YYDEBUG 0 232#endif 233 234/* Enabling verbose error messages. */ 235#ifdef YYERROR_VERBOSE 236# undef YYERROR_VERBOSE 237# define YYERROR_VERBOSE 1 238#else 239# define YYERROR_VERBOSE 0 240#endif 241 242#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) 243#line 123 "objc-exp.y" 244typedef union YYSTYPE { 245 LONGEST lval; 246 struct { 247 LONGEST val; 248 struct type *type; 249 } typed_val_int; 250 struct { 251 DOUBLEST dval; 252 struct type *type; 253 } typed_val_float; 254 struct symbol *sym; 255 struct type *tval; 256 struct stoken sval; 257 struct ttype tsym; 258 struct symtoken ssym; 259 int voidval; 260 struct block *bval; 261 enum exp_opcode opcode; 262 struct internalvar *ivar; 263 struct objc_class_str class; 264 265 struct type **tvec; 266 int *ivec; 267 } YYSTYPE; 268/* Line 191 of yacc.c. */ 269#line 270 "objc-exp.c" 270# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 271# define YYSTYPE_IS_DECLARED 1 272# define YYSTYPE_IS_TRIVIAL 1 273#endif 274 275 276 277/* Copy the second part of user declarations. */ 278#line 148 "objc-exp.y" 279 280/* YYSTYPE gets defined by %union. */ 281static int parse_number (char *, int, int, YYSTYPE *); 282 283 284/* Line 214 of yacc.c. */ 285#line 286 "objc-exp.c" 286 287#if ! defined (yyoverflow) || YYERROR_VERBOSE 288 289# ifndef YYFREE 290# define YYFREE xfree 291# endif 292# ifndef YYMALLOC 293# define YYMALLOC xmalloc 294# endif 295 296/* The parser invokes alloca or xmalloc; define the necessary symbols. */ 297 298# ifdef YYSTACK_USE_ALLOCA 299# if YYSTACK_USE_ALLOCA 300# define YYSTACK_ALLOC alloca 301# endif 302# else 303# if defined (alloca) || defined (_ALLOCA_H) 304# define YYSTACK_ALLOC alloca 305# else 306# ifdef __GNUC__ 307# define YYSTACK_ALLOC __builtin_alloca 308# endif 309# endif 310# endif 311 312# ifdef YYSTACK_ALLOC 313 /* Pacify GCC's `empty if-body' warning. */ 314# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 315# else 316# if defined (__STDC__) || defined (__cplusplus) 317# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 318# define YYSIZE_T size_t 319# endif 320# define YYSTACK_ALLOC YYMALLOC 321# define YYSTACK_FREE YYFREE 322# endif 323#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ 324 325 326#if (! defined (yyoverflow) \ 327 && (! defined (__cplusplus) \ 328 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) 329 330/* A type that is properly aligned for any stack member. */ 331union yyalloc 332{ 333 short yyss; 334 YYSTYPE yyvs; 335 }; 336 337/* The size of the maximum gap between one aligned stack and the next. */ 338# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 339 340/* The size of an array large to enough to hold all stacks, each with 341 N elements. */ 342# define YYSTACK_BYTES(N) \ 343 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ 344 + YYSTACK_GAP_MAXIMUM) 345 346/* Copy COUNT objects from FROM to TO. The source and destination do 347 not overlap. */ 348# ifndef YYCOPY 349# if defined (__GNUC__) && 1 < __GNUC__ 350# define YYCOPY(To, From, Count) \ 351 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 352# else 353# define YYCOPY(To, From, Count) \ 354 do \ 355 { \ 356 register YYSIZE_T yyi; \ 357 for (yyi = 0; yyi < (Count); yyi++) \ 358 (To)[yyi] = (From)[yyi]; \ 359 } \ 360 while (0) 361# endif 362# endif 363 364/* Relocate STACK from its old location to the new one. The 365 local variables YYSIZE and YYSTACKSIZE give the old and new number of 366 elements in the stack, and YYPTR gives the new location of the 367 stack. Advance YYPTR to a properly aligned location for the next 368 stack. */ 369# define YYSTACK_RELOCATE(Stack) \ 370 do \ 371 { \ 372 YYSIZE_T yynewbytes; \ 373 YYCOPY (&yyptr->Stack, Stack, yysize); \ 374 Stack = &yyptr->Stack; \ 375 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 376 yyptr += yynewbytes / sizeof (*yyptr); \ 377 } \ 378 while (0) 379 380#endif 381 382#if defined (__STDC__) || defined (__cplusplus) 383 typedef signed char yysigned_char; 384#else 385 typedef short yysigned_char; 386#endif 387 388/* YYFINAL -- State number of the termination state. */ 389#define YYFINAL 89 390/* YYLAST -- Last index in YYTABLE. */ 391#define YYLAST 793 392 393/* YYNTOKENS -- Number of terminals. */ 394#define YYNTOKENS 68 395/* YYNNTS -- Number of nonterminals. */ 396#define YYNNTS 29 397/* YYNRULES -- Number of rules. */ 398#define YYNRULES 146 399/* YYNRULES -- Number of states. */ 400#define YYNSTATES 236 401 402/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 403#define YYUNDEFTOK 2 404#define YYMAXUTOK 298 405 406#define YYTRANSLATE(YYX) \ 407 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 408 409/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 410static const unsigned char yytranslate[] = 411{ 412 0, 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, 61, 2, 2, 2, 52, 38, 2, 416 58, 65, 50, 48, 30, 49, 56, 51, 2, 2, 417 2, 2, 2, 2, 2, 2, 2, 2, 64, 2, 418 41, 32, 42, 33, 47, 2, 2, 2, 2, 2, 419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 421 2, 57, 2, 63, 37, 2, 2, 2, 2, 2, 422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 424 2, 2, 2, 66, 36, 67, 62, 2, 2, 2, 425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 432 2, 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, 2, 2, 436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 437 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 438 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 439 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 440 25, 26, 27, 28, 29, 31, 34, 35, 39, 40, 441 43, 44, 45, 46, 53, 54, 55, 59, 60 442}; 443 444#if YYDEBUG 445/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 446 YYRHS. */ 447static const unsigned short yyprhs[] = 448{ 449 0, 0, 3, 5, 7, 9, 11, 15, 18, 21, 450 24, 27, 30, 33, 36, 39, 42, 45, 49, 53, 451 58, 62, 66, 71, 76, 77, 83, 84, 90, 91, 452 97, 99, 101, 103, 106, 110, 113, 116, 117, 123, 453 125, 126, 128, 132, 134, 138, 143, 148, 152, 156, 454 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 455 200, 204, 208, 212, 216, 220, 224, 228, 234, 238, 456 242, 244, 246, 248, 250, 252, 254, 259, 261, 263, 457 265, 269, 273, 277, 282, 284, 287, 289, 291, 294, 458 297, 300, 304, 308, 310, 313, 315, 318, 320, 324, 459 327, 329, 332, 334, 337, 341, 344, 348, 350, 352, 460 354, 356, 358, 360, 363, 367, 370, 374, 378, 383, 461 386, 390, 392, 395, 398, 401, 404, 407, 410, 412, 462 415, 417, 423, 426, 429, 431, 433, 435, 437, 439, 463 443, 445, 447, 449, 451, 453, 455 464}; 465 466/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 467static const yysigned_char yyrhs[] = 468{ 469 69, 0, -1, 71, -1, 70, -1, 91, -1, 72, 470 -1, 71, 30, 72, -1, 50, 72, -1, 38, 72, 471 -1, 49, 72, -1, 61, 72, -1, 62, 72, -1, 472 54, 72, -1, 53, 72, -1, 72, 54, -1, 72, 473 53, -1, 16, 72, -1, 72, 59, 95, -1, 72, 474 59, 85, -1, 72, 59, 50, 72, -1, 72, 56, 475 95, -1, 72, 56, 85, -1, 72, 56, 50, 72, 476 -1, 72, 57, 71, 63, -1, -1, 57, 9, 73, 477 76, 63, -1, -1, 57, 10, 74, 76, 63, -1, 478 -1, 57, 72, 75, 76, 63, -1, 95, -1, 77, 479 -1, 78, -1, 77, 78, -1, 95, 64, 72, -1, 480 64, 72, -1, 30, 72, -1, -1, 72, 58, 79, 481 81, 65, -1, 66, -1, -1, 72, -1, 81, 30, 482 72, -1, 67, -1, 80, 81, 82, -1, 80, 91, 483 82, 72, -1, 58, 91, 65, 72, -1, 58, 71, 484 65, -1, 72, 47, 72, -1, 72, 50, 72, -1, 485 72, 51, 72, -1, 72, 52, 72, -1, 72, 48, 486 72, -1, 72, 49, 72, -1, 72, 46, 72, -1, 487 72, 45, 72, -1, 72, 40, 72, -1, 72, 39, 488 72, -1, 72, 44, 72, -1, 72, 43, 72, -1, 489 72, 41, 72, -1, 72, 42, 72, -1, 72, 38, 490 72, -1, 72, 37, 72, -1, 72, 36, 72, -1, 491 72, 35, 72, -1, 72, 34, 72, -1, 72, 33, 492 72, 64, 72, -1, 72, 32, 72, -1, 72, 29, 493 72, -1, 3, -1, 11, -1, 4, -1, 84, -1, 494 28, -1, 7, -1, 16, 58, 91, 65, -1, 5, 495 -1, 6, -1, 60, -1, 83, 18, 95, -1, 83, 496 18, 95, -1, 92, 18, 95, -1, 92, 18, 62, 497 95, -1, 85, -1, 18, 95, -1, 96, -1, 92, 498 -1, 92, 25, -1, 92, 26, -1, 92, 87, -1, 499 92, 25, 87, -1, 92, 26, 87, -1, 50, -1, 500 50, 87, -1, 38, -1, 38, 87, -1, 88, -1, 501 58, 87, 65, -1, 88, 89, -1, 89, -1, 88, 502 90, -1, 90, -1, 57, 63, -1, 57, 3, 63, 503 -1, 58, 65, -1, 58, 94, 65, -1, 86, -1, 504 9, -1, 10, -1, 24, -1, 22, -1, 23, -1, 505 22, 24, -1, 17, 22, 24, -1, 22, 22, -1, 506 22, 22, 24, -1, 17, 22, 22, -1, 17, 22, 507 22, 24, -1, 23, 24, -1, 17, 23, 24, -1, 508 27, -1, 22, 27, -1, 12, 95, -1, 13, 95, 509 -1, 14, 95, -1, 15, 95, -1, 17, 93, -1, 510 17, -1, 21, 93, -1, 21, -1, 19, 95, 41, 511 91, 42, -1, 25, 92, -1, 26, 92, -1, 9, 512 -1, 24, -1, 22, -1, 23, -1, 91, -1, 94, 513 30, 91, -1, 8, -1, 60, -1, 9, -1, 10, 514 -1, 11, -1, 8, -1, 60, -1 515}; 516 517/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 518static const unsigned short yyrline[] = 519{ 520 0, 227, 227, 228, 231, 238, 239, 244, 248, 252, 521 256, 260, 264, 268, 272, 276, 280, 284, 290, 297, 522 301, 308, 316, 320, 329, 328, 351, 350, 366, 365, 523 374, 376, 379, 380, 383, 385, 387, 394, 391, 401, 524 405, 408, 412, 416, 419, 426, 432, 438, 444, 448, 525 452, 456, 460, 464, 468, 472, 476, 480, 484, 488, 526 492, 496, 500, 504, 508, 512, 516, 520, 524, 528, 527 534, 541, 554, 561, 564, 568, 575, 583, 608, 616, 528 634, 644, 659, 672, 697, 698, 729, 785, 791, 792, 529 793, 795, 797, 801, 803, 805, 807, 809, 812, 814, 530 819, 826, 828, 832, 834, 838, 840, 852, 856, 858, 531 866, 868, 870, 872, 874, 876, 878, 880, 882, 884, 532 886, 888, 890, 892, 895, 898, 901, 904, 908, 910, 533 914, 916, 923, 924, 927, 928, 934, 940, 949, 954, 534 961, 962, 963, 964, 965, 968, 969 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. */ 541static const char *const yytname[] = 542{ 543 "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "NSSTRING", 544 "SELECTOR", "NAME", "TYPENAME", "CLASSNAME", "NAME_OR_INT", "STRUCT", 545 "CLASS", "UNION", "ENUM", "SIZEOF", "UNSIGNED", "COLONCOLON", "TEMPLATE", 546 "ERROR", "SIGNED_KEYWORD", "LONG", "SHORT", "INT_KEYWORD", 547 "CONST_KEYWORD", "VOLATILE_KEYWORD", "DOUBLE_KEYWORD", "VARIABLE", 548 "ASSIGN_MODIFY", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND", 549 "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ", 550 "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT", 551 "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "BLOCKNAME", "'!'", 552 "'~'", "']'", "':'", "')'", "'{'", "'}'", "$accept", "start", "type_exp", 553 "exp1", "exp", "@1", "@2", "@3", "msglist", "msgarglist", "msgarg", "@4", 554 "lcurly", "arglist", "rcurly", "block", "variable", "qualified_name", 555 "ptype", "abs_decl", "direct_abs_decl", "array_mod", "func_mod", "type", 556 "typebase", "typename", "nonempty_typelist", "name", "name_not_typename", 0 557}; 558#endif 559 560# ifdef YYPRINT 561/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 562 token YYLEX-NUM. */ 563static const unsigned short yytoknum[] = 564{ 565 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 566 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 567 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 568 44, 285, 61, 63, 286, 287, 124, 94, 38, 288, 569 289, 60, 62, 290, 291, 292, 293, 64, 43, 45, 570 42, 47, 37, 294, 295, 296, 46, 91, 40, 297, 571 298, 33, 126, 93, 58, 41, 123, 125 572}; 573# endif 574 575/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 576static const unsigned char yyr1[] = 577{ 578 0, 68, 69, 69, 70, 71, 71, 72, 72, 72, 579 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 580 72, 72, 72, 72, 73, 72, 74, 72, 75, 72, 581 76, 76, 77, 77, 78, 78, 78, 79, 72, 80, 582 81, 81, 81, 82, 72, 72, 72, 72, 72, 72, 583 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 584 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 585 72, 72, 72, 72, 72, 72, 72, 72, 72, 83, 586 83, 84, 85, 85, 84, 84, 84, 86, 86, 86, 587 86, 86, 86, 87, 87, 87, 87, 87, 88, 88, 588 88, 88, 88, 89, 89, 90, 90, 91, 92, 92, 589 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 590 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 591 92, 92, 92, 92, 93, 93, 93, 93, 94, 94, 592 95, 95, 95, 95, 95, 96, 96 593}; 594 595/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 596static const unsigned char yyr2[] = 597{ 598 0, 2, 1, 1, 1, 1, 3, 2, 2, 2, 599 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 600 3, 3, 4, 4, 0, 5, 0, 5, 0, 5, 601 1, 1, 1, 2, 3, 2, 2, 0, 5, 1, 602 0, 1, 3, 1, 3, 4, 4, 3, 3, 3, 603 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 604 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 605 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 606 3, 3, 3, 4, 1, 2, 1, 1, 2, 2, 607 2, 3, 3, 1, 2, 1, 2, 1, 3, 2, 608 1, 2, 1, 2, 3, 2, 3, 1, 1, 1, 609 1, 1, 1, 2, 3, 2, 3, 3, 4, 2, 610 3, 1, 2, 2, 2, 2, 2, 2, 1, 2, 611 1, 5, 2, 2, 1, 1, 1, 1, 1, 3, 612 1, 1, 1, 1, 1, 1, 1 613}; 614 615/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 616 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 617 means the default is an error. */ 618static const unsigned char yydefact[] = 619{ 620 0, 70, 72, 77, 78, 75, 145, 108, 109, 71, 621 0, 0, 0, 0, 0, 128, 0, 0, 130, 111, 622 112, 110, 0, 0, 121, 74, 0, 0, 0, 0, 623 0, 0, 0, 146, 0, 0, 39, 0, 3, 2, 624 5, 40, 0, 73, 84, 107, 4, 87, 86, 140, 625 142, 143, 144, 141, 123, 124, 125, 126, 0, 16, 626 0, 134, 136, 137, 135, 127, 85, 0, 136, 137, 627 129, 115, 113, 122, 119, 132, 133, 8, 9, 7, 628 13, 12, 24, 26, 28, 0, 0, 10, 11, 1, 629 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 631 0, 0, 0, 15, 14, 0, 0, 37, 0, 41, 632 0, 0, 0, 0, 88, 89, 95, 93, 0, 0, 633 90, 97, 100, 102, 0, 117, 114, 120, 0, 116, 634 0, 0, 0, 47, 0, 6, 69, 68, 0, 66, 635 65, 64, 63, 62, 57, 56, 60, 61, 59, 58, 636 55, 54, 48, 52, 53, 49, 50, 51, 142, 143, 637 0, 21, 20, 0, 40, 0, 18, 17, 0, 43, 638 44, 0, 81, 0, 82, 91, 92, 96, 94, 0, 639 103, 105, 0, 138, 87, 0, 0, 99, 101, 76, 640 118, 0, 0, 0, 0, 31, 32, 30, 0, 0, 641 46, 0, 22, 23, 0, 19, 42, 45, 83, 104, 642 98, 0, 106, 131, 36, 35, 25, 33, 0, 0, 643 27, 29, 67, 38, 139, 34 644}; 645 646/* YYDEFGOTO[NTERM-NUM]. */ 647static const short yydefgoto[] = 648{ 649 -1, 37, 38, 85, 40, 140, 141, 142, 204, 205, 650 206, 174, 41, 120, 180, 42, 43, 44, 45, 130, 651 131, 132, 133, 193, 60, 65, 195, 207, 48 652}; 653 654/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 655 STATE-NUM. */ 656#define YYPACT_NINF -86 657static const short yypact[] = 658{ 659 220, -86, -86, -86, -86, -86, -86, -86, -86, -86, 660 19, 19, 19, 19, 284, 28, 19, 19, 118, 16, 661 -9, -86, 240, 240, -86, -86, 220, 220, 220, 220, 662 220, 348, 220, 8, 220, 220, -86, 44, -86, 23, 663 573, 220, 91, -86, -86, -86, -86, 119, -86, -86, 664 -86, -86, -86, -86, -86, -86, -86, -86, 220, 129, 665 93, -86, 47, 88, -86, -86, -86, 73, -86, -86, 666 -86, 100, -86, -86, -86, -86, -86, 129, 129, 129, 667 129, 129, 97, 108, 573, -20, 63, 129, 129, -86, 668 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 669 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 670 220, 220, 220, -86, -86, 491, 220, -86, 511, 573, 671 -21, 69, 19, 112, -3, -3, -3, -3, -1, 433, 672 -86, 50, -86, -86, 78, 122, -86, -86, 240, -86, 673 95, 95, 95, -86, 220, 573, 573, 573, 540, 625, 674 649, 672, 694, 715, 734, 734, 157, 157, 157, 157, 675 267, 267, 331, 496, 496, 129, 129, 129, 97, 108, 676 220, -86, -86, 4, 220, 220, -86, -86, 220, -86, 677 -86, 220, 132, 19, -86, -86, -86, -86, -86, 84, 678 -86, -86, 86, -86, 123, -17, 51, -86, -86, 412, 679 -86, 110, 220, 220, 90, 95, -86, 92, 99, 103, 680 129, 220, 129, -86, -16, 129, 573, 129, -86, -86, 681 -86, 240, -86, -86, 573, 573, -86, -86, 92, 220, 682 -86, -86, 600, -86, -86, 573 683}; 684 685/* YYPGOTO[NTERM-NUM]. */ 686static const short yypgoto[] = 687{ 688 -86, -86, -86, 3, -10, -86, -86, -86, -85, -86, 689 -51, -86, -86, -11, 37, -86, -86, -79, -86, 6, 690 -86, 36, 39, 1, 0, 161, -86, -5, -86 691}; 692 693/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 694 positive, shift that token. If negative, reduce the rule which 695 number is the opposite. If zero, do what YYDEFACT says. 696 If YYTABLE_NINF, syntax error. */ 697#define YYTABLE_NINF -110 698static const short yytable[] = 699{ 700 47, 46, 189, 39, 59, 54, 55, 56, 57, 178, 701 90, 66, 67, 221, 178, 74, 77, 78, 79, 80, 702 81, 84, 75, 76, 87, 88, -79, 49, 50, 51, 703 52, 119, 47, 86, 90, 126, 171, 61, 71, 176, 704 72, 47, 121, 73, 89, 143, 179, 127, 222, 233, 705 62, 63, 64, 90, 128, 129, 208, 209, 47, 134, 706 7, 8, 190, 10, 11, 12, 13, 213, 15, 135, 707 17, 136, 18, 19, 20, 21, 22, 23, 24, 53, 708 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 709 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 710 165, 166, 167, 49, 50, 51, 52, 128, 196, 122, 711 172, 123, 137, 177, 138, -108, 191, 182, 184, 173, 712 49, 50, 51, 52, 139, 202, -109, 61, 144, 194, 713 185, 186, 187, 188, 210, 192, 179, 123, 194, 201, 714 68, 69, 64, 199, 124, 125, 200, 219, 124, 125, 715 -80, 220, 223, 226, 227, 53, 229, 126, 181, 203, 716 212, 126, 230, 214, 119, 215, 231, 197, 216, 127, 717 198, 217, 53, 127, 183, 0, 128, 129, 218, 70, 718 128, 129, 113, 114, 0, 115, 116, 117, 118, 210, 719 0, 0, 224, 225, 0, 0, 194, 0, 0, 0, 720 228, 232, 105, 106, 107, 108, 109, 110, 111, 112, 721 113, 114, 0, 115, 116, 117, 118, 0, 0, 235, 722 0, 194, 234, 1, 2, 3, 4, 5, 6, 7, 723 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 724 0, 18, 19, 20, 21, 22, 23, 24, 25, 7, 725 8, 0, 10, 11, 12, 13, 0, 15, 26, 17, 726 0, 18, 19, 20, 21, 22, 23, 24, 0, 27, 727 28, 0, 0, 29, 30, 0, 0, 31, 32, 0, 728 33, 34, 35, 0, 0, 0, 36, 1, 2, 3, 729 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 730 14, 15, 16, 17, 0, 18, 19, 20, 21, 22, 731 23, 24, 25, 0, 107, 108, 109, 110, 111, 112, 732 113, 114, 26, 115, 116, 117, 118, 0, 0, 0, 733 0, 0, 0, 27, 28, 0, 0, 29, 30, 0, 734 0, 31, 58, 0, 33, 34, 35, 0, 0, 0, 735 36, 1, 2, 3, 4, 5, 6, 82, 83, 9, 736 10, 11, 12, 13, 14, 15, 16, 17, 0, 18, 737 19, 20, 21, 22, 23, 24, 25, 0, 0, 108, 738 109, 110, 111, 112, 113, 114, 26, 115, 116, 117, 739 118, 0, 0, 0, 0, 0, 0, 27, 28, 0, 740 0, 29, 30, 0, 0, 31, 32, 0, 33, 34, 741 35, 0, 0, 0, 36, 1, 2, 3, 4, 5, 742 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 743 16, 17, 0, 18, 19, 20, 21, 22, 23, 24, 744 25, 0, 7, 8, 0, 10, 11, 12, 13, 0, 745 15, 0, 17, 0, 18, 19, 20, 21, 22, 23, 746 24, 0, 0, 0, 0, 29, 30, 0, 0, 31, 747 32, 126, 33, 34, 35, 0, 0, 0, 36, 0, 748 0, 0, 0, 127, 0, 0, 0, 0, 0, 0, 749 128, 129, 0, 0, 0, 0, 0, 0, 191, 49, 750 168, 169, 52, 10, 11, 12, 13, 0, 15, 0, 751 17, 0, 18, 19, 20, 21, 22, 23, 24, 49, 752 168, 169, 52, 10, 11, 12, 13, 0, 15, 0, 753 17, 0, 18, 19, 20, 21, 22, 23, 24, 0, 754 0, 170, 0, 0, 0, 0, 110, 111, 112, 113, 755 114, 53, 115, 116, 117, 118, 0, 0, 0, 0, 756 0, 175, 0, 0, 0, 0, 0, 0, 0, 91, 757 0, 53, 92, 93, 94, 95, 96, 97, 98, 99, 758 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 759 110, 111, 112, 113, 114, 0, 115, 116, 117, 118, 760 0, 0, 91, 0, 211, 92, 93, 94, 95, 96, 761 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 762 107, 108, 109, 110, 111, 112, 113, 114, 0, 115, 763 116, 117, 118, 93, 94, 95, 96, 97, 98, 99, 764 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 765 110, 111, 112, 113, 114, 0, 115, 116, 117, 118, 766 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 767 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 768 0, 115, 116, 117, 118, 96, 97, 98, 99, 100, 769 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 770 111, 112, 113, 114, 0, 115, 116, 117, 118, 97, 771 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 772 108, 109, 110, 111, 112, 113, 114, 0, 115, 116, 773 117, 118, 98, 99, 100, 101, 102, 103, 104, 105, 774 106, 107, 108, 109, 110, 111, 112, 113, 114, 0, 775 115, 116, 117, 118, 99, 100, 101, 102, 103, 104, 776 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 777 0, 115, 116, 117, 118, 101, 102, 103, 104, 105, 778 106, 107, 108, 109, 110, 111, 112, 113, 114, 0, 779 115, 116, 117, 118 780}; 781 782static const short yycheck[] = 783{ 784 0, 0, 3, 0, 14, 10, 11, 12, 13, 30, 785 30, 16, 17, 30, 30, 24, 26, 27, 28, 29, 786 30, 31, 22, 23, 34, 35, 18, 8, 9, 10, 787 11, 41, 32, 32, 30, 38, 115, 9, 22, 118, 788 24, 41, 41, 27, 0, 65, 67, 50, 65, 65, 789 22, 23, 24, 30, 57, 58, 141, 142, 58, 58, 790 9, 10, 63, 12, 13, 14, 15, 63, 17, 22, 791 19, 24, 21, 22, 23, 24, 25, 26, 27, 60, 792 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 793 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 794 110, 111, 112, 8, 9, 10, 11, 57, 58, 18, 795 115, 18, 24, 118, 41, 18, 65, 122, 123, 116, 796 8, 9, 10, 11, 24, 30, 18, 9, 65, 129, 797 124, 125, 126, 127, 144, 129, 67, 18, 138, 138, 798 22, 23, 24, 65, 25, 26, 24, 63, 25, 26, 799 18, 65, 42, 63, 205, 60, 64, 38, 121, 64, 800 170, 38, 63, 174, 174, 175, 63, 131, 178, 50, 801 131, 181, 60, 50, 62, -1, 57, 58, 183, 18, 802 57, 58, 53, 54, -1, 56, 57, 58, 59, 199, 803 -1, -1, 202, 203, -1, -1, 196, -1, -1, -1, 804 205, 211, 45, 46, 47, 48, 49, 50, 51, 52, 805 53, 54, -1, 56, 57, 58, 59, -1, -1, 229, 806 -1, 221, 221, 3, 4, 5, 6, 7, 8, 9, 807 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 808 -1, 21, 22, 23, 24, 25, 26, 27, 28, 9, 809 10, -1, 12, 13, 14, 15, -1, 17, 38, 19, 810 -1, 21, 22, 23, 24, 25, 26, 27, -1, 49, 811 50, -1, -1, 53, 54, -1, -1, 57, 58, -1, 812 60, 61, 62, -1, -1, -1, 66, 3, 4, 5, 813 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 814 16, 17, 18, 19, -1, 21, 22, 23, 24, 25, 815 26, 27, 28, -1, 47, 48, 49, 50, 51, 52, 816 53, 54, 38, 56, 57, 58, 59, -1, -1, -1, 817 -1, -1, -1, 49, 50, -1, -1, 53, 54, -1, 818 -1, 57, 58, -1, 60, 61, 62, -1, -1, -1, 819 66, 3, 4, 5, 6, 7, 8, 9, 10, 11, 820 12, 13, 14, 15, 16, 17, 18, 19, -1, 21, 821 22, 23, 24, 25, 26, 27, 28, -1, -1, 48, 822 49, 50, 51, 52, 53, 54, 38, 56, 57, 58, 823 59, -1, -1, -1, -1, -1, -1, 49, 50, -1, 824 -1, 53, 54, -1, -1, 57, 58, -1, 60, 61, 825 62, -1, -1, -1, 66, 3, 4, 5, 6, 7, 826 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 827 18, 19, -1, 21, 22, 23, 24, 25, 26, 27, 828 28, -1, 9, 10, -1, 12, 13, 14, 15, -1, 829 17, -1, 19, -1, 21, 22, 23, 24, 25, 26, 830 27, -1, -1, -1, -1, 53, 54, -1, -1, 57, 831 58, 38, 60, 61, 62, -1, -1, -1, 66, -1, 832 -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, 833 57, 58, -1, -1, -1, -1, -1, -1, 65, 8, 834 9, 10, 11, 12, 13, 14, 15, -1, 17, -1, 835 19, -1, 21, 22, 23, 24, 25, 26, 27, 8, 836 9, 10, 11, 12, 13, 14, 15, -1, 17, -1, 837 19, -1, 21, 22, 23, 24, 25, 26, 27, -1, 838 -1, 50, -1, -1, -1, -1, 50, 51, 52, 53, 839 54, 60, 56, 57, 58, 59, -1, -1, -1, -1, 840 -1, 50, -1, -1, -1, -1, -1, -1, -1, 29, 841 -1, 60, 32, 33, 34, 35, 36, 37, 38, 39, 842 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 843 50, 51, 52, 53, 54, -1, 56, 57, 58, 59, 844 -1, -1, 29, -1, 64, 32, 33, 34, 35, 36, 845 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 846 47, 48, 49, 50, 51, 52, 53, 54, -1, 56, 847 57, 58, 59, 33, 34, 35, 36, 37, 38, 39, 848 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 849 50, 51, 52, 53, 54, -1, 56, 57, 58, 59, 850 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 851 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 852 -1, 56, 57, 58, 59, 36, 37, 38, 39, 40, 853 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 854 51, 52, 53, 54, -1, 56, 57, 58, 59, 37, 855 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 856 48, 49, 50, 51, 52, 53, 54, -1, 56, 57, 857 58, 59, 38, 39, 40, 41, 42, 43, 44, 45, 858 46, 47, 48, 49, 50, 51, 52, 53, 54, -1, 859 56, 57, 58, 59, 39, 40, 41, 42, 43, 44, 860 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 861 -1, 56, 57, 58, 59, 41, 42, 43, 44, 45, 862 46, 47, 48, 49, 50, 51, 52, 53, 54, -1, 863 56, 57, 58, 59 864}; 865 866/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 867 symbol of state STATE-NUM. */ 868static const unsigned char yystos[] = 869{ 870 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 871 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 872 23, 24, 25, 26, 27, 28, 38, 49, 50, 53, 873 54, 57, 58, 60, 61, 62, 66, 69, 70, 71, 874 72, 80, 83, 84, 85, 86, 91, 92, 96, 8, 875 9, 10, 11, 60, 95, 95, 95, 95, 58, 72, 876 92, 9, 22, 23, 24, 93, 95, 95, 22, 23, 877 93, 22, 24, 27, 24, 92, 92, 72, 72, 72, 878 72, 72, 9, 10, 72, 71, 91, 72, 72, 0, 879 30, 29, 32, 33, 34, 35, 36, 37, 38, 39, 880 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 881 50, 51, 52, 53, 54, 56, 57, 58, 59, 72, 882 81, 91, 18, 18, 25, 26, 38, 50, 57, 58, 883 87, 88, 89, 90, 91, 22, 24, 24, 41, 24, 884 73, 74, 75, 65, 65, 72, 72, 72, 72, 72, 885 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 886 72, 72, 72, 72, 72, 72, 72, 72, 9, 10, 887 50, 85, 95, 71, 79, 50, 85, 95, 30, 67, 888 82, 82, 95, 62, 95, 87, 87, 87, 87, 3, 889 63, 65, 87, 91, 92, 94, 58, 89, 90, 65, 890 24, 91, 30, 64, 76, 77, 78, 95, 76, 76, 891 72, 64, 72, 63, 81, 72, 72, 72, 95, 63, 892 65, 30, 65, 42, 72, 72, 63, 78, 95, 64, 893 63, 63, 72, 65, 91, 72 894}; 895 896#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 897# define YYSIZE_T __SIZE_TYPE__ 898#endif 899#if ! defined (YYSIZE_T) && defined (size_t) 900# define YYSIZE_T size_t 901#endif 902#if ! defined (YYSIZE_T) 903# if defined (__STDC__) || defined (__cplusplus) 904# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 905# define YYSIZE_T size_t 906# endif 907#endif 908#if ! defined (YYSIZE_T) 909# define YYSIZE_T unsigned int 910#endif 911 912#define yyerrok (yyerrstatus = 0) 913#define yyclearin (yychar = YYEMPTY) 914#define YYEMPTY (-2) 915#define YYEOF 0 916 917#define YYACCEPT goto yyacceptlab 918#define YYABORT goto yyabortlab 919#define YYERROR goto yyerrorlab 920 921 922/* Like YYERROR except do call yyerror. This remains here temporarily 923 to ease the transition to the new meaning of YYERROR, for GCC. 924 Once GCC version 2 has supplanted version 1, this can go. */ 925 926#define YYFAIL goto yyerrlab 927 928#define YYRECOVERING() (!!yyerrstatus) 929 930#define YYBACKUP(Token, Value) \ 931do \ 932 if (yychar == YYEMPTY && yylen == 1) \ 933 { \ 934 yychar = (Token); \ 935 yylval = (Value); \ 936 yytoken = YYTRANSLATE (yychar); \ 937 YYPOPSTACK; \ 938 goto yybackup; \ 939 } \ 940 else \ 941 { \ 942 yyerror ("syntax error: cannot back up");\ 943 YYERROR; \ 944 } \ 945while (0) 946 947#define YYTERROR 1 948#define YYERRCODE 256 949 950/* YYLLOC_DEFAULT -- Compute the default location (before the actions 951 are run). */ 952 953#ifndef YYLLOC_DEFAULT 954# define YYLLOC_DEFAULT(Current, Rhs, N) \ 955 ((Current).first_line = (Rhs)[1].first_line, \ 956 (Current).first_column = (Rhs)[1].first_column, \ 957 (Current).last_line = (Rhs)[N].last_line, \ 958 (Current).last_column = (Rhs)[N].last_column) 959#endif 960 961/* YYLEX -- calling `yylex' with the right arguments. */ 962 963#ifdef YYLEX_PARAM 964# define YYLEX yylex (YYLEX_PARAM) 965#else 966# define YYLEX yylex () 967#endif 968 969/* Enable debugging if requested. */ 970#if YYDEBUG 971 972# ifndef YYFPRINTF 973# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 974# define YYFPRINTF fprintf 975# endif 976 977# define YYDPRINTF(Args) \ 978do { \ 979 if (yydebug) \ 980 YYFPRINTF Args; \ 981} while (0) 982 983# define YYDSYMPRINT(Args) \ 984do { \ 985 if (yydebug) \ 986 yysymprint Args; \ 987} while (0) 988 989# define YYDSYMPRINTF(Title, Token, Value, Location) \ 990do { \ 991 if (yydebug) \ 992 { \ 993 YYFPRINTF (stderr, "%s ", Title); \ 994 yysymprint (stderr, \ 995 Token, Value); \ 996 YYFPRINTF (stderr, "\n"); \ 997 } \ 998} while (0) 999 1000/*------------------------------------------------------------------. 1001| yy_stack_print -- Print the state stack from its BOTTOM up to its | 1002| TOP (included). | 1003`------------------------------------------------------------------*/ 1004 1005#if defined (__STDC__) || defined (__cplusplus) 1006static void 1007yy_stack_print (short *bottom, short *top) 1008#else 1009static void 1010yy_stack_print (bottom, top) 1011 short *bottom; 1012 short *top; 1013#endif 1014{ 1015 YYFPRINTF (stderr, "Stack now"); 1016 for (/* Nothing. */; bottom <= top; ++bottom) 1017 YYFPRINTF (stderr, " %d", *bottom); 1018 YYFPRINTF (stderr, "\n"); 1019} 1020 1021# define YY_STACK_PRINT(Bottom, Top) \ 1022do { \ 1023 if (yydebug) \ 1024 yy_stack_print ((Bottom), (Top)); \ 1025} while (0) 1026 1027 1028/*------------------------------------------------. 1029| Report that the YYRULE is going to be reduced. | 1030`------------------------------------------------*/ 1031 1032#if defined (__STDC__) || defined (__cplusplus) 1033static void 1034yy_reduce_print (int yyrule) 1035#else 1036static void 1037yy_reduce_print (yyrule) 1038 int yyrule; 1039#endif 1040{ 1041 int yyi; 1042 unsigned int yylno = yyrline[yyrule]; 1043 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", 1044 yyrule - 1, yylno); 1045 /* Print the symbols being reduced, and their result. */ 1046 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) 1047 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); 1048 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); 1049} 1050 1051# define YY_REDUCE_PRINT(Rule) \ 1052do { \ 1053 if (yydebug) \ 1054 yy_reduce_print (Rule); \ 1055} while (0) 1056 1057/* Nonzero means print parse trace. It is left uninitialized so that 1058 multiple parsers can coexist. */ 1059int yydebug; 1060#else /* !YYDEBUG */ 1061# define YYDPRINTF(Args) 1062# define YYDSYMPRINT(Args) 1063# define YYDSYMPRINTF(Title, Token, Value, Location) 1064# define YY_STACK_PRINT(Bottom, Top) 1065# define YY_REDUCE_PRINT(Rule) 1066#endif /* !YYDEBUG */ 1067 1068 1069/* YYINITDEPTH -- initial size of the parser's stacks. */ 1070#ifndef YYINITDEPTH 1071# define YYINITDEPTH 200 1072#endif 1073 1074/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1075 if the built-in stack extension method is used). 1076 1077 Do not make this value too large; the results are undefined if 1078 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) 1079 evaluated with infinite-precision integer arithmetic. */ 1080 1081#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 1082# undef YYMAXDEPTH 1083#endif 1084 1085#ifndef YYMAXDEPTH 1086# define YYMAXDEPTH 10000 1087#endif 1088 1089 1090 1091#if YYERROR_VERBOSE 1092 1093# ifndef yystrlen 1094# if defined (__GLIBC__) && defined (_STRING_H) 1095# define yystrlen strlen 1096# else 1097/* Return the length of YYSTR. */ 1098static YYSIZE_T 1099# if defined (__STDC__) || defined (__cplusplus) 1100yystrlen (const char *yystr) 1101# else 1102yystrlen (yystr) 1103 const char *yystr; 1104# endif 1105{ 1106 register const char *yys = yystr; 1107 1108 while (*yys++ != '\0') 1109 continue; 1110 1111 return yys - yystr - 1; 1112} 1113# endif 1114# endif 1115 1116# ifndef yystpcpy 1117# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) 1118# define yystpcpy stpcpy 1119# else 1120/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1121 YYDEST. */ 1122static char * 1123# if defined (__STDC__) || defined (__cplusplus) 1124yystpcpy (char *yydest, const char *yysrc) 1125# else 1126yystpcpy (yydest, yysrc) 1127 char *yydest; 1128 const char *yysrc; 1129# endif 1130{ 1131 register char *yyd = yydest; 1132 register const char *yys = yysrc; 1133 1134 while ((*yyd++ = *yys++) != '\0') 1135 continue; 1136 1137 return yyd - 1; 1138} 1139# endif 1140# endif 1141 1142#endif /* !YYERROR_VERBOSE */ 1143 1144 1145 1146#if YYDEBUG 1147/*--------------------------------. 1148| Print this symbol on YYOUTPUT. | 1149`--------------------------------*/ 1150 1151#if defined (__STDC__) || defined (__cplusplus) 1152static void 1153yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) 1154#else 1155static void 1156yysymprint (yyoutput, yytype, yyvaluep) 1157 FILE *yyoutput; 1158 int yytype; 1159 YYSTYPE *yyvaluep; 1160#endif 1161{ 1162 /* Pacify ``unused variable'' warnings. */ 1163 (void) yyvaluep; 1164 1165 if (yytype < YYNTOKENS) 1166 { 1167 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 1168# ifdef YYPRINT 1169 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 1170# endif 1171 } 1172 else 1173 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 1174 1175 switch (yytype) 1176 { 1177 default: 1178 break; 1179 } 1180 YYFPRINTF (yyoutput, ")"); 1181} 1182 1183#endif /* ! YYDEBUG */ 1184/*-----------------------------------------------. 1185| Release the memory associated to this symbol. | 1186`-----------------------------------------------*/ 1187 1188#if defined (__STDC__) || defined (__cplusplus) 1189static void 1190yydestruct (int yytype, YYSTYPE *yyvaluep) 1191#else 1192static void 1193yydestruct (yytype, yyvaluep) 1194 int yytype; 1195 YYSTYPE *yyvaluep; 1196#endif 1197{ 1198 /* Pacify ``unused variable'' warnings. */ 1199 (void) yyvaluep; 1200 1201 switch (yytype) 1202 { 1203 1204 default: 1205 break; 1206 } 1207} 1208 1209 1210/* Prevent warnings from -Wmissing-prototypes. */ 1211 1212#ifdef YYPARSE_PARAM 1213# if defined (__STDC__) || defined (__cplusplus) 1214int yyparse (void *YYPARSE_PARAM); 1215# else 1216int yyparse (); 1217# endif 1218#else /* ! YYPARSE_PARAM */ 1219#if defined (__STDC__) || defined (__cplusplus) 1220int yyparse (void); 1221#else 1222int yyparse (); 1223#endif 1224#endif /* ! YYPARSE_PARAM */ 1225 1226 1227 1228/* The lookahead symbol. */ 1229int yychar; 1230 1231/* The semantic value of the lookahead symbol. */ 1232YYSTYPE yylval; 1233 1234/* Number of syntax errors so far. */ 1235int yynerrs; 1236 1237 1238 1239/*----------. 1240| yyparse. | 1241`----------*/ 1242 1243#ifdef YYPARSE_PARAM 1244# if defined (__STDC__) || defined (__cplusplus) 1245int yyparse (void *YYPARSE_PARAM) 1246# else 1247int yyparse (YYPARSE_PARAM) 1248 void *YYPARSE_PARAM; 1249# endif 1250#else /* ! YYPARSE_PARAM */ 1251#if defined (__STDC__) || defined (__cplusplus) 1252int 1253yyparse (void) 1254#else 1255int 1256yyparse () 1257 1258#endif 1259#endif 1260{ 1261 1262 register int yystate; 1263 register int yyn; 1264 int yyresult; 1265 /* Number of tokens to shift before error messages enabled. */ 1266 int yyerrstatus; 1267 /* Lookahead token as an internal (translated) token number. */ 1268 int yytoken = 0; 1269 1270 /* Three stacks and their tools: 1271 `yyss': related to states, 1272 `yyvs': related to semantic values, 1273 `yyls': related to locations. 1274 1275 Refer to the stacks thru separate pointers, to allow yyoverflow 1276 to xreallocate them elsewhere. */ 1277 1278 /* The state stack. */ 1279 short yyssa[YYINITDEPTH]; 1280 short *yyss = yyssa; 1281 register short *yyssp; 1282 1283 /* The semantic value stack. */ 1284 YYSTYPE yyvsa[YYINITDEPTH]; 1285 YYSTYPE *yyvs = yyvsa; 1286 register YYSTYPE *yyvsp; 1287 1288 1289 1290#define YYPOPSTACK (yyvsp--, yyssp--) 1291 1292 YYSIZE_T yystacksize = YYINITDEPTH; 1293 1294 /* The variables used to return semantic value and location from the 1295 action routines. */ 1296 YYSTYPE yyval; 1297 1298 1299 /* When reducing, the number of symbols on the RHS of the reduced 1300 rule. */ 1301 int yylen; 1302 1303 YYDPRINTF ((stderr, "Starting parse\n")); 1304 1305 yystate = 0; 1306 yyerrstatus = 0; 1307 yynerrs = 0; 1308 yychar = YYEMPTY; /* Cause a token to be read. */ 1309 1310 /* Initialize stack pointers. 1311 Waste one element of value and location stack 1312 so that they stay on the same level as the state stack. 1313 The wasted elements are never initialized. */ 1314 1315 yyssp = yyss; 1316 yyvsp = yyvs; 1317 1318 goto yysetstate; 1319 1320/*------------------------------------------------------------. 1321| yynewstate -- Push a new state, which is found in yystate. | 1322`------------------------------------------------------------*/ 1323 yynewstate: 1324 /* In all cases, when you get here, the value and location stacks 1325 have just been pushed. so pushing a state here evens the stacks. 1326 */ 1327 yyssp++; 1328 1329 yysetstate: 1330 *yyssp = yystate; 1331 1332 if (yyss + yystacksize - 1 <= yyssp) 1333 { 1334 /* Get the current used size of the three stacks, in elements. */ 1335 YYSIZE_T yysize = yyssp - yyss + 1; 1336 1337#ifdef yyoverflow 1338 { 1339 /* Give user a chance to xreallocate the stack. Use copies of 1340 these so that the &'s don't force the real ones into 1341 memory. */ 1342 YYSTYPE *yyvs1 = yyvs; 1343 short *yyss1 = yyss; 1344 1345 1346 /* Each stack pointer address is followed by the size of the 1347 data in use in that stack, in bytes. This used to be a 1348 conditional around just the two extra args, but that might 1349 be undefined if yyoverflow is a macro. */ 1350 yyoverflow ("parser stack overflow", 1351 &yyss1, yysize * sizeof (*yyssp), 1352 &yyvs1, yysize * sizeof (*yyvsp), 1353 1354 &yystacksize); 1355 1356 yyss = yyss1; 1357 yyvs = yyvs1; 1358 } 1359#else /* no yyoverflow */ 1360# ifndef YYSTACK_RELOCATE 1361 goto yyoverflowlab; 1362# else 1363 /* Extend the stack our own way. */ 1364 if (YYMAXDEPTH <= yystacksize) 1365 goto yyoverflowlab; 1366 yystacksize *= 2; 1367 if (YYMAXDEPTH < yystacksize) 1368 yystacksize = YYMAXDEPTH; 1369 1370 { 1371 short *yyss1 = yyss; 1372 union yyalloc *yyptr = 1373 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1374 if (! yyptr) 1375 goto yyoverflowlab; 1376 YYSTACK_RELOCATE (yyss); 1377 YYSTACK_RELOCATE (yyvs); 1378 1379# undef YYSTACK_RELOCATE 1380 if (yyss1 != yyssa) 1381 YYSTACK_FREE (yyss1); 1382 } 1383# endif 1384#endif /* no yyoverflow */ 1385 1386 yyssp = yyss + yysize - 1; 1387 yyvsp = yyvs + yysize - 1; 1388 1389 1390 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1391 (unsigned long int) yystacksize)); 1392 1393 if (yyss + yystacksize - 1 <= yyssp) 1394 YYABORT; 1395 } 1396 1397 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1398 1399 goto yybackup; 1400 1401/*-----------. 1402| yybackup. | 1403`-----------*/ 1404yybackup: 1405 1406/* Do appropriate processing given the current state. */ 1407/* Read a lookahead token if we need one and don't already have one. */ 1408/* yyresume: */ 1409 1410 /* First try to decide what to do without reference to lookahead token. */ 1411 1412 yyn = yypact[yystate]; 1413 if (yyn == YYPACT_NINF) 1414 goto yydefault; 1415 1416 /* Not known => get a lookahead token if don't already have one. */ 1417 1418 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1419 if (yychar == YYEMPTY) 1420 { 1421 YYDPRINTF ((stderr, "Reading a token: ")); 1422 yychar = YYLEX; 1423 } 1424 1425 if (yychar <= YYEOF) 1426 { 1427 yychar = yytoken = YYEOF; 1428 YYDPRINTF ((stderr, "Now at end of input.\n")); 1429 } 1430 else 1431 { 1432 yytoken = YYTRANSLATE (yychar); 1433 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); 1434 } 1435 1436 /* If the proper action on seeing token YYTOKEN is to reduce or to 1437 detect an error, take that action. */ 1438 yyn += yytoken; 1439 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1440 goto yydefault; 1441 yyn = yytable[yyn]; 1442 if (yyn <= 0) 1443 { 1444 if (yyn == 0 || yyn == YYTABLE_NINF) 1445 goto yyerrlab; 1446 yyn = -yyn; 1447 goto yyreduce; 1448 } 1449 1450 if (yyn == YYFINAL) 1451 YYACCEPT; 1452 1453 /* Shift the lookahead token. */ 1454 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); 1455 1456 /* Discard the token being shifted unless it is eof. */ 1457 if (yychar != YYEOF) 1458 yychar = YYEMPTY; 1459 1460 *++yyvsp = yylval; 1461 1462 1463 /* Count tokens shifted since error; after three, turn off error 1464 status. */ 1465 if (yyerrstatus) 1466 yyerrstatus--; 1467 1468 yystate = yyn; 1469 goto yynewstate; 1470 1471 1472/*-----------------------------------------------------------. 1473| yydefault -- do the default action for the current state. | 1474`-----------------------------------------------------------*/ 1475yydefault: 1476 yyn = yydefact[yystate]; 1477 if (yyn == 0) 1478 goto yyerrlab; 1479 goto yyreduce; 1480 1481 1482/*-----------------------------. 1483| yyreduce -- Do a reduction. | 1484`-----------------------------*/ 1485yyreduce: 1486 /* yyn is the number of a rule to reduce with. */ 1487 yylen = yyr2[yyn]; 1488 1489 /* If YYLEN is nonzero, implement the default value of the action: 1490 `$$ = $1'. 1491 1492 Otherwise, the following line sets YYVAL to garbage. 1493 This behavior is undocumented and Bison 1494 users should not rely upon it. Assigning to YYVAL 1495 unconditionally makes the parser a bit smaller, and it avoids a 1496 GCC warning that YYVAL may be used uninitialized. */ 1497 yyval = yyvsp[1-yylen]; 1498 1499 1500 YY_REDUCE_PRINT (yyn); 1501 switch (yyn) 1502 { 1503 case 4: 1504#line 232 "objc-exp.y" 1505 { write_exp_elt_opcode(OP_TYPE); 1506 write_exp_elt_type(yyvsp[0].tval); 1507 write_exp_elt_opcode(OP_TYPE);} 1508 break; 1509 1510 case 6: 1511#line 240 "objc-exp.y" 1512 { write_exp_elt_opcode (BINOP_COMMA); } 1513 break; 1514 1515 case 7: 1516#line 245 "objc-exp.y" 1517 { write_exp_elt_opcode (UNOP_IND); } 1518 break; 1519 1520 case 8: 1521#line 249 "objc-exp.y" 1522 { write_exp_elt_opcode (UNOP_ADDR); } 1523 break; 1524 1525 case 9: 1526#line 253 "objc-exp.y" 1527 { write_exp_elt_opcode (UNOP_NEG); } 1528 break; 1529 1530 case 10: 1531#line 257 "objc-exp.y" 1532 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } 1533 break; 1534 1535 case 11: 1536#line 261 "objc-exp.y" 1537 { write_exp_elt_opcode (UNOP_COMPLEMENT); } 1538 break; 1539 1540 case 12: 1541#line 265 "objc-exp.y" 1542 { write_exp_elt_opcode (UNOP_PREINCREMENT); } 1543 break; 1544 1545 case 13: 1546#line 269 "objc-exp.y" 1547 { write_exp_elt_opcode (UNOP_PREDECREMENT); } 1548 break; 1549 1550 case 14: 1551#line 273 "objc-exp.y" 1552 { write_exp_elt_opcode (UNOP_POSTINCREMENT); } 1553 break; 1554 1555 case 15: 1556#line 277 "objc-exp.y" 1557 { write_exp_elt_opcode (UNOP_POSTDECREMENT); } 1558 break; 1559 1560 case 16: 1561#line 281 "objc-exp.y" 1562 { write_exp_elt_opcode (UNOP_SIZEOF); } 1563 break; 1564 1565 case 17: 1566#line 285 "objc-exp.y" 1567 { write_exp_elt_opcode (STRUCTOP_PTR); 1568 write_exp_string (yyvsp[0].sval); 1569 write_exp_elt_opcode (STRUCTOP_PTR); } 1570 break; 1571 1572 case 18: 1573#line 291 "objc-exp.y" 1574 { /* exp->type::name becomes exp->*(&type::name) */ 1575 /* Note: this doesn't work if name is a 1576 static member! FIXME */ 1577 write_exp_elt_opcode (UNOP_ADDR); 1578 write_exp_elt_opcode (STRUCTOP_MPTR); } 1579 break; 1580 1581 case 19: 1582#line 298 "objc-exp.y" 1583 { write_exp_elt_opcode (STRUCTOP_MPTR); } 1584 break; 1585 1586 case 20: 1587#line 302 "objc-exp.y" 1588 { write_exp_elt_opcode (STRUCTOP_STRUCT); 1589 write_exp_string (yyvsp[0].sval); 1590 write_exp_elt_opcode (STRUCTOP_STRUCT); } 1591 break; 1592 1593 case 21: 1594#line 309 "objc-exp.y" 1595 { /* exp.type::name becomes exp.*(&type::name) */ 1596 /* Note: this doesn't work if name is a 1597 static member! FIXME */ 1598 write_exp_elt_opcode (UNOP_ADDR); 1599 write_exp_elt_opcode (STRUCTOP_MEMBER); } 1600 break; 1601 1602 case 22: 1603#line 317 "objc-exp.y" 1604 { write_exp_elt_opcode (STRUCTOP_MEMBER); } 1605 break; 1606 1607 case 23: 1608#line 321 "objc-exp.y" 1609 { write_exp_elt_opcode (BINOP_SUBSCRIPT); } 1610 break; 1611 1612 case 24: 1613#line 329 "objc-exp.y" 1614 { 1615 CORE_ADDR class; 1616 1617 class = lookup_objc_class (parse_gdbarch, 1618 copy_name (yyvsp[0].tsym.stoken)); 1619 if (class == 0) 1620 error (_("%s is not an ObjC Class"), 1621 copy_name (yyvsp[0].tsym.stoken)); 1622 write_exp_elt_opcode (OP_LONG); 1623 write_exp_elt_type (parse_type->builtin_int); 1624 write_exp_elt_longcst ((LONGEST) class); 1625 write_exp_elt_opcode (OP_LONG); 1626 start_msglist(); 1627 } 1628 break; 1629 1630 case 25: 1631#line 344 "objc-exp.y" 1632 { write_exp_elt_opcode (OP_OBJC_MSGCALL); 1633 end_msglist(); 1634 write_exp_elt_opcode (OP_OBJC_MSGCALL); 1635 } 1636 break; 1637 1638 case 26: 1639#line 351 "objc-exp.y" 1640 { 1641 write_exp_elt_opcode (OP_LONG); 1642 write_exp_elt_type (parse_type->builtin_int); 1643 write_exp_elt_longcst ((LONGEST) yyvsp[0].class.class); 1644 write_exp_elt_opcode (OP_LONG); 1645 start_msglist(); 1646 } 1647 break; 1648 1649 case 27: 1650#line 359 "objc-exp.y" 1651 { write_exp_elt_opcode (OP_OBJC_MSGCALL); 1652 end_msglist(); 1653 write_exp_elt_opcode (OP_OBJC_MSGCALL); 1654 } 1655 break; 1656 1657 case 28: 1658#line 366 "objc-exp.y" 1659 { start_msglist(); } 1660 break; 1661 1662 case 29: 1663#line 368 "objc-exp.y" 1664 { write_exp_elt_opcode (OP_OBJC_MSGCALL); 1665 end_msglist(); 1666 write_exp_elt_opcode (OP_OBJC_MSGCALL); 1667 } 1668 break; 1669 1670 case 30: 1671#line 375 "objc-exp.y" 1672 { add_msglist(&yyvsp[0].sval, 0); } 1673 break; 1674 1675 case 34: 1676#line 384 "objc-exp.y" 1677 { add_msglist(&yyvsp[-2].sval, 1); } 1678 break; 1679 1680 case 35: 1681#line 386 "objc-exp.y" 1682 { add_msglist(0, 1); } 1683 break; 1684 1685 case 36: 1686#line 388 "objc-exp.y" 1687 { add_msglist(0, 0); } 1688 break; 1689 1690 case 37: 1691#line 394 "objc-exp.y" 1692 { start_arglist (); } 1693 break; 1694 1695 case 38: 1696#line 396 "objc-exp.y" 1697 { write_exp_elt_opcode (OP_FUNCALL); 1698 write_exp_elt_longcst ((LONGEST) end_arglist ()); 1699 write_exp_elt_opcode (OP_FUNCALL); } 1700 break; 1701 1702 case 39: 1703#line 402 "objc-exp.y" 1704 { start_arglist (); } 1705 break; 1706 1707 case 41: 1708#line 409 "objc-exp.y" 1709 { arglist_len = 1; } 1710 break; 1711 1712 case 42: 1713#line 413 "objc-exp.y" 1714 { arglist_len++; } 1715 break; 1716 1717 case 43: 1718#line 417 "objc-exp.y" 1719 { yyval.lval = end_arglist () - 1; } 1720 break; 1721 1722 case 44: 1723#line 420 "objc-exp.y" 1724 { write_exp_elt_opcode (OP_ARRAY); 1725 write_exp_elt_longcst ((LONGEST) 0); 1726 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); 1727 write_exp_elt_opcode (OP_ARRAY); } 1728 break; 1729 1730 case 45: 1731#line 427 "objc-exp.y" 1732 { write_exp_elt_opcode (UNOP_MEMVAL); 1733 write_exp_elt_type (yyvsp[-2].tval); 1734 write_exp_elt_opcode (UNOP_MEMVAL); } 1735 break; 1736 1737 case 46: 1738#line 433 "objc-exp.y" 1739 { write_exp_elt_opcode (UNOP_CAST); 1740 write_exp_elt_type (yyvsp[-2].tval); 1741 write_exp_elt_opcode (UNOP_CAST); } 1742 break; 1743 1744 case 47: 1745#line 439 "objc-exp.y" 1746 { } 1747 break; 1748 1749 case 48: 1750#line 445 "objc-exp.y" 1751 { write_exp_elt_opcode (BINOP_REPEAT); } 1752 break; 1753 1754 case 49: 1755#line 449 "objc-exp.y" 1756 { write_exp_elt_opcode (BINOP_MUL); } 1757 break; 1758 1759 case 50: 1760#line 453 "objc-exp.y" 1761 { write_exp_elt_opcode (BINOP_DIV); } 1762 break; 1763 1764 case 51: 1765#line 457 "objc-exp.y" 1766 { write_exp_elt_opcode (BINOP_REM); } 1767 break; 1768 1769 case 52: 1770#line 461 "objc-exp.y" 1771 { write_exp_elt_opcode (BINOP_ADD); } 1772 break; 1773 1774 case 53: 1775#line 465 "objc-exp.y" 1776 { write_exp_elt_opcode (BINOP_SUB); } 1777 break; 1778 1779 case 54: 1780#line 469 "objc-exp.y" 1781 { write_exp_elt_opcode (BINOP_LSH); } 1782 break; 1783 1784 case 55: 1785#line 473 "objc-exp.y" 1786 { write_exp_elt_opcode (BINOP_RSH); } 1787 break; 1788 1789 case 56: 1790#line 477 "objc-exp.y" 1791 { write_exp_elt_opcode (BINOP_EQUAL); } 1792 break; 1793 1794 case 57: 1795#line 481 "objc-exp.y" 1796 { write_exp_elt_opcode (BINOP_NOTEQUAL); } 1797 break; 1798 1799 case 58: 1800#line 485 "objc-exp.y" 1801 { write_exp_elt_opcode (BINOP_LEQ); } 1802 break; 1803 1804 case 59: 1805#line 489 "objc-exp.y" 1806 { write_exp_elt_opcode (BINOP_GEQ); } 1807 break; 1808 1809 case 60: 1810#line 493 "objc-exp.y" 1811 { write_exp_elt_opcode (BINOP_LESS); } 1812 break; 1813 1814 case 61: 1815#line 497 "objc-exp.y" 1816 { write_exp_elt_opcode (BINOP_GTR); } 1817 break; 1818 1819 case 62: 1820#line 501 "objc-exp.y" 1821 { write_exp_elt_opcode (BINOP_BITWISE_AND); } 1822 break; 1823 1824 case 63: 1825#line 505 "objc-exp.y" 1826 { write_exp_elt_opcode (BINOP_BITWISE_XOR); } 1827 break; 1828 1829 case 64: 1830#line 509 "objc-exp.y" 1831 { write_exp_elt_opcode (BINOP_BITWISE_IOR); } 1832 break; 1833 1834 case 65: 1835#line 513 "objc-exp.y" 1836 { write_exp_elt_opcode (BINOP_LOGICAL_AND); } 1837 break; 1838 1839 case 66: 1840#line 517 "objc-exp.y" 1841 { write_exp_elt_opcode (BINOP_LOGICAL_OR); } 1842 break; 1843 1844 case 67: 1845#line 521 "objc-exp.y" 1846 { write_exp_elt_opcode (TERNOP_COND); } 1847 break; 1848 1849 case 68: 1850#line 525 "objc-exp.y" 1851 { write_exp_elt_opcode (BINOP_ASSIGN); } 1852 break; 1853 1854 case 69: 1855#line 529 "objc-exp.y" 1856 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); 1857 write_exp_elt_opcode (yyvsp[-1].opcode); 1858 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); } 1859 break; 1860 1861 case 70: 1862#line 535 "objc-exp.y" 1863 { write_exp_elt_opcode (OP_LONG); 1864 write_exp_elt_type (yyvsp[0].typed_val_int.type); 1865 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val)); 1866 write_exp_elt_opcode (OP_LONG); } 1867 break; 1868 1869 case 71: 1870#line 542 "objc-exp.y" 1871 { YYSTYPE val; 1872 parse_number (yyvsp[0].ssym.stoken.ptr, 1873 yyvsp[0].ssym.stoken.length, 0, &val); 1874 write_exp_elt_opcode (OP_LONG); 1875 write_exp_elt_type (val.typed_val_int.type); 1876 write_exp_elt_longcst ((LONGEST) 1877 val.typed_val_int.val); 1878 write_exp_elt_opcode (OP_LONG); 1879 } 1880 break; 1881 1882 case 72: 1883#line 555 "objc-exp.y" 1884 { write_exp_elt_opcode (OP_DOUBLE); 1885 write_exp_elt_type (yyvsp[0].typed_val_float.type); 1886 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval); 1887 write_exp_elt_opcode (OP_DOUBLE); } 1888 break; 1889 1890 case 75: 1891#line 569 "objc-exp.y" 1892 { 1893 write_exp_elt_opcode (OP_OBJC_SELECTOR); 1894 write_exp_string (yyvsp[0].sval); 1895 write_exp_elt_opcode (OP_OBJC_SELECTOR); } 1896 break; 1897 1898 case 76: 1899#line 576 "objc-exp.y" 1900 { write_exp_elt_opcode (OP_LONG); 1901 write_exp_elt_type (parse_type->builtin_int); 1902 CHECK_TYPEDEF (yyvsp[-1].tval); 1903 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval)); 1904 write_exp_elt_opcode (OP_LONG); } 1905 break; 1906 1907 case 77: 1908#line 584 "objc-exp.y" 1909 { /* C strings are converted into array 1910 constants with an explicit null byte 1911 added at the end. Thus the array upper 1912 bound is the string length. There is no 1913 such thing in C as a completely empty 1914 string. */ 1915 char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length; 1916 while (count-- > 0) 1917 { 1918 write_exp_elt_opcode (OP_LONG); 1919 write_exp_elt_type (parse_type->builtin_char); 1920 write_exp_elt_longcst ((LONGEST)(*sp++)); 1921 write_exp_elt_opcode (OP_LONG); 1922 } 1923 write_exp_elt_opcode (OP_LONG); 1924 write_exp_elt_type (parse_type->builtin_char); 1925 write_exp_elt_longcst ((LONGEST)'\0'); 1926 write_exp_elt_opcode (OP_LONG); 1927 write_exp_elt_opcode (OP_ARRAY); 1928 write_exp_elt_longcst ((LONGEST) 0); 1929 write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length)); 1930 write_exp_elt_opcode (OP_ARRAY); } 1931 break; 1932 1933 case 78: 1934#line 611 "objc-exp.y" 1935 { write_exp_elt_opcode (OP_OBJC_NSSTRING); 1936 write_exp_string (yyvsp[0].sval); 1937 write_exp_elt_opcode (OP_OBJC_NSSTRING); } 1938 break; 1939 1940 case 79: 1941#line 617 "objc-exp.y" 1942 { 1943 if (yyvsp[0].ssym.sym != 0) 1944 yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym); 1945 else 1946 { 1947 struct symtab *tem = 1948 lookup_symtab (copy_name (yyvsp[0].ssym.stoken)); 1949 if (tem) 1950 yyval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), 1951 STATIC_BLOCK); 1952 else 1953 error (_("No file or function \"%s\"."), 1954 copy_name (yyvsp[0].ssym.stoken)); 1955 } 1956 } 1957 break; 1958 1959 case 80: 1960#line 635 "objc-exp.y" 1961 { struct symbol *tem 1962 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval, 1963 VAR_DOMAIN, (int *) NULL); 1964 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) 1965 error (_("No function \"%s\" in specified context."), 1966 copy_name (yyvsp[0].sval)); 1967 yyval.bval = SYMBOL_BLOCK_VALUE (tem); } 1968 break; 1969 1970 case 81: 1971#line 645 "objc-exp.y" 1972 { struct symbol *sym; 1973 sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval, 1974 VAR_DOMAIN, (int *) NULL); 1975 if (sym == 0) 1976 error (_("No symbol \"%s\" in specified context."), 1977 copy_name (yyvsp[0].sval)); 1978 1979 write_exp_elt_opcode (OP_VAR_VALUE); 1980 /* block_found is set by lookup_symbol. */ 1981 write_exp_elt_block (block_found); 1982 write_exp_elt_sym (sym); 1983 write_exp_elt_opcode (OP_VAR_VALUE); } 1984 break; 1985 1986 case 82: 1987#line 660 "objc-exp.y" 1988 { 1989 struct type *type = yyvsp[-2].tval; 1990 if (TYPE_CODE (type) != TYPE_CODE_STRUCT 1991 && TYPE_CODE (type) != TYPE_CODE_UNION) 1992 error (_("`%s' is not defined as an aggregate type."), 1993 TYPE_NAME (type)); 1994 1995 write_exp_elt_opcode (OP_SCOPE); 1996 write_exp_elt_type (type); 1997 write_exp_string (yyvsp[0].sval); 1998 write_exp_elt_opcode (OP_SCOPE); 1999 } 2000 break; 2001 2002 case 83: 2003#line 673 "objc-exp.y" 2004 { 2005 struct type *type = yyvsp[-3].tval; 2006 struct stoken tmp_token; 2007 if (TYPE_CODE (type) != TYPE_CODE_STRUCT 2008 && TYPE_CODE (type) != TYPE_CODE_UNION) 2009 error (_("`%s' is not defined as an aggregate type."), 2010 TYPE_NAME (type)); 2011 2012 if (strcmp (type_name_no_tag (type), yyvsp[0].sval.ptr) != 0) 2013 error (_("invalid destructor `%s::~%s'"), 2014 type_name_no_tag (type), yyvsp[0].sval.ptr); 2015 2016 tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2); 2017 tmp_token.length = yyvsp[0].sval.length + 1; 2018 tmp_token.ptr[0] = '~'; 2019 memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length); 2020 tmp_token.ptr[tmp_token.length] = 0; 2021 write_exp_elt_opcode (OP_SCOPE); 2022 write_exp_elt_type (type); 2023 write_exp_string (tmp_token); 2024 write_exp_elt_opcode (OP_SCOPE); 2025 } 2026 break; 2027 2028 case 85: 2029#line 699 "objc-exp.y" 2030 { 2031 char *name = copy_name (yyvsp[0].sval); 2032 struct symbol *sym; 2033 struct minimal_symbol *msymbol; 2034 2035 sym = 2036 lookup_symbol (name, (const struct block *) NULL, 2037 VAR_DOMAIN, (int *) NULL); 2038 if (sym) 2039 { 2040 write_exp_elt_opcode (OP_VAR_VALUE); 2041 write_exp_elt_block (NULL); 2042 write_exp_elt_sym (sym); 2043 write_exp_elt_opcode (OP_VAR_VALUE); 2044 break; 2045 } 2046 2047 msymbol = lookup_minimal_symbol (name, NULL, NULL); 2048 if (msymbol != NULL) 2049 write_exp_msymbol (msymbol); 2050 else if (!have_full_symbols () 2051 && !have_partial_symbols ()) 2052 error (_("No symbol table is loaded. " 2053 "Use the \"file\" command.")); 2054 else 2055 error (_("No symbol \"%s\" in current context."), 2056 name); 2057 } 2058 break; 2059 2060 case 86: 2061#line 730 "objc-exp.y" 2062 { struct symbol *sym = yyvsp[0].ssym.sym; 2063 2064 if (sym) 2065 { 2066 if (symbol_read_needs_frame (sym)) 2067 { 2068 if (innermost_block == 0 || 2069 contained_in (block_found, 2070 innermost_block)) 2071 innermost_block = block_found; 2072 } 2073 2074 write_exp_elt_opcode (OP_VAR_VALUE); 2075 /* We want to use the selected frame, not 2076 another more inner frame which happens to 2077 be in the same block. */ 2078 write_exp_elt_block (NULL); 2079 write_exp_elt_sym (sym); 2080 write_exp_elt_opcode (OP_VAR_VALUE); 2081 } 2082 else if (yyvsp[0].ssym.is_a_field_of_this) 2083 { 2084 /* C++/ObjC: it hangs off of `this'/'self'. 2085 Must not inadvertently convert from a 2086 method call to data ref. */ 2087 if (innermost_block == 0 || 2088 contained_in (block_found, innermost_block)) 2089 innermost_block = block_found; 2090 write_exp_elt_opcode (OP_OBJC_SELF); 2091 write_exp_elt_opcode (OP_OBJC_SELF); 2092 write_exp_elt_opcode (STRUCTOP_PTR); 2093 write_exp_string (yyvsp[0].ssym.stoken); 2094 write_exp_elt_opcode (STRUCTOP_PTR); 2095 } 2096 else 2097 { 2098 struct minimal_symbol *msymbol; 2099 char *arg = copy_name (yyvsp[0].ssym.stoken); 2100 2101 msymbol = 2102 lookup_minimal_symbol (arg, NULL, NULL); 2103 if (msymbol != NULL) 2104 write_exp_msymbol (msymbol); 2105 else if (!have_full_symbols () && 2106 !have_partial_symbols ()) 2107 error (_("No symbol table is loaded. " 2108 "Use the \"file\" command.")); 2109 else 2110 error (_("No symbol \"%s\" in current context."), 2111 copy_name (yyvsp[0].ssym.stoken)); 2112 } 2113 } 2114 break; 2115 2116 case 90: 2117#line 794 "objc-exp.y" 2118 { yyval.tval = follow_types (yyvsp[-1].tval); } 2119 break; 2120 2121 case 91: 2122#line 796 "objc-exp.y" 2123 { yyval.tval = follow_types (yyvsp[-2].tval); } 2124 break; 2125 2126 case 92: 2127#line 798 "objc-exp.y" 2128 { yyval.tval = follow_types (yyvsp[-2].tval); } 2129 break; 2130 2131 case 93: 2132#line 802 "objc-exp.y" 2133 { push_type (tp_pointer); yyval.voidval = 0; } 2134 break; 2135 2136 case 94: 2137#line 804 "objc-exp.y" 2138 { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; } 2139 break; 2140 2141 case 95: 2142#line 806 "objc-exp.y" 2143 { push_type (tp_reference); yyval.voidval = 0; } 2144 break; 2145 2146 case 96: 2147#line 808 "objc-exp.y" 2148 { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; } 2149 break; 2150 2151 case 98: 2152#line 813 "objc-exp.y" 2153 { yyval.voidval = yyvsp[-1].voidval; } 2154 break; 2155 2156 case 99: 2157#line 815 "objc-exp.y" 2158 { 2159 push_type_int (yyvsp[0].lval); 2160 push_type (tp_array); 2161 } 2162 break; 2163 2164 case 100: 2165#line 820 "objc-exp.y" 2166 { 2167 push_type_int (yyvsp[0].lval); 2168 push_type (tp_array); 2169 yyval.voidval = 0; 2170 } 2171 break; 2172 2173 case 101: 2174#line 827 "objc-exp.y" 2175 { push_type (tp_function); } 2176 break; 2177 2178 case 102: 2179#line 829 "objc-exp.y" 2180 { push_type (tp_function); } 2181 break; 2182 2183 case 103: 2184#line 833 "objc-exp.y" 2185 { yyval.lval = -1; } 2186 break; 2187 2188 case 104: 2189#line 835 "objc-exp.y" 2190 { yyval.lval = yyvsp[-1].typed_val_int.val; } 2191 break; 2192 2193 case 105: 2194#line 839 "objc-exp.y" 2195 { yyval.voidval = 0; } 2196 break; 2197 2198 case 106: 2199#line 841 "objc-exp.y" 2200 { xfree (yyvsp[-1].tvec); yyval.voidval = 0; } 2201 break; 2202 2203 case 108: 2204#line 857 "objc-exp.y" 2205 { yyval.tval = yyvsp[0].tsym.type; } 2206 break; 2207 2208 case 109: 2209#line 859 "objc-exp.y" 2210 { 2211 if (yyvsp[0].class.type == NULL) 2212 error (_("No symbol \"%s\" in current context."), 2213 copy_name(yyvsp[0].class.stoken)); 2214 else 2215 yyval.tval = yyvsp[0].class.type; 2216 } 2217 break; 2218 2219 case 110: 2220#line 867 "objc-exp.y" 2221 { yyval.tval = parse_type->builtin_int; } 2222 break; 2223 2224 case 111: 2225#line 869 "objc-exp.y" 2226 { yyval.tval = parse_type->builtin_long; } 2227 break; 2228 2229 case 112: 2230#line 871 "objc-exp.y" 2231 { yyval.tval = parse_type->builtin_short; } 2232 break; 2233 2234 case 113: 2235#line 873 "objc-exp.y" 2236 { yyval.tval = parse_type->builtin_long; } 2237 break; 2238 2239 case 114: 2240#line 875 "objc-exp.y" 2241 { yyval.tval = parse_type->builtin_unsigned_long; } 2242 break; 2243 2244 case 115: 2245#line 877 "objc-exp.y" 2246 { yyval.tval = parse_type->builtin_long_long; } 2247 break; 2248 2249 case 116: 2250#line 879 "objc-exp.y" 2251 { yyval.tval = parse_type->builtin_long_long; } 2252 break; 2253 2254 case 117: 2255#line 881 "objc-exp.y" 2256 { yyval.tval = parse_type->builtin_unsigned_long_long; } 2257 break; 2258 2259 case 118: 2260#line 883 "objc-exp.y" 2261 { yyval.tval = parse_type->builtin_unsigned_long_long; } 2262 break; 2263 2264 case 119: 2265#line 885 "objc-exp.y" 2266 { yyval.tval = parse_type->builtin_short; } 2267 break; 2268 2269 case 120: 2270#line 887 "objc-exp.y" 2271 { yyval.tval = parse_type->builtin_unsigned_short; } 2272 break; 2273 2274 case 121: 2275#line 889 "objc-exp.y" 2276 { yyval.tval = parse_type->builtin_double; } 2277 break; 2278 2279 case 122: 2280#line 891 "objc-exp.y" 2281 { yyval.tval = parse_type->builtin_long_double; } 2282 break; 2283 2284 case 123: 2285#line 893 "objc-exp.y" 2286 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval), 2287 expression_context_block); } 2288 break; 2289 2290 case 124: 2291#line 896 "objc-exp.y" 2292 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval), 2293 expression_context_block); } 2294 break; 2295 2296 case 125: 2297#line 899 "objc-exp.y" 2298 { yyval.tval = lookup_union (copy_name (yyvsp[0].sval), 2299 expression_context_block); } 2300 break; 2301 2302 case 126: 2303#line 902 "objc-exp.y" 2304 { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval), 2305 expression_context_block); } 2306 break; 2307 2308 case 127: 2309#line 905 "objc-exp.y" 2310 { yyval.tval = lookup_unsigned_typename (parse_language, 2311 parse_gdbarch, 2312 TYPE_NAME(yyvsp[0].tsym.type)); } 2313 break; 2314 2315 case 128: 2316#line 909 "objc-exp.y" 2317 { yyval.tval = parse_type->builtin_unsigned_int; } 2318 break; 2319 2320 case 129: 2321#line 911 "objc-exp.y" 2322 { yyval.tval = lookup_signed_typename (parse_language, 2323 parse_gdbarch, 2324 TYPE_NAME(yyvsp[0].tsym.type)); } 2325 break; 2326 2327 case 130: 2328#line 915 "objc-exp.y" 2329 { yyval.tval = parse_type->builtin_int; } 2330 break; 2331 2332 case 131: 2333#line 917 "objc-exp.y" 2334 { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval, 2335 expression_context_block); 2336 } 2337 break; 2338 2339 case 132: 2340#line 923 "objc-exp.y" 2341 { yyval.tval = yyvsp[0].tval; } 2342 break; 2343 2344 case 133: 2345#line 924 "objc-exp.y" 2346 { yyval.tval = yyvsp[0].tval; } 2347 break; 2348 2349 case 135: 2350#line 929 "objc-exp.y" 2351 { 2352 yyval.tsym.stoken.ptr = "int"; 2353 yyval.tsym.stoken.length = 3; 2354 yyval.tsym.type = parse_type->builtin_int; 2355 } 2356 break; 2357 2358 case 136: 2359#line 935 "objc-exp.y" 2360 { 2361 yyval.tsym.stoken.ptr = "long"; 2362 yyval.tsym.stoken.length = 4; 2363 yyval.tsym.type = parse_type->builtin_long; 2364 } 2365 break; 2366 2367 case 137: 2368#line 941 "objc-exp.y" 2369 { 2370 yyval.tsym.stoken.ptr = "short"; 2371 yyval.tsym.stoken.length = 5; 2372 yyval.tsym.type = parse_type->builtin_short; 2373 } 2374 break; 2375 2376 case 138: 2377#line 950 "objc-exp.y" 2378 { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2); 2379 yyval.ivec[0] = 1; /* Number of types in vector. */ 2380 yyval.tvec[1] = yyvsp[0].tval; 2381 } 2382 break; 2383 2384 case 139: 2385#line 955 "objc-exp.y" 2386 { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1); 2387 yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len); 2388 yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval; 2389 } 2390 break; 2391 2392 case 140: 2393#line 961 "objc-exp.y" 2394 { yyval.sval = yyvsp[0].ssym.stoken; } 2395 break; 2396 2397 case 141: 2398#line 962 "objc-exp.y" 2399 { yyval.sval = yyvsp[0].ssym.stoken; } 2400 break; 2401 2402 case 142: 2403#line 963 "objc-exp.y" 2404 { yyval.sval = yyvsp[0].tsym.stoken; } 2405 break; 2406 2407 case 143: 2408#line 964 "objc-exp.y" 2409 { yyval.sval = yyvsp[0].class.stoken; } 2410 break; 2411 2412 case 144: 2413#line 965 "objc-exp.y" 2414 { yyval.sval = yyvsp[0].ssym.stoken; } 2415 break; 2416 2417 2418 } 2419 2420/* Line 1000 of yacc.c. */ 2421#line 2422 "objc-exp.c" 2422 2423 yyvsp -= yylen; 2424 yyssp -= yylen; 2425 2426 2427 YY_STACK_PRINT (yyss, yyssp); 2428 2429 *++yyvsp = yyval; 2430 2431 2432 /* Now `shift' the result of the reduction. Determine what state 2433 that goes to, based on the state we popped back to and the rule 2434 number reduced by. */ 2435 2436 yyn = yyr1[yyn]; 2437 2438 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2439 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2440 yystate = yytable[yystate]; 2441 else 2442 yystate = yydefgoto[yyn - YYNTOKENS]; 2443 2444 goto yynewstate; 2445 2446 2447/*------------------------------------. 2448| yyerrlab -- here on detecting error | 2449`------------------------------------*/ 2450yyerrlab: 2451 /* If not already recovering from an error, report this error. */ 2452 if (!yyerrstatus) 2453 { 2454 ++yynerrs; 2455#if YYERROR_VERBOSE 2456 yyn = yypact[yystate]; 2457 2458 if (YYPACT_NINF < yyn && yyn < YYLAST) 2459 { 2460 YYSIZE_T yysize = 0; 2461 int yytype = YYTRANSLATE (yychar); 2462 const char* yyprefix; 2463 char *yymsg; 2464 int yyx; 2465 2466 /* Start YYX at -YYN if negative to avoid negative indexes in 2467 YYCHECK. */ 2468 int yyxbegin = yyn < 0 ? -yyn : 0; 2469 2470 /* Stay within bounds of both yycheck and yytname. */ 2471 int yychecklim = YYLAST - yyn; 2472 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 2473 int yycount = 0; 2474 2475 yyprefix = ", expecting "; 2476 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 2477 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 2478 { 2479 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); 2480 yycount += 1; 2481 if (yycount == 5) 2482 { 2483 yysize = 0; 2484 break; 2485 } 2486 } 2487 yysize += (sizeof ("syntax error, unexpected ") 2488 + yystrlen (yytname[yytype])); 2489 yymsg = (char *) YYSTACK_ALLOC (yysize); 2490 if (yymsg != 0) 2491 { 2492 char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); 2493 yyp = yystpcpy (yyp, yytname[yytype]); 2494 2495 if (yycount < 5) 2496 { 2497 yyprefix = ", expecting "; 2498 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 2499 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 2500 { 2501 yyp = yystpcpy (yyp, yyprefix); 2502 yyp = yystpcpy (yyp, yytname[yyx]); 2503 yyprefix = " or "; 2504 } 2505 } 2506 yyerror (yymsg); 2507 YYSTACK_FREE (yymsg); 2508 } 2509 else 2510 yyerror ("syntax error; also virtual memory exhausted"); 2511 } 2512 else 2513#endif /* YYERROR_VERBOSE */ 2514 yyerror ("syntax error"); 2515 } 2516 2517 2518 2519 if (yyerrstatus == 3) 2520 { 2521 /* If just tried and failed to reuse lookahead token after an 2522 error, discard it. */ 2523 2524 if (yychar <= YYEOF) 2525 { 2526 /* If at end of input, pop the error token, 2527 then the rest of the stack, then return failure. */ 2528 if (yychar == YYEOF) 2529 for (;;) 2530 { 2531 YYPOPSTACK; 2532 if (yyssp == yyss) 2533 YYABORT; 2534 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); 2535 yydestruct (yystos[*yyssp], yyvsp); 2536 } 2537 } 2538 else 2539 { 2540 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); 2541 yydestruct (yytoken, &yylval); 2542 yychar = YYEMPTY; 2543 2544 } 2545 } 2546 2547 /* Else will try to reuse lookahead token after shifting the error 2548 token. */ 2549 goto yyerrlab1; 2550 2551 2552/*---------------------------------------------------. 2553| yyerrorlab -- error raised explicitly by YYERROR. | 2554`---------------------------------------------------*/ 2555yyerrorlab: 2556 2557#ifdef __GNUC__ 2558 /* Pacify GCC when the user code never invokes YYERROR and the label 2559 yyerrorlab therefore never appears in user code. */ 2560 if (0) 2561 goto yyerrorlab; 2562#endif 2563 2564 yyvsp -= yylen; 2565 yyssp -= yylen; 2566 yystate = *yyssp; 2567 goto yyerrlab1; 2568 2569 2570/*-------------------------------------------------------------. 2571| yyerrlab1 -- common code for both syntax error and YYERROR. | 2572`-------------------------------------------------------------*/ 2573yyerrlab1: 2574 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2575 2576 for (;;) 2577 { 2578 yyn = yypact[yystate]; 2579 if (yyn != YYPACT_NINF) 2580 { 2581 yyn += YYTERROR; 2582 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2583 { 2584 yyn = yytable[yyn]; 2585 if (0 < yyn) 2586 break; 2587 } 2588 } 2589 2590 /* Pop the current state because it cannot handle the error token. */ 2591 if (yyssp == yyss) 2592 YYABORT; 2593 2594 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); 2595 yydestruct (yystos[yystate], yyvsp); 2596 YYPOPSTACK; 2597 yystate = *yyssp; 2598 YY_STACK_PRINT (yyss, yyssp); 2599 } 2600 2601 if (yyn == YYFINAL) 2602 YYACCEPT; 2603 2604 YYDPRINTF ((stderr, "Shifting error token, ")); 2605 2606 *++yyvsp = yylval; 2607 2608 2609 yystate = yyn; 2610 goto yynewstate; 2611 2612 2613/*-------------------------------------. 2614| yyacceptlab -- YYACCEPT comes here. | 2615`-------------------------------------*/ 2616yyacceptlab: 2617 yyresult = 0; 2618 goto yyreturn; 2619 2620/*-----------------------------------. 2621| yyabortlab -- YYABORT comes here. | 2622`-----------------------------------*/ 2623yyabortlab: 2624 yyresult = 1; 2625 goto yyreturn; 2626 2627#ifndef yyoverflow 2628/*----------------------------------------------. 2629| yyoverflowlab -- parser overflow comes here. | 2630`----------------------------------------------*/ 2631yyoverflowlab: 2632 yyerror ("parser stack overflow"); 2633 yyresult = 2; 2634 /* Fall through. */ 2635#endif 2636 2637yyreturn: 2638#ifndef yyoverflow 2639 if (yyss != yyssa) 2640 YYSTACK_FREE (yyss); 2641#endif 2642 return yyresult; 2643} 2644 2645 2646#line 979 "objc-exp.y" 2647 2648 2649/* Take care of parsing a number (anything that starts with a digit). 2650 Set yylval and return the token type; update lexptr. LEN is the 2651 number of characters in it. */ 2652 2653/*** Needs some error checking for the float case. ***/ 2654 2655static int 2656parse_number (p, len, parsed_float, putithere) 2657 char *p; 2658 int len; 2659 int parsed_float; 2660 YYSTYPE *putithere; 2661{ 2662 /* FIXME: Shouldn't these be unsigned? We don't deal with negative 2663 values here, and we do kind of silly things like cast to 2664 unsigned. */ 2665 LONGEST n = 0; 2666 LONGEST prevn = 0; 2667 unsigned LONGEST un; 2668 2669 int i = 0; 2670 int c; 2671 int base = input_radix; 2672 int unsigned_p = 0; 2673 2674 /* Number of "L" suffixes encountered. */ 2675 int long_p = 0; 2676 2677 /* We have found a "L" or "U" suffix. */ 2678 int found_suffix = 0; 2679 2680 unsigned LONGEST high_bit; 2681 struct type *signed_type; 2682 struct type *unsigned_type; 2683 2684 if (parsed_float) 2685 { 2686 if (! parse_c_float (parse_gdbarch, p, len, 2687 &putithere->typed_val_float.dval, 2688 &putithere->typed_val_float.type)) 2689 return ERROR; 2690 return FLOAT; 2691 } 2692 2693 /* Handle base-switching prefixes 0x, 0t, 0d, and 0. */ 2694 if (p[0] == '0') 2695 switch (p[1]) 2696 { 2697 case 'x': 2698 case 'X': 2699 if (len >= 3) 2700 { 2701 p += 2; 2702 base = 16; 2703 len -= 2; 2704 } 2705 break; 2706 2707 case 't': 2708 case 'T': 2709 case 'd': 2710 case 'D': 2711 if (len >= 3) 2712 { 2713 p += 2; 2714 base = 10; 2715 len -= 2; 2716 } 2717 break; 2718 2719 default: 2720 base = 8; 2721 break; 2722 } 2723 2724 while (len-- > 0) 2725 { 2726 c = *p++; 2727 if (c >= 'A' && c <= 'Z') 2728 c += 'a' - 'A'; 2729 if (c != 'l' && c != 'u') 2730 n *= base; 2731 if (c >= '0' && c <= '9') 2732 { 2733 if (found_suffix) 2734 return ERROR; 2735 n += i = c - '0'; 2736 } 2737 else 2738 { 2739 if (base > 10 && c >= 'a' && c <= 'f') 2740 { 2741 if (found_suffix) 2742 return ERROR; 2743 n += i = c - 'a' + 10; 2744 } 2745 else if (c == 'l') 2746 { 2747 ++long_p; 2748 found_suffix = 1; 2749 } 2750 else if (c == 'u') 2751 { 2752 unsigned_p = 1; 2753 found_suffix = 1; 2754 } 2755 else 2756 return ERROR; /* Char not a digit. */ 2757 } 2758 if (i >= base) 2759 return ERROR; /* Invalid digit in this base. */ 2760 2761 /* Portably test for overflow (only works for nonzero values, so 2762 make a second check for zero). FIXME: Can't we just make n 2763 and prevn unsigned and avoid this? */ 2764 if (c != 'l' && c != 'u' && (prevn >= n) && n != 0) 2765 unsigned_p = 1; /* Try something unsigned. */ 2766 2767 /* Portably test for unsigned overflow. 2768 FIXME: This check is wrong; for example it doesn't find 2769 overflow on 0x123456789 when LONGEST is 32 bits. */ 2770 if (c != 'l' && c != 'u' && n != 0) 2771 { 2772 if ((unsigned_p && (unsigned LONGEST) prevn >= (unsigned LONGEST) n)) 2773 error (_("Numeric constant too large.")); 2774 } 2775 prevn = n; 2776 } 2777 2778 /* An integer constant is an int, a long, or a long long. An L 2779 suffix forces it to be long; an LL suffix forces it to be long 2780 long. If not forced to a larger size, it gets the first type of 2781 the above that it fits in. To figure out whether it fits, we 2782 shift it right and see whether anything remains. Note that we 2783 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one 2784 operation, because many compilers will warn about such a shift 2785 (which always produces a zero result). Sometimes gdbarch_int_bit 2786 or gdbarch_long_int will be that big, sometimes not. To deal with 2787 the case where it is we just always shift the value more than 2788 once, with fewer bits each time. */ 2789 2790 un = (unsigned LONGEST)n >> 2; 2791 if (long_p == 0 2792 && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0) 2793 { 2794 high_bit 2795 = ((unsigned LONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1); 2796 2797 /* A large decimal (not hex or octal) constant (between INT_MAX 2798 and UINT_MAX) is a long or unsigned long, according to ANSI, 2799 never an unsigned int, but this code treats it as unsigned 2800 int. This probably should be fixed. GCC gives a warning on 2801 such constants. */ 2802 2803 unsigned_type = parse_type->builtin_unsigned_int; 2804 signed_type = parse_type->builtin_int; 2805 } 2806 else if (long_p <= 1 2807 && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0) 2808 { 2809 high_bit 2810 = ((unsigned LONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1); 2811 unsigned_type = parse_type->builtin_unsigned_long; 2812 signed_type = parse_type->builtin_long; 2813 } 2814 else 2815 { 2816 high_bit = (((unsigned LONGEST)1) 2817 << (gdbarch_long_long_bit (parse_gdbarch) - 32 - 1) 2818 << 16 2819 << 16); 2820 if (high_bit == 0) 2821 /* A long long does not fit in a LONGEST. */ 2822 high_bit = 2823 (unsigned LONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1); 2824 unsigned_type = parse_type->builtin_unsigned_long_long; 2825 signed_type = parse_type->builtin_long_long; 2826 } 2827 2828 putithere->typed_val_int.val = n; 2829 2830 /* If the high bit of the worked out type is set then this number 2831 has to be unsigned. */ 2832 2833 if (unsigned_p || (n & high_bit)) 2834 { 2835 putithere->typed_val_int.type = unsigned_type; 2836 } 2837 else 2838 { 2839 putithere->typed_val_int.type = signed_type; 2840 } 2841 2842 return INT; 2843} 2844 2845struct token 2846{ 2847 char *operator; 2848 int token; 2849 enum exp_opcode opcode; 2850}; 2851 2852static const struct token tokentab3[] = 2853 { 2854 {">>=", ASSIGN_MODIFY, BINOP_RSH}, 2855 {"<<=", ASSIGN_MODIFY, BINOP_LSH} 2856 }; 2857 2858static const struct token tokentab2[] = 2859 { 2860 {"+=", ASSIGN_MODIFY, BINOP_ADD}, 2861 {"-=", ASSIGN_MODIFY, BINOP_SUB}, 2862 {"*=", ASSIGN_MODIFY, BINOP_MUL}, 2863 {"/=", ASSIGN_MODIFY, BINOP_DIV}, 2864 {"%=", ASSIGN_MODIFY, BINOP_REM}, 2865 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR}, 2866 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND}, 2867 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR}, 2868 {"++", INCREMENT, BINOP_END}, 2869 {"--", DECREMENT, BINOP_END}, 2870 {"->", ARROW, BINOP_END}, 2871 {"&&", ANDAND, BINOP_END}, 2872 {"||", OROR, BINOP_END}, 2873 {"::", COLONCOLON, BINOP_END}, 2874 {"<<", LSH, BINOP_END}, 2875 {">>", RSH, BINOP_END}, 2876 {"==", EQUAL, BINOP_END}, 2877 {"!=", NOTEQUAL, BINOP_END}, 2878 {"<=", LEQ, BINOP_END}, 2879 {">=", GEQ, BINOP_END} 2880 }; 2881 2882/* Read one token, getting characters through lexptr. */ 2883 2884static int 2885yylex (void) 2886{ 2887 int c, tokchr; 2888 int namelen; 2889 unsigned int i; 2890 char *tokstart; 2891 char *tokptr; 2892 int tempbufindex; 2893 static char *tempbuf; 2894 static int tempbufsize; 2895 2896 retry: 2897 2898 tokstart = lexptr; 2899 /* See if it is a special token of length 3. */ 2900 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) 2901 if (strncmp (tokstart, tokentab3[i].operator, 3) == 0) 2902 { 2903 lexptr += 3; 2904 yylval.opcode = tokentab3[i].opcode; 2905 return tokentab3[i].token; 2906 } 2907 2908 /* See if it is a special token of length 2. */ 2909 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) 2910 if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) 2911 { 2912 lexptr += 2; 2913 yylval.opcode = tokentab2[i].opcode; 2914 return tokentab2[i].token; 2915 } 2916 2917 c = 0; 2918 switch (tokchr = *tokstart) 2919 { 2920 case 0: 2921 return 0; 2922 2923 case ' ': 2924 case '\t': 2925 case '\n': 2926 lexptr++; 2927 goto retry; 2928 2929 case '\'': 2930 /* We either have a character constant ('0' or '\177' for 2931 example) or we have a quoted symbol reference ('foo(int,int)' 2932 in C++ for example). */ 2933 lexptr++; 2934 c = *lexptr++; 2935 if (c == '\\') 2936 c = parse_escape (parse_gdbarch, &lexptr); 2937 else if (c == '\'') 2938 error (_("Empty character constant.")); 2939 2940 yylval.typed_val_int.val = c; 2941 yylval.typed_val_int.type = parse_type->builtin_char; 2942 2943 c = *lexptr++; 2944 if (c != '\'') 2945 { 2946 namelen = skip_quoted (tokstart) - tokstart; 2947 if (namelen > 2) 2948 { 2949 lexptr = tokstart + namelen; 2950 if (lexptr[-1] != '\'') 2951 error (_("Unmatched single quote.")); 2952 namelen -= 2; 2953 tokstart++; 2954 goto tryname; 2955 } 2956 error (_("Invalid character constant.")); 2957 } 2958 return INT; 2959 2960 case '(': 2961 paren_depth++; 2962 lexptr++; 2963 return '('; 2964 2965 case ')': 2966 if (paren_depth == 0) 2967 return 0; 2968 paren_depth--; 2969 lexptr++; 2970 return ')'; 2971 2972 case ',': 2973 if (comma_terminates && paren_depth == 0) 2974 return 0; 2975 lexptr++; 2976 return ','; 2977 2978 case '.': 2979 /* Might be a floating point number. */ 2980 if (lexptr[1] < '0' || lexptr[1] > '9') 2981 goto symbol; /* Nope, must be a symbol. */ 2982 /* FALL THRU into number case. */ 2983 2984 case '0': 2985 case '1': 2986 case '2': 2987 case '3': 2988 case '4': 2989 case '5': 2990 case '6': 2991 case '7': 2992 case '8': 2993 case '9': 2994 { 2995 /* It's a number. */ 2996 int got_dot = 0, got_e = 0, toktype = FLOAT; 2997 /* Initialize toktype to anything other than ERROR. */ 2998 char *p = tokstart; 2999 int hex = input_radix > 10; 3000 int local_radix = input_radix; 3001 if (tokchr == '0' && (p[1] == 'x' || p[1] == 'X')) 3002 { 3003 p += 2; 3004 hex = 1; 3005 local_radix = 16; 3006 } 3007 else if (tokchr == '0' && (p[1]=='t' || p[1]=='T' 3008 || p[1]=='d' || p[1]=='D')) 3009 { 3010 p += 2; 3011 hex = 0; 3012 local_radix = 10; 3013 } 3014 3015 for (;; ++p) 3016 { 3017 /* This test includes !hex because 'e' is a valid hex digit 3018 and thus does not indicate a floating point number when 3019 the radix is hex. */ 3020 3021 if (!hex && (*p == 'e' || *p == 'E')) 3022 if (got_e) 3023 toktype = ERROR; /* Only one 'e' in a float. */ 3024 else 3025 got_e = 1; 3026 /* This test does not include !hex, because a '.' always 3027 indicates a decimal floating point number regardless of 3028 the radix. */ 3029 else if (*p == '.') 3030 if (got_dot) 3031 toktype = ERROR; /* Only one '.' in a float. */ 3032 else 3033 got_dot = 1; 3034 else if (got_e && (p[-1] == 'e' || p[-1] == 'E') && 3035 (*p == '-' || *p == '+')) 3036 /* This is the sign of the exponent, not the end of the 3037 number. */ 3038 continue; 3039 /* Always take decimal digits; parse_number handles radix 3040 error. */ 3041 else if (*p >= '0' && *p <= '9') 3042 continue; 3043 /* We will take letters only if hex is true, and only up 3044 to what the input radix would permit. FSF was content 3045 to rely on parse_number to validate; but it leaks. */ 3046 else if (*p >= 'a' && *p <= 'z') 3047 { 3048 if (!hex || *p >= ('a' + local_radix - 10)) 3049 toktype = ERROR; 3050 } 3051 else if (*p >= 'A' && *p <= 'Z') 3052 { 3053 if (!hex || *p >= ('A' + local_radix - 10)) 3054 toktype = ERROR; 3055 } 3056 else break; 3057 } 3058 if (toktype != ERROR) 3059 toktype = parse_number (tokstart, p - tokstart, 3060 got_dot | got_e, &yylval); 3061 if (toktype == ERROR) 3062 { 3063 char *err_copy = (char *) alloca (p - tokstart + 1); 3064 3065 memcpy (err_copy, tokstart, p - tokstart); 3066 err_copy[p - tokstart] = 0; 3067 error (_("Invalid number \"%s\"."), err_copy); 3068 } 3069 lexptr = p; 3070 return toktype; 3071 } 3072 3073 case '+': 3074 case '-': 3075 case '*': 3076 case '/': 3077 case '%': 3078 case '|': 3079 case '&': 3080 case '^': 3081 case '~': 3082 case '!': 3083#if 0 3084 case '@': /* Moved out below. */ 3085#endif 3086 case '<': 3087 case '>': 3088 case '[': 3089 case ']': 3090 case '?': 3091 case ':': 3092 case '=': 3093 case '{': 3094 case '}': 3095 symbol: 3096 lexptr++; 3097 return tokchr; 3098 3099 case '@': 3100 if (strncmp(tokstart, "@selector", 9) == 0) 3101 { 3102 tokptr = strchr(tokstart, '('); 3103 if (tokptr == NULL) 3104 { 3105 error (_("Missing '(' in @selector(...)")); 3106 } 3107 tempbufindex = 0; 3108 tokptr++; /* Skip the '('. */ 3109 do { 3110 /* Grow the static temp buffer if necessary, including 3111 allocating the first one on demand. */ 3112 if (tempbufindex + 1 >= tempbufsize) 3113 { 3114 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64); 3115 } 3116 tempbuf[tempbufindex++] = *tokptr++; 3117 } while ((*tokptr != ')') && (*tokptr != '\0')); 3118 if (*tokptr++ != ')') 3119 { 3120 error (_("Missing ')' in @selector(...)")); 3121 } 3122 tempbuf[tempbufindex] = '\0'; 3123 yylval.sval.ptr = tempbuf; 3124 yylval.sval.length = tempbufindex; 3125 lexptr = tokptr; 3126 return SELECTOR; 3127 } 3128 if (tokstart[1] != '"') 3129 { 3130 lexptr++; 3131 return tokchr; 3132 } 3133 /* ObjC NextStep NSString constant: fall thru and parse like 3134 STRING. */ 3135 tokstart++; 3136 3137 case '"': 3138 3139 /* Build the gdb internal form of the input string in tempbuf, 3140 translating any standard C escape forms seen. Note that the 3141 buffer is null byte terminated *only* for the convenience of 3142 debugging gdb itself and printing the buffer contents when 3143 the buffer contains no embedded nulls. Gdb does not depend 3144 upon the buffer being null byte terminated, it uses the 3145 length string instead. This allows gdb to handle C strings 3146 (as well as strings in other languages) with embedded null 3147 bytes. */ 3148 3149 tokptr = ++tokstart; 3150 tempbufindex = 0; 3151 3152 do { 3153 /* Grow the static temp buffer if necessary, including 3154 allocating the first one on demand. */ 3155 if (tempbufindex + 1 >= tempbufsize) 3156 { 3157 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64); 3158 } 3159 switch (*tokptr) 3160 { 3161 case '\0': 3162 case '"': 3163 /* Do nothing, loop will terminate. */ 3164 break; 3165 case '\\': 3166 tokptr++; 3167 c = parse_escape (parse_gdbarch, &tokptr); 3168 if (c == -1) 3169 { 3170 continue; 3171 } 3172 tempbuf[tempbufindex++] = c; 3173 break; 3174 default: 3175 tempbuf[tempbufindex++] = *tokptr++; 3176 break; 3177 } 3178 } while ((*tokptr != '"') && (*tokptr != '\0')); 3179 if (*tokptr++ != '"') 3180 { 3181 error (_("Unterminated string in expression.")); 3182 } 3183 tempbuf[tempbufindex] = '\0'; /* See note above. */ 3184 yylval.sval.ptr = tempbuf; 3185 yylval.sval.length = tempbufindex; 3186 lexptr = tokptr; 3187 return (tokchr == '@' ? NSSTRING : STRING); 3188 } 3189 3190 if (!(tokchr == '_' || tokchr == '$' || 3191 (tokchr >= 'a' && tokchr <= 'z') || (tokchr >= 'A' && tokchr <= 'Z'))) 3192 /* We must have come across a bad character (e.g. ';'). */ 3193 error (_("Invalid character '%c' in expression."), c); 3194 3195 /* It's a name. See how long it is. */ 3196 namelen = 0; 3197 for (c = tokstart[namelen]; 3198 (c == '_' || c == '$' || (c >= '0' && c <= '9') 3199 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) 3200 { 3201 if (c == '<') 3202 { 3203 int i = namelen; 3204 while (tokstart[++i] && tokstart[i] != '>'); 3205 if (tokstart[i] == '>') 3206 namelen = i; 3207 } 3208 c = tokstart[++namelen]; 3209 } 3210 3211 /* The token "if" terminates the expression and is NOT 3212 removed from the input stream. */ 3213 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') 3214 { 3215 return 0; 3216 } 3217 3218 lexptr += namelen; 3219 3220 tryname: 3221 3222 /* Catch specific keywords. Should be done with a data structure. */ 3223 switch (namelen) 3224 { 3225 case 8: 3226 if (strncmp (tokstart, "unsigned", 8) == 0) 3227 return UNSIGNED; 3228 if (parse_language->la_language == language_cplus 3229 && strncmp (tokstart, "template", 8) == 0) 3230 return TEMPLATE; 3231 if (strncmp (tokstart, "volatile", 8) == 0) 3232 return VOLATILE_KEYWORD; 3233 break; 3234 case 6: 3235 if (strncmp (tokstart, "struct", 6) == 0) 3236 return STRUCT; 3237 if (strncmp (tokstart, "signed", 6) == 0) 3238 return SIGNED_KEYWORD; 3239 if (strncmp (tokstart, "sizeof", 6) == 0) 3240 return SIZEOF; 3241 if (strncmp (tokstart, "double", 6) == 0) 3242 return DOUBLE_KEYWORD; 3243 break; 3244 case 5: 3245 if ((parse_language->la_language == language_cplus) 3246 && strncmp (tokstart, "class", 5) == 0) 3247 return CLASS; 3248 if (strncmp (tokstart, "union", 5) == 0) 3249 return UNION; 3250 if (strncmp (tokstart, "short", 5) == 0) 3251 return SHORT; 3252 if (strncmp (tokstart, "const", 5) == 0) 3253 return CONST_KEYWORD; 3254 break; 3255 case 4: 3256 if (strncmp (tokstart, "enum", 4) == 0) 3257 return ENUM; 3258 if (strncmp (tokstart, "long", 4) == 0) 3259 return LONG; 3260 break; 3261 case 3: 3262 if (strncmp (tokstart, "int", 3) == 0) 3263 return INT_KEYWORD; 3264 break; 3265 default: 3266 break; 3267 } 3268 3269 yylval.sval.ptr = tokstart; 3270 yylval.sval.length = namelen; 3271 3272 if (*tokstart == '$') 3273 { 3274 write_dollar_variable (yylval.sval); 3275 return VARIABLE; 3276 } 3277 3278 /* Use token-type BLOCKNAME for symbols that happen to be defined as 3279 functions or symtabs. If this is not so, then ... 3280 Use token-type TYPENAME for symbols that happen to be defined 3281 currently as names of types; NAME for other symbols. 3282 The caller is not constrained to care about the distinction. */ 3283 { 3284 char *tmp = copy_name (yylval.sval); 3285 struct symbol *sym; 3286 int is_a_field_of_this = 0, *need_this; 3287 int hextype; 3288 3289 if (parse_language->la_language == language_cplus || 3290 parse_language->la_language == language_objc) 3291 need_this = &is_a_field_of_this; 3292 else 3293 need_this = (int *) NULL; 3294 3295 sym = lookup_symbol (tmp, expression_context_block, 3296 VAR_DOMAIN, 3297 need_this); 3298 /* Call lookup_symtab, not lookup_partial_symtab, in case there 3299 are no psymtabs (coff, xcoff, or some future change to blow 3300 away the psymtabs once symbols are read). */ 3301 if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) || 3302 lookup_symtab (tmp)) 3303 { 3304 yylval.ssym.sym = sym; 3305 yylval.ssym.is_a_field_of_this = is_a_field_of_this; 3306 return BLOCKNAME; 3307 } 3308 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) 3309 { 3310#if 1 3311 /* Despite the following flaw, we need to keep this code 3312 enabled. Because we can get called from 3313 check_stub_method, if we don't handle nested types then 3314 it screws many operations in any program which uses 3315 nested types. */ 3316 /* In "A::x", if x is a member function of A and there 3317 happens to be a type (nested or not, since the stabs 3318 don't make that distinction) named x, then this code 3319 incorrectly thinks we are dealing with nested types 3320 rather than a member function. */ 3321 3322 char *p; 3323 char *namestart; 3324 struct symbol *best_sym; 3325 3326 /* Look ahead to detect nested types. This probably should 3327 be done in the grammar, but trying seemed to introduce a 3328 lot of shift/reduce and reduce/reduce conflicts. It's 3329 possible that it could be done, though. Or perhaps a 3330 non-grammar, but less ad hoc, approach would work well. */ 3331 3332 /* Since we do not currently have any way of distinguishing 3333 a nested type from a non-nested one (the stabs don't tell 3334 us whether a type is nested), we just ignore the 3335 containing type. */ 3336 3337 p = lexptr; 3338 best_sym = sym; 3339 while (1) 3340 { 3341 /* Skip whitespace. */ 3342 while (*p == ' ' || *p == '\t' || *p == '\n') 3343 ++p; 3344 if (*p == ':' && p[1] == ':') 3345 { 3346 /* Skip the `::'. */ 3347 p += 2; 3348 /* Skip whitespace. */ 3349 while (*p == ' ' || *p == '\t' || *p == '\n') 3350 ++p; 3351 namestart = p; 3352 while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9') 3353 || (*p >= 'a' && *p <= 'z') 3354 || (*p >= 'A' && *p <= 'Z')) 3355 ++p; 3356 if (p != namestart) 3357 { 3358 struct symbol *cur_sym; 3359 /* As big as the whole rest of the expression, 3360 which is at least big enough. */ 3361 char *ncopy = alloca (strlen (tmp) + 3362 strlen (namestart) + 3); 3363 char *tmp1; 3364 3365 tmp1 = ncopy; 3366 memcpy (tmp1, tmp, strlen (tmp)); 3367 tmp1 += strlen (tmp); 3368 memcpy (tmp1, "::", 2); 3369 tmp1 += 2; 3370 memcpy (tmp1, namestart, p - namestart); 3371 tmp1[p - namestart] = '\0'; 3372 cur_sym = lookup_symbol (ncopy, 3373 expression_context_block, 3374 VAR_DOMAIN, (int *) NULL); 3375 if (cur_sym) 3376 { 3377 if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF) 3378 { 3379 best_sym = cur_sym; 3380 lexptr = p; 3381 } 3382 else 3383 break; 3384 } 3385 else 3386 break; 3387 } 3388 else 3389 break; 3390 } 3391 else 3392 break; 3393 } 3394 3395 yylval.tsym.type = SYMBOL_TYPE (best_sym); 3396#else /* not 0 */ 3397 yylval.tsym.type = SYMBOL_TYPE (sym); 3398#endif /* not 0 */ 3399 return TYPENAME; 3400 } 3401 yylval.tsym.type 3402 = language_lookup_primitive_type_by_name (parse_language, 3403 parse_gdbarch, tmp); 3404 if (yylval.tsym.type != NULL) 3405 return TYPENAME; 3406 3407 /* See if it's an ObjC classname. */ 3408 if (!sym) 3409 { 3410 CORE_ADDR Class = lookup_objc_class (parse_gdbarch, tmp); 3411 if (Class) 3412 { 3413 yylval.class.class = Class; 3414 if ((sym = lookup_struct_typedef (tmp, 3415 expression_context_block, 3416 1))) 3417 yylval.class.type = SYMBOL_TYPE (sym); 3418 return CLASSNAME; 3419 } 3420 } 3421 3422 /* Input names that aren't symbols but ARE valid hex numbers, 3423 when the input radix permits them, can be names or numbers 3424 depending on the parse. Note we support radixes > 16 here. */ 3425 if (!sym && 3426 ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) || 3427 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) 3428 { 3429 YYSTYPE newlval; /* Its value is ignored. */ 3430 hextype = parse_number (tokstart, namelen, 0, &newlval); 3431 if (hextype == INT) 3432 { 3433 yylval.ssym.sym = sym; 3434 yylval.ssym.is_a_field_of_this = is_a_field_of_this; 3435 return NAME_OR_INT; 3436 } 3437 } 3438 3439 /* Any other kind of symbol. */ 3440 yylval.ssym.sym = sym; 3441 yylval.ssym.is_a_field_of_this = is_a_field_of_this; 3442 return NAME; 3443 } 3444} 3445 3446void 3447yyerror (msg) 3448 char *msg; 3449{ 3450 if (*lexptr == '\0') 3451 error(_("A %s near end of expression."), (msg ? msg : "error")); 3452 else 3453 error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), 3454 lexptr); 3455} 3456 3457 3458