GDB (API)
|
00001 /* A Bison parser, made by GNU Bison 2.5. */ 00002 00003 /* Bison implementation for Yacc-like parsers in C 00004 00005 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 /* As a special exception, you may create a larger work that contains 00021 part or all of the Bison parser skeleton and distribute that work 00022 under terms of your choice, so long as that work isn't itself a 00023 parser generator using the skeleton or a modified version thereof 00024 as a parser skeleton. Alternatively, if you modify or redistribute 00025 the parser skeleton itself, you may (at your option) remove this 00026 special exception, which will cause the skeleton and the resulting 00027 Bison output files to be licensed under the GNU General Public 00028 License without this special exception. 00029 00030 This special exception was added by the Free Software Foundation in 00031 version 2.2 of Bison. */ 00032 00033 /* C LALR(1) parser skeleton written by Richard Stallman, by 00034 simplifying the original so-called "semantic" parser. */ 00035 00036 /* All symbols defined below should begin with yy or YY, to avoid 00037 infringing on user name space. This should be done even for local 00038 variables, as they might otherwise be expanded by user macros. 00039 There are some unavoidable exceptions within include files to 00040 define necessary library symbols; they are noted "INFRINGES ON 00041 USER NAME SPACE" below. */ 00042 00043 /* Identify Bison output. */ 00044 #define YYBISON 1 00045 00046 /* Bison version. */ 00047 #define YYBISON_VERSION "2.5" 00048 00049 /* Skeleton name. */ 00050 #define YYSKELETON_NAME "yacc.c" 00051 00052 /* Pure parsers. */ 00053 #define YYPURE 0 00054 00055 /* Push parsers. */ 00056 #define YYPUSH 0 00057 00058 /* Pull parsers. */ 00059 #define YYPULL 1 00060 00061 /* Using locations. */ 00062 #define YYLSP_NEEDED 0 00063 00064 00065 00066 /* Copy the first part of user declarations. */ 00067 00068 /* Line 268 of yacc.c */ 00069 #line 44 "../../src/gdb/p-exp.y" 00070 00071 00072 #include "defs.h" 00073 #include "gdb_string.h" 00074 #include <ctype.h> 00075 #include "expression.h" 00076 #include "value.h" 00077 #include "parser-defs.h" 00078 #include "language.h" 00079 #include "p-lang.h" 00080 #include "bfd.h" /* Required by objfiles.h. */ 00081 #include "symfile.h" /* Required by objfiles.h. */ 00082 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */ 00083 #include "block.h" 00084 #include "completer.h" 00085 00086 #define parse_type builtin_type (parse_gdbarch) 00087 00088 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), 00089 as well as gratuitiously global symbol names, so we can have multiple 00090 yacc generated parsers in gdb. Note that these are only the variables 00091 produced by yacc. If other parser generators (bison, byacc, etc) produce 00092 additional global names that conflict at link time, then those parser 00093 generators need to be fixed instead of adding those names to this list. */ 00094 00095 #define yymaxdepth pascal_maxdepth 00096 #define yyparse pascal_parse 00097 #define yylex pascal_lex 00098 #define yyerror pascal_error 00099 #define yylval pascal_lval 00100 #define yychar pascal_char 00101 #define yydebug pascal_debug 00102 #define yypact pascal_pact 00103 #define yyr1 pascal_r1 00104 #define yyr2 pascal_r2 00105 #define yydef pascal_def 00106 #define yychk pascal_chk 00107 #define yypgo pascal_pgo 00108 #define yyact pascal_act 00109 #define yyexca pascal_exca 00110 #define yyerrflag pascal_errflag 00111 #define yynerrs pascal_nerrs 00112 #define yyps pascal_ps 00113 #define yypv pascal_pv 00114 #define yys pascal_s 00115 #define yy_yys pascal_yys 00116 #define yystate pascal_state 00117 #define yytmp pascal_tmp 00118 #define yyv pascal_v 00119 #define yy_yyv pascal_yyv 00120 #define yyval pascal_val 00121 #define yylloc pascal_lloc 00122 #define yyreds pascal_reds /* With YYDEBUG defined */ 00123 #define yytoks pascal_toks /* With YYDEBUG defined */ 00124 #define yyname pascal_name /* With YYDEBUG defined */ 00125 #define yyrule pascal_rule /* With YYDEBUG defined */ 00126 #define yylhs pascal_yylhs 00127 #define yylen pascal_yylen 00128 #define yydefred pascal_yydefred 00129 #define yydgoto pascal_yydgoto 00130 #define yysindex pascal_yysindex 00131 #define yyrindex pascal_yyrindex 00132 #define yygindex pascal_yygindex 00133 #define yytable pascal_yytable 00134 #define yycheck pascal_yycheck 00135 #define yyss pascal_yyss 00136 #define yysslim pascal_yysslim 00137 #define yyssp pascal_yyssp 00138 #define yystacksize pascal_yystacksize 00139 #define yyvs pascal_yyvs 00140 #define yyvsp pascal_yyvsp 00141 00142 #ifndef YYDEBUG 00143 #define YYDEBUG 1 /* Default to yydebug support */ 00144 #endif 00145 00146 #define YYFPRINTF parser_fprintf 00147 00148 int yyparse (void); 00149 00150 static int yylex (void); 00151 00152 void yyerror (char *); 00153 00154 static char * uptok (char *, int); 00155 00156 00157 /* Line 268 of yacc.c */ 00158 #line 159 "p-exp.c" 00159 00160 /* Enabling traces. */ 00161 #ifndef YYDEBUG 00162 # define YYDEBUG 0 00163 #endif 00164 00165 /* Enabling verbose error messages. */ 00166 #ifdef YYERROR_VERBOSE 00167 # undef YYERROR_VERBOSE 00168 # define YYERROR_VERBOSE 1 00169 #else 00170 # define YYERROR_VERBOSE 0 00171 #endif 00172 00173 /* Enabling the token table. */ 00174 #ifndef YYTOKEN_TABLE 00175 # define YYTOKEN_TABLE 0 00176 #endif 00177 00178 00179 /* Tokens. */ 00180 #ifndef YYTOKENTYPE 00181 # define YYTOKENTYPE 00182 /* Put the tokens into the symbol table, so that GDB and other debuggers 00183 know about them. */ 00184 enum yytokentype { 00185 INT = 258, 00186 FLOAT = 259, 00187 STRING = 260, 00188 FIELDNAME = 261, 00189 COMPLETE = 262, 00190 NAME = 263, 00191 TYPENAME = 264, 00192 NAME_OR_INT = 265, 00193 STRUCT = 266, 00194 CLASS = 267, 00195 SIZEOF = 268, 00196 COLONCOLON = 269, 00197 ERROR = 270, 00198 VARIABLE = 271, 00199 THIS = 272, 00200 TRUEKEYWORD = 273, 00201 FALSEKEYWORD = 274, 00202 ABOVE_COMMA = 275, 00203 ASSIGN = 276, 00204 NOT = 277, 00205 OR = 278, 00206 XOR = 279, 00207 ANDAND = 280, 00208 NOTEQUAL = 281, 00209 GEQ = 282, 00210 LEQ = 283, 00211 MOD = 284, 00212 DIV = 285, 00213 RSH = 286, 00214 LSH = 287, 00215 DECREMENT = 288, 00216 INCREMENT = 289, 00217 UNARY = 290, 00218 ARROW = 291, 00219 BLOCKNAME = 292 00220 }; 00221 #endif 00222 /* Tokens. */ 00223 #define INT 258 00224 #define FLOAT 259 00225 #define STRING 260 00226 #define FIELDNAME 261 00227 #define COMPLETE 262 00228 #define NAME 263 00229 #define TYPENAME 264 00230 #define NAME_OR_INT 265 00231 #define STRUCT 266 00232 #define CLASS 267 00233 #define SIZEOF 268 00234 #define COLONCOLON 269 00235 #define ERROR 270 00236 #define VARIABLE 271 00237 #define THIS 272 00238 #define TRUEKEYWORD 273 00239 #define FALSEKEYWORD 274 00240 #define ABOVE_COMMA 275 00241 #define ASSIGN 276 00242 #define NOT 277 00243 #define OR 278 00244 #define XOR 279 00245 #define ANDAND 280 00246 #define NOTEQUAL 281 00247 #define GEQ 282 00248 #define LEQ 283 00249 #define MOD 284 00250 #define DIV 285 00251 #define RSH 286 00252 #define LSH 287 00253 #define DECREMENT 288 00254 #define INCREMENT 289 00255 #define UNARY 290 00256 #define ARROW 291 00257 #define BLOCKNAME 292 00258 00259 00260 00261 00262 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00263 typedef union YYSTYPE 00264 { 00265 00266 /* Line 293 of yacc.c */ 00267 #line 136 "../../src/gdb/p-exp.y" 00268 00269 LONGEST lval; 00270 struct { 00271 LONGEST val; 00272 struct type *type; 00273 } typed_val_int; 00274 struct { 00275 DOUBLEST dval; 00276 struct type *type; 00277 } typed_val_float; 00278 struct symbol *sym; 00279 struct type *tval; 00280 struct stoken sval; 00281 struct ttype tsym; 00282 struct symtoken ssym; 00283 int voidval; 00284 struct block *bval; 00285 enum exp_opcode opcode; 00286 struct internalvar *ivar; 00287 00288 struct type **tvec; 00289 int *ivec; 00290 00291 00292 00293 /* Line 293 of yacc.c */ 00294 #line 295 "p-exp.c" 00295 } YYSTYPE; 00296 # define YYSTYPE_IS_TRIVIAL 1 00297 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00298 # define YYSTYPE_IS_DECLARED 1 00299 #endif 00300 00301 00302 /* Copy the second part of user declarations. */ 00303 00304 /* Line 343 of yacc.c */ 00305 #line 160 "../../src/gdb/p-exp.y" 00306 00307 /* YYSTYPE gets defined by %union */ 00308 static int parse_number (const char *, int, int, YYSTYPE *); 00309 00310 static struct type *current_type; 00311 static struct internalvar *intvar; 00312 static int leftdiv_is_integer; 00313 static void push_current_type (void); 00314 static void pop_current_type (void); 00315 static int search_field; 00316 00317 00318 /* Line 343 of yacc.c */ 00319 #line 320 "p-exp.c" 00320 00321 #ifdef short 00322 # undef short 00323 #endif 00324 00325 #ifdef YYTYPE_UINT8 00326 typedef YYTYPE_UINT8 yytype_uint8; 00327 #else 00328 typedef unsigned char yytype_uint8; 00329 #endif 00330 00331 #ifdef YYTYPE_INT8 00332 typedef YYTYPE_INT8 yytype_int8; 00333 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00334 || defined __cplusplus || defined _MSC_VER) 00335 typedef signed char yytype_int8; 00336 #else 00337 typedef short int yytype_int8; 00338 #endif 00339 00340 #ifdef YYTYPE_UINT16 00341 typedef YYTYPE_UINT16 yytype_uint16; 00342 #else 00343 typedef unsigned short int yytype_uint16; 00344 #endif 00345 00346 #ifdef YYTYPE_INT16 00347 typedef YYTYPE_INT16 yytype_int16; 00348 #else 00349 typedef short int yytype_int16; 00350 #endif 00351 00352 #ifndef YYSIZE_T 00353 # ifdef __SIZE_TYPE__ 00354 # define YYSIZE_T __SIZE_TYPE__ 00355 # elif defined size_t 00356 # define YYSIZE_T size_t 00357 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00358 || defined __cplusplus || defined _MSC_VER) 00359 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00360 # define YYSIZE_T size_t 00361 # else 00362 # define YYSIZE_T unsigned int 00363 # endif 00364 #endif 00365 00366 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00367 00368 #ifndef YY_ 00369 # if defined YYENABLE_NLS && YYENABLE_NLS 00370 # if ENABLE_NLS 00371 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00372 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00373 # endif 00374 # endif 00375 # ifndef YY_ 00376 # define YY_(msgid) msgid 00377 # endif 00378 #endif 00379 00380 /* Suppress unused-variable warnings by "using" E. */ 00381 #if ! defined lint || defined __GNUC__ 00382 # define YYUSE(e) ((void) (e)) 00383 #else 00384 # define YYUSE(e) /* empty */ 00385 #endif 00386 00387 /* Identity function, used to suppress warnings about constant conditions. */ 00388 #ifndef lint 00389 # define YYID(n) (n) 00390 #else 00391 #if (defined __STDC__ || defined __C99__FUNC__ \ 00392 || defined __cplusplus || defined _MSC_VER) 00393 static int 00394 YYID (int yyi) 00395 #else 00396 static int 00397 YYID (yyi) 00398 int yyi; 00399 #endif 00400 { 00401 return yyi; 00402 } 00403 #endif 00404 00405 #if ! defined yyoverflow || YYERROR_VERBOSE 00406 00407 /* The parser invokes alloca or xmalloc; define the necessary symbols. */ 00408 00409 # ifdef YYSTACK_USE_ALLOCA 00410 # if YYSTACK_USE_ALLOCA 00411 # ifdef __GNUC__ 00412 # define YYSTACK_ALLOC __builtin_alloca 00413 # elif defined __BUILTIN_VA_ARG_INCR 00414 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00415 # elif defined _AIX 00416 # define YYSTACK_ALLOC __alloca 00417 # elif defined _MSC_VER 00418 # define alloca _alloca 00419 # else 00420 # define YYSTACK_ALLOC alloca 00421 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00422 || defined __cplusplus || defined _MSC_VER) 00423 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00424 # ifndef EXIT_SUCCESS 00425 # define EXIT_SUCCESS 0 00426 # endif 00427 # endif 00428 # endif 00429 # endif 00430 # endif 00431 00432 # ifdef YYSTACK_ALLOC 00433 /* Pacify GCC's `empty if-body' warning. */ 00434 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00435 # ifndef YYSTACK_ALLOC_MAXIMUM 00436 /* The OS might guarantee only one guard page at the bottom of the stack, 00437 and a page size can be as small as 4096 bytes. So we cannot safely 00438 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00439 to allow for a few compiler-allocated temporary stack slots. */ 00440 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00441 # endif 00442 # else 00443 # define YYSTACK_ALLOC YYMALLOC 00444 # define YYSTACK_FREE YYFREE 00445 # ifndef YYSTACK_ALLOC_MAXIMUM 00446 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00447 # endif 00448 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 00449 && ! ((defined YYMALLOC || defined xmalloc) \ 00450 && (defined YYFREE || defined xfree))) 00451 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00452 # ifndef EXIT_SUCCESS 00453 # define EXIT_SUCCESS 0 00454 # endif 00455 # endif 00456 # ifndef YYMALLOC 00457 # define YYMALLOC xmalloc 00458 # if ! defined xmalloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00459 || defined __cplusplus || defined _MSC_VER) 00460 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00461 # endif 00462 # endif 00463 # ifndef YYFREE 00464 # define YYFREE xfree 00465 # if ! defined xfree && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00466 || defined __cplusplus || defined _MSC_VER) 00467 void xfree (void *); /* INFRINGES ON USER NAME SPACE */ 00468 # endif 00469 # endif 00470 # endif 00471 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00472 00473 00474 #if (! defined yyoverflow \ 00475 && (! defined __cplusplus \ 00476 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00477 00478 /* A type that is properly aligned for any stack member. */ 00479 union yyalloc 00480 { 00481 yytype_int16 yyss_alloc; 00482 YYSTYPE yyvs_alloc; 00483 }; 00484 00485 /* The size of the maximum gap between one aligned stack and the next. */ 00486 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00487 00488 /* The size of an array large to enough to hold all stacks, each with 00489 N elements. */ 00490 # define YYSTACK_BYTES(N) \ 00491 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00492 + YYSTACK_GAP_MAXIMUM) 00493 00494 # define YYCOPY_NEEDED 1 00495 00496 /* Relocate STACK from its old location to the new one. The 00497 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00498 elements in the stack, and YYPTR gives the new location of the 00499 stack. Advance YYPTR to a properly aligned location for the next 00500 stack. */ 00501 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00502 do \ 00503 { \ 00504 YYSIZE_T yynewbytes; \ 00505 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00506 Stack = &yyptr->Stack_alloc; \ 00507 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00508 yyptr += yynewbytes / sizeof (*yyptr); \ 00509 } \ 00510 while (YYID (0)) 00511 00512 #endif 00513 00514 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 00515 /* Copy COUNT objects from FROM to TO. The source and destination do 00516 not overlap. */ 00517 # ifndef YYCOPY 00518 # if defined __GNUC__ && 1 < __GNUC__ 00519 # define YYCOPY(To, From, Count) \ 00520 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00521 # else 00522 # define YYCOPY(To, From, Count) \ 00523 do \ 00524 { \ 00525 YYSIZE_T yyi; \ 00526 for (yyi = 0; yyi < (Count); yyi++) \ 00527 (To)[yyi] = (From)[yyi]; \ 00528 } \ 00529 while (YYID (0)) 00530 # endif 00531 # endif 00532 #endif /* !YYCOPY_NEEDED */ 00533 00534 /* YYFINAL -- State number of the termination state. */ 00535 #define YYFINAL 3 00536 /* YYLAST -- Last index in YYTABLE. */ 00537 #define YYLAST 382 00538 00539 /* YYNTOKENS -- Number of terminals. */ 00540 #define YYNTOKENS 53 00541 /* YYNNTS -- Number of nonterminals. */ 00542 #define YYNNTS 20 00543 /* YYNRULES -- Number of rules. */ 00544 #define YYNRULES 76 00545 /* YYNRULES -- Number of states. */ 00546 #define YYNSTATES 125 00547 00548 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00549 #define YYUNDEFTOK 2 00550 #define YYMAXUTOK 292 00551 00552 #define YYTRANSLATE(YYX) \ 00553 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00554 00555 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00556 static const yytype_uint8 yytranslate[] = 00557 { 00558 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00562 47, 51, 40, 38, 20, 39, 45, 41, 2, 2, 00563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00564 29, 27, 30, 2, 37, 2, 2, 2, 2, 2, 00565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00567 2, 46, 2, 52, 49, 2, 2, 2, 2, 2, 00568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00583 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00584 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00585 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 00586 26, 28, 31, 32, 33, 34, 35, 36, 42, 43, 00587 44, 48, 50 00588 }; 00589 00590 #if YYDEBUG 00591 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00592 YYRHS. */ 00593 static const yytype_uint8 yyprhs[] = 00594 { 00595 0, 0, 3, 4, 7, 9, 11, 13, 15, 19, 00596 22, 25, 28, 31, 36, 41, 44, 47, 50, 53, 00597 54, 60, 61, 67, 68, 70, 74, 79, 83, 87, 00598 88, 93, 97, 101, 105, 109, 113, 117, 121, 125, 00599 129, 133, 137, 141, 145, 149, 153, 157, 159, 161, 00600 163, 165, 167, 169, 171, 176, 181, 183, 185, 187, 00601 191, 195, 199, 201, 204, 206, 208, 210, 213, 215, 00602 218, 221, 223, 225, 227, 229, 231 00603 }; 00604 00605 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00606 static const yytype_int8 yyrhs[] = 00607 { 00608 54, 0, -1, -1, 55, 56, -1, 58, -1, 57, 00609 -1, 69, -1, 59, -1, 58, 20, 59, -1, 59, 00610 49, -1, 37, 59, -1, 39, 59, -1, 23, 59, 00611 -1, 43, 47, 59, 51, -1, 42, 47, 59, 51, 00612 -1, 59, 45, -1, 60, 6, -1, 60, 71, -1, 00613 60, 7, -1, -1, 59, 46, 61, 58, 52, -1, 00614 -1, 59, 47, 62, 63, 51, -1, -1, 59, -1, 00615 63, 20, 59, -1, 69, 47, 59, 51, -1, 47, 00616 58, 51, -1, 59, 40, 59, -1, -1, 59, 41, 00617 64, 59, -1, 59, 34, 59, -1, 59, 33, 59, 00618 -1, 59, 38, 59, -1, 59, 39, 59, -1, 59, 00619 36, 59, -1, 59, 35, 59, -1, 59, 27, 59, 00620 -1, 59, 28, 59, -1, 59, 32, 59, -1, 59, 00621 31, 59, -1, 59, 29, 59, -1, 59, 30, 59, 00622 -1, 59, 26, 59, -1, 59, 25, 59, -1, 59, 00623 24, 59, -1, 59, 22, 59, -1, 18, -1, 19, 00624 -1, 3, -1, 10, -1, 4, -1, 66, -1, 16, 00625 -1, 13, 47, 69, 51, -1, 13, 47, 59, 51, 00626 -1, 5, -1, 17, -1, 50, -1, 65, 14, 71, 00627 -1, 65, 14, 71, -1, 70, 14, 71, -1, 67, 00628 -1, 14, 71, -1, 72, -1, 70, -1, 68, -1, 00629 49, 70, -1, 9, -1, 11, 71, -1, 12, 71, 00630 -1, 8, -1, 50, -1, 9, -1, 10, -1, 8, 00631 -1, 50, -1 00632 }; 00633 00634 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00635 static const yytype_uint16 yyrline[] = 00636 { 00637 0, 241, 241, 241, 250, 251, 254, 261, 262, 267, 00638 273, 279, 283, 287, 291, 296, 300, 318, 336, 348, 00639 346, 379, 376, 391, 392, 394, 398, 413, 419, 423, 00640 423, 443, 447, 451, 455, 459, 463, 467, 473, 479, 00641 485, 491, 497, 503, 507, 511, 515, 519, 526, 533, 00642 541, 555, 563, 566, 581, 589, 592, 618, 645, 663, 00643 673, 688, 703, 704, 735, 806, 817, 821, 823, 825, 00644 828, 836, 837, 838, 839, 842, 843 00645 }; 00646 #endif 00647 00648 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00649 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00650 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00651 static const char *const yytname[] = 00652 { 00653 "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "FIELDNAME", 00654 "COMPLETE", "NAME", "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", 00655 "SIZEOF", "COLONCOLON", "ERROR", "VARIABLE", "THIS", "TRUEKEYWORD", 00656 "FALSEKEYWORD", "','", "ABOVE_COMMA", "ASSIGN", "NOT", "OR", "XOR", 00657 "ANDAND", "'='", "NOTEQUAL", "'<'", "'>'", "GEQ", "LEQ", "MOD", "DIV", 00658 "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "DECREMENT", 00659 "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "'^'", "BLOCKNAME", 00660 "')'", "']'", "$accept", "start", "$@1", "normal_start", "type_exp", 00661 "exp1", "exp", "field_exp", "$@2", "$@3", "arglist", "$@4", "block", 00662 "variable", "qualified_name", "ptype", "type", "typebase", "name", 00663 "name_not_typename", 0 00664 }; 00665 #endif 00666 00667 # ifdef YYPRINT 00668 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00669 token YYLEX-NUM. */ 00670 static const yytype_uint16 yytoknum[] = 00671 { 00672 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00673 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 00674 44, 275, 276, 277, 278, 279, 280, 61, 281, 60, 00675 62, 282, 283, 284, 285, 286, 287, 64, 43, 45, 00676 42, 47, 288, 289, 290, 46, 91, 40, 291, 94, 00677 292, 41, 93 00678 }; 00679 # endif 00680 00681 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00682 static const yytype_uint8 yyr1[] = 00683 { 00684 0, 53, 55, 54, 56, 56, 57, 58, 58, 59, 00685 59, 59, 59, 59, 59, 60, 59, 59, 59, 61, 00686 59, 62, 59, 63, 63, 63, 59, 59, 59, 64, 00687 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 00688 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 00689 59, 59, 59, 59, 59, 59, 59, 59, 65, 65, 00690 66, 67, 66, 66, 66, 68, 69, 70, 70, 70, 00691 70, 71, 71, 71, 71, 72, 72 00692 }; 00693 00694 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00695 static const yytype_uint8 yyr2[] = 00696 { 00697 0, 2, 0, 2, 1, 1, 1, 1, 3, 2, 00698 2, 2, 2, 4, 4, 2, 2, 2, 2, 0, 00699 5, 0, 5, 0, 1, 3, 4, 3, 3, 0, 00700 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 00701 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 00702 1, 1, 1, 1, 4, 4, 1, 1, 1, 3, 00703 3, 3, 1, 2, 1, 1, 1, 2, 1, 2, 00704 2, 1, 1, 1, 1, 1, 1 00705 }; 00706 00707 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. 00708 Performed when YYTABLE doesn't specify something else to do. Zero 00709 means the default is an error. */ 00710 static const yytype_uint8 yydefact[] = 00711 { 00712 2, 0, 0, 1, 49, 51, 56, 75, 68, 50, 00713 0, 0, 0, 0, 53, 57, 47, 48, 0, 0, 00714 0, 0, 0, 0, 0, 76, 3, 5, 4, 7, 00715 0, 0, 52, 62, 66, 6, 65, 64, 71, 73, 00716 74, 72, 69, 70, 0, 63, 12, 0, 10, 11, 00717 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 00718 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00719 0, 0, 29, 15, 19, 21, 9, 16, 18, 17, 00720 0, 0, 0, 0, 0, 0, 0, 27, 8, 46, 00721 45, 44, 43, 37, 38, 41, 42, 40, 39, 32, 00722 31, 36, 35, 33, 34, 28, 0, 0, 23, 60, 00723 0, 61, 55, 54, 14, 13, 30, 0, 24, 0, 00724 26, 20, 0, 22, 25 00725 }; 00726 00727 /* YYDEFGOTO[NTERM-NUM]. */ 00728 static const yytype_int8 yydefgoto[] = 00729 { 00730 -1, 1, 2, 26, 27, 28, 29, 30, 107, 108, 00731 119, 106, 31, 32, 33, 34, 47, 36, 42, 37 00732 }; 00733 00734 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00735 STATE-NUM. */ 00736 #define YYPACT_NINF -43 00737 static const yytype_int16 yypact[] = 00738 { 00739 -43, 8, 89, -43, -43, -43, -43, -43, -43, -43, 00740 7, 7, -40, 7, -43, -43, -43, -43, 89, 89, 00741 89, -27, -23, 89, 10, 13, -43, -43, 14, 230, 00742 4, 21, -43, -43, -43, -19, 41, -43, -43, -43, 00743 -43, -43, -43, -43, 89, -43, 36, -19, 36, 36, 00744 89, 89, 5, -43, 89, 89, 89, 89, 89, 89, 00745 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 00746 89, 89, -43, -43, -43, -43, -43, -43, -43, -43, 00747 7, 89, 7, 118, -42, 146, 174, -43, 230, 230, 00748 255, 279, 302, 323, 323, 31, 31, 31, 31, 75, 00749 75, 75, 75, 333, 333, 36, 89, 89, 89, 44, 00750 202, -43, -43, -43, -43, -43, 36, 9, 230, 11, 00751 -43, -43, 89, -43, 230 00752 }; 00753 00754 /* YYPGOTO[NTERM-NUM]. */ 00755 static const yytype_int8 yypgoto[] = 00756 { 00757 -43, -43, -43, -43, -43, -20, -18, -43, -43, -43, 00758 -43, -43, -43, -43, -43, -43, 16, 6, -7, -43 00759 }; 00760 00761 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00762 positive, shift that token. If negative, reduce the rule which 00763 number is the opposite. If YYTABLE_NINF, syntax error. */ 00764 #define YYTABLE_NINF -60 00765 static const yytype_int8 yytable[] = 00766 { 00767 46, 48, 49, 52, 43, 81, 45, 44, 3, 113, 00768 77, 78, 38, 39, 40, 38, 39, 40, 35, 8, 00769 50, 10, 11, 79, 51, 54, 83, -58, 81, 54, 00770 53, 122, 85, 86, 54, 80, 88, 89, 90, 91, 00771 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 00772 102, 103, 104, 105, 41, 82, 87, 41, -59, 24, 00773 84, 121, 123, 110, 65, 66, 67, 68, 0, 69, 00774 70, 71, 72, 109, 0, 111, 73, 74, 75, 0, 00775 76, 73, 74, 75, 0, 76, 0, 117, 116, 0, 00776 118, 0, 4, 5, 6, 0, 0, 7, 8, 9, 00777 10, 11, 12, 13, 124, 14, 15, 16, 17, 0, 00778 0, 0, 18, 69, 70, 71, 72, 0, 0, 0, 00779 73, 74, 75, 0, 76, 0, 19, 0, 20, 0, 00780 0, 21, 22, 0, 0, 0, 23, 0, 24, 25, 00781 55, 0, 56, 57, 58, 59, 60, 61, 62, 63, 00782 64, 65, 66, 67, 68, 0, 69, 70, 71, 72, 00783 0, 0, 0, 73, 74, 75, 0, 76, 55, 112, 00784 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 00785 66, 67, 68, 0, 69, 70, 71, 72, 0, 0, 00786 0, 73, 74, 75, 0, 76, 55, 114, 56, 57, 00787 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 00788 68, 0, 69, 70, 71, 72, 0, 0, 0, 73, 00789 74, 75, 0, 76, 55, 115, 56, 57, 58, 59, 00790 60, 61, 62, 63, 64, 65, 66, 67, 68, 0, 00791 69, 70, 71, 72, 0, 0, 0, 73, 74, 75, 00792 0, 76, 55, 120, 56, 57, 58, 59, 60, 61, 00793 62, 63, 64, 65, 66, 67, 68, 0, 69, 70, 00794 71, 72, 0, 0, 0, 73, 74, 75, 0, 76, 00795 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 00796 67, 68, 0, 69, 70, 71, 72, 0, 0, 0, 00797 73, 74, 75, 0, 76, 58, 59, 60, 61, 62, 00798 63, 64, 65, 66, 67, 68, 0, 69, 70, 71, 00799 72, 0, 0, 0, 73, 74, 75, 0, 76, 59, 00800 60, 61, 62, 63, 64, 65, 66, 67, 68, 0, 00801 69, 70, 71, 72, 0, 0, 0, 73, 74, 75, 00802 0, 76, 61, 62, 63, 64, 65, 66, 67, 68, 00803 0, 69, 70, 71, 72, 0, 0, 0, 73, 74, 00804 75, 0, 76, 71, 72, 0, 0, 0, 73, 74, 00805 75, 0, 76 00806 }; 00807 00808 #define yypact_value_is_default(yystate) \ 00809 ((yystate) == (-43)) 00810 00811 #define yytable_value_is_error(yytable_value) \ 00812 YYID (0) 00813 00814 static const yytype_int8 yycheck[] = 00815 { 00816 18, 19, 20, 23, 11, 47, 13, 47, 0, 51, 00817 6, 7, 8, 9, 10, 8, 9, 10, 2, 9, 00818 47, 11, 12, 30, 47, 20, 44, 14, 47, 20, 00819 24, 20, 50, 51, 20, 14, 54, 55, 56, 57, 00820 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 00821 68, 69, 70, 71, 50, 14, 51, 50, 14, 49, 00822 44, 52, 51, 81, 33, 34, 35, 36, -1, 38, 00823 39, 40, 41, 80, -1, 82, 45, 46, 47, -1, 00824 49, 45, 46, 47, -1, 49, -1, 107, 106, -1, 00825 108, -1, 3, 4, 5, -1, -1, 8, 9, 10, 00826 11, 12, 13, 14, 122, 16, 17, 18, 19, -1, 00827 -1, -1, 23, 38, 39, 40, 41, -1, -1, -1, 00828 45, 46, 47, -1, 49, -1, 37, -1, 39, -1, 00829 -1, 42, 43, -1, -1, -1, 47, -1, 49, 50, 00830 22, -1, 24, 25, 26, 27, 28, 29, 30, 31, 00831 32, 33, 34, 35, 36, -1, 38, 39, 40, 41, 00832 -1, -1, -1, 45, 46, 47, -1, 49, 22, 51, 00833 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 00834 34, 35, 36, -1, 38, 39, 40, 41, -1, -1, 00835 -1, 45, 46, 47, -1, 49, 22, 51, 24, 25, 00836 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 00837 36, -1, 38, 39, 40, 41, -1, -1, -1, 45, 00838 46, 47, -1, 49, 22, 51, 24, 25, 26, 27, 00839 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 00840 38, 39, 40, 41, -1, -1, -1, 45, 46, 47, 00841 -1, 49, 22, 51, 24, 25, 26, 27, 28, 29, 00842 30, 31, 32, 33, 34, 35, 36, -1, 38, 39, 00843 40, 41, -1, -1, -1, 45, 46, 47, -1, 49, 00844 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 00845 35, 36, -1, 38, 39, 40, 41, -1, -1, -1, 00846 45, 46, 47, -1, 49, 26, 27, 28, 29, 30, 00847 31, 32, 33, 34, 35, 36, -1, 38, 39, 40, 00848 41, -1, -1, -1, 45, 46, 47, -1, 49, 27, 00849 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 00850 38, 39, 40, 41, -1, -1, -1, 45, 46, 47, 00851 -1, 49, 29, 30, 31, 32, 33, 34, 35, 36, 00852 -1, 38, 39, 40, 41, -1, -1, -1, 45, 46, 00853 47, -1, 49, 40, 41, -1, -1, -1, 45, 46, 00854 47, -1, 49 00855 }; 00856 00857 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00858 symbol of state STATE-NUM. */ 00859 static const yytype_uint8 yystos[] = 00860 { 00861 0, 54, 55, 0, 3, 4, 5, 8, 9, 10, 00862 11, 12, 13, 14, 16, 17, 18, 19, 23, 37, 00863 39, 42, 43, 47, 49, 50, 56, 57, 58, 59, 00864 60, 65, 66, 67, 68, 69, 70, 72, 8, 9, 00865 10, 50, 71, 71, 47, 71, 59, 69, 59, 59, 00866 47, 47, 58, 70, 20, 22, 24, 25, 26, 27, 00867 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 00868 39, 40, 41, 45, 46, 47, 49, 6, 7, 71, 00869 14, 47, 14, 59, 69, 59, 59, 51, 59, 59, 00870 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 00871 59, 59, 59, 59, 59, 59, 64, 61, 62, 71, 00872 59, 71, 51, 51, 51, 51, 59, 58, 59, 63, 00873 51, 52, 20, 51, 59 00874 }; 00875 00876 #define yyerrok (yyerrstatus = 0) 00877 #define yyclearin (yychar = YYEMPTY) 00878 #define YYEMPTY (-2) 00879 #define YYEOF 0 00880 00881 #define YYACCEPT goto yyacceptlab 00882 #define YYABORT goto yyabortlab 00883 #define YYERROR goto yyerrorlab 00884 00885 00886 /* Like YYERROR except do call yyerror. This remains here temporarily 00887 to ease the transition to the new meaning of YYERROR, for GCC. 00888 Once GCC version 2 has supplanted version 1, this can go. However, 00889 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 00890 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 00891 discussed. */ 00892 00893 #define YYFAIL goto yyerrlab 00894 #if defined YYFAIL 00895 /* This is here to suppress warnings from the GCC cpp's 00896 -Wunused-macros. Normally we don't worry about that warning, but 00897 some users do, and we want to make it easy for users to remove 00898 YYFAIL uses, which will produce warnings from Bison 2.5. */ 00899 #endif 00900 00901 #define YYRECOVERING() (!!yyerrstatus) 00902 00903 #define YYBACKUP(Token, Value) \ 00904 do \ 00905 if (yychar == YYEMPTY && yylen == 1) \ 00906 { \ 00907 yychar = (Token); \ 00908 yylval = (Value); \ 00909 YYPOPSTACK (1); \ 00910 goto yybackup; \ 00911 } \ 00912 else \ 00913 { \ 00914 yyerror (YY_("syntax error: cannot back up")); \ 00915 YYERROR; \ 00916 } \ 00917 while (YYID (0)) 00918 00919 00920 #define YYTERROR 1 00921 #define YYERRCODE 256 00922 00923 00924 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00925 If N is 0, then set CURRENT to the empty location which ends 00926 the previous symbol: RHS[0] (always defined). */ 00927 00928 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00929 #ifndef YYLLOC_DEFAULT 00930 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00931 do \ 00932 if (YYID (N)) \ 00933 { \ 00934 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 00935 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 00936 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 00937 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 00938 } \ 00939 else \ 00940 { \ 00941 (Current).first_line = (Current).last_line = \ 00942 YYRHSLOC (Rhs, 0).last_line; \ 00943 (Current).first_column = (Current).last_column = \ 00944 YYRHSLOC (Rhs, 0).last_column; \ 00945 } \ 00946 while (YYID (0)) 00947 #endif 00948 00949 00950 /* This macro is provided for backward compatibility. */ 00951 00952 #ifndef YY_LOCATION_PRINT 00953 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 00954 #endif 00955 00956 00957 /* YYLEX -- calling `yylex' with the right arguments. */ 00958 00959 #ifdef YYLEX_PARAM 00960 # define YYLEX yylex (YYLEX_PARAM) 00961 #else 00962 # define YYLEX yylex () 00963 #endif 00964 00965 /* Enable debugging if requested. */ 00966 #if YYDEBUG 00967 00968 # ifndef YYFPRINTF 00969 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 00970 # define YYFPRINTF fprintf 00971 # endif 00972 00973 # define YYDPRINTF(Args) \ 00974 do { \ 00975 if (yydebug) \ 00976 YYFPRINTF Args; \ 00977 } while (YYID (0)) 00978 00979 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 00980 do { \ 00981 if (yydebug) \ 00982 { \ 00983 YYFPRINTF (stderr, "%s ", Title); \ 00984 yy_symbol_print (stderr, \ 00985 Type, Value); \ 00986 YYFPRINTF (stderr, "\n"); \ 00987 } \ 00988 } while (YYID (0)) 00989 00990 00991 /*--------------------------------. 00992 | Print this symbol on YYOUTPUT. | 00993 `--------------------------------*/ 00994 00995 /*ARGSUSED*/ 00996 #if (defined __STDC__ || defined __C99__FUNC__ \ 00997 || defined __cplusplus || defined _MSC_VER) 00998 static void 00999 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01000 #else 01001 static void 01002 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 01003 FILE *yyoutput; 01004 int yytype; 01005 YYSTYPE const * const yyvaluep; 01006 #endif 01007 { 01008 if (!yyvaluep) 01009 return; 01010 # ifdef YYPRINT 01011 if (yytype < YYNTOKENS) 01012 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 01013 # else 01014 YYUSE (yyoutput); 01015 # endif 01016 switch (yytype) 01017 { 01018 default: 01019 break; 01020 } 01021 } 01022 01023 01024 /*--------------------------------. 01025 | Print this symbol on YYOUTPUT. | 01026 `--------------------------------*/ 01027 01028 #if (defined __STDC__ || defined __C99__FUNC__ \ 01029 || defined __cplusplus || defined _MSC_VER) 01030 static void 01031 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01032 #else 01033 static void 01034 yy_symbol_print (yyoutput, yytype, yyvaluep) 01035 FILE *yyoutput; 01036 int yytype; 01037 YYSTYPE const * const yyvaluep; 01038 #endif 01039 { 01040 if (yytype < YYNTOKENS) 01041 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 01042 else 01043 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 01044 01045 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 01046 YYFPRINTF (yyoutput, ")"); 01047 } 01048 01049 /*------------------------------------------------------------------. 01050 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 01051 | TOP (included). | 01052 `------------------------------------------------------------------*/ 01053 01054 #if (defined __STDC__ || defined __C99__FUNC__ \ 01055 || defined __cplusplus || defined _MSC_VER) 01056 static void 01057 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 01058 #else 01059 static void 01060 yy_stack_print (yybottom, yytop) 01061 yytype_int16 *yybottom; 01062 yytype_int16 *yytop; 01063 #endif 01064 { 01065 YYFPRINTF (stderr, "Stack now"); 01066 for (; yybottom <= yytop; yybottom++) 01067 { 01068 int yybot = *yybottom; 01069 YYFPRINTF (stderr, " %d", yybot); 01070 } 01071 YYFPRINTF (stderr, "\n"); 01072 } 01073 01074 # define YY_STACK_PRINT(Bottom, Top) \ 01075 do { \ 01076 if (yydebug) \ 01077 yy_stack_print ((Bottom), (Top)); \ 01078 } while (YYID (0)) 01079 01080 01081 /*------------------------------------------------. 01082 | Report that the YYRULE is going to be reduced. | 01083 `------------------------------------------------*/ 01084 01085 #if (defined __STDC__ || defined __C99__FUNC__ \ 01086 || defined __cplusplus || defined _MSC_VER) 01087 static void 01088 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 01089 #else 01090 static void 01091 yy_reduce_print (yyvsp, yyrule) 01092 YYSTYPE *yyvsp; 01093 int yyrule; 01094 #endif 01095 { 01096 int yynrhs = yyr2[yyrule]; 01097 int yyi; 01098 unsigned long int yylno = yyrline[yyrule]; 01099 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 01100 yyrule - 1, yylno); 01101 /* The symbols being reduced. */ 01102 for (yyi = 0; yyi < yynrhs; yyi++) 01103 { 01104 YYFPRINTF (stderr, " $%d = ", yyi + 1); 01105 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 01106 &(yyvsp[(yyi + 1) - (yynrhs)]) 01107 ); 01108 YYFPRINTF (stderr, "\n"); 01109 } 01110 } 01111 01112 # define YY_REDUCE_PRINT(Rule) \ 01113 do { \ 01114 if (yydebug) \ 01115 yy_reduce_print (yyvsp, Rule); \ 01116 } while (YYID (0)) 01117 01118 /* Nonzero means print parse trace. It is left uninitialized so that 01119 multiple parsers can coexist. */ 01120 int yydebug; 01121 #else /* !YYDEBUG */ 01122 # define YYDPRINTF(Args) 01123 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 01124 # define YY_STACK_PRINT(Bottom, Top) 01125 # define YY_REDUCE_PRINT(Rule) 01126 #endif /* !YYDEBUG */ 01127 01128 01129 /* YYINITDEPTH -- initial size of the parser's stacks. */ 01130 #ifndef YYINITDEPTH 01131 # define YYINITDEPTH 200 01132 #endif 01133 01134 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 01135 if the built-in stack extension method is used). 01136 01137 Do not make this value too large; the results are undefined if 01138 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 01139 evaluated with infinite-precision integer arithmetic. */ 01140 01141 #ifndef YYMAXDEPTH 01142 # define YYMAXDEPTH 10000 01143 #endif 01144 01145 01146 #if YYERROR_VERBOSE 01147 01148 # ifndef yystrlen 01149 # if defined __GLIBC__ && defined _STRING_H 01150 # define yystrlen strlen 01151 # else 01152 /* Return the length of YYSTR. */ 01153 #if (defined __STDC__ || defined __C99__FUNC__ \ 01154 || defined __cplusplus || defined _MSC_VER) 01155 static YYSIZE_T 01156 yystrlen (const char *yystr) 01157 #else 01158 static YYSIZE_T 01159 yystrlen (yystr) 01160 const char *yystr; 01161 #endif 01162 { 01163 YYSIZE_T yylen; 01164 for (yylen = 0; yystr[yylen]; yylen++) 01165 continue; 01166 return yylen; 01167 } 01168 # endif 01169 # endif 01170 01171 # ifndef yystpcpy 01172 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 01173 # define yystpcpy stpcpy 01174 # else 01175 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 01176 YYDEST. */ 01177 #if (defined __STDC__ || defined __C99__FUNC__ \ 01178 || defined __cplusplus || defined _MSC_VER) 01179 static char * 01180 yystpcpy (char *yydest, const char *yysrc) 01181 #else 01182 static char * 01183 yystpcpy (yydest, yysrc) 01184 char *yydest; 01185 const char *yysrc; 01186 #endif 01187 { 01188 char *yyd = yydest; 01189 const char *yys = yysrc; 01190 01191 while ((*yyd++ = *yys++) != '\0') 01192 continue; 01193 01194 return yyd - 1; 01195 } 01196 # endif 01197 # endif 01198 01199 # ifndef yytnamerr 01200 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01201 quotes and backslashes, so that it's suitable for yyerror. The 01202 heuristic is that double-quoting is unnecessary unless the string 01203 contains an apostrophe, a comma, or backslash (other than 01204 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01205 null, do not copy; instead, return the length of what the result 01206 would have been. */ 01207 static YYSIZE_T 01208 yytnamerr (char *yyres, const char *yystr) 01209 { 01210 if (*yystr == '"') 01211 { 01212 YYSIZE_T yyn = 0; 01213 char const *yyp = yystr; 01214 01215 for (;;) 01216 switch (*++yyp) 01217 { 01218 case '\'': 01219 case ',': 01220 goto do_not_strip_quotes; 01221 01222 case '\\': 01223 if (*++yyp != '\\') 01224 goto do_not_strip_quotes; 01225 /* Fall through. */ 01226 default: 01227 if (yyres) 01228 yyres[yyn] = *yyp; 01229 yyn++; 01230 break; 01231 01232 case '"': 01233 if (yyres) 01234 yyres[yyn] = '\0'; 01235 return yyn; 01236 } 01237 do_not_strip_quotes: ; 01238 } 01239 01240 if (! yyres) 01241 return yystrlen (yystr); 01242 01243 return yystpcpy (yyres, yystr) - yyres; 01244 } 01245 # endif 01246 01247 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 01248 about the unexpected token YYTOKEN for the state stack whose top is 01249 YYSSP. 01250 01251 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 01252 not large enough to hold the message. In that case, also set 01253 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 01254 required number of bytes is too large to store. */ 01255 static int 01256 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 01257 yytype_int16 *yyssp, int yytoken) 01258 { 01259 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); 01260 YYSIZE_T yysize = yysize0; 01261 YYSIZE_T yysize1; 01262 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01263 /* Internationalized format string. */ 01264 const char *yyformat = 0; 01265 /* Arguments of yyformat. */ 01266 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01267 /* Number of reported tokens (one for the "unexpected", one per 01268 "expected"). */ 01269 int yycount = 0; 01270 01271 /* There are many possibilities here to consider: 01272 - Assume YYFAIL is not used. It's too flawed to consider. See 01273 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> 01274 for details. YYERROR is fine as it does not invoke this 01275 function. 01276 - If this state is a consistent state with a default action, then 01277 the only way this function was invoked is if the default action 01278 is an error action. In that case, don't check for expected 01279 tokens because there are none. 01280 - The only way there can be no lookahead present (in yychar) is if 01281 this state is a consistent state with a default action. Thus, 01282 detecting the absence of a lookahead is sufficient to determine 01283 that there is no unexpected or expected token to report. In that 01284 case, just report a simple "syntax error". 01285 - Don't assume there isn't a lookahead just because this state is a 01286 consistent state with a default action. There might have been a 01287 previous inconsistent state, consistent state with a non-default 01288 action, or user semantic action that manipulated yychar. 01289 - Of course, the expected token list depends on states to have 01290 correct lookahead information, and it depends on the parser not 01291 to perform extra reductions after fetching a lookahead from the 01292 scanner and before detecting a syntax error. Thus, state merging 01293 (from LALR or IELR) and default reductions corrupt the expected 01294 token list. However, the list is correct for canonical LR with 01295 one exception: it will still contain any token that will not be 01296 accepted due to an error action in a later state. 01297 */ 01298 if (yytoken != YYEMPTY) 01299 { 01300 int yyn = yypact[*yyssp]; 01301 yyarg[yycount++] = yytname[yytoken]; 01302 if (!yypact_value_is_default (yyn)) 01303 { 01304 /* Start YYX at -YYN if negative to avoid negative indexes in 01305 YYCHECK. In other words, skip the first -YYN actions for 01306 this state because they are default actions. */ 01307 int yyxbegin = yyn < 0 ? -yyn : 0; 01308 /* Stay within bounds of both yycheck and yytname. */ 01309 int yychecklim = YYLAST - yyn + 1; 01310 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01311 int yyx; 01312 01313 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01314 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 01315 && !yytable_value_is_error (yytable[yyx + yyn])) 01316 { 01317 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01318 { 01319 yycount = 1; 01320 yysize = yysize0; 01321 break; 01322 } 01323 yyarg[yycount++] = yytname[yyx]; 01324 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01325 if (! (yysize <= yysize1 01326 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01327 return 2; 01328 yysize = yysize1; 01329 } 01330 } 01331 } 01332 01333 switch (yycount) 01334 { 01335 # define YYCASE_(N, S) \ 01336 case N: \ 01337 yyformat = S; \ 01338 break 01339 YYCASE_(0, YY_("syntax error")); 01340 YYCASE_(1, YY_("syntax error, unexpected %s")); 01341 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 01342 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 01343 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 01344 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 01345 # undef YYCASE_ 01346 } 01347 01348 yysize1 = yysize + yystrlen (yyformat); 01349 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01350 return 2; 01351 yysize = yysize1; 01352 01353 if (*yymsg_alloc < yysize) 01354 { 01355 *yymsg_alloc = 2 * yysize; 01356 if (! (yysize <= *yymsg_alloc 01357 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 01358 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 01359 return 1; 01360 } 01361 01362 /* Avoid sprintf, as that infringes on the user's name space. 01363 Don't have undefined behavior even if the translation 01364 produced a string with the wrong number of "%s"s. */ 01365 { 01366 char *yyp = *yymsg; 01367 int yyi = 0; 01368 while ((*yyp = *yyformat) != '\0') 01369 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 01370 { 01371 yyp += yytnamerr (yyp, yyarg[yyi++]); 01372 yyformat += 2; 01373 } 01374 else 01375 { 01376 yyp++; 01377 yyformat++; 01378 } 01379 } 01380 return 0; 01381 } 01382 #endif /* YYERROR_VERBOSE */ 01383 01384 /*-----------------------------------------------. 01385 | Release the memory associated to this symbol. | 01386 `-----------------------------------------------*/ 01387 01388 /*ARGSUSED*/ 01389 #if (defined __STDC__ || defined __C99__FUNC__ \ 01390 || defined __cplusplus || defined _MSC_VER) 01391 static void 01392 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01393 #else 01394 static void 01395 yydestruct (yymsg, yytype, yyvaluep) 01396 const char *yymsg; 01397 int yytype; 01398 YYSTYPE *yyvaluep; 01399 #endif 01400 { 01401 YYUSE (yyvaluep); 01402 01403 if (!yymsg) 01404 yymsg = "Deleting"; 01405 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01406 01407 switch (yytype) 01408 { 01409 01410 default: 01411 break; 01412 } 01413 } 01414 01415 01416 /* Prevent warnings from -Wmissing-prototypes. */ 01417 #ifdef YYPARSE_PARAM 01418 #if defined __STDC__ || defined __cplusplus 01419 int yyparse (void *YYPARSE_PARAM); 01420 #else 01421 int yyparse (); 01422 #endif 01423 #else /* ! YYPARSE_PARAM */ 01424 #if defined __STDC__ || defined __cplusplus 01425 int yyparse (void); 01426 #else 01427 int yyparse (); 01428 #endif 01429 #endif /* ! YYPARSE_PARAM */ 01430 01431 01432 /* The lookahead symbol. */ 01433 int yychar; 01434 01435 /* The semantic value of the lookahead symbol. */ 01436 YYSTYPE yylval; 01437 01438 /* Number of syntax errors so far. */ 01439 int yynerrs; 01440 01441 01442 /*----------. 01443 | yyparse. | 01444 `----------*/ 01445 01446 #ifdef YYPARSE_PARAM 01447 #if (defined __STDC__ || defined __C99__FUNC__ \ 01448 || defined __cplusplus || defined _MSC_VER) 01449 int 01450 yyparse (void *YYPARSE_PARAM) 01451 #else 01452 int 01453 yyparse (YYPARSE_PARAM) 01454 void *YYPARSE_PARAM; 01455 #endif 01456 #else /* ! YYPARSE_PARAM */ 01457 #if (defined __STDC__ || defined __C99__FUNC__ \ 01458 || defined __cplusplus || defined _MSC_VER) 01459 int 01460 yyparse (void) 01461 #else 01462 int 01463 yyparse () 01464 01465 #endif 01466 #endif 01467 { 01468 int yystate; 01469 /* Number of tokens to shift before error messages enabled. */ 01470 int yyerrstatus; 01471 01472 /* The stacks and their tools: 01473 `yyss': related to states. 01474 `yyvs': related to semantic values. 01475 01476 Refer to the stacks thru separate pointers, to allow yyoverflow 01477 to xreallocate them elsewhere. */ 01478 01479 /* The state stack. */ 01480 yytype_int16 yyssa[YYINITDEPTH]; 01481 yytype_int16 *yyss; 01482 yytype_int16 *yyssp; 01483 01484 /* The semantic value stack. */ 01485 YYSTYPE yyvsa[YYINITDEPTH]; 01486 YYSTYPE *yyvs; 01487 YYSTYPE *yyvsp; 01488 01489 YYSIZE_T yystacksize; 01490 01491 int yyn; 01492 int yyresult; 01493 /* Lookahead token as an internal (translated) token number. */ 01494 int yytoken; 01495 /* The variables used to return semantic value and location from the 01496 action routines. */ 01497 YYSTYPE yyval; 01498 01499 #if YYERROR_VERBOSE 01500 /* Buffer for error messages, and its allocated size. */ 01501 char yymsgbuf[128]; 01502 char *yymsg = yymsgbuf; 01503 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01504 #endif 01505 01506 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01507 01508 /* The number of symbols on the RHS of the reduced rule. 01509 Keep to zero when no symbol should be popped. */ 01510 int yylen = 0; 01511 01512 yytoken = 0; 01513 yyss = yyssa; 01514 yyvs = yyvsa; 01515 yystacksize = YYINITDEPTH; 01516 01517 YYDPRINTF ((stderr, "Starting parse\n")); 01518 01519 yystate = 0; 01520 yyerrstatus = 0; 01521 yynerrs = 0; 01522 yychar = YYEMPTY; /* Cause a token to be read. */ 01523 01524 /* Initialize stack pointers. 01525 Waste one element of value and location stack 01526 so that they stay on the same level as the state stack. 01527 The wasted elements are never initialized. */ 01528 yyssp = yyss; 01529 yyvsp = yyvs; 01530 01531 goto yysetstate; 01532 01533 /*------------------------------------------------------------. 01534 | yynewstate -- Push a new state, which is found in yystate. | 01535 `------------------------------------------------------------*/ 01536 yynewstate: 01537 /* In all cases, when you get here, the value and location stacks 01538 have just been pushed. So pushing a state here evens the stacks. */ 01539 yyssp++; 01540 01541 yysetstate: 01542 *yyssp = yystate; 01543 01544 if (yyss + yystacksize - 1 <= yyssp) 01545 { 01546 /* Get the current used size of the three stacks, in elements. */ 01547 YYSIZE_T yysize = yyssp - yyss + 1; 01548 01549 #ifdef yyoverflow 01550 { 01551 /* Give user a chance to xreallocate the stack. Use copies of 01552 these so that the &'s don't force the real ones into 01553 memory. */ 01554 YYSTYPE *yyvs1 = yyvs; 01555 yytype_int16 *yyss1 = yyss; 01556 01557 /* Each stack pointer address is followed by the size of the 01558 data in use in that stack, in bytes. This used to be a 01559 conditional around just the two extra args, but that might 01560 be undefined if yyoverflow is a macro. */ 01561 yyoverflow (YY_("memory exhausted"), 01562 &yyss1, yysize * sizeof (*yyssp), 01563 &yyvs1, yysize * sizeof (*yyvsp), 01564 &yystacksize); 01565 01566 yyss = yyss1; 01567 yyvs = yyvs1; 01568 } 01569 #else /* no yyoverflow */ 01570 # ifndef YYSTACK_RELOCATE 01571 goto yyexhaustedlab; 01572 # else 01573 /* Extend the stack our own way. */ 01574 if (YYMAXDEPTH <= yystacksize) 01575 goto yyexhaustedlab; 01576 yystacksize *= 2; 01577 if (YYMAXDEPTH < yystacksize) 01578 yystacksize = YYMAXDEPTH; 01579 01580 { 01581 yytype_int16 *yyss1 = yyss; 01582 union yyalloc *yyptr = 01583 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01584 if (! yyptr) 01585 goto yyexhaustedlab; 01586 YYSTACK_RELOCATE (yyss_alloc, yyss); 01587 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01588 # undef YYSTACK_RELOCATE 01589 if (yyss1 != yyssa) 01590 YYSTACK_FREE (yyss1); 01591 } 01592 # endif 01593 #endif /* no yyoverflow */ 01594 01595 yyssp = yyss + yysize - 1; 01596 yyvsp = yyvs + yysize - 1; 01597 01598 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01599 (unsigned long int) yystacksize)); 01600 01601 if (yyss + yystacksize - 1 <= yyssp) 01602 YYABORT; 01603 } 01604 01605 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01606 01607 if (yystate == YYFINAL) 01608 YYACCEPT; 01609 01610 goto yybackup; 01611 01612 /*-----------. 01613 | yybackup. | 01614 `-----------*/ 01615 yybackup: 01616 01617 /* Do appropriate processing given the current state. Read a 01618 lookahead token if we need one and don't already have one. */ 01619 01620 /* First try to decide what to do without reference to lookahead token. */ 01621 yyn = yypact[yystate]; 01622 if (yypact_value_is_default (yyn)) 01623 goto yydefault; 01624 01625 /* Not known => get a lookahead token if don't already have one. */ 01626 01627 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01628 if (yychar == YYEMPTY) 01629 { 01630 YYDPRINTF ((stderr, "Reading a token: ")); 01631 yychar = YYLEX; 01632 } 01633 01634 if (yychar <= YYEOF) 01635 { 01636 yychar = yytoken = YYEOF; 01637 YYDPRINTF ((stderr, "Now at end of input.\n")); 01638 } 01639 else 01640 { 01641 yytoken = YYTRANSLATE (yychar); 01642 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01643 } 01644 01645 /* If the proper action on seeing token YYTOKEN is to reduce or to 01646 detect an error, take that action. */ 01647 yyn += yytoken; 01648 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01649 goto yydefault; 01650 yyn = yytable[yyn]; 01651 if (yyn <= 0) 01652 { 01653 if (yytable_value_is_error (yyn)) 01654 goto yyerrlab; 01655 yyn = -yyn; 01656 goto yyreduce; 01657 } 01658 01659 /* Count tokens shifted since error; after three, turn off error 01660 status. */ 01661 if (yyerrstatus) 01662 yyerrstatus--; 01663 01664 /* Shift the lookahead token. */ 01665 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01666 01667 /* Discard the shifted token. */ 01668 yychar = YYEMPTY; 01669 01670 yystate = yyn; 01671 *++yyvsp = yylval; 01672 01673 goto yynewstate; 01674 01675 01676 /*-----------------------------------------------------------. 01677 | yydefault -- do the default action for the current state. | 01678 `-----------------------------------------------------------*/ 01679 yydefault: 01680 yyn = yydefact[yystate]; 01681 if (yyn == 0) 01682 goto yyerrlab; 01683 goto yyreduce; 01684 01685 01686 /*-----------------------------. 01687 | yyreduce -- Do a reduction. | 01688 `-----------------------------*/ 01689 yyreduce: 01690 /* yyn is the number of a rule to reduce with. */ 01691 yylen = yyr2[yyn]; 01692 01693 /* If YYLEN is nonzero, implement the default value of the action: 01694 `$$ = $1'. 01695 01696 Otherwise, the following line sets YYVAL to garbage. 01697 This behavior is undocumented and Bison 01698 users should not rely upon it. Assigning to YYVAL 01699 unconditionally makes the parser a bit smaller, and it avoids a 01700 GCC warning that YYVAL may be used uninitialized. */ 01701 yyval = yyvsp[1-yylen]; 01702 01703 01704 YY_REDUCE_PRINT (yyn); 01705 switch (yyn) 01706 { 01707 case 2: 01708 01709 /* Line 1806 of yacc.c */ 01710 #line 241 "../../src/gdb/p-exp.y" 01711 { current_type = NULL; 01712 intvar = NULL; 01713 search_field = 0; 01714 leftdiv_is_integer = 0; 01715 } 01716 break; 01717 01718 case 3: 01719 01720 /* Line 1806 of yacc.c */ 01721 #line 246 "../../src/gdb/p-exp.y" 01722 {} 01723 break; 01724 01725 case 6: 01726 01727 /* Line 1806 of yacc.c */ 01728 #line 255 "../../src/gdb/p-exp.y" 01729 { write_exp_elt_opcode(OP_TYPE); 01730 write_exp_elt_type((yyvsp[(1) - (1)].tval)); 01731 write_exp_elt_opcode(OP_TYPE); 01732 current_type = (yyvsp[(1) - (1)].tval); } 01733 break; 01734 01735 case 8: 01736 01737 /* Line 1806 of yacc.c */ 01738 #line 263 "../../src/gdb/p-exp.y" 01739 { write_exp_elt_opcode (BINOP_COMMA); } 01740 break; 01741 01742 case 9: 01743 01744 /* Line 1806 of yacc.c */ 01745 #line 268 "../../src/gdb/p-exp.y" 01746 { write_exp_elt_opcode (UNOP_IND); 01747 if (current_type) 01748 current_type = TYPE_TARGET_TYPE (current_type); } 01749 break; 01750 01751 case 10: 01752 01753 /* Line 1806 of yacc.c */ 01754 #line 274 "../../src/gdb/p-exp.y" 01755 { write_exp_elt_opcode (UNOP_ADDR); 01756 if (current_type) 01757 current_type = TYPE_POINTER_TYPE (current_type); } 01758 break; 01759 01760 case 11: 01761 01762 /* Line 1806 of yacc.c */ 01763 #line 280 "../../src/gdb/p-exp.y" 01764 { write_exp_elt_opcode (UNOP_NEG); } 01765 break; 01766 01767 case 12: 01768 01769 /* Line 1806 of yacc.c */ 01770 #line 284 "../../src/gdb/p-exp.y" 01771 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } 01772 break; 01773 01774 case 13: 01775 01776 /* Line 1806 of yacc.c */ 01777 #line 288 "../../src/gdb/p-exp.y" 01778 { write_exp_elt_opcode (UNOP_PREINCREMENT); } 01779 break; 01780 01781 case 14: 01782 01783 /* Line 1806 of yacc.c */ 01784 #line 292 "../../src/gdb/p-exp.y" 01785 { write_exp_elt_opcode (UNOP_PREDECREMENT); } 01786 break; 01787 01788 case 15: 01789 01790 /* Line 1806 of yacc.c */ 01791 #line 297 "../../src/gdb/p-exp.y" 01792 { search_field = 1; } 01793 break; 01794 01795 case 16: 01796 01797 /* Line 1806 of yacc.c */ 01798 #line 301 "../../src/gdb/p-exp.y" 01799 { write_exp_elt_opcode (STRUCTOP_STRUCT); 01800 write_exp_string ((yyvsp[(2) - (2)].sval)); 01801 write_exp_elt_opcode (STRUCTOP_STRUCT); 01802 search_field = 0; 01803 if (current_type) 01804 { 01805 while (TYPE_CODE (current_type) 01806 == TYPE_CODE_PTR) 01807 current_type = 01808 TYPE_TARGET_TYPE (current_type); 01809 current_type = lookup_struct_elt_type ( 01810 current_type, (yyvsp[(2) - (2)].sval).ptr, 0); 01811 } 01812 } 01813 break; 01814 01815 case 17: 01816 01817 /* Line 1806 of yacc.c */ 01818 #line 319 "../../src/gdb/p-exp.y" 01819 { mark_struct_expression (); 01820 write_exp_elt_opcode (STRUCTOP_STRUCT); 01821 write_exp_string ((yyvsp[(2) - (2)].sval)); 01822 write_exp_elt_opcode (STRUCTOP_STRUCT); 01823 search_field = 0; 01824 if (current_type) 01825 { 01826 while (TYPE_CODE (current_type) 01827 == TYPE_CODE_PTR) 01828 current_type = 01829 TYPE_TARGET_TYPE (current_type); 01830 current_type = lookup_struct_elt_type ( 01831 current_type, (yyvsp[(2) - (2)].sval).ptr, 0); 01832 } 01833 } 01834 break; 01835 01836 case 18: 01837 01838 /* Line 1806 of yacc.c */ 01839 #line 337 "../../src/gdb/p-exp.y" 01840 { struct stoken s; 01841 mark_struct_expression (); 01842 write_exp_elt_opcode (STRUCTOP_STRUCT); 01843 s.ptr = ""; 01844 s.length = 0; 01845 write_exp_string (s); 01846 write_exp_elt_opcode (STRUCTOP_STRUCT); } 01847 break; 01848 01849 case 19: 01850 01851 /* Line 1806 of yacc.c */ 01852 #line 348 "../../src/gdb/p-exp.y" 01853 { const char *arrayname; 01854 int arrayfieldindex; 01855 arrayfieldindex = is_pascal_string_type ( 01856 current_type, NULL, NULL, 01857 NULL, NULL, &arrayname); 01858 if (arrayfieldindex) 01859 { 01860 struct stoken stringsval; 01861 char *buf; 01862 01863 buf = alloca (strlen (arrayname) + 1); 01864 stringsval.ptr = buf; 01865 stringsval.length = strlen (arrayname); 01866 strcpy (buf, arrayname); 01867 current_type = TYPE_FIELD_TYPE (current_type, 01868 arrayfieldindex - 1); 01869 write_exp_elt_opcode (STRUCTOP_STRUCT); 01870 write_exp_string (stringsval); 01871 write_exp_elt_opcode (STRUCTOP_STRUCT); 01872 } 01873 push_current_type (); } 01874 break; 01875 01876 case 20: 01877 01878 /* Line 1806 of yacc.c */ 01879 #line 370 "../../src/gdb/p-exp.y" 01880 { pop_current_type (); 01881 write_exp_elt_opcode (BINOP_SUBSCRIPT); 01882 if (current_type) 01883 current_type = TYPE_TARGET_TYPE (current_type); } 01884 break; 01885 01886 case 21: 01887 01888 /* Line 1806 of yacc.c */ 01889 #line 379 "../../src/gdb/p-exp.y" 01890 { push_current_type (); 01891 start_arglist (); } 01892 break; 01893 01894 case 22: 01895 01896 /* Line 1806 of yacc.c */ 01897 #line 382 "../../src/gdb/p-exp.y" 01898 { write_exp_elt_opcode (OP_FUNCALL); 01899 write_exp_elt_longcst ((LONGEST) end_arglist ()); 01900 write_exp_elt_opcode (OP_FUNCALL); 01901 pop_current_type (); 01902 if (current_type) 01903 current_type = TYPE_TARGET_TYPE (current_type); 01904 } 01905 break; 01906 01907 case 24: 01908 01909 /* Line 1806 of yacc.c */ 01910 #line 393 "../../src/gdb/p-exp.y" 01911 { arglist_len = 1; } 01912 break; 01913 01914 case 25: 01915 01916 /* Line 1806 of yacc.c */ 01917 #line 395 "../../src/gdb/p-exp.y" 01918 { arglist_len++; } 01919 break; 01920 01921 case 26: 01922 01923 /* Line 1806 of yacc.c */ 01924 #line 399 "../../src/gdb/p-exp.y" 01925 { if (current_type) 01926 { 01927 /* Allow automatic dereference of classes. */ 01928 if ((TYPE_CODE (current_type) == TYPE_CODE_PTR) 01929 && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS) 01930 && (TYPE_CODE ((yyvsp[(1) - (4)].tval)) == TYPE_CODE_CLASS)) 01931 write_exp_elt_opcode (UNOP_IND); 01932 } 01933 write_exp_elt_opcode (UNOP_CAST); 01934 write_exp_elt_type ((yyvsp[(1) - (4)].tval)); 01935 write_exp_elt_opcode (UNOP_CAST); 01936 current_type = (yyvsp[(1) - (4)].tval); } 01937 break; 01938 01939 case 27: 01940 01941 /* Line 1806 of yacc.c */ 01942 #line 414 "../../src/gdb/p-exp.y" 01943 { } 01944 break; 01945 01946 case 28: 01947 01948 /* Line 1806 of yacc.c */ 01949 #line 420 "../../src/gdb/p-exp.y" 01950 { write_exp_elt_opcode (BINOP_MUL); } 01951 break; 01952 01953 case 29: 01954 01955 /* Line 1806 of yacc.c */ 01956 #line 423 "../../src/gdb/p-exp.y" 01957 { 01958 if (current_type && is_integral_type (current_type)) 01959 leftdiv_is_integer = 1; 01960 } 01961 break; 01962 01963 case 30: 01964 01965 /* Line 1806 of yacc.c */ 01966 #line 428 "../../src/gdb/p-exp.y" 01967 { 01968 if (leftdiv_is_integer && current_type 01969 && is_integral_type (current_type)) 01970 { 01971 write_exp_elt_opcode (UNOP_CAST); 01972 write_exp_elt_type (parse_type->builtin_long_double); 01973 current_type = parse_type->builtin_long_double; 01974 write_exp_elt_opcode (UNOP_CAST); 01975 leftdiv_is_integer = 0; 01976 } 01977 01978 write_exp_elt_opcode (BINOP_DIV); 01979 } 01980 break; 01981 01982 case 31: 01983 01984 /* Line 1806 of yacc.c */ 01985 #line 444 "../../src/gdb/p-exp.y" 01986 { write_exp_elt_opcode (BINOP_INTDIV); } 01987 break; 01988 01989 case 32: 01990 01991 /* Line 1806 of yacc.c */ 01992 #line 448 "../../src/gdb/p-exp.y" 01993 { write_exp_elt_opcode (BINOP_REM); } 01994 break; 01995 01996 case 33: 01997 01998 /* Line 1806 of yacc.c */ 01999 #line 452 "../../src/gdb/p-exp.y" 02000 { write_exp_elt_opcode (BINOP_ADD); } 02001 break; 02002 02003 case 34: 02004 02005 /* Line 1806 of yacc.c */ 02006 #line 456 "../../src/gdb/p-exp.y" 02007 { write_exp_elt_opcode (BINOP_SUB); } 02008 break; 02009 02010 case 35: 02011 02012 /* Line 1806 of yacc.c */ 02013 #line 460 "../../src/gdb/p-exp.y" 02014 { write_exp_elt_opcode (BINOP_LSH); } 02015 break; 02016 02017 case 36: 02018 02019 /* Line 1806 of yacc.c */ 02020 #line 464 "../../src/gdb/p-exp.y" 02021 { write_exp_elt_opcode (BINOP_RSH); } 02022 break; 02023 02024 case 37: 02025 02026 /* Line 1806 of yacc.c */ 02027 #line 468 "../../src/gdb/p-exp.y" 02028 { write_exp_elt_opcode (BINOP_EQUAL); 02029 current_type = parse_type->builtin_bool; 02030 } 02031 break; 02032 02033 case 38: 02034 02035 /* Line 1806 of yacc.c */ 02036 #line 474 "../../src/gdb/p-exp.y" 02037 { write_exp_elt_opcode (BINOP_NOTEQUAL); 02038 current_type = parse_type->builtin_bool; 02039 } 02040 break; 02041 02042 case 39: 02043 02044 /* Line 1806 of yacc.c */ 02045 #line 480 "../../src/gdb/p-exp.y" 02046 { write_exp_elt_opcode (BINOP_LEQ); 02047 current_type = parse_type->builtin_bool; 02048 } 02049 break; 02050 02051 case 40: 02052 02053 /* Line 1806 of yacc.c */ 02054 #line 486 "../../src/gdb/p-exp.y" 02055 { write_exp_elt_opcode (BINOP_GEQ); 02056 current_type = parse_type->builtin_bool; 02057 } 02058 break; 02059 02060 case 41: 02061 02062 /* Line 1806 of yacc.c */ 02063 #line 492 "../../src/gdb/p-exp.y" 02064 { write_exp_elt_opcode (BINOP_LESS); 02065 current_type = parse_type->builtin_bool; 02066 } 02067 break; 02068 02069 case 42: 02070 02071 /* Line 1806 of yacc.c */ 02072 #line 498 "../../src/gdb/p-exp.y" 02073 { write_exp_elt_opcode (BINOP_GTR); 02074 current_type = parse_type->builtin_bool; 02075 } 02076 break; 02077 02078 case 43: 02079 02080 /* Line 1806 of yacc.c */ 02081 #line 504 "../../src/gdb/p-exp.y" 02082 { write_exp_elt_opcode (BINOP_BITWISE_AND); } 02083 break; 02084 02085 case 44: 02086 02087 /* Line 1806 of yacc.c */ 02088 #line 508 "../../src/gdb/p-exp.y" 02089 { write_exp_elt_opcode (BINOP_BITWISE_XOR); } 02090 break; 02091 02092 case 45: 02093 02094 /* Line 1806 of yacc.c */ 02095 #line 512 "../../src/gdb/p-exp.y" 02096 { write_exp_elt_opcode (BINOP_BITWISE_IOR); } 02097 break; 02098 02099 case 46: 02100 02101 /* Line 1806 of yacc.c */ 02102 #line 516 "../../src/gdb/p-exp.y" 02103 { write_exp_elt_opcode (BINOP_ASSIGN); } 02104 break; 02105 02106 case 47: 02107 02108 /* Line 1806 of yacc.c */ 02109 #line 520 "../../src/gdb/p-exp.y" 02110 { write_exp_elt_opcode (OP_BOOL); 02111 write_exp_elt_longcst ((LONGEST) (yyvsp[(1) - (1)].lval)); 02112 current_type = parse_type->builtin_bool; 02113 write_exp_elt_opcode (OP_BOOL); } 02114 break; 02115 02116 case 48: 02117 02118 /* Line 1806 of yacc.c */ 02119 #line 527 "../../src/gdb/p-exp.y" 02120 { write_exp_elt_opcode (OP_BOOL); 02121 write_exp_elt_longcst ((LONGEST) (yyvsp[(1) - (1)].lval)); 02122 current_type = parse_type->builtin_bool; 02123 write_exp_elt_opcode (OP_BOOL); } 02124 break; 02125 02126 case 49: 02127 02128 /* Line 1806 of yacc.c */ 02129 #line 534 "../../src/gdb/p-exp.y" 02130 { write_exp_elt_opcode (OP_LONG); 02131 write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_int).type); 02132 current_type = (yyvsp[(1) - (1)].typed_val_int).type; 02133 write_exp_elt_longcst ((LONGEST)((yyvsp[(1) - (1)].typed_val_int).val)); 02134 write_exp_elt_opcode (OP_LONG); } 02135 break; 02136 02137 case 50: 02138 02139 /* Line 1806 of yacc.c */ 02140 #line 542 "../../src/gdb/p-exp.y" 02141 { YYSTYPE val; 02142 parse_number ((yyvsp[(1) - (1)].ssym).stoken.ptr, 02143 (yyvsp[(1) - (1)].ssym).stoken.length, 0, &val); 02144 write_exp_elt_opcode (OP_LONG); 02145 write_exp_elt_type (val.typed_val_int.type); 02146 current_type = val.typed_val_int.type; 02147 write_exp_elt_longcst ((LONGEST) 02148 val.typed_val_int.val); 02149 write_exp_elt_opcode (OP_LONG); 02150 } 02151 break; 02152 02153 case 51: 02154 02155 /* Line 1806 of yacc.c */ 02156 #line 556 "../../src/gdb/p-exp.y" 02157 { write_exp_elt_opcode (OP_DOUBLE); 02158 write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_float).type); 02159 current_type = (yyvsp[(1) - (1)].typed_val_float).type; 02160 write_exp_elt_dblcst ((yyvsp[(1) - (1)].typed_val_float).dval); 02161 write_exp_elt_opcode (OP_DOUBLE); } 02162 break; 02163 02164 case 53: 02165 02166 /* Line 1806 of yacc.c */ 02167 #line 569 "../../src/gdb/p-exp.y" 02168 { if (intvar) { 02169 struct value * val, * mark; 02170 02171 mark = value_mark (); 02172 val = value_of_internalvar (parse_gdbarch, 02173 intvar); 02174 current_type = value_type (val); 02175 value_release_to_mark (mark); 02176 } 02177 } 02178 break; 02179 02180 case 54: 02181 02182 /* Line 1806 of yacc.c */ 02183 #line 582 "../../src/gdb/p-exp.y" 02184 { write_exp_elt_opcode (OP_LONG); 02185 write_exp_elt_type (parse_type->builtin_int); 02186 CHECK_TYPEDEF ((yyvsp[(3) - (4)].tval)); 02187 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ((yyvsp[(3) - (4)].tval))); 02188 write_exp_elt_opcode (OP_LONG); } 02189 break; 02190 02191 case 55: 02192 02193 /* Line 1806 of yacc.c */ 02194 #line 590 "../../src/gdb/p-exp.y" 02195 { write_exp_elt_opcode (UNOP_SIZEOF); } 02196 break; 02197 02198 case 56: 02199 02200 /* Line 1806 of yacc.c */ 02201 #line 593 "../../src/gdb/p-exp.y" 02202 { /* C strings are converted into array constants with 02203 an explicit null byte added at the end. Thus 02204 the array upper bound is the string length. 02205 There is no such thing in C as a completely empty 02206 string. */ 02207 const char *sp = (yyvsp[(1) - (1)].sval).ptr; int count = (yyvsp[(1) - (1)].sval).length; 02208 02209 while (count-- > 0) 02210 { 02211 write_exp_elt_opcode (OP_LONG); 02212 write_exp_elt_type (parse_type->builtin_char); 02213 write_exp_elt_longcst ((LONGEST)(*sp++)); 02214 write_exp_elt_opcode (OP_LONG); 02215 } 02216 write_exp_elt_opcode (OP_LONG); 02217 write_exp_elt_type (parse_type->builtin_char); 02218 write_exp_elt_longcst ((LONGEST)'\0'); 02219 write_exp_elt_opcode (OP_LONG); 02220 write_exp_elt_opcode (OP_ARRAY); 02221 write_exp_elt_longcst ((LONGEST) 0); 02222 write_exp_elt_longcst ((LONGEST) ((yyvsp[(1) - (1)].sval).length)); 02223 write_exp_elt_opcode (OP_ARRAY); } 02224 break; 02225 02226 case 57: 02227 02228 /* Line 1806 of yacc.c */ 02229 #line 619 "../../src/gdb/p-exp.y" 02230 { 02231 struct value * this_val; 02232 struct type * this_type; 02233 write_exp_elt_opcode (OP_THIS); 02234 write_exp_elt_opcode (OP_THIS); 02235 /* We need type of this. */ 02236 this_val = value_of_this_silent (parse_language); 02237 if (this_val) 02238 this_type = value_type (this_val); 02239 else 02240 this_type = NULL; 02241 if (this_type) 02242 { 02243 if (TYPE_CODE (this_type) == TYPE_CODE_PTR) 02244 { 02245 this_type = TYPE_TARGET_TYPE (this_type); 02246 write_exp_elt_opcode (UNOP_IND); 02247 } 02248 } 02249 02250 current_type = this_type; 02251 } 02252 break; 02253 02254 case 58: 02255 02256 /* Line 1806 of yacc.c */ 02257 #line 646 "../../src/gdb/p-exp.y" 02258 { 02259 if ((yyvsp[(1) - (1)].ssym).sym != 0) 02260 (yyval.bval) = SYMBOL_BLOCK_VALUE ((yyvsp[(1) - (1)].ssym).sym); 02261 else 02262 { 02263 struct symtab *tem = 02264 lookup_symtab (copy_name ((yyvsp[(1) - (1)].ssym).stoken)); 02265 if (tem) 02266 (yyval.bval) = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), 02267 STATIC_BLOCK); 02268 else 02269 error (_("No file or function \"%s\"."), 02270 copy_name ((yyvsp[(1) - (1)].ssym).stoken)); 02271 } 02272 } 02273 break; 02274 02275 case 59: 02276 02277 /* Line 1806 of yacc.c */ 02278 #line 664 "../../src/gdb/p-exp.y" 02279 { struct symbol *tem 02280 = lookup_symbol (copy_name ((yyvsp[(3) - (3)].sval)), (yyvsp[(1) - (3)].bval), 02281 VAR_DOMAIN, NULL); 02282 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) 02283 error (_("No function \"%s\" in specified context."), 02284 copy_name ((yyvsp[(3) - (3)].sval))); 02285 (yyval.bval) = SYMBOL_BLOCK_VALUE (tem); } 02286 break; 02287 02288 case 60: 02289 02290 /* Line 1806 of yacc.c */ 02291 #line 674 "../../src/gdb/p-exp.y" 02292 { struct symbol *sym; 02293 sym = lookup_symbol (copy_name ((yyvsp[(3) - (3)].sval)), (yyvsp[(1) - (3)].bval), 02294 VAR_DOMAIN, NULL); 02295 if (sym == 0) 02296 error (_("No symbol \"%s\" in specified context."), 02297 copy_name ((yyvsp[(3) - (3)].sval))); 02298 02299 write_exp_elt_opcode (OP_VAR_VALUE); 02300 /* block_found is set by lookup_symbol. */ 02301 write_exp_elt_block (block_found); 02302 write_exp_elt_sym (sym); 02303 write_exp_elt_opcode (OP_VAR_VALUE); } 02304 break; 02305 02306 case 61: 02307 02308 /* Line 1806 of yacc.c */ 02309 #line 689 "../../src/gdb/p-exp.y" 02310 { 02311 struct type *type = (yyvsp[(1) - (3)].tval); 02312 if (TYPE_CODE (type) != TYPE_CODE_STRUCT 02313 && TYPE_CODE (type) != TYPE_CODE_UNION) 02314 error (_("`%s' is not defined as an aggregate type."), 02315 TYPE_NAME (type)); 02316 02317 write_exp_elt_opcode (OP_SCOPE); 02318 write_exp_elt_type (type); 02319 write_exp_string ((yyvsp[(3) - (3)].sval)); 02320 write_exp_elt_opcode (OP_SCOPE); 02321 } 02322 break; 02323 02324 case 63: 02325 02326 /* Line 1806 of yacc.c */ 02327 #line 705 "../../src/gdb/p-exp.y" 02328 { 02329 char *name = copy_name ((yyvsp[(2) - (2)].sval)); 02330 struct symbol *sym; 02331 struct bound_minimal_symbol msymbol; 02332 02333 sym = 02334 lookup_symbol (name, (const struct block *) NULL, 02335 VAR_DOMAIN, NULL); 02336 if (sym) 02337 { 02338 write_exp_elt_opcode (OP_VAR_VALUE); 02339 write_exp_elt_block (NULL); 02340 write_exp_elt_sym (sym); 02341 write_exp_elt_opcode (OP_VAR_VALUE); 02342 break; 02343 } 02344 02345 msymbol = lookup_bound_minimal_symbol (name); 02346 if (msymbol.minsym != NULL) 02347 write_exp_msymbol (msymbol); 02348 else if (!have_full_symbols () 02349 && !have_partial_symbols ()) 02350 error (_("No symbol table is loaded. " 02351 "Use the \"file\" command.")); 02352 else 02353 error (_("No symbol \"%s\" in current context."), 02354 name); 02355 } 02356 break; 02357 02358 case 64: 02359 02360 /* Line 1806 of yacc.c */ 02361 #line 736 "../../src/gdb/p-exp.y" 02362 { struct symbol *sym = (yyvsp[(1) - (1)].ssym).sym; 02363 02364 if (sym) 02365 { 02366 if (symbol_read_needs_frame (sym)) 02367 { 02368 if (innermost_block == 0 02369 || contained_in (block_found, 02370 innermost_block)) 02371 innermost_block = block_found; 02372 } 02373 02374 write_exp_elt_opcode (OP_VAR_VALUE); 02375 /* We want to use the selected frame, not 02376 another more inner frame which happens to 02377 be in the same block. */ 02378 write_exp_elt_block (NULL); 02379 write_exp_elt_sym (sym); 02380 write_exp_elt_opcode (OP_VAR_VALUE); 02381 current_type = sym->type; } 02382 else if ((yyvsp[(1) - (1)].ssym).is_a_field_of_this) 02383 { 02384 struct value * this_val; 02385 struct type * this_type; 02386 /* Object pascal: it hangs off of `this'. Must 02387 not inadvertently convert from a method call 02388 to data ref. */ 02389 if (innermost_block == 0 02390 || contained_in (block_found, 02391 innermost_block)) 02392 innermost_block = block_found; 02393 write_exp_elt_opcode (OP_THIS); 02394 write_exp_elt_opcode (OP_THIS); 02395 write_exp_elt_opcode (STRUCTOP_PTR); 02396 write_exp_string ((yyvsp[(1) - (1)].ssym).stoken); 02397 write_exp_elt_opcode (STRUCTOP_PTR); 02398 /* We need type of this. */ 02399 this_val = value_of_this_silent (parse_language); 02400 if (this_val) 02401 this_type = value_type (this_val); 02402 else 02403 this_type = NULL; 02404 if (this_type) 02405 current_type = lookup_struct_elt_type ( 02406 this_type, 02407 copy_name ((yyvsp[(1) - (1)].ssym).stoken), 0); 02408 else 02409 current_type = NULL; 02410 } 02411 else 02412 { 02413 struct bound_minimal_symbol msymbol; 02414 char *arg = copy_name ((yyvsp[(1) - (1)].ssym).stoken); 02415 02416 msymbol = 02417 lookup_bound_minimal_symbol (arg); 02418 if (msymbol.minsym != NULL) 02419 write_exp_msymbol (msymbol); 02420 else if (!have_full_symbols () 02421 && !have_partial_symbols ()) 02422 error (_("No symbol table is loaded. " 02423 "Use the \"file\" command.")); 02424 else 02425 error (_("No symbol \"%s\" in current context."), 02426 copy_name ((yyvsp[(1) - (1)].ssym).stoken)); 02427 } 02428 } 02429 break; 02430 02431 case 67: 02432 02433 /* Line 1806 of yacc.c */ 02434 #line 822 "../../src/gdb/p-exp.y" 02435 { (yyval.tval) = lookup_pointer_type ((yyvsp[(2) - (2)].tval)); } 02436 break; 02437 02438 case 68: 02439 02440 /* Line 1806 of yacc.c */ 02441 #line 824 "../../src/gdb/p-exp.y" 02442 { (yyval.tval) = (yyvsp[(1) - (1)].tsym).type; } 02443 break; 02444 02445 case 69: 02446 02447 /* Line 1806 of yacc.c */ 02448 #line 826 "../../src/gdb/p-exp.y" 02449 { (yyval.tval) = lookup_struct (copy_name ((yyvsp[(2) - (2)].sval)), 02450 expression_context_block); } 02451 break; 02452 02453 case 70: 02454 02455 /* Line 1806 of yacc.c */ 02456 #line 829 "../../src/gdb/p-exp.y" 02457 { (yyval.tval) = lookup_struct (copy_name ((yyvsp[(2) - (2)].sval)), 02458 expression_context_block); } 02459 break; 02460 02461 case 71: 02462 02463 /* Line 1806 of yacc.c */ 02464 #line 836 "../../src/gdb/p-exp.y" 02465 { (yyval.sval) = (yyvsp[(1) - (1)].ssym).stoken; } 02466 break; 02467 02468 case 72: 02469 02470 /* Line 1806 of yacc.c */ 02471 #line 837 "../../src/gdb/p-exp.y" 02472 { (yyval.sval) = (yyvsp[(1) - (1)].ssym).stoken; } 02473 break; 02474 02475 case 73: 02476 02477 /* Line 1806 of yacc.c */ 02478 #line 838 "../../src/gdb/p-exp.y" 02479 { (yyval.sval) = (yyvsp[(1) - (1)].tsym).stoken; } 02480 break; 02481 02482 case 74: 02483 02484 /* Line 1806 of yacc.c */ 02485 #line 839 "../../src/gdb/p-exp.y" 02486 { (yyval.sval) = (yyvsp[(1) - (1)].ssym).stoken; } 02487 break; 02488 02489 02490 02491 /* Line 1806 of yacc.c */ 02492 #line 2494 "p-exp.c" 02493 default: break; 02494 } 02495 /* User semantic actions sometimes alter yychar, and that requires 02496 that yytoken be updated with the new translation. We take the 02497 approach of translating immediately before every use of yytoken. 02498 One alternative is translating here after every semantic action, 02499 but that translation would be missed if the semantic action invokes 02500 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 02501 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 02502 incorrect destructor might then be invoked immediately. In the 02503 case of YYERROR or YYBACKUP, subsequent parser actions might lead 02504 to an incorrect destructor call or verbose syntax error message 02505 before the lookahead is translated. */ 02506 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 02507 02508 YYPOPSTACK (yylen); 02509 yylen = 0; 02510 YY_STACK_PRINT (yyss, yyssp); 02511 02512 *++yyvsp = yyval; 02513 02514 /* Now `shift' the result of the reduction. Determine what state 02515 that goes to, based on the state we popped back to and the rule 02516 number reduced by. */ 02517 02518 yyn = yyr1[yyn]; 02519 02520 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 02521 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 02522 yystate = yytable[yystate]; 02523 else 02524 yystate = yydefgoto[yyn - YYNTOKENS]; 02525 02526 goto yynewstate; 02527 02528 02529 /*------------------------------------. 02530 | yyerrlab -- here on detecting error | 02531 `------------------------------------*/ 02532 yyerrlab: 02533 /* Make sure we have latest lookahead translation. See comments at 02534 user semantic actions for why this is necessary. */ 02535 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 02536 02537 /* If not already recovering from an error, report this error. */ 02538 if (!yyerrstatus) 02539 { 02540 ++yynerrs; 02541 #if ! YYERROR_VERBOSE 02542 yyerror (YY_("syntax error")); 02543 #else 02544 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 02545 yyssp, yytoken) 02546 { 02547 char const *yymsgp = YY_("syntax error"); 02548 int yysyntax_error_status; 02549 yysyntax_error_status = YYSYNTAX_ERROR; 02550 if (yysyntax_error_status == 0) 02551 yymsgp = yymsg; 02552 else if (yysyntax_error_status == 1) 02553 { 02554 if (yymsg != yymsgbuf) 02555 YYSTACK_FREE (yymsg); 02556 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 02557 if (!yymsg) 02558 { 02559 yymsg = yymsgbuf; 02560 yymsg_alloc = sizeof yymsgbuf; 02561 yysyntax_error_status = 2; 02562 } 02563 else 02564 { 02565 yysyntax_error_status = YYSYNTAX_ERROR; 02566 yymsgp = yymsg; 02567 } 02568 } 02569 yyerror (yymsgp); 02570 if (yysyntax_error_status == 2) 02571 goto yyexhaustedlab; 02572 } 02573 # undef YYSYNTAX_ERROR 02574 #endif 02575 } 02576 02577 02578 02579 if (yyerrstatus == 3) 02580 { 02581 /* If just tried and failed to reuse lookahead token after an 02582 error, discard it. */ 02583 02584 if (yychar <= YYEOF) 02585 { 02586 /* Return failure if at end of input. */ 02587 if (yychar == YYEOF) 02588 YYABORT; 02589 } 02590 else 02591 { 02592 yydestruct ("Error: discarding", 02593 yytoken, &yylval); 02594 yychar = YYEMPTY; 02595 } 02596 } 02597 02598 /* Else will try to reuse lookahead token after shifting the error 02599 token. */ 02600 goto yyerrlab1; 02601 02602 02603 /*---------------------------------------------------. 02604 | yyerrorlab -- error raised explicitly by YYERROR. | 02605 `---------------------------------------------------*/ 02606 yyerrorlab: 02607 02608 /* Pacify compilers like GCC when the user code never invokes 02609 YYERROR and the label yyerrorlab therefore never appears in user 02610 code. */ 02611 if (/*CONSTCOND*/ 0) 02612 goto yyerrorlab; 02613 02614 /* Do not reclaim the symbols of the rule which action triggered 02615 this YYERROR. */ 02616 YYPOPSTACK (yylen); 02617 yylen = 0; 02618 YY_STACK_PRINT (yyss, yyssp); 02619 yystate = *yyssp; 02620 goto yyerrlab1; 02621 02622 02623 /*-------------------------------------------------------------. 02624 | yyerrlab1 -- common code for both syntax error and YYERROR. | 02625 `-------------------------------------------------------------*/ 02626 yyerrlab1: 02627 yyerrstatus = 3; /* Each real token shifted decrements this. */ 02628 02629 for (;;) 02630 { 02631 yyn = yypact[yystate]; 02632 if (!yypact_value_is_default (yyn)) 02633 { 02634 yyn += YYTERROR; 02635 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 02636 { 02637 yyn = yytable[yyn]; 02638 if (0 < yyn) 02639 break; 02640 } 02641 } 02642 02643 /* Pop the current state because it cannot handle the error token. */ 02644 if (yyssp == yyss) 02645 YYABORT; 02646 02647 02648 yydestruct ("Error: popping", 02649 yystos[yystate], yyvsp); 02650 YYPOPSTACK (1); 02651 yystate = *yyssp; 02652 YY_STACK_PRINT (yyss, yyssp); 02653 } 02654 02655 *++yyvsp = yylval; 02656 02657 02658 /* Shift the error token. */ 02659 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 02660 02661 yystate = yyn; 02662 goto yynewstate; 02663 02664 02665 /*-------------------------------------. 02666 | yyacceptlab -- YYACCEPT comes here. | 02667 `-------------------------------------*/ 02668 yyacceptlab: 02669 yyresult = 0; 02670 goto yyreturn; 02671 02672 /*-----------------------------------. 02673 | yyabortlab -- YYABORT comes here. | 02674 `-----------------------------------*/ 02675 yyabortlab: 02676 yyresult = 1; 02677 goto yyreturn; 02678 02679 #if !defined(yyoverflow) || YYERROR_VERBOSE 02680 /*-------------------------------------------------. 02681 | yyexhaustedlab -- memory exhaustion comes here. | 02682 `-------------------------------------------------*/ 02683 yyexhaustedlab: 02684 yyerror (YY_("memory exhausted")); 02685 yyresult = 2; 02686 /* Fall through. */ 02687 #endif 02688 02689 yyreturn: 02690 if (yychar != YYEMPTY) 02691 { 02692 /* Make sure we have latest lookahead translation. See comments at 02693 user semantic actions for why this is necessary. */ 02694 yytoken = YYTRANSLATE (yychar); 02695 yydestruct ("Cleanup: discarding lookahead", 02696 yytoken, &yylval); 02697 } 02698 /* Do not reclaim the symbols of the rule which action triggered 02699 this YYABORT or YYACCEPT. */ 02700 YYPOPSTACK (yylen); 02701 YY_STACK_PRINT (yyss, yyssp); 02702 while (yyssp != yyss) 02703 { 02704 yydestruct ("Cleanup: popping", 02705 yystos[*yyssp], yyvsp); 02706 YYPOPSTACK (1); 02707 } 02708 #ifndef yyoverflow 02709 if (yyss != yyssa) 02710 YYSTACK_FREE (yyss); 02711 #endif 02712 #if YYERROR_VERBOSE 02713 if (yymsg != yymsgbuf) 02714 YYSTACK_FREE (yymsg); 02715 #endif 02716 /* Make sure YYID is used. */ 02717 return YYID (yyresult); 02718 } 02719 02720 02721 02722 /* Line 2067 of yacc.c */ 02723 #line 853 "../../src/gdb/p-exp.y" 02724 02725 02726 /* Take care of parsing a number (anything that starts with a digit). 02727 Set yylval and return the token type; update lexptr. 02728 LEN is the number of characters in it. */ 02729 02730 /*** Needs some error checking for the float case ***/ 02731 02732 static int 02733 parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere) 02734 { 02735 /* FIXME: Shouldn't these be unsigned? We don't deal with negative values 02736 here, and we do kind of silly things like cast to unsigned. */ 02737 LONGEST n = 0; 02738 LONGEST prevn = 0; 02739 ULONGEST un; 02740 02741 int i = 0; 02742 int c; 02743 int base = input_radix; 02744 int unsigned_p = 0; 02745 02746 /* Number of "L" suffixes encountered. */ 02747 int long_p = 0; 02748 02749 /* We have found a "L" or "U" suffix. */ 02750 int found_suffix = 0; 02751 02752 ULONGEST high_bit; 02753 struct type *signed_type; 02754 struct type *unsigned_type; 02755 02756 if (parsed_float) 02757 { 02758 if (! parse_c_float (parse_gdbarch, p, len, 02759 &putithere->typed_val_float.dval, 02760 &putithere->typed_val_float.type)) 02761 return ERROR; 02762 return FLOAT; 02763 } 02764 02765 /* Handle base-switching prefixes 0x, 0t, 0d, 0. */ 02766 if (p[0] == '0') 02767 switch (p[1]) 02768 { 02769 case 'x': 02770 case 'X': 02771 if (len >= 3) 02772 { 02773 p += 2; 02774 base = 16; 02775 len -= 2; 02776 } 02777 break; 02778 02779 case 't': 02780 case 'T': 02781 case 'd': 02782 case 'D': 02783 if (len >= 3) 02784 { 02785 p += 2; 02786 base = 10; 02787 len -= 2; 02788 } 02789 break; 02790 02791 default: 02792 base = 8; 02793 break; 02794 } 02795 02796 while (len-- > 0) 02797 { 02798 c = *p++; 02799 if (c >= 'A' && c <= 'Z') 02800 c += 'a' - 'A'; 02801 if (c != 'l' && c != 'u') 02802 n *= base; 02803 if (c >= '0' && c <= '9') 02804 { 02805 if (found_suffix) 02806 return ERROR; 02807 n += i = c - '0'; 02808 } 02809 else 02810 { 02811 if (base > 10 && c >= 'a' && c <= 'f') 02812 { 02813 if (found_suffix) 02814 return ERROR; 02815 n += i = c - 'a' + 10; 02816 } 02817 else if (c == 'l') 02818 { 02819 ++long_p; 02820 found_suffix = 1; 02821 } 02822 else if (c == 'u') 02823 { 02824 unsigned_p = 1; 02825 found_suffix = 1; 02826 } 02827 else 02828 return ERROR; /* Char not a digit */ 02829 } 02830 if (i >= base) 02831 return ERROR; /* Invalid digit in this base. */ 02832 02833 /* Portably test for overflow (only works for nonzero values, so make 02834 a second check for zero). FIXME: Can't we just make n and prevn 02835 unsigned and avoid this? */ 02836 if (c != 'l' && c != 'u' && (prevn >= n) && n != 0) 02837 unsigned_p = 1; /* Try something unsigned. */ 02838 02839 /* Portably test for unsigned overflow. 02840 FIXME: This check is wrong; for example it doesn't find overflow 02841 on 0x123456789 when LONGEST is 32 bits. */ 02842 if (c != 'l' && c != 'u' && n != 0) 02843 { 02844 if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n)) 02845 error (_("Numeric constant too large.")); 02846 } 02847 prevn = n; 02848 } 02849 02850 /* An integer constant is an int, a long, or a long long. An L 02851 suffix forces it to be long; an LL suffix forces it to be long 02852 long. If not forced to a larger size, it gets the first type of 02853 the above that it fits in. To figure out whether it fits, we 02854 shift it right and see whether anything remains. Note that we 02855 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one 02856 operation, because many compilers will warn about such a shift 02857 (which always produces a zero result). Sometimes gdbarch_int_bit 02858 or gdbarch_long_bit will be that big, sometimes not. To deal with 02859 the case where it is we just always shift the value more than 02860 once, with fewer bits each time. */ 02861 02862 un = (ULONGEST)n >> 2; 02863 if (long_p == 0 02864 && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0) 02865 { 02866 high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1); 02867 02868 /* A large decimal (not hex or octal) constant (between INT_MAX 02869 and UINT_MAX) is a long or unsigned long, according to ANSI, 02870 never an unsigned int, but this code treats it as unsigned 02871 int. This probably should be fixed. GCC gives a warning on 02872 such constants. */ 02873 02874 unsigned_type = parse_type->builtin_unsigned_int; 02875 signed_type = parse_type->builtin_int; 02876 } 02877 else if (long_p <= 1 02878 && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0) 02879 { 02880 high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1); 02881 unsigned_type = parse_type->builtin_unsigned_long; 02882 signed_type = parse_type->builtin_long; 02883 } 02884 else 02885 { 02886 int shift; 02887 if (sizeof (ULONGEST) * HOST_CHAR_BIT 02888 < gdbarch_long_long_bit (parse_gdbarch)) 02889 /* A long long does not fit in a LONGEST. */ 02890 shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); 02891 else 02892 shift = (gdbarch_long_long_bit (parse_gdbarch) - 1); 02893 high_bit = (ULONGEST) 1 << shift; 02894 unsigned_type = parse_type->builtin_unsigned_long_long; 02895 signed_type = parse_type->builtin_long_long; 02896 } 02897 02898 putithere->typed_val_int.val = n; 02899 02900 /* If the high bit of the worked out type is set then this number 02901 has to be unsigned. */ 02902 02903 if (unsigned_p || (n & high_bit)) 02904 { 02905 putithere->typed_val_int.type = unsigned_type; 02906 } 02907 else 02908 { 02909 putithere->typed_val_int.type = signed_type; 02910 } 02911 02912 return INT; 02913 } 02914 02915 02916 struct type_push 02917 { 02918 struct type *stored; 02919 struct type_push *next; 02920 }; 02921 02922 static struct type_push *tp_top = NULL; 02923 02924 static void 02925 push_current_type (void) 02926 { 02927 struct type_push *tpnew; 02928 tpnew = (struct type_push *) xmalloc (sizeof (struct type_push)); 02929 tpnew->next = tp_top; 02930 tpnew->stored = current_type; 02931 current_type = NULL; 02932 tp_top = tpnew; 02933 } 02934 02935 static void 02936 pop_current_type (void) 02937 { 02938 struct type_push *tp = tp_top; 02939 if (tp) 02940 { 02941 current_type = tp->stored; 02942 tp_top = tp->next; 02943 xfree (tp); 02944 } 02945 } 02946 02947 struct token 02948 { 02949 char *operator; 02950 int token; 02951 enum exp_opcode opcode; 02952 }; 02953 02954 static const struct token tokentab3[] = 02955 { 02956 {"shr", RSH, BINOP_END}, 02957 {"shl", LSH, BINOP_END}, 02958 {"and", ANDAND, BINOP_END}, 02959 {"div", DIV, BINOP_END}, 02960 {"not", NOT, BINOP_END}, 02961 {"mod", MOD, BINOP_END}, 02962 {"inc", INCREMENT, BINOP_END}, 02963 {"dec", DECREMENT, BINOP_END}, 02964 {"xor", XOR, BINOP_END} 02965 }; 02966 02967 static const struct token tokentab2[] = 02968 { 02969 {"or", OR, BINOP_END}, 02970 {"<>", NOTEQUAL, BINOP_END}, 02971 {"<=", LEQ, BINOP_END}, 02972 {">=", GEQ, BINOP_END}, 02973 {":=", ASSIGN, BINOP_END}, 02974 {"::", COLONCOLON, BINOP_END} }; 02975 02976 /* Allocate uppercased var: */ 02977 /* make an uppercased copy of tokstart. */ 02978 static char * 02979 uptok (char *tokstart, int namelen) 02980 { 02981 int i; 02982 char *uptokstart = (char *)xmalloc(namelen+1); 02983 for (i = 0;i <= namelen;i++) 02984 { 02985 if ((tokstart[i]>='a' && tokstart[i]<='z')) 02986 uptokstart[i] = tokstart[i]-('a'-'A'); 02987 else 02988 uptokstart[i] = tokstart[i]; 02989 } 02990 uptokstart[namelen]='\0'; 02991 return uptokstart; 02992 } 02993 02994 /* This is set if the previously-returned token was a structure 02995 operator '.'. This is used only when parsing to 02996 do field name completion. */ 02997 static int last_was_structop; 02998 02999 /* Read one token, getting characters through lexptr. */ 03000 03001 static int 03002 yylex (void) 03003 { 03004 int c; 03005 int namelen; 03006 unsigned int i; 03007 char *tokstart; 03008 char *uptokstart; 03009 char *tokptr; 03010 int explen, tempbufindex; 03011 static char *tempbuf; 03012 static int tempbufsize; 03013 int saw_structop = last_was_structop; 03014 03015 last_was_structop = 0; 03016 retry: 03017 03018 prev_lexptr = lexptr; 03019 03020 explen = strlen (lexptr); 03021 tokstart = alloca (explen + 1); 03022 memcpy (tokstart, lexptr, explen + 1); 03023 03024 /* See if it is a special token of length 3. */ 03025 if (explen > 2) 03026 for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++) 03027 if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0 03028 && (!isalpha (tokentab3[i].operator[0]) || explen == 3 03029 || (!isalpha (tokstart[3]) 03030 && !isdigit (tokstart[3]) && tokstart[3] != '_'))) 03031 { 03032 lexptr += 3; 03033 yylval.opcode = tokentab3[i].opcode; 03034 return tokentab3[i].token; 03035 } 03036 03037 /* See if it is a special token of length 2. */ 03038 if (explen > 1) 03039 for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++) 03040 if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0 03041 && (!isalpha (tokentab2[i].operator[0]) || explen == 2 03042 || (!isalpha (tokstart[2]) 03043 && !isdigit (tokstart[2]) && tokstart[2] != '_'))) 03044 { 03045 lexptr += 2; 03046 yylval.opcode = tokentab2[i].opcode; 03047 return tokentab2[i].token; 03048 } 03049 03050 switch (c = *tokstart) 03051 { 03052 case 0: 03053 if (saw_structop && search_field) 03054 return COMPLETE; 03055 else 03056 return 0; 03057 03058 case ' ': 03059 case '\t': 03060 case '\n': 03061 lexptr++; 03062 goto retry; 03063 03064 case '\'': 03065 /* We either have a character constant ('0' or '\177' for example) 03066 or we have a quoted symbol reference ('foo(int,int)' in object pascal 03067 for example). */ 03068 lexptr++; 03069 c = *lexptr++; 03070 if (c == '\\') 03071 c = parse_escape (parse_gdbarch, &lexptr); 03072 else if (c == '\'') 03073 error (_("Empty character constant.")); 03074 03075 yylval.typed_val_int.val = c; 03076 yylval.typed_val_int.type = parse_type->builtin_char; 03077 03078 c = *lexptr++; 03079 if (c != '\'') 03080 { 03081 namelen = skip_quoted (tokstart) - tokstart; 03082 if (namelen > 2) 03083 { 03084 lexptr = tokstart + namelen; 03085 if (lexptr[-1] != '\'') 03086 error (_("Unmatched single quote.")); 03087 namelen -= 2; 03088 tokstart++; 03089 uptokstart = uptok(tokstart,namelen); 03090 goto tryname; 03091 } 03092 error (_("Invalid character constant.")); 03093 } 03094 return INT; 03095 03096 case '(': 03097 paren_depth++; 03098 lexptr++; 03099 return c; 03100 03101 case ')': 03102 if (paren_depth == 0) 03103 return 0; 03104 paren_depth--; 03105 lexptr++; 03106 return c; 03107 03108 case ',': 03109 if (comma_terminates && paren_depth == 0) 03110 return 0; 03111 lexptr++; 03112 return c; 03113 03114 case '.': 03115 /* Might be a floating point number. */ 03116 if (lexptr[1] < '0' || lexptr[1] > '9') 03117 { 03118 if (parse_completion) 03119 last_was_structop = 1; 03120 goto symbol; /* Nope, must be a symbol. */ 03121 } 03122 03123 /* FALL THRU into number case. */ 03124 03125 case '0': 03126 case '1': 03127 case '2': 03128 case '3': 03129 case '4': 03130 case '5': 03131 case '6': 03132 case '7': 03133 case '8': 03134 case '9': 03135 { 03136 /* It's a number. */ 03137 int got_dot = 0, got_e = 0, toktype; 03138 char *p = tokstart; 03139 int hex = input_radix > 10; 03140 03141 if (c == '0' && (p[1] == 'x' || p[1] == 'X')) 03142 { 03143 p += 2; 03144 hex = 1; 03145 } 03146 else if (c == '0' && (p[1]=='t' || p[1]=='T' 03147 || p[1]=='d' || p[1]=='D')) 03148 { 03149 p += 2; 03150 hex = 0; 03151 } 03152 03153 for (;; ++p) 03154 { 03155 /* This test includes !hex because 'e' is a valid hex digit 03156 and thus does not indicate a floating point number when 03157 the radix is hex. */ 03158 if (!hex && !got_e && (*p == 'e' || *p == 'E')) 03159 got_dot = got_e = 1; 03160 /* This test does not include !hex, because a '.' always indicates 03161 a decimal floating point number regardless of the radix. */ 03162 else if (!got_dot && *p == '.') 03163 got_dot = 1; 03164 else if (got_e && (p[-1] == 'e' || p[-1] == 'E') 03165 && (*p == '-' || *p == '+')) 03166 /* This is the sign of the exponent, not the end of the 03167 number. */ 03168 continue; 03169 /* We will take any letters or digits. parse_number will 03170 complain if past the radix, or if L or U are not final. */ 03171 else if ((*p < '0' || *p > '9') 03172 && ((*p < 'a' || *p > 'z') 03173 && (*p < 'A' || *p > 'Z'))) 03174 break; 03175 } 03176 toktype = parse_number (tokstart, 03177 p - tokstart, got_dot | got_e, &yylval); 03178 if (toktype == ERROR) 03179 { 03180 char *err_copy = (char *) alloca (p - tokstart + 1); 03181 03182 memcpy (err_copy, tokstart, p - tokstart); 03183 err_copy[p - tokstart] = 0; 03184 error (_("Invalid number \"%s\"."), err_copy); 03185 } 03186 lexptr = p; 03187 return toktype; 03188 } 03189 03190 case '+': 03191 case '-': 03192 case '*': 03193 case '/': 03194 case '|': 03195 case '&': 03196 case '^': 03197 case '~': 03198 case '!': 03199 case '@': 03200 case '<': 03201 case '>': 03202 case '[': 03203 case ']': 03204 case '?': 03205 case ':': 03206 case '=': 03207 case '{': 03208 case '}': 03209 symbol: 03210 lexptr++; 03211 return c; 03212 03213 case '"': 03214 03215 /* Build the gdb internal form of the input string in tempbuf, 03216 translating any standard C escape forms seen. Note that the 03217 buffer is null byte terminated *only* for the convenience of 03218 debugging gdb itself and printing the buffer contents when 03219 the buffer contains no embedded nulls. Gdb does not depend 03220 upon the buffer being null byte terminated, it uses the length 03221 string instead. This allows gdb to handle C strings (as well 03222 as strings in other languages) with embedded null bytes. */ 03223 03224 tokptr = ++tokstart; 03225 tempbufindex = 0; 03226 03227 do { 03228 /* Grow the static temp buffer if necessary, including allocating 03229 the first one on demand. */ 03230 if (tempbufindex + 1 >= tempbufsize) 03231 { 03232 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64); 03233 } 03234 03235 switch (*tokptr) 03236 { 03237 case '\0': 03238 case '"': 03239 /* Do nothing, loop will terminate. */ 03240 break; 03241 case '\\': 03242 { 03243 const char *s, *o; 03244 03245 o = s = ++tokptr; 03246 c = parse_escape (parse_gdbarch, &s); 03247 *tokptr += s - o; 03248 if (c == -1) 03249 { 03250 continue; 03251 } 03252 tempbuf[tempbufindex++] = c; 03253 } 03254 break; 03255 default: 03256 tempbuf[tempbufindex++] = *tokptr++; 03257 break; 03258 } 03259 } while ((*tokptr != '"') && (*tokptr != '\0')); 03260 if (*tokptr++ != '"') 03261 { 03262 error (_("Unterminated string in expression.")); 03263 } 03264 tempbuf[tempbufindex] = '\0'; /* See note above. */ 03265 yylval.sval.ptr = tempbuf; 03266 yylval.sval.length = tempbufindex; 03267 lexptr = tokptr; 03268 return (STRING); 03269 } 03270 03271 if (!(c == '_' || c == '$' 03272 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) 03273 /* We must have come across a bad character (e.g. ';'). */ 03274 error (_("Invalid character '%c' in expression."), c); 03275 03276 /* It's a name. See how long it is. */ 03277 namelen = 0; 03278 for (c = tokstart[namelen]; 03279 (c == '_' || c == '$' || (c >= '0' && c <= '9') 03280 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) 03281 { 03282 /* Template parameter lists are part of the name. 03283 FIXME: This mishandles `print $a<4&&$a>3'. */ 03284 if (c == '<') 03285 { 03286 int i = namelen; 03287 int nesting_level = 1; 03288 while (tokstart[++i]) 03289 { 03290 if (tokstart[i] == '<') 03291 nesting_level++; 03292 else if (tokstart[i] == '>') 03293 { 03294 if (--nesting_level == 0) 03295 break; 03296 } 03297 } 03298 if (tokstart[i] == '>') 03299 namelen = i; 03300 else 03301 break; 03302 } 03303 03304 /* do NOT uppercase internals because of registers !!! */ 03305 c = tokstart[++namelen]; 03306 } 03307 03308 uptokstart = uptok(tokstart,namelen); 03309 03310 /* The token "if" terminates the expression and is NOT 03311 removed from the input stream. */ 03312 if (namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F') 03313 { 03314 xfree (uptokstart); 03315 return 0; 03316 } 03317 03318 lexptr += namelen; 03319 03320 tryname: 03321 03322 /* Catch specific keywords. Should be done with a data structure. */ 03323 switch (namelen) 03324 { 03325 case 6: 03326 if (strcmp (uptokstart, "OBJECT") == 0) 03327 { 03328 xfree (uptokstart); 03329 return CLASS; 03330 } 03331 if (strcmp (uptokstart, "RECORD") == 0) 03332 { 03333 xfree (uptokstart); 03334 return STRUCT; 03335 } 03336 if (strcmp (uptokstart, "SIZEOF") == 0) 03337 { 03338 xfree (uptokstart); 03339 return SIZEOF; 03340 } 03341 break; 03342 case 5: 03343 if (strcmp (uptokstart, "CLASS") == 0) 03344 { 03345 xfree (uptokstart); 03346 return CLASS; 03347 } 03348 if (strcmp (uptokstart, "FALSE") == 0) 03349 { 03350 yylval.lval = 0; 03351 xfree (uptokstart); 03352 return FALSEKEYWORD; 03353 } 03354 break; 03355 case 4: 03356 if (strcmp (uptokstart, "TRUE") == 0) 03357 { 03358 yylval.lval = 1; 03359 xfree (uptokstart); 03360 return TRUEKEYWORD; 03361 } 03362 if (strcmp (uptokstart, "SELF") == 0) 03363 { 03364 /* Here we search for 'this' like 03365 inserted in FPC stabs debug info. */ 03366 static const char this_name[] = "this"; 03367 03368 if (lookup_symbol (this_name, expression_context_block, 03369 VAR_DOMAIN, NULL)) 03370 { 03371 xfree (uptokstart); 03372 return THIS; 03373 } 03374 } 03375 break; 03376 default: 03377 break; 03378 } 03379 03380 yylval.sval.ptr = tokstart; 03381 yylval.sval.length = namelen; 03382 03383 if (*tokstart == '$') 03384 { 03385 char c; 03386 /* $ is the normal prefix for pascal hexadecimal values 03387 but this conflicts with the GDB use for debugger variables 03388 so in expression to enter hexadecimal values 03389 we still need to use C syntax with 0xff */ 03390 write_dollar_variable (yylval.sval); 03391 c = tokstart[namelen]; 03392 tokstart[namelen] = 0; 03393 intvar = lookup_only_internalvar (++tokstart); 03394 --tokstart; 03395 tokstart[namelen] = c; 03396 xfree (uptokstart); 03397 return VARIABLE; 03398 } 03399 03400 /* Use token-type BLOCKNAME for symbols that happen to be defined as 03401 functions or symtabs. If this is not so, then ... 03402 Use token-type TYPENAME for symbols that happen to be defined 03403 currently as names of types; NAME for other symbols. 03404 The caller is not constrained to care about the distinction. */ 03405 { 03406 char *tmp = copy_name (yylval.sval); 03407 struct symbol *sym; 03408 struct field_of_this_result is_a_field_of_this; 03409 int is_a_field = 0; 03410 int hextype; 03411 03412 03413 if (search_field && current_type) 03414 is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); 03415 if (is_a_field || parse_completion) 03416 sym = NULL; 03417 else 03418 sym = lookup_symbol (tmp, expression_context_block, 03419 VAR_DOMAIN, &is_a_field_of_this); 03420 /* second chance uppercased (as Free Pascal does). */ 03421 if (!sym && is_a_field_of_this.type == NULL && !is_a_field) 03422 { 03423 for (i = 0; i <= namelen; i++) 03424 { 03425 if ((tmp[i] >= 'a' && tmp[i] <= 'z')) 03426 tmp[i] -= ('a'-'A'); 03427 } 03428 if (search_field && current_type) 03429 is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); 03430 if (is_a_field || parse_completion) 03431 sym = NULL; 03432 else 03433 sym = lookup_symbol (tmp, expression_context_block, 03434 VAR_DOMAIN, &is_a_field_of_this); 03435 if (sym || is_a_field_of_this.type != NULL || is_a_field) 03436 for (i = 0; i <= namelen; i++) 03437 { 03438 if ((tokstart[i] >= 'a' && tokstart[i] <= 'z')) 03439 tokstart[i] -= ('a'-'A'); 03440 } 03441 } 03442 /* Third chance Capitalized (as GPC does). */ 03443 if (!sym && is_a_field_of_this.type == NULL && !is_a_field) 03444 { 03445 for (i = 0; i <= namelen; i++) 03446 { 03447 if (i == 0) 03448 { 03449 if ((tmp[i] >= 'a' && tmp[i] <= 'z')) 03450 tmp[i] -= ('a'-'A'); 03451 } 03452 else 03453 if ((tmp[i] >= 'A' && tmp[i] <= 'Z')) 03454 tmp[i] -= ('A'-'a'); 03455 } 03456 if (search_field && current_type) 03457 is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); 03458 if (is_a_field || parse_completion) 03459 sym = NULL; 03460 else 03461 sym = lookup_symbol (tmp, expression_context_block, 03462 VAR_DOMAIN, &is_a_field_of_this); 03463 if (sym || is_a_field_of_this.type != NULL || is_a_field) 03464 for (i = 0; i <= namelen; i++) 03465 { 03466 if (i == 0) 03467 { 03468 if ((tokstart[i] >= 'a' && tokstart[i] <= 'z')) 03469 tokstart[i] -= ('a'-'A'); 03470 } 03471 else 03472 if ((tokstart[i] >= 'A' && tokstart[i] <= 'Z')) 03473 tokstart[i] -= ('A'-'a'); 03474 } 03475 } 03476 03477 if (is_a_field) 03478 { 03479 tempbuf = (char *) xrealloc (tempbuf, namelen + 1); 03480 strncpy (tempbuf, tokstart, namelen); tempbuf [namelen] = 0; 03481 yylval.sval.ptr = tempbuf; 03482 yylval.sval.length = namelen; 03483 xfree (uptokstart); 03484 return FIELDNAME; 03485 } 03486 /* Call lookup_symtab, not lookup_partial_symtab, in case there are 03487 no psymtabs (coff, xcoff, or some future change to blow away the 03488 psymtabs once once symbols are read). */ 03489 if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) 03490 || lookup_symtab (tmp)) 03491 { 03492 yylval.ssym.sym = sym; 03493 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; 03494 xfree (uptokstart); 03495 return BLOCKNAME; 03496 } 03497 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) 03498 { 03499 #if 1 03500 /* Despite the following flaw, we need to keep this code enabled. 03501 Because we can get called from check_stub_method, if we don't 03502 handle nested types then it screws many operations in any 03503 program which uses nested types. */ 03504 /* In "A::x", if x is a member function of A and there happens 03505 to be a type (nested or not, since the stabs don't make that 03506 distinction) named x, then this code incorrectly thinks we 03507 are dealing with nested types rather than a member function. */ 03508 03509 const char *p; 03510 const char *namestart; 03511 struct symbol *best_sym; 03512 03513 /* Look ahead to detect nested types. This probably should be 03514 done in the grammar, but trying seemed to introduce a lot 03515 of shift/reduce and reduce/reduce conflicts. It's possible 03516 that it could be done, though. Or perhaps a non-grammar, but 03517 less ad hoc, approach would work well. */ 03518 03519 /* Since we do not currently have any way of distinguishing 03520 a nested type from a non-nested one (the stabs don't tell 03521 us whether a type is nested), we just ignore the 03522 containing type. */ 03523 03524 p = lexptr; 03525 best_sym = sym; 03526 while (1) 03527 { 03528 /* Skip whitespace. */ 03529 while (*p == ' ' || *p == '\t' || *p == '\n') 03530 ++p; 03531 if (*p == ':' && p[1] == ':') 03532 { 03533 /* Skip the `::'. */ 03534 p += 2; 03535 /* Skip whitespace. */ 03536 while (*p == ' ' || *p == '\t' || *p == '\n') 03537 ++p; 03538 namestart = p; 03539 while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9') 03540 || (*p >= 'a' && *p <= 'z') 03541 || (*p >= 'A' && *p <= 'Z')) 03542 ++p; 03543 if (p != namestart) 03544 { 03545 struct symbol *cur_sym; 03546 /* As big as the whole rest of the expression, which is 03547 at least big enough. */ 03548 char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3); 03549 char *tmp1; 03550 03551 tmp1 = ncopy; 03552 memcpy (tmp1, tmp, strlen (tmp)); 03553 tmp1 += strlen (tmp); 03554 memcpy (tmp1, "::", 2); 03555 tmp1 += 2; 03556 memcpy (tmp1, namestart, p - namestart); 03557 tmp1[p - namestart] = '\0'; 03558 cur_sym = lookup_symbol (ncopy, expression_context_block, 03559 VAR_DOMAIN, NULL); 03560 if (cur_sym) 03561 { 03562 if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF) 03563 { 03564 best_sym = cur_sym; 03565 lexptr = p; 03566 } 03567 else 03568 break; 03569 } 03570 else 03571 break; 03572 } 03573 else 03574 break; 03575 } 03576 else 03577 break; 03578 } 03579 03580 yylval.tsym.type = SYMBOL_TYPE (best_sym); 03581 #else /* not 0 */ 03582 yylval.tsym.type = SYMBOL_TYPE (sym); 03583 #endif /* not 0 */ 03584 xfree (uptokstart); 03585 return TYPENAME; 03586 } 03587 yylval.tsym.type 03588 = language_lookup_primitive_type_by_name (parse_language, 03589 parse_gdbarch, tmp); 03590 if (yylval.tsym.type != NULL) 03591 { 03592 xfree (uptokstart); 03593 return TYPENAME; 03594 } 03595 03596 /* Input names that aren't symbols but ARE valid hex numbers, 03597 when the input radix permits them, can be names or numbers 03598 depending on the parse. Note we support radixes > 16 here. */ 03599 if (!sym 03600 && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) 03601 || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) 03602 { 03603 YYSTYPE newlval; /* Its value is ignored. */ 03604 hextype = parse_number (tokstart, namelen, 0, &newlval); 03605 if (hextype == INT) 03606 { 03607 yylval.ssym.sym = sym; 03608 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; 03609 xfree (uptokstart); 03610 return NAME_OR_INT; 03611 } 03612 } 03613 03614 xfree(uptokstart); 03615 /* Any other kind of symbol. */ 03616 yylval.ssym.sym = sym; 03617 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; 03618 return NAME; 03619 } 03620 } 03621 03622 void 03623 yyerror (char *msg) 03624 { 03625 if (prev_lexptr) 03626 lexptr = prev_lexptr; 03627 03628 error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr); 03629 } 03630