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 36 "../../src/gdb/jv-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 "jv-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 #define parse_java_type builtin_java_type (parse_gdbarch) 00088 00089 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), 00090 as well as gratuitiously global symbol names, so we can have multiple 00091 yacc generated parsers in gdb. Note that these are only the variables 00092 produced by yacc. If other parser generators (bison, byacc, etc) produce 00093 additional global names that conflict at link time, then those parser 00094 generators need to be fixed instead of adding those names to this list. */ 00095 00096 #define yymaxdepth java_maxdepth 00097 #define yyparse java_parse 00098 #define yylex java_lex 00099 #define yyerror java_error 00100 #define yylval java_lval 00101 #define yychar java_char 00102 #define yydebug java_debug 00103 #define yypact java_pact 00104 #define yyr1 java_r1 00105 #define yyr2 java_r2 00106 #define yydef java_def 00107 #define yychk java_chk 00108 #define yypgo java_pgo 00109 #define yyact java_act 00110 #define yyexca java_exca 00111 #define yyerrflag java_errflag 00112 #define yynerrs java_nerrs 00113 #define yyps java_ps 00114 #define yypv java_pv 00115 #define yys java_s 00116 #define yy_yys java_yys 00117 #define yystate java_state 00118 #define yytmp java_tmp 00119 #define yyv java_v 00120 #define yy_yyv java_yyv 00121 #define yyval java_val 00122 #define yylloc java_lloc 00123 #define yyreds java_reds /* With YYDEBUG defined */ 00124 #define yytoks java_toks /* With YYDEBUG defined */ 00125 #define yyname java_name /* With YYDEBUG defined */ 00126 #define yyrule java_rule /* With YYDEBUG defined */ 00127 #define yylhs java_yylhs 00128 #define yylen java_yylen 00129 #define yydefred java_yydefred 00130 #define yydgoto java_yydgoto 00131 #define yysindex java_yysindex 00132 #define yyrindex java_yyrindex 00133 #define yygindex java_yygindex 00134 #define yytable java_yytable 00135 #define yycheck java_yycheck 00136 #define yyss java_yyss 00137 #define yysslim java_yysslim 00138 #define yyssp java_yyssp 00139 #define yystacksize java_yystacksize 00140 #define yyvs java_yyvs 00141 #define yyvsp java_yyvsp 00142 00143 #ifndef YYDEBUG 00144 #define YYDEBUG 1 /* Default to yydebug support */ 00145 #endif 00146 00147 #define YYFPRINTF parser_fprintf 00148 00149 int yyparse (void); 00150 00151 static int yylex (void); 00152 00153 void yyerror (char *); 00154 00155 static struct type *java_type_from_name (struct stoken); 00156 static void push_expression_name (struct stoken); 00157 static void push_fieldnames (struct stoken); 00158 00159 static struct expression *copy_exp (struct expression *, int); 00160 static void insert_exp (int, struct expression *); 00161 00162 00163 00164 /* Line 268 of yacc.c */ 00165 #line 166 "jv-exp.c" 00166 00167 /* Enabling traces. */ 00168 #ifndef YYDEBUG 00169 # define YYDEBUG 0 00170 #endif 00171 00172 /* Enabling verbose error messages. */ 00173 #ifdef YYERROR_VERBOSE 00174 # undef YYERROR_VERBOSE 00175 # define YYERROR_VERBOSE 1 00176 #else 00177 # define YYERROR_VERBOSE 0 00178 #endif 00179 00180 /* Enabling the token table. */ 00181 #ifndef YYTOKEN_TABLE 00182 # define YYTOKEN_TABLE 0 00183 #endif 00184 00185 00186 /* Tokens. */ 00187 #ifndef YYTOKENTYPE 00188 # define YYTOKENTYPE 00189 /* Put the tokens into the symbol table, so that GDB and other debuggers 00190 know about them. */ 00191 enum yytokentype { 00192 INTEGER_LITERAL = 258, 00193 FLOATING_POINT_LITERAL = 259, 00194 IDENTIFIER = 260, 00195 STRING_LITERAL = 261, 00196 BOOLEAN_LITERAL = 262, 00197 TYPENAME = 263, 00198 NAME_OR_INT = 264, 00199 ERROR = 265, 00200 LONG = 266, 00201 SHORT = 267, 00202 BYTE = 268, 00203 INT = 269, 00204 CHAR = 270, 00205 BOOLEAN = 271, 00206 DOUBLE = 272, 00207 FLOAT = 273, 00208 VARIABLE = 274, 00209 ASSIGN_MODIFY = 275, 00210 SUPER = 276, 00211 NEW = 277, 00212 OROR = 278, 00213 ANDAND = 279, 00214 NOTEQUAL = 280, 00215 EQUAL = 281, 00216 GEQ = 282, 00217 LEQ = 283, 00218 RSH = 284, 00219 LSH = 285, 00220 DECREMENT = 286, 00221 INCREMENT = 287 00222 }; 00223 #endif 00224 /* Tokens. */ 00225 #define INTEGER_LITERAL 258 00226 #define FLOATING_POINT_LITERAL 259 00227 #define IDENTIFIER 260 00228 #define STRING_LITERAL 261 00229 #define BOOLEAN_LITERAL 262 00230 #define TYPENAME 263 00231 #define NAME_OR_INT 264 00232 #define ERROR 265 00233 #define LONG 266 00234 #define SHORT 267 00235 #define BYTE 268 00236 #define INT 269 00237 #define CHAR 270 00238 #define BOOLEAN 271 00239 #define DOUBLE 272 00240 #define FLOAT 273 00241 #define VARIABLE 274 00242 #define ASSIGN_MODIFY 275 00243 #define SUPER 276 00244 #define NEW 277 00245 #define OROR 278 00246 #define ANDAND 279 00247 #define NOTEQUAL 280 00248 #define EQUAL 281 00249 #define GEQ 282 00250 #define LEQ 283 00251 #define RSH 284 00252 #define LSH 285 00253 #define DECREMENT 286 00254 #define INCREMENT 287 00255 00256 00257 00258 00259 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00260 typedef union YYSTYPE 00261 { 00262 00263 /* Line 293 of yacc.c */ 00264 #line 135 "../../src/gdb/jv-exp.y" 00265 00266 LONGEST lval; 00267 struct { 00268 LONGEST val; 00269 struct type *type; 00270 } typed_val_int; 00271 struct { 00272 DOUBLEST dval; 00273 struct type *type; 00274 } typed_val_float; 00275 struct symbol *sym; 00276 struct type *tval; 00277 struct stoken sval; 00278 struct ttype tsym; 00279 struct symtoken ssym; 00280 struct block *bval; 00281 enum exp_opcode opcode; 00282 struct internalvar *ivar; 00283 int *ivec; 00284 00285 00286 00287 /* Line 293 of yacc.c */ 00288 #line 289 "jv-exp.c" 00289 } YYSTYPE; 00290 # define YYSTYPE_IS_TRIVIAL 1 00291 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00292 # define YYSTYPE_IS_DECLARED 1 00293 #endif 00294 00295 00296 /* Copy the second part of user declarations. */ 00297 00298 /* Line 343 of yacc.c */ 00299 #line 156 "../../src/gdb/jv-exp.y" 00300 00301 /* YYSTYPE gets defined by %union */ 00302 static int parse_number (const char *, int, int, YYSTYPE *); 00303 00304 00305 /* Line 343 of yacc.c */ 00306 #line 307 "jv-exp.c" 00307 00308 #ifdef short 00309 # undef short 00310 #endif 00311 00312 #ifdef YYTYPE_UINT8 00313 typedef YYTYPE_UINT8 yytype_uint8; 00314 #else 00315 typedef unsigned char yytype_uint8; 00316 #endif 00317 00318 #ifdef YYTYPE_INT8 00319 typedef YYTYPE_INT8 yytype_int8; 00320 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00321 || defined __cplusplus || defined _MSC_VER) 00322 typedef signed char yytype_int8; 00323 #else 00324 typedef short int yytype_int8; 00325 #endif 00326 00327 #ifdef YYTYPE_UINT16 00328 typedef YYTYPE_UINT16 yytype_uint16; 00329 #else 00330 typedef unsigned short int yytype_uint16; 00331 #endif 00332 00333 #ifdef YYTYPE_INT16 00334 typedef YYTYPE_INT16 yytype_int16; 00335 #else 00336 typedef short int yytype_int16; 00337 #endif 00338 00339 #ifndef YYSIZE_T 00340 # ifdef __SIZE_TYPE__ 00341 # define YYSIZE_T __SIZE_TYPE__ 00342 # elif defined size_t 00343 # define YYSIZE_T size_t 00344 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00345 || defined __cplusplus || defined _MSC_VER) 00346 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00347 # define YYSIZE_T size_t 00348 # else 00349 # define YYSIZE_T unsigned int 00350 # endif 00351 #endif 00352 00353 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00354 00355 #ifndef YY_ 00356 # if defined YYENABLE_NLS && YYENABLE_NLS 00357 # if ENABLE_NLS 00358 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00359 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00360 # endif 00361 # endif 00362 # ifndef YY_ 00363 # define YY_(msgid) msgid 00364 # endif 00365 #endif 00366 00367 /* Suppress unused-variable warnings by "using" E. */ 00368 #if ! defined lint || defined __GNUC__ 00369 # define YYUSE(e) ((void) (e)) 00370 #else 00371 # define YYUSE(e) /* empty */ 00372 #endif 00373 00374 /* Identity function, used to suppress warnings about constant conditions. */ 00375 #ifndef lint 00376 # define YYID(n) (n) 00377 #else 00378 #if (defined __STDC__ || defined __C99__FUNC__ \ 00379 || defined __cplusplus || defined _MSC_VER) 00380 static int 00381 YYID (int yyi) 00382 #else 00383 static int 00384 YYID (yyi) 00385 int yyi; 00386 #endif 00387 { 00388 return yyi; 00389 } 00390 #endif 00391 00392 #if ! defined yyoverflow || YYERROR_VERBOSE 00393 00394 /* The parser invokes alloca or xmalloc; define the necessary symbols. */ 00395 00396 # ifdef YYSTACK_USE_ALLOCA 00397 # if YYSTACK_USE_ALLOCA 00398 # ifdef __GNUC__ 00399 # define YYSTACK_ALLOC __builtin_alloca 00400 # elif defined __BUILTIN_VA_ARG_INCR 00401 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00402 # elif defined _AIX 00403 # define YYSTACK_ALLOC __alloca 00404 # elif defined _MSC_VER 00405 # define alloca _alloca 00406 # else 00407 # define YYSTACK_ALLOC alloca 00408 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00409 || defined __cplusplus || defined _MSC_VER) 00410 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00411 # ifndef EXIT_SUCCESS 00412 # define EXIT_SUCCESS 0 00413 # endif 00414 # endif 00415 # endif 00416 # endif 00417 # endif 00418 00419 # ifdef YYSTACK_ALLOC 00420 /* Pacify GCC's `empty if-body' warning. */ 00421 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00422 # ifndef YYSTACK_ALLOC_MAXIMUM 00423 /* The OS might guarantee only one guard page at the bottom of the stack, 00424 and a page size can be as small as 4096 bytes. So we cannot safely 00425 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00426 to allow for a few compiler-allocated temporary stack slots. */ 00427 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00428 # endif 00429 # else 00430 # define YYSTACK_ALLOC YYMALLOC 00431 # define YYSTACK_FREE YYFREE 00432 # ifndef YYSTACK_ALLOC_MAXIMUM 00433 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00434 # endif 00435 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 00436 && ! ((defined YYMALLOC || defined xmalloc) \ 00437 && (defined YYFREE || defined xfree))) 00438 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00439 # ifndef EXIT_SUCCESS 00440 # define EXIT_SUCCESS 0 00441 # endif 00442 # endif 00443 # ifndef YYMALLOC 00444 # define YYMALLOC xmalloc 00445 # if ! defined xmalloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00446 || defined __cplusplus || defined _MSC_VER) 00447 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00448 # endif 00449 # endif 00450 # ifndef YYFREE 00451 # define YYFREE xfree 00452 # if ! defined xfree && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00453 || defined __cplusplus || defined _MSC_VER) 00454 void xfree (void *); /* INFRINGES ON USER NAME SPACE */ 00455 # endif 00456 # endif 00457 # endif 00458 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00459 00460 00461 #if (! defined yyoverflow \ 00462 && (! defined __cplusplus \ 00463 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00464 00465 /* A type that is properly aligned for any stack member. */ 00466 union yyalloc 00467 { 00468 yytype_int16 yyss_alloc; 00469 YYSTYPE yyvs_alloc; 00470 }; 00471 00472 /* The size of the maximum gap between one aligned stack and the next. */ 00473 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00474 00475 /* The size of an array large to enough to hold all stacks, each with 00476 N elements. */ 00477 # define YYSTACK_BYTES(N) \ 00478 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00479 + YYSTACK_GAP_MAXIMUM) 00480 00481 # define YYCOPY_NEEDED 1 00482 00483 /* Relocate STACK from its old location to the new one. The 00484 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00485 elements in the stack, and YYPTR gives the new location of the 00486 stack. Advance YYPTR to a properly aligned location for the next 00487 stack. */ 00488 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00489 do \ 00490 { \ 00491 YYSIZE_T yynewbytes; \ 00492 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00493 Stack = &yyptr->Stack_alloc; \ 00494 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00495 yyptr += yynewbytes / sizeof (*yyptr); \ 00496 } \ 00497 while (YYID (0)) 00498 00499 #endif 00500 00501 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 00502 /* Copy COUNT objects from FROM to TO. The source and destination do 00503 not overlap. */ 00504 # ifndef YYCOPY 00505 # if defined __GNUC__ && 1 < __GNUC__ 00506 # define YYCOPY(To, From, Count) \ 00507 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00508 # else 00509 # define YYCOPY(To, From, Count) \ 00510 do \ 00511 { \ 00512 YYSIZE_T yyi; \ 00513 for (yyi = 0; yyi < (Count); yyi++) \ 00514 (To)[yyi] = (From)[yyi]; \ 00515 } \ 00516 while (YYID (0)) 00517 # endif 00518 # endif 00519 #endif /* !YYCOPY_NEEDED */ 00520 00521 /* YYFINAL -- State number of the termination state. */ 00522 #define YYFINAL 98 00523 /* YYLAST -- Last index in YYTABLE. */ 00524 #define YYLAST 373 00525 00526 /* YYNTOKENS -- Number of terminals. */ 00527 #define YYNTOKENS 56 00528 /* YYNNTS -- Number of nonterminals. */ 00529 #define YYNNTS 58 00530 /* YYNRULES -- Number of rules. */ 00531 #define YYNRULES 132 00532 /* YYNRULES -- Number of states. */ 00533 #define YYNSTATES 209 00534 00535 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00536 #define YYUNDEFTOK 2 00537 #define YYMAXUTOK 287 00538 00539 #define YYTRANSLATE(YYX) \ 00540 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00541 00542 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00543 static const yytype_uint8 yytranslate[] = 00544 { 00545 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00548 2, 2, 2, 54, 2, 2, 2, 43, 30, 2, 00549 48, 49, 41, 39, 23, 40, 46, 42, 2, 2, 00550 2, 2, 2, 2, 2, 2, 2, 2, 55, 2, 00551 33, 24, 34, 25, 2, 2, 2, 2, 2, 2, 00552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00554 2, 47, 2, 52, 29, 2, 2, 2, 2, 2, 00555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00557 2, 2, 2, 50, 28, 51, 53, 2, 2, 2, 00558 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00564 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 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, 1, 2, 3, 4, 00571 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00572 15, 16, 17, 18, 19, 20, 21, 22, 26, 27, 00573 31, 32, 35, 36, 37, 38, 44, 45 00574 }; 00575 00576 #if YYDEBUG 00577 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00578 YYRHS. */ 00579 static const yytype_uint16 yyprhs[] = 00580 { 00581 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 00582 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 00583 39, 41, 43, 45, 47, 49, 51, 54, 57, 59, 00584 61, 63, 65, 67, 69, 73, 75, 79, 81, 83, 00585 85, 89, 91, 93, 95, 97, 101, 103, 105, 111, 00586 113, 117, 118, 120, 125, 130, 132, 135, 139, 142, 00587 146, 148, 149, 153, 157, 160, 161, 166, 173, 180, 00588 185, 190, 195, 197, 199, 201, 203, 205, 208, 211, 00589 213, 215, 218, 221, 224, 226, 229, 232, 234, 237, 00590 240, 242, 248, 253, 259, 261, 265, 269, 273, 275, 00591 279, 283, 285, 289, 293, 295, 299, 303, 307, 311, 00592 313, 317, 321, 323, 327, 329, 333, 335, 339, 341, 00593 345, 347, 351, 353, 359, 361, 363, 367, 371, 373, 00594 375, 377, 379 00595 }; 00596 00597 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00598 static const yytype_int8 yyrhs[] = 00599 { 00600 57, 0, -1, 73, -1, 58, -1, 59, -1, 62, 00601 -1, 68, -1, 6, -1, 3, -1, 9, -1, 4, 00602 -1, 7, -1, 60, -1, 63, -1, 16, -1, 64, 00603 -1, 65, -1, 13, -1, 12, -1, 14, -1, 11, 00604 -1, 15, -1, 18, -1, 17, -1, 69, -1, 66, 00605 -1, 62, 84, -1, 69, 84, -1, 5, -1, 72, 00606 -1, 71, -1, 72, -1, 5, -1, 9, -1, 69, 00607 46, 71, -1, 113, -1, 73, 23, 113, -1, 75, 00608 -1, 81, -1, 61, -1, 48, 113, 49, -1, 78, 00609 -1, 86, -1, 88, -1, 90, -1, 76, 79, 77, 00610 -1, 50, -1, 51, -1, 22, 67, 48, 80, 49, 00611 -1, 113, -1, 79, 23, 113, -1, -1, 79, -1, 00612 22, 62, 82, 85, -1, 22, 66, 82, 85, -1, 00613 83, -1, 82, 83, -1, 47, 113, 52, -1, 47, 00614 52, -1, 84, 47, 52, -1, 84, -1, -1, 74, 00615 46, 71, -1, 19, 46, 71, -1, 69, 48, -1, 00616 -1, 87, 89, 80, 49, -1, 74, 46, 71, 48, 00617 80, 49, -1, 21, 46, 71, 48, 80, 49, -1, 00618 69, 47, 113, 52, -1, 19, 47, 113, 52, -1, 00619 75, 47, 113, 52, -1, 74, -1, 69, -1, 19, 00620 -1, 92, -1, 93, -1, 91, 45, -1, 91, 44, 00621 -1, 95, -1, 96, -1, 39, 94, -1, 40, 94, 00622 -1, 41, 94, -1, 97, -1, 45, 94, -1, 44, 00623 94, -1, 91, -1, 53, 94, -1, 54, 94, -1, 00624 98, -1, 48, 62, 85, 49, 94, -1, 48, 113, 00625 49, 97, -1, 48, 69, 84, 49, 97, -1, 94, 00626 -1, 99, 41, 94, -1, 99, 42, 94, -1, 99, 00627 43, 94, -1, 99, -1, 100, 39, 99, -1, 100, 00628 40, 99, -1, 100, -1, 101, 38, 100, -1, 101, 00629 37, 100, -1, 101, -1, 102, 33, 101, -1, 102, 00630 34, 101, -1, 102, 36, 101, -1, 102, 35, 101, 00631 -1, 102, -1, 103, 32, 102, -1, 103, 31, 102, 00632 -1, 103, -1, 104, 30, 103, -1, 104, -1, 105, 00633 29, 104, -1, 105, -1, 106, 28, 105, -1, 106, 00634 -1, 107, 27, 106, -1, 107, -1, 108, 26, 107, 00635 -1, 108, -1, 108, 25, 113, 55, 109, -1, 109, 00636 -1, 111, -1, 112, 24, 109, -1, 112, 20, 109, 00637 -1, 70, -1, 19, -1, 86, -1, 90, -1, 110, 00638 -1 00639 }; 00640 00641 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00642 static const yytype_uint16 yyrline[] = 00643 { 00644 0, 212, 212, 213, 216, 225, 226, 230, 239, 244, 00645 252, 257, 262, 273, 274, 279, 280, 284, 286, 288, 00646 290, 292, 297, 299, 311, 316, 320, 322, 327, 328, 00647 332, 333, 337, 338, 342, 368, 369, 374, 375, 379, 00648 380, 381, 382, 383, 384, 385, 393, 398, 403, 409, 00649 411, 417, 418, 422, 425, 431, 432, 436, 440, 442, 00650 447, 449, 453, 455, 461, 467, 466, 472, 474, 479, 00651 496, 498, 503, 504, 506, 508, 509, 513, 518, 523, 00652 524, 525, 526, 528, 530, 534, 539, 544, 545, 547, 00653 549, 553, 557, 577, 585, 586, 588, 590, 595, 596, 00654 598, 603, 604, 606, 612, 613, 615, 617, 619, 625, 00655 626, 628, 633, 634, 639, 640, 644, 645, 650, 651, 00656 656, 657, 662, 663, 668, 669, 673, 675, 682, 684, 00657 686, 687, 692 00658 }; 00659 #endif 00660 00661 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00662 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00663 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00664 static const char *const yytname[] = 00665 { 00666 "$end", "error", "$undefined", "INTEGER_LITERAL", 00667 "FLOATING_POINT_LITERAL", "IDENTIFIER", "STRING_LITERAL", 00668 "BOOLEAN_LITERAL", "TYPENAME", "NAME_OR_INT", "ERROR", "LONG", "SHORT", 00669 "BYTE", "INT", "CHAR", "BOOLEAN", "DOUBLE", "FLOAT", "VARIABLE", 00670 "ASSIGN_MODIFY", "SUPER", "NEW", "','", "'='", "'?'", "OROR", "ANDAND", 00671 "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ", 00672 "RSH", "LSH", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT", 00673 "INCREMENT", "'.'", "'['", "'('", "')'", "'{'", "'}'", "']'", "'~'", 00674 "'!'", "':'", "$accept", "start", "type_exp", "PrimitiveOrArrayType", 00675 "StringLiteral", "Literal", "PrimitiveType", "NumericType", 00676 "IntegralType", "FloatingPointType", "ClassOrInterfaceType", "ClassType", 00677 "ArrayType", "Name", "ForcedName", "SimpleName", "QualifiedName", "exp1", 00678 "Primary", "PrimaryNoNewArray", "lcurly", "rcurly", 00679 "ClassInstanceCreationExpression", "ArgumentList", "ArgumentList_opt", 00680 "ArrayCreationExpression", "DimExprs", "DimExpr", "Dims", "Dims_opt", 00681 "FieldAccess", "FuncStart", "MethodInvocation", "$@1", "ArrayAccess", 00682 "PostfixExpression", "PostIncrementExpression", 00683 "PostDecrementExpression", "UnaryExpression", "PreIncrementExpression", 00684 "PreDecrementExpression", "UnaryExpressionNotPlusMinus", 00685 "CastExpression", "MultiplicativeExpression", "AdditiveExpression", 00686 "ShiftExpression", "RelationalExpression", "EqualityExpression", 00687 "AndExpression", "ExclusiveOrExpression", "InclusiveOrExpression", 00688 "ConditionalAndExpression", "ConditionalOrExpression", 00689 "ConditionalExpression", "AssignmentExpression", "Assignment", 00690 "LeftHandSide", "Expression", 0 00691 }; 00692 #endif 00693 00694 # ifdef YYPRINT 00695 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00696 token YYLEX-NUM. */ 00697 static const yytype_uint16 yytoknum[] = 00698 { 00699 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00700 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 00701 275, 276, 277, 44, 61, 63, 278, 279, 124, 94, 00702 38, 280, 281, 60, 62, 282, 283, 284, 285, 43, 00703 45, 42, 47, 37, 286, 287, 46, 91, 40, 41, 00704 123, 125, 93, 126, 33, 58 00705 }; 00706 # endif 00707 00708 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00709 static const yytype_uint8 yyr1[] = 00710 { 00711 0, 56, 57, 57, 58, 59, 59, 60, 61, 61, 00712 61, 61, 61, 62, 62, 63, 63, 64, 64, 64, 00713 64, 64, 65, 65, 66, 67, 68, 68, 69, 69, 00714 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 00715 75, 75, 75, 75, 75, 75, 76, 77, 78, 79, 00716 79, 80, 80, 81, 81, 82, 82, 83, 84, 84, 00717 85, 85, 86, 86, 87, 89, 88, 88, 88, 90, 00718 90, 90, 91, 91, 91, 91, 91, 92, 93, 94, 00719 94, 94, 94, 94, 94, 95, 96, 97, 97, 97, 00720 97, 98, 98, 98, 99, 99, 99, 99, 100, 100, 00721 100, 101, 101, 101, 102, 102, 102, 102, 102, 103, 00722 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 00723 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 00724 112, 112, 113 00725 }; 00726 00727 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00728 static const yytype_uint8 yyr2[] = 00729 { 00730 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 00731 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00732 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 00733 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 00734 3, 1, 1, 1, 1, 3, 1, 1, 5, 1, 00735 3, 0, 1, 4, 4, 1, 2, 3, 2, 3, 00736 1, 0, 3, 3, 2, 0, 4, 6, 6, 4, 00737 4, 4, 1, 1, 1, 1, 1, 2, 2, 1, 00738 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 00739 1, 5, 4, 5, 1, 3, 3, 3, 1, 3, 00740 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 00741 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 00742 1, 3, 1, 5, 1, 1, 3, 3, 1, 1, 00743 1, 1, 1 00744 }; 00745 00746 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. 00747 Performed when YYTABLE doesn't specify something else to do. Zero 00748 means the default is an error. */ 00749 static const yytype_uint8 yydefact[] = 00750 { 00751 0, 8, 10, 28, 7, 11, 9, 20, 18, 17, 00752 19, 21, 14, 23, 22, 74, 0, 0, 0, 0, 00753 0, 0, 0, 0, 46, 0, 0, 0, 3, 4, 00754 12, 39, 5, 13, 15, 16, 6, 73, 128, 30, 00755 29, 2, 72, 37, 0, 41, 38, 42, 65, 43, 00756 44, 87, 75, 76, 94, 79, 80, 84, 90, 98, 00757 101, 104, 109, 112, 114, 116, 118, 120, 122, 124, 00758 132, 125, 0, 35, 0, 0, 0, 28, 0, 25, 00759 0, 24, 29, 9, 74, 73, 42, 44, 81, 82, 00760 83, 86, 85, 61, 73, 0, 88, 89, 1, 0, 00761 26, 0, 0, 64, 27, 0, 0, 0, 0, 49, 00762 51, 78, 77, 0, 0, 0, 0, 0, 0, 0, 00763 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00764 0, 0, 0, 0, 32, 33, 63, 0, 0, 0, 00765 61, 55, 61, 51, 0, 60, 0, 0, 40, 58, 00766 0, 34, 0, 36, 62, 0, 0, 47, 45, 52, 00767 0, 95, 96, 97, 99, 100, 103, 102, 105, 106, 00768 108, 107, 111, 110, 113, 115, 117, 119, 0, 121, 00769 127, 126, 70, 51, 0, 0, 56, 53, 54, 0, 00770 0, 0, 92, 59, 69, 51, 71, 50, 66, 0, 00771 0, 57, 48, 91, 93, 0, 123, 68, 67 00772 }; 00773 00774 /* YYDEFGOTO[NTERM-NUM]. */ 00775 static const yytype_int16 yydefgoto[] = 00776 { 00777 -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 00778 79, 80, 36, 85, 38, 39, 82, 41, 42, 43, 00779 44, 158, 45, 159, 160, 46, 140, 141, 145, 146, 00780 86, 48, 49, 110, 87, 51, 52, 53, 54, 55, 00781 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 00782 66, 67, 68, 69, 70, 71, 72, 109 00783 }; 00784 00785 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00786 STATE-NUM. */ 00787 #define YYPACT_NINF -145 00788 static const yytype_int16 yypact[] = 00789 { 00790 215, -145, -145, -5, -145, -145, 1, -145, -145, -145, 00791 -145, -145, -145, -145, -145, -7, -19, 279, 50, 50, 00792 50, 50, 50, 215, -145, 50, 50, 46, -145, -145, 00793 -145, -145, -9, -145, -145, -145, -145, 87, -145, -145, 00794 12, 44, 5, 16, 319, -145, -145, 28, -145, -145, 00795 38, 29, -145, -145, -145, -145, -145, -145, -145, 99, 00796 53, 85, 52, 94, 66, 41, 71, 74, 122, -145, 00797 -145, -145, 40, -145, 26, 319, 26, -145, 59, 59, 00798 67, 82, -145, -145, 111, 107, -145, -145, -145, -145, 00799 -145, -145, -145, -9, 87, 68, -145, -145, -145, 79, 00800 91, 26, 267, -145, 91, 319, 26, 319, -18, -145, 00801 319, -145, -145, 50, 50, 50, 50, 50, 50, 50, 00802 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 00803 319, 50, 50, 50, -145, -145, -145, 112, 126, 319, 00804 128, -145, 128, 319, 319, 91, 127, -31, 193, -145, 00805 125, -145, 129, -145, 131, 130, 319, -145, -145, 157, 00806 135, -145, -145, -145, 99, 99, 53, 53, 85, 85, 00807 85, 85, 52, 52, 94, 66, 41, 71, 132, 74, 00808 -145, -145, -145, 319, 134, 267, -145, -145, -145, 139, 00809 50, 193, -145, -145, -145, 319, -145, -145, -145, 50, 00810 141, -145, -145, -145, -145, 144, -145, -145, -145 00811 }; 00812 00813 /* YYPGOTO[NTERM-NUM]. */ 00814 static const yytype_int16 yypgoto[] = 00815 { 00816 -145, -145, -145, -145, -145, -145, -3, -145, -145, -145, 00817 -145, -145, -145, 11, -145, -64, 0, -145, -145, -145, 00818 -145, -145, -145, 150, -134, -145, 124, -116, -29, -99, 00819 6, -145, -145, -145, 22, -145, -145, -145, 58, -145, 00820 -145, -144, -145, 43, 49, -2, 45, 78, 81, 83, 00821 77, 92, -145, -131, -145, -145, -145, 7 00822 }; 00823 00824 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00825 positive, shift that token. If negative, reduce the rule which 00826 number is the opposite. If YYTABLE_NINF, syntax error. */ 00827 #define YYTABLE_NINF -132 00828 static const yytype_int16 yytable[] = 00829 { 00830 40, 180, 181, 100, 192, 156, 47, 73, 104, 189, 00831 136, 37, 138, -129, 78, -32, 150, -129, 191, -32, 00832 93, -33, 50, 40, 186, -33, 186, 76, 81, 47, 00833 95, 134, -31, 157, 94, 135, -31, 151, 99, 74, 00834 75, 187, 154, 188, 40, 50, 98, 204, -130, 200, 00835 47, 106, -130, 1, 2, 77, 4, 5, -131, 83, 00836 132, 205, -131, 107, 133, 147, 50, 105, 206, 84, 00837 127, 16, 17, 111, 112, 40, 88, 89, 90, 91, 00838 92, 47, 137, 96, 97, 120, 121, 122, 123, 18, 00839 19, 20, 116, 117, 21, 22, 126, 50, 23, 128, 00840 24, 129, 40, 25, 26, 40, 139, 40, 47, 152, 00841 40, 47, 153, 47, 155, 143, 47, 148, 168, 169, 00842 170, 171, 118, 119, 50, 124, 125, 50, 101, 50, 00843 40, 149, 50, 101, 102, 103, 47, 178, 150, 40, 00844 113, 114, 115, 40, 40, 47, 184, 130, 131, 47, 00845 47, 152, 50, 101, 144, 103, 40, 74, 75, 164, 00846 165, 50, 47, 197, 182, 50, 50, 166, 167, 172, 00847 173, 161, 162, 163, 183, 185, 190, 193, 50, 195, 00848 156, 194, 196, 40, 198, 40, 201, 199, 202, 47, 00849 207, 47, 184, 208, 108, 40, 1, 2, 77, 4, 00850 5, 47, 83, 142, 174, 50, 177, 50, 175, 0, 00851 0, 176, 84, 0, 16, 17, 0, 50, 1, 2, 00852 3, 4, 5, 179, 6, 0, 7, 8, 9, 10, 00853 11, 12, 13, 14, 15, 0, 16, 17, 0, 0, 00854 0, 23, 0, 24, 0, 0, 25, 26, 203, 0, 00855 0, 0, 0, 0, 18, 19, 20, 0, 0, 21, 00856 22, 0, 0, 23, 0, 24, 0, 0, 25, 26, 00857 1, 2, 3, 4, 5, 0, 6, 0, 0, 0, 00858 0, 0, 0, 0, 77, 0, 15, 0, 16, 17, 00859 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, 00860 0, 0, 0, 0, 0, 0, 18, 19, 20, 0, 00861 0, 21, 22, 0, 0, 23, 0, 24, 0, 149, 00862 25, 26, 1, 2, 3, 4, 5, 0, 6, 0, 00863 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 00864 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 00865 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 00866 20, 0, 0, 21, 22, 0, 0, 23, 0, 24, 00867 0, 0, 25, 26 00868 }; 00869 00870 #define yypact_value_is_default(yystate) \ 00871 ((yystate) == (-145)) 00872 00873 #define yytable_value_is_error(yytable_value) \ 00874 YYID (0) 00875 00876 static const yytype_int16 yycheck[] = 00877 { 00878 0, 132, 133, 32, 148, 23, 0, 0, 37, 143, 00879 74, 0, 76, 20, 17, 20, 47, 24, 49, 24, 00880 23, 20, 0, 23, 140, 24, 142, 46, 17, 23, 00881 23, 5, 20, 51, 23, 9, 24, 101, 47, 46, 00882 47, 140, 106, 142, 44, 23, 0, 191, 20, 183, 00883 44, 46, 24, 3, 4, 5, 6, 7, 20, 9, 00884 20, 195, 24, 47, 24, 94, 44, 23, 199, 19, 00885 29, 21, 22, 44, 45, 75, 18, 19, 20, 21, 00886 22, 75, 75, 25, 26, 33, 34, 35, 36, 39, 00887 40, 41, 39, 40, 44, 45, 30, 75, 48, 28, 00888 50, 27, 102, 53, 54, 105, 47, 107, 102, 102, 00889 110, 105, 105, 107, 107, 48, 110, 49, 120, 121, 00890 122, 123, 37, 38, 102, 31, 32, 105, 46, 107, 00891 130, 52, 110, 46, 47, 48, 130, 130, 47, 139, 00892 41, 42, 43, 143, 144, 139, 139, 25, 26, 143, 00893 144, 144, 130, 46, 47, 48, 156, 46, 47, 116, 00894 117, 139, 156, 156, 52, 143, 144, 118, 119, 124, 00895 125, 113, 114, 115, 48, 47, 49, 52, 156, 48, 00896 23, 52, 52, 183, 49, 185, 52, 55, 49, 183, 00897 49, 185, 185, 49, 44, 195, 3, 4, 5, 6, 00898 7, 195, 9, 79, 126, 183, 129, 185, 127, -1, 00899 -1, 128, 19, -1, 21, 22, -1, 195, 3, 4, 00900 5, 6, 7, 131, 9, -1, 11, 12, 13, 14, 00901 15, 16, 17, 18, 19, -1, 21, 22, -1, -1, 00902 -1, 48, -1, 50, -1, -1, 53, 54, 190, -1, 00903 -1, -1, -1, -1, 39, 40, 41, -1, -1, 44, 00904 45, -1, -1, 48, -1, 50, -1, -1, 53, 54, 00905 3, 4, 5, 6, 7, -1, 9, -1, -1, -1, 00906 -1, -1, -1, -1, 5, -1, 19, -1, 21, 22, 00907 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, 00908 -1, -1, -1, -1, -1, -1, 39, 40, 41, -1, 00909 -1, 44, 45, -1, -1, 48, -1, 50, -1, 52, 00910 53, 54, 3, 4, 5, 6, 7, -1, 9, -1, 00911 -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, 00912 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, 00913 -1, -1, -1, -1, -1, -1, -1, -1, 39, 40, 00914 41, -1, -1, 44, 45, -1, -1, 48, -1, 50, 00915 -1, -1, 53, 54 00916 }; 00917 00918 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00919 symbol of state STATE-NUM. */ 00920 static const yytype_uint8 yystos[] = 00921 { 00922 0, 3, 4, 5, 6, 7, 9, 11, 12, 13, 00923 14, 15, 16, 17, 18, 19, 21, 22, 39, 40, 00924 41, 44, 45, 48, 50, 53, 54, 57, 58, 59, 00925 60, 61, 62, 63, 64, 65, 68, 69, 70, 71, 00926 72, 73, 74, 75, 76, 78, 81, 86, 87, 88, 00927 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 00928 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 00929 110, 111, 112, 113, 46, 47, 46, 5, 62, 66, 00930 67, 69, 72, 9, 19, 69, 86, 90, 94, 94, 00931 94, 94, 94, 62, 69, 113, 94, 94, 0, 47, 00932 84, 46, 47, 48, 84, 23, 46, 47, 79, 113, 00933 89, 44, 45, 41, 42, 43, 39, 40, 37, 38, 00934 33, 34, 35, 36, 31, 32, 30, 29, 28, 27, 00935 25, 26, 20, 24, 5, 9, 71, 113, 71, 47, 00936 82, 83, 82, 48, 47, 84, 85, 84, 49, 52, 00937 47, 71, 113, 113, 71, 113, 23, 51, 77, 79, 00938 80, 94, 94, 94, 99, 99, 100, 100, 101, 101, 00939 101, 101, 102, 102, 103, 104, 105, 106, 113, 107, 00940 109, 109, 52, 48, 113, 47, 83, 85, 85, 80, 00941 49, 49, 97, 52, 52, 48, 52, 113, 49, 55, 00942 80, 52, 49, 94, 97, 80, 109, 49, 49 00943 }; 00944 00945 #define yyerrok (yyerrstatus = 0) 00946 #define yyclearin (yychar = YYEMPTY) 00947 #define YYEMPTY (-2) 00948 #define YYEOF 0 00949 00950 #define YYACCEPT goto yyacceptlab 00951 #define YYABORT goto yyabortlab 00952 #define YYERROR goto yyerrorlab 00953 00954 00955 /* Like YYERROR except do call yyerror. This remains here temporarily 00956 to ease the transition to the new meaning of YYERROR, for GCC. 00957 Once GCC version 2 has supplanted version 1, this can go. However, 00958 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 00959 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 00960 discussed. */ 00961 00962 #define YYFAIL goto yyerrlab 00963 #if defined YYFAIL 00964 /* This is here to suppress warnings from the GCC cpp's 00965 -Wunused-macros. Normally we don't worry about that warning, but 00966 some users do, and we want to make it easy for users to remove 00967 YYFAIL uses, which will produce warnings from Bison 2.5. */ 00968 #endif 00969 00970 #define YYRECOVERING() (!!yyerrstatus) 00971 00972 #define YYBACKUP(Token, Value) \ 00973 do \ 00974 if (yychar == YYEMPTY && yylen == 1) \ 00975 { \ 00976 yychar = (Token); \ 00977 yylval = (Value); \ 00978 YYPOPSTACK (1); \ 00979 goto yybackup; \ 00980 } \ 00981 else \ 00982 { \ 00983 yyerror (YY_("syntax error: cannot back up")); \ 00984 YYERROR; \ 00985 } \ 00986 while (YYID (0)) 00987 00988 00989 #define YYTERROR 1 00990 #define YYERRCODE 256 00991 00992 00993 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00994 If N is 0, then set CURRENT to the empty location which ends 00995 the previous symbol: RHS[0] (always defined). */ 00996 00997 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00998 #ifndef YYLLOC_DEFAULT 00999 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 01000 do \ 01001 if (YYID (N)) \ 01002 { \ 01003 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 01004 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 01005 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 01006 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 01007 } \ 01008 else \ 01009 { \ 01010 (Current).first_line = (Current).last_line = \ 01011 YYRHSLOC (Rhs, 0).last_line; \ 01012 (Current).first_column = (Current).last_column = \ 01013 YYRHSLOC (Rhs, 0).last_column; \ 01014 } \ 01015 while (YYID (0)) 01016 #endif 01017 01018 01019 /* This macro is provided for backward compatibility. */ 01020 01021 #ifndef YY_LOCATION_PRINT 01022 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 01023 #endif 01024 01025 01026 /* YYLEX -- calling `yylex' with the right arguments. */ 01027 01028 #ifdef YYLEX_PARAM 01029 # define YYLEX yylex (YYLEX_PARAM) 01030 #else 01031 # define YYLEX yylex () 01032 #endif 01033 01034 /* Enable debugging if requested. */ 01035 #if YYDEBUG 01036 01037 # ifndef YYFPRINTF 01038 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 01039 # define YYFPRINTF fprintf 01040 # endif 01041 01042 # define YYDPRINTF(Args) \ 01043 do { \ 01044 if (yydebug) \ 01045 YYFPRINTF Args; \ 01046 } while (YYID (0)) 01047 01048 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 01049 do { \ 01050 if (yydebug) \ 01051 { \ 01052 YYFPRINTF (stderr, "%s ", Title); \ 01053 yy_symbol_print (stderr, \ 01054 Type, Value); \ 01055 YYFPRINTF (stderr, "\n"); \ 01056 } \ 01057 } while (YYID (0)) 01058 01059 01060 /*--------------------------------. 01061 | Print this symbol on YYOUTPUT. | 01062 `--------------------------------*/ 01063 01064 /*ARGSUSED*/ 01065 #if (defined __STDC__ || defined __C99__FUNC__ \ 01066 || defined __cplusplus || defined _MSC_VER) 01067 static void 01068 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01069 #else 01070 static void 01071 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 01072 FILE *yyoutput; 01073 int yytype; 01074 YYSTYPE const * const yyvaluep; 01075 #endif 01076 { 01077 if (!yyvaluep) 01078 return; 01079 # ifdef YYPRINT 01080 if (yytype < YYNTOKENS) 01081 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 01082 # else 01083 YYUSE (yyoutput); 01084 # endif 01085 switch (yytype) 01086 { 01087 default: 01088 break; 01089 } 01090 } 01091 01092 01093 /*--------------------------------. 01094 | Print this symbol on YYOUTPUT. | 01095 `--------------------------------*/ 01096 01097 #if (defined __STDC__ || defined __C99__FUNC__ \ 01098 || defined __cplusplus || defined _MSC_VER) 01099 static void 01100 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01101 #else 01102 static void 01103 yy_symbol_print (yyoutput, yytype, yyvaluep) 01104 FILE *yyoutput; 01105 int yytype; 01106 YYSTYPE const * const yyvaluep; 01107 #endif 01108 { 01109 if (yytype < YYNTOKENS) 01110 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 01111 else 01112 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 01113 01114 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 01115 YYFPRINTF (yyoutput, ")"); 01116 } 01117 01118 /*------------------------------------------------------------------. 01119 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 01120 | TOP (included). | 01121 `------------------------------------------------------------------*/ 01122 01123 #if (defined __STDC__ || defined __C99__FUNC__ \ 01124 || defined __cplusplus || defined _MSC_VER) 01125 static void 01126 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 01127 #else 01128 static void 01129 yy_stack_print (yybottom, yytop) 01130 yytype_int16 *yybottom; 01131 yytype_int16 *yytop; 01132 #endif 01133 { 01134 YYFPRINTF (stderr, "Stack now"); 01135 for (; yybottom <= yytop; yybottom++) 01136 { 01137 int yybot = *yybottom; 01138 YYFPRINTF (stderr, " %d", yybot); 01139 } 01140 YYFPRINTF (stderr, "\n"); 01141 } 01142 01143 # define YY_STACK_PRINT(Bottom, Top) \ 01144 do { \ 01145 if (yydebug) \ 01146 yy_stack_print ((Bottom), (Top)); \ 01147 } while (YYID (0)) 01148 01149 01150 /*------------------------------------------------. 01151 | Report that the YYRULE is going to be reduced. | 01152 `------------------------------------------------*/ 01153 01154 #if (defined __STDC__ || defined __C99__FUNC__ \ 01155 || defined __cplusplus || defined _MSC_VER) 01156 static void 01157 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 01158 #else 01159 static void 01160 yy_reduce_print (yyvsp, yyrule) 01161 YYSTYPE *yyvsp; 01162 int yyrule; 01163 #endif 01164 { 01165 int yynrhs = yyr2[yyrule]; 01166 int yyi; 01167 unsigned long int yylno = yyrline[yyrule]; 01168 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 01169 yyrule - 1, yylno); 01170 /* The symbols being reduced. */ 01171 for (yyi = 0; yyi < yynrhs; yyi++) 01172 { 01173 YYFPRINTF (stderr, " $%d = ", yyi + 1); 01174 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 01175 &(yyvsp[(yyi + 1) - (yynrhs)]) 01176 ); 01177 YYFPRINTF (stderr, "\n"); 01178 } 01179 } 01180 01181 # define YY_REDUCE_PRINT(Rule) \ 01182 do { \ 01183 if (yydebug) \ 01184 yy_reduce_print (yyvsp, Rule); \ 01185 } while (YYID (0)) 01186 01187 /* Nonzero means print parse trace. It is left uninitialized so that 01188 multiple parsers can coexist. */ 01189 int yydebug; 01190 #else /* !YYDEBUG */ 01191 # define YYDPRINTF(Args) 01192 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 01193 # define YY_STACK_PRINT(Bottom, Top) 01194 # define YY_REDUCE_PRINT(Rule) 01195 #endif /* !YYDEBUG */ 01196 01197 01198 /* YYINITDEPTH -- initial size of the parser's stacks. */ 01199 #ifndef YYINITDEPTH 01200 # define YYINITDEPTH 200 01201 #endif 01202 01203 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 01204 if the built-in stack extension method is used). 01205 01206 Do not make this value too large; the results are undefined if 01207 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 01208 evaluated with infinite-precision integer arithmetic. */ 01209 01210 #ifndef YYMAXDEPTH 01211 # define YYMAXDEPTH 10000 01212 #endif 01213 01214 01215 #if YYERROR_VERBOSE 01216 01217 # ifndef yystrlen 01218 # if defined __GLIBC__ && defined _STRING_H 01219 # define yystrlen strlen 01220 # else 01221 /* Return the length of YYSTR. */ 01222 #if (defined __STDC__ || defined __C99__FUNC__ \ 01223 || defined __cplusplus || defined _MSC_VER) 01224 static YYSIZE_T 01225 yystrlen (const char *yystr) 01226 #else 01227 static YYSIZE_T 01228 yystrlen (yystr) 01229 const char *yystr; 01230 #endif 01231 { 01232 YYSIZE_T yylen; 01233 for (yylen = 0; yystr[yylen]; yylen++) 01234 continue; 01235 return yylen; 01236 } 01237 # endif 01238 # endif 01239 01240 # ifndef yystpcpy 01241 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 01242 # define yystpcpy stpcpy 01243 # else 01244 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 01245 YYDEST. */ 01246 #if (defined __STDC__ || defined __C99__FUNC__ \ 01247 || defined __cplusplus || defined _MSC_VER) 01248 static char * 01249 yystpcpy (char *yydest, const char *yysrc) 01250 #else 01251 static char * 01252 yystpcpy (yydest, yysrc) 01253 char *yydest; 01254 const char *yysrc; 01255 #endif 01256 { 01257 char *yyd = yydest; 01258 const char *yys = yysrc; 01259 01260 while ((*yyd++ = *yys++) != '\0') 01261 continue; 01262 01263 return yyd - 1; 01264 } 01265 # endif 01266 # endif 01267 01268 # ifndef yytnamerr 01269 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01270 quotes and backslashes, so that it's suitable for yyerror. The 01271 heuristic is that double-quoting is unnecessary unless the string 01272 contains an apostrophe, a comma, or backslash (other than 01273 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01274 null, do not copy; instead, return the length of what the result 01275 would have been. */ 01276 static YYSIZE_T 01277 yytnamerr (char *yyres, const char *yystr) 01278 { 01279 if (*yystr == '"') 01280 { 01281 YYSIZE_T yyn = 0; 01282 char const *yyp = yystr; 01283 01284 for (;;) 01285 switch (*++yyp) 01286 { 01287 case '\'': 01288 case ',': 01289 goto do_not_strip_quotes; 01290 01291 case '\\': 01292 if (*++yyp != '\\') 01293 goto do_not_strip_quotes; 01294 /* Fall through. */ 01295 default: 01296 if (yyres) 01297 yyres[yyn] = *yyp; 01298 yyn++; 01299 break; 01300 01301 case '"': 01302 if (yyres) 01303 yyres[yyn] = '\0'; 01304 return yyn; 01305 } 01306 do_not_strip_quotes: ; 01307 } 01308 01309 if (! yyres) 01310 return yystrlen (yystr); 01311 01312 return yystpcpy (yyres, yystr) - yyres; 01313 } 01314 # endif 01315 01316 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 01317 about the unexpected token YYTOKEN for the state stack whose top is 01318 YYSSP. 01319 01320 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 01321 not large enough to hold the message. In that case, also set 01322 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 01323 required number of bytes is too large to store. */ 01324 static int 01325 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 01326 yytype_int16 *yyssp, int yytoken) 01327 { 01328 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); 01329 YYSIZE_T yysize = yysize0; 01330 YYSIZE_T yysize1; 01331 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01332 /* Internationalized format string. */ 01333 const char *yyformat = 0; 01334 /* Arguments of yyformat. */ 01335 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01336 /* Number of reported tokens (one for the "unexpected", one per 01337 "expected"). */ 01338 int yycount = 0; 01339 01340 /* There are many possibilities here to consider: 01341 - Assume YYFAIL is not used. It's too flawed to consider. See 01342 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> 01343 for details. YYERROR is fine as it does not invoke this 01344 function. 01345 - If this state is a consistent state with a default action, then 01346 the only way this function was invoked is if the default action 01347 is an error action. In that case, don't check for expected 01348 tokens because there are none. 01349 - The only way there can be no lookahead present (in yychar) is if 01350 this state is a consistent state with a default action. Thus, 01351 detecting the absence of a lookahead is sufficient to determine 01352 that there is no unexpected or expected token to report. In that 01353 case, just report a simple "syntax error". 01354 - Don't assume there isn't a lookahead just because this state is a 01355 consistent state with a default action. There might have been a 01356 previous inconsistent state, consistent state with a non-default 01357 action, or user semantic action that manipulated yychar. 01358 - Of course, the expected token list depends on states to have 01359 correct lookahead information, and it depends on the parser not 01360 to perform extra reductions after fetching a lookahead from the 01361 scanner and before detecting a syntax error. Thus, state merging 01362 (from LALR or IELR) and default reductions corrupt the expected 01363 token list. However, the list is correct for canonical LR with 01364 one exception: it will still contain any token that will not be 01365 accepted due to an error action in a later state. 01366 */ 01367 if (yytoken != YYEMPTY) 01368 { 01369 int yyn = yypact[*yyssp]; 01370 yyarg[yycount++] = yytname[yytoken]; 01371 if (!yypact_value_is_default (yyn)) 01372 { 01373 /* Start YYX at -YYN if negative to avoid negative indexes in 01374 YYCHECK. In other words, skip the first -YYN actions for 01375 this state because they are default actions. */ 01376 int yyxbegin = yyn < 0 ? -yyn : 0; 01377 /* Stay within bounds of both yycheck and yytname. */ 01378 int yychecklim = YYLAST - yyn + 1; 01379 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01380 int yyx; 01381 01382 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01383 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 01384 && !yytable_value_is_error (yytable[yyx + yyn])) 01385 { 01386 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01387 { 01388 yycount = 1; 01389 yysize = yysize0; 01390 break; 01391 } 01392 yyarg[yycount++] = yytname[yyx]; 01393 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01394 if (! (yysize <= yysize1 01395 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01396 return 2; 01397 yysize = yysize1; 01398 } 01399 } 01400 } 01401 01402 switch (yycount) 01403 { 01404 # define YYCASE_(N, S) \ 01405 case N: \ 01406 yyformat = S; \ 01407 break 01408 YYCASE_(0, YY_("syntax error")); 01409 YYCASE_(1, YY_("syntax error, unexpected %s")); 01410 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 01411 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 01412 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 01413 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 01414 # undef YYCASE_ 01415 } 01416 01417 yysize1 = yysize + yystrlen (yyformat); 01418 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01419 return 2; 01420 yysize = yysize1; 01421 01422 if (*yymsg_alloc < yysize) 01423 { 01424 *yymsg_alloc = 2 * yysize; 01425 if (! (yysize <= *yymsg_alloc 01426 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 01427 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 01428 return 1; 01429 } 01430 01431 /* Avoid sprintf, as that infringes on the user's name space. 01432 Don't have undefined behavior even if the translation 01433 produced a string with the wrong number of "%s"s. */ 01434 { 01435 char *yyp = *yymsg; 01436 int yyi = 0; 01437 while ((*yyp = *yyformat) != '\0') 01438 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 01439 { 01440 yyp += yytnamerr (yyp, yyarg[yyi++]); 01441 yyformat += 2; 01442 } 01443 else 01444 { 01445 yyp++; 01446 yyformat++; 01447 } 01448 } 01449 return 0; 01450 } 01451 #endif /* YYERROR_VERBOSE */ 01452 01453 /*-----------------------------------------------. 01454 | Release the memory associated to this symbol. | 01455 `-----------------------------------------------*/ 01456 01457 /*ARGSUSED*/ 01458 #if (defined __STDC__ || defined __C99__FUNC__ \ 01459 || defined __cplusplus || defined _MSC_VER) 01460 static void 01461 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01462 #else 01463 static void 01464 yydestruct (yymsg, yytype, yyvaluep) 01465 const char *yymsg; 01466 int yytype; 01467 YYSTYPE *yyvaluep; 01468 #endif 01469 { 01470 YYUSE (yyvaluep); 01471 01472 if (!yymsg) 01473 yymsg = "Deleting"; 01474 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01475 01476 switch (yytype) 01477 { 01478 01479 default: 01480 break; 01481 } 01482 } 01483 01484 01485 /* Prevent warnings from -Wmissing-prototypes. */ 01486 #ifdef YYPARSE_PARAM 01487 #if defined __STDC__ || defined __cplusplus 01488 int yyparse (void *YYPARSE_PARAM); 01489 #else 01490 int yyparse (); 01491 #endif 01492 #else /* ! YYPARSE_PARAM */ 01493 #if defined __STDC__ || defined __cplusplus 01494 int yyparse (void); 01495 #else 01496 int yyparse (); 01497 #endif 01498 #endif /* ! YYPARSE_PARAM */ 01499 01500 01501 /* The lookahead symbol. */ 01502 int yychar; 01503 01504 /* The semantic value of the lookahead symbol. */ 01505 YYSTYPE yylval; 01506 01507 /* Number of syntax errors so far. */ 01508 int yynerrs; 01509 01510 01511 /*----------. 01512 | yyparse. | 01513 `----------*/ 01514 01515 #ifdef YYPARSE_PARAM 01516 #if (defined __STDC__ || defined __C99__FUNC__ \ 01517 || defined __cplusplus || defined _MSC_VER) 01518 int 01519 yyparse (void *YYPARSE_PARAM) 01520 #else 01521 int 01522 yyparse (YYPARSE_PARAM) 01523 void *YYPARSE_PARAM; 01524 #endif 01525 #else /* ! YYPARSE_PARAM */ 01526 #if (defined __STDC__ || defined __C99__FUNC__ \ 01527 || defined __cplusplus || defined _MSC_VER) 01528 int 01529 yyparse (void) 01530 #else 01531 int 01532 yyparse () 01533 01534 #endif 01535 #endif 01536 { 01537 int yystate; 01538 /* Number of tokens to shift before error messages enabled. */ 01539 int yyerrstatus; 01540 01541 /* The stacks and their tools: 01542 `yyss': related to states. 01543 `yyvs': related to semantic values. 01544 01545 Refer to the stacks thru separate pointers, to allow yyoverflow 01546 to xreallocate them elsewhere. */ 01547 01548 /* The state stack. */ 01549 yytype_int16 yyssa[YYINITDEPTH]; 01550 yytype_int16 *yyss; 01551 yytype_int16 *yyssp; 01552 01553 /* The semantic value stack. */ 01554 YYSTYPE yyvsa[YYINITDEPTH]; 01555 YYSTYPE *yyvs; 01556 YYSTYPE *yyvsp; 01557 01558 YYSIZE_T yystacksize; 01559 01560 int yyn; 01561 int yyresult; 01562 /* Lookahead token as an internal (translated) token number. */ 01563 int yytoken; 01564 /* The variables used to return semantic value and location from the 01565 action routines. */ 01566 YYSTYPE yyval; 01567 01568 #if YYERROR_VERBOSE 01569 /* Buffer for error messages, and its allocated size. */ 01570 char yymsgbuf[128]; 01571 char *yymsg = yymsgbuf; 01572 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01573 #endif 01574 01575 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01576 01577 /* The number of symbols on the RHS of the reduced rule. 01578 Keep to zero when no symbol should be popped. */ 01579 int yylen = 0; 01580 01581 yytoken = 0; 01582 yyss = yyssa; 01583 yyvs = yyvsa; 01584 yystacksize = YYINITDEPTH; 01585 01586 YYDPRINTF ((stderr, "Starting parse\n")); 01587 01588 yystate = 0; 01589 yyerrstatus = 0; 01590 yynerrs = 0; 01591 yychar = YYEMPTY; /* Cause a token to be read. */ 01592 01593 /* Initialize stack pointers. 01594 Waste one element of value and location stack 01595 so that they stay on the same level as the state stack. 01596 The wasted elements are never initialized. */ 01597 yyssp = yyss; 01598 yyvsp = yyvs; 01599 01600 goto yysetstate; 01601 01602 /*------------------------------------------------------------. 01603 | yynewstate -- Push a new state, which is found in yystate. | 01604 `------------------------------------------------------------*/ 01605 yynewstate: 01606 /* In all cases, when you get here, the value and location stacks 01607 have just been pushed. So pushing a state here evens the stacks. */ 01608 yyssp++; 01609 01610 yysetstate: 01611 *yyssp = yystate; 01612 01613 if (yyss + yystacksize - 1 <= yyssp) 01614 { 01615 /* Get the current used size of the three stacks, in elements. */ 01616 YYSIZE_T yysize = yyssp - yyss + 1; 01617 01618 #ifdef yyoverflow 01619 { 01620 /* Give user a chance to xreallocate the stack. Use copies of 01621 these so that the &'s don't force the real ones into 01622 memory. */ 01623 YYSTYPE *yyvs1 = yyvs; 01624 yytype_int16 *yyss1 = yyss; 01625 01626 /* Each stack pointer address is followed by the size of the 01627 data in use in that stack, in bytes. This used to be a 01628 conditional around just the two extra args, but that might 01629 be undefined if yyoverflow is a macro. */ 01630 yyoverflow (YY_("memory exhausted"), 01631 &yyss1, yysize * sizeof (*yyssp), 01632 &yyvs1, yysize * sizeof (*yyvsp), 01633 &yystacksize); 01634 01635 yyss = yyss1; 01636 yyvs = yyvs1; 01637 } 01638 #else /* no yyoverflow */ 01639 # ifndef YYSTACK_RELOCATE 01640 goto yyexhaustedlab; 01641 # else 01642 /* Extend the stack our own way. */ 01643 if (YYMAXDEPTH <= yystacksize) 01644 goto yyexhaustedlab; 01645 yystacksize *= 2; 01646 if (YYMAXDEPTH < yystacksize) 01647 yystacksize = YYMAXDEPTH; 01648 01649 { 01650 yytype_int16 *yyss1 = yyss; 01651 union yyalloc *yyptr = 01652 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01653 if (! yyptr) 01654 goto yyexhaustedlab; 01655 YYSTACK_RELOCATE (yyss_alloc, yyss); 01656 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01657 # undef YYSTACK_RELOCATE 01658 if (yyss1 != yyssa) 01659 YYSTACK_FREE (yyss1); 01660 } 01661 # endif 01662 #endif /* no yyoverflow */ 01663 01664 yyssp = yyss + yysize - 1; 01665 yyvsp = yyvs + yysize - 1; 01666 01667 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01668 (unsigned long int) yystacksize)); 01669 01670 if (yyss + yystacksize - 1 <= yyssp) 01671 YYABORT; 01672 } 01673 01674 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01675 01676 if (yystate == YYFINAL) 01677 YYACCEPT; 01678 01679 goto yybackup; 01680 01681 /*-----------. 01682 | yybackup. | 01683 `-----------*/ 01684 yybackup: 01685 01686 /* Do appropriate processing given the current state. Read a 01687 lookahead token if we need one and don't already have one. */ 01688 01689 /* First try to decide what to do without reference to lookahead token. */ 01690 yyn = yypact[yystate]; 01691 if (yypact_value_is_default (yyn)) 01692 goto yydefault; 01693 01694 /* Not known => get a lookahead token if don't already have one. */ 01695 01696 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01697 if (yychar == YYEMPTY) 01698 { 01699 YYDPRINTF ((stderr, "Reading a token: ")); 01700 yychar = YYLEX; 01701 } 01702 01703 if (yychar <= YYEOF) 01704 { 01705 yychar = yytoken = YYEOF; 01706 YYDPRINTF ((stderr, "Now at end of input.\n")); 01707 } 01708 else 01709 { 01710 yytoken = YYTRANSLATE (yychar); 01711 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01712 } 01713 01714 /* If the proper action on seeing token YYTOKEN is to reduce or to 01715 detect an error, take that action. */ 01716 yyn += yytoken; 01717 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01718 goto yydefault; 01719 yyn = yytable[yyn]; 01720 if (yyn <= 0) 01721 { 01722 if (yytable_value_is_error (yyn)) 01723 goto yyerrlab; 01724 yyn = -yyn; 01725 goto yyreduce; 01726 } 01727 01728 /* Count tokens shifted since error; after three, turn off error 01729 status. */ 01730 if (yyerrstatus) 01731 yyerrstatus--; 01732 01733 /* Shift the lookahead token. */ 01734 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01735 01736 /* Discard the shifted token. */ 01737 yychar = YYEMPTY; 01738 01739 yystate = yyn; 01740 *++yyvsp = yylval; 01741 01742 goto yynewstate; 01743 01744 01745 /*-----------------------------------------------------------. 01746 | yydefault -- do the default action for the current state. | 01747 `-----------------------------------------------------------*/ 01748 yydefault: 01749 yyn = yydefact[yystate]; 01750 if (yyn == 0) 01751 goto yyerrlab; 01752 goto yyreduce; 01753 01754 01755 /*-----------------------------. 01756 | yyreduce -- Do a reduction. | 01757 `-----------------------------*/ 01758 yyreduce: 01759 /* yyn is the number of a rule to reduce with. */ 01760 yylen = yyr2[yyn]; 01761 01762 /* If YYLEN is nonzero, implement the default value of the action: 01763 `$$ = $1'. 01764 01765 Otherwise, the following line sets YYVAL to garbage. 01766 This behavior is undocumented and Bison 01767 users should not rely upon it. Assigning to YYVAL 01768 unconditionally makes the parser a bit smaller, and it avoids a 01769 GCC warning that YYVAL may be used uninitialized. */ 01770 yyval = yyvsp[1-yylen]; 01771 01772 01773 YY_REDUCE_PRINT (yyn); 01774 switch (yyn) 01775 { 01776 case 4: 01777 01778 /* Line 1806 of yacc.c */ 01779 #line 217 "../../src/gdb/jv-exp.y" 01780 { 01781 write_exp_elt_opcode(OP_TYPE); 01782 write_exp_elt_type((yyvsp[(1) - (1)].tval)); 01783 write_exp_elt_opcode(OP_TYPE); 01784 } 01785 break; 01786 01787 case 7: 01788 01789 /* Line 1806 of yacc.c */ 01790 #line 231 "../../src/gdb/jv-exp.y" 01791 { 01792 write_exp_elt_opcode (OP_STRING); 01793 write_exp_string ((yyvsp[(1) - (1)].sval)); 01794 write_exp_elt_opcode (OP_STRING); 01795 } 01796 break; 01797 01798 case 8: 01799 01800 /* Line 1806 of yacc.c */ 01801 #line 240 "../../src/gdb/jv-exp.y" 01802 { write_exp_elt_opcode (OP_LONG); 01803 write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_int).type); 01804 write_exp_elt_longcst ((LONGEST)((yyvsp[(1) - (1)].typed_val_int).val)); 01805 write_exp_elt_opcode (OP_LONG); } 01806 break; 01807 01808 case 9: 01809 01810 /* Line 1806 of yacc.c */ 01811 #line 245 "../../src/gdb/jv-exp.y" 01812 { YYSTYPE val; 01813 parse_number ((yyvsp[(1) - (1)].sval).ptr, (yyvsp[(1) - (1)].sval).length, 0, &val); 01814 write_exp_elt_opcode (OP_LONG); 01815 write_exp_elt_type (val.typed_val_int.type); 01816 write_exp_elt_longcst ((LONGEST)val.typed_val_int.val); 01817 write_exp_elt_opcode (OP_LONG); 01818 } 01819 break; 01820 01821 case 10: 01822 01823 /* Line 1806 of yacc.c */ 01824 #line 253 "../../src/gdb/jv-exp.y" 01825 { write_exp_elt_opcode (OP_DOUBLE); 01826 write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_float).type); 01827 write_exp_elt_dblcst ((yyvsp[(1) - (1)].typed_val_float).dval); 01828 write_exp_elt_opcode (OP_DOUBLE); } 01829 break; 01830 01831 case 11: 01832 01833 /* Line 1806 of yacc.c */ 01834 #line 258 "../../src/gdb/jv-exp.y" 01835 { write_exp_elt_opcode (OP_LONG); 01836 write_exp_elt_type (parse_java_type->builtin_boolean); 01837 write_exp_elt_longcst ((LONGEST)(yyvsp[(1) - (1)].lval)); 01838 write_exp_elt_opcode (OP_LONG); } 01839 break; 01840 01841 case 14: 01842 01843 /* Line 1806 of yacc.c */ 01844 #line 275 "../../src/gdb/jv-exp.y" 01845 { (yyval.tval) = parse_java_type->builtin_boolean; } 01846 break; 01847 01848 case 17: 01849 01850 /* Line 1806 of yacc.c */ 01851 #line 285 "../../src/gdb/jv-exp.y" 01852 { (yyval.tval) = parse_java_type->builtin_byte; } 01853 break; 01854 01855 case 18: 01856 01857 /* Line 1806 of yacc.c */ 01858 #line 287 "../../src/gdb/jv-exp.y" 01859 { (yyval.tval) = parse_java_type->builtin_short; } 01860 break; 01861 01862 case 19: 01863 01864 /* Line 1806 of yacc.c */ 01865 #line 289 "../../src/gdb/jv-exp.y" 01866 { (yyval.tval) = parse_java_type->builtin_int; } 01867 break; 01868 01869 case 20: 01870 01871 /* Line 1806 of yacc.c */ 01872 #line 291 "../../src/gdb/jv-exp.y" 01873 { (yyval.tval) = parse_java_type->builtin_long; } 01874 break; 01875 01876 case 21: 01877 01878 /* Line 1806 of yacc.c */ 01879 #line 293 "../../src/gdb/jv-exp.y" 01880 { (yyval.tval) = parse_java_type->builtin_char; } 01881 break; 01882 01883 case 22: 01884 01885 /* Line 1806 of yacc.c */ 01886 #line 298 "../../src/gdb/jv-exp.y" 01887 { (yyval.tval) = parse_java_type->builtin_float; } 01888 break; 01889 01890 case 23: 01891 01892 /* Line 1806 of yacc.c */ 01893 #line 300 "../../src/gdb/jv-exp.y" 01894 { (yyval.tval) = parse_java_type->builtin_double; } 01895 break; 01896 01897 case 24: 01898 01899 /* Line 1806 of yacc.c */ 01900 #line 312 "../../src/gdb/jv-exp.y" 01901 { (yyval.tval) = java_type_from_name ((yyvsp[(1) - (1)].sval)); } 01902 break; 01903 01904 case 26: 01905 01906 /* Line 1806 of yacc.c */ 01907 #line 321 "../../src/gdb/jv-exp.y" 01908 { (yyval.tval) = java_array_type ((yyvsp[(1) - (2)].tval), (yyvsp[(2) - (2)].lval)); } 01909 break; 01910 01911 case 27: 01912 01913 /* Line 1806 of yacc.c */ 01914 #line 323 "../../src/gdb/jv-exp.y" 01915 { (yyval.tval) = java_array_type (java_type_from_name ((yyvsp[(1) - (2)].sval)), (yyvsp[(2) - (2)].lval)); } 01916 break; 01917 01918 case 34: 01919 01920 /* Line 1806 of yacc.c */ 01921 #line 343 "../../src/gdb/jv-exp.y" 01922 { (yyval.sval).length = (yyvsp[(1) - (3)].sval).length + (yyvsp[(3) - (3)].sval).length + 1; 01923 if ((yyvsp[(1) - (3)].sval).ptr + (yyvsp[(1) - (3)].sval).length + 1 == (yyvsp[(3) - (3)].sval).ptr 01924 && (yyvsp[(1) - (3)].sval).ptr[(yyvsp[(1) - (3)].sval).length] == '.') 01925 (yyval.sval).ptr = (yyvsp[(1) - (3)].sval).ptr; /* Optimization. */ 01926 else 01927 { 01928 char *buf; 01929 01930 buf = xmalloc ((yyval.sval).length + 1); 01931 make_cleanup (xfree, buf); 01932 sprintf (buf, "%.*s.%.*s", 01933 (yyvsp[(1) - (3)].sval).length, (yyvsp[(1) - (3)].sval).ptr, (yyvsp[(3) - (3)].sval).length, (yyvsp[(3) - (3)].sval).ptr); 01934 (yyval.sval).ptr = buf; 01935 } } 01936 break; 01937 01938 case 36: 01939 01940 /* Line 1806 of yacc.c */ 01941 #line 370 "../../src/gdb/jv-exp.y" 01942 { write_exp_elt_opcode (BINOP_COMMA); } 01943 break; 01944 01945 case 45: 01946 01947 /* Line 1806 of yacc.c */ 01948 #line 386 "../../src/gdb/jv-exp.y" 01949 { write_exp_elt_opcode (OP_ARRAY); 01950 write_exp_elt_longcst ((LONGEST) 0); 01951 write_exp_elt_longcst ((LONGEST) (yyvsp[(3) - (3)].lval)); 01952 write_exp_elt_opcode (OP_ARRAY); } 01953 break; 01954 01955 case 46: 01956 01957 /* Line 1806 of yacc.c */ 01958 #line 394 "../../src/gdb/jv-exp.y" 01959 { start_arglist (); } 01960 break; 01961 01962 case 47: 01963 01964 /* Line 1806 of yacc.c */ 01965 #line 399 "../../src/gdb/jv-exp.y" 01966 { (yyval.lval) = end_arglist () - 1; } 01967 break; 01968 01969 case 48: 01970 01971 /* Line 1806 of yacc.c */ 01972 #line 404 "../../src/gdb/jv-exp.y" 01973 { internal_error (__FILE__, __LINE__, 01974 _("FIXME - ClassInstanceCreationExpression")); } 01975 break; 01976 01977 case 49: 01978 01979 /* Line 1806 of yacc.c */ 01980 #line 410 "../../src/gdb/jv-exp.y" 01981 { arglist_len = 1; } 01982 break; 01983 01984 case 50: 01985 01986 /* Line 1806 of yacc.c */ 01987 #line 412 "../../src/gdb/jv-exp.y" 01988 { arglist_len++; } 01989 break; 01990 01991 case 51: 01992 01993 /* Line 1806 of yacc.c */ 01994 #line 417 "../../src/gdb/jv-exp.y" 01995 { arglist_len = 0; } 01996 break; 01997 01998 case 53: 01999 02000 /* Line 1806 of yacc.c */ 02001 #line 423 "../../src/gdb/jv-exp.y" 02002 { internal_error (__FILE__, __LINE__, 02003 _("FIXME - ArrayCreationExpression")); } 02004 break; 02005 02006 case 54: 02007 02008 /* Line 1806 of yacc.c */ 02009 #line 426 "../../src/gdb/jv-exp.y" 02010 { internal_error (__FILE__, __LINE__, 02011 _("FIXME - ArrayCreationExpression")); } 02012 break; 02013 02014 case 58: 02015 02016 /* Line 1806 of yacc.c */ 02017 #line 441 "../../src/gdb/jv-exp.y" 02018 { (yyval.lval) = 1; } 02019 break; 02020 02021 case 59: 02022 02023 /* Line 1806 of yacc.c */ 02024 #line 443 "../../src/gdb/jv-exp.y" 02025 { (yyval.lval) = (yyvsp[(1) - (3)].lval) + 1; } 02026 break; 02027 02028 case 61: 02029 02030 /* Line 1806 of yacc.c */ 02031 #line 449 "../../src/gdb/jv-exp.y" 02032 { (yyval.lval) = 0; } 02033 break; 02034 02035 case 62: 02036 02037 /* Line 1806 of yacc.c */ 02038 #line 454 "../../src/gdb/jv-exp.y" 02039 { push_fieldnames ((yyvsp[(3) - (3)].sval)); } 02040 break; 02041 02042 case 63: 02043 02044 /* Line 1806 of yacc.c */ 02045 #line 456 "../../src/gdb/jv-exp.y" 02046 { push_fieldnames ((yyvsp[(3) - (3)].sval)); } 02047 break; 02048 02049 case 64: 02050 02051 /* Line 1806 of yacc.c */ 02052 #line 462 "../../src/gdb/jv-exp.y" 02053 { push_expression_name ((yyvsp[(1) - (2)].sval)); } 02054 break; 02055 02056 case 65: 02057 02058 /* Line 1806 of yacc.c */ 02059 #line 467 "../../src/gdb/jv-exp.y" 02060 { start_arglist(); } 02061 break; 02062 02063 case 66: 02064 02065 /* Line 1806 of yacc.c */ 02066 #line 469 "../../src/gdb/jv-exp.y" 02067 { write_exp_elt_opcode (OP_FUNCALL); 02068 write_exp_elt_longcst ((LONGEST) end_arglist ()); 02069 write_exp_elt_opcode (OP_FUNCALL); } 02070 break; 02071 02072 case 67: 02073 02074 /* Line 1806 of yacc.c */ 02075 #line 473 "../../src/gdb/jv-exp.y" 02076 { error (_("Form of method invocation not implemented")); } 02077 break; 02078 02079 case 68: 02080 02081 /* Line 1806 of yacc.c */ 02082 #line 475 "../../src/gdb/jv-exp.y" 02083 { error (_("Form of method invocation not implemented")); } 02084 break; 02085 02086 case 69: 02087 02088 /* Line 1806 of yacc.c */ 02089 #line 480 "../../src/gdb/jv-exp.y" 02090 { 02091 /* Emit code for the Name now, then exchange it in the 02092 expout array with the Expression's code. We could 02093 introduce a OP_SWAP code or a reversed version of 02094 BINOP_SUBSCRIPT, but that makes the rest of GDB pay 02095 for our parsing kludges. */ 02096 struct expression *name_expr; 02097 02098 push_expression_name ((yyvsp[(1) - (4)].sval)); 02099 name_expr = copy_exp (expout, expout_ptr); 02100 expout_ptr -= name_expr->nelts; 02101 insert_exp (expout_ptr-length_of_subexp (expout, expout_ptr), 02102 name_expr); 02103 xfree (name_expr); 02104 write_exp_elt_opcode (BINOP_SUBSCRIPT); 02105 } 02106 break; 02107 02108 case 70: 02109 02110 /* Line 1806 of yacc.c */ 02111 #line 497 "../../src/gdb/jv-exp.y" 02112 { write_exp_elt_opcode (BINOP_SUBSCRIPT); } 02113 break; 02114 02115 case 71: 02116 02117 /* Line 1806 of yacc.c */ 02118 #line 499 "../../src/gdb/jv-exp.y" 02119 { write_exp_elt_opcode (BINOP_SUBSCRIPT); } 02120 break; 02121 02122 case 73: 02123 02124 /* Line 1806 of yacc.c */ 02125 #line 505 "../../src/gdb/jv-exp.y" 02126 { push_expression_name ((yyvsp[(1) - (1)].sval)); } 02127 break; 02128 02129 case 77: 02130 02131 /* Line 1806 of yacc.c */ 02132 #line 514 "../../src/gdb/jv-exp.y" 02133 { write_exp_elt_opcode (UNOP_POSTINCREMENT); } 02134 break; 02135 02136 case 78: 02137 02138 /* Line 1806 of yacc.c */ 02139 #line 519 "../../src/gdb/jv-exp.y" 02140 { write_exp_elt_opcode (UNOP_POSTDECREMENT); } 02141 break; 02142 02143 case 82: 02144 02145 /* Line 1806 of yacc.c */ 02146 #line 527 "../../src/gdb/jv-exp.y" 02147 { write_exp_elt_opcode (UNOP_NEG); } 02148 break; 02149 02150 case 83: 02151 02152 /* Line 1806 of yacc.c */ 02153 #line 529 "../../src/gdb/jv-exp.y" 02154 { write_exp_elt_opcode (UNOP_IND); } 02155 break; 02156 02157 case 85: 02158 02159 /* Line 1806 of yacc.c */ 02160 #line 535 "../../src/gdb/jv-exp.y" 02161 { write_exp_elt_opcode (UNOP_PREINCREMENT); } 02162 break; 02163 02164 case 86: 02165 02166 /* Line 1806 of yacc.c */ 02167 #line 540 "../../src/gdb/jv-exp.y" 02168 { write_exp_elt_opcode (UNOP_PREDECREMENT); } 02169 break; 02170 02171 case 88: 02172 02173 /* Line 1806 of yacc.c */ 02174 #line 546 "../../src/gdb/jv-exp.y" 02175 { write_exp_elt_opcode (UNOP_COMPLEMENT); } 02176 break; 02177 02178 case 89: 02179 02180 /* Line 1806 of yacc.c */ 02181 #line 548 "../../src/gdb/jv-exp.y" 02182 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } 02183 break; 02184 02185 case 91: 02186 02187 /* Line 1806 of yacc.c */ 02188 #line 554 "../../src/gdb/jv-exp.y" 02189 { write_exp_elt_opcode (UNOP_CAST); 02190 write_exp_elt_type (java_array_type ((yyvsp[(2) - (5)].tval), (yyvsp[(3) - (5)].lval))); 02191 write_exp_elt_opcode (UNOP_CAST); } 02192 break; 02193 02194 case 92: 02195 02196 /* Line 1806 of yacc.c */ 02197 #line 558 "../../src/gdb/jv-exp.y" 02198 { 02199 int last_exp_size = length_of_subexp(expout, expout_ptr); 02200 struct type *type; 02201 int i; 02202 int base = expout_ptr - last_exp_size - 3; 02203 if (base < 0 || expout->elts[base+2].opcode != OP_TYPE) 02204 error (_("Invalid cast expression")); 02205 type = expout->elts[base+1].type; 02206 /* Remove the 'Expression' and slide the 02207 UnaryExpressionNotPlusMinus down to replace it. */ 02208 for (i = 0; i < last_exp_size; i++) 02209 expout->elts[base + i] = expout->elts[base + i + 3]; 02210 expout_ptr -= 3; 02211 if (TYPE_CODE (type) == TYPE_CODE_STRUCT) 02212 type = lookup_pointer_type (type); 02213 write_exp_elt_opcode (UNOP_CAST); 02214 write_exp_elt_type (type); 02215 write_exp_elt_opcode (UNOP_CAST); 02216 } 02217 break; 02218 02219 case 93: 02220 02221 /* Line 1806 of yacc.c */ 02222 #line 578 "../../src/gdb/jv-exp.y" 02223 { write_exp_elt_opcode (UNOP_CAST); 02224 write_exp_elt_type (java_array_type (java_type_from_name ((yyvsp[(2) - (5)].sval)), (yyvsp[(3) - (5)].lval))); 02225 write_exp_elt_opcode (UNOP_CAST); } 02226 break; 02227 02228 case 95: 02229 02230 /* Line 1806 of yacc.c */ 02231 #line 587 "../../src/gdb/jv-exp.y" 02232 { write_exp_elt_opcode (BINOP_MUL); } 02233 break; 02234 02235 case 96: 02236 02237 /* Line 1806 of yacc.c */ 02238 #line 589 "../../src/gdb/jv-exp.y" 02239 { write_exp_elt_opcode (BINOP_DIV); } 02240 break; 02241 02242 case 97: 02243 02244 /* Line 1806 of yacc.c */ 02245 #line 591 "../../src/gdb/jv-exp.y" 02246 { write_exp_elt_opcode (BINOP_REM); } 02247 break; 02248 02249 case 99: 02250 02251 /* Line 1806 of yacc.c */ 02252 #line 597 "../../src/gdb/jv-exp.y" 02253 { write_exp_elt_opcode (BINOP_ADD); } 02254 break; 02255 02256 case 100: 02257 02258 /* Line 1806 of yacc.c */ 02259 #line 599 "../../src/gdb/jv-exp.y" 02260 { write_exp_elt_opcode (BINOP_SUB); } 02261 break; 02262 02263 case 102: 02264 02265 /* Line 1806 of yacc.c */ 02266 #line 605 "../../src/gdb/jv-exp.y" 02267 { write_exp_elt_opcode (BINOP_LSH); } 02268 break; 02269 02270 case 103: 02271 02272 /* Line 1806 of yacc.c */ 02273 #line 607 "../../src/gdb/jv-exp.y" 02274 { write_exp_elt_opcode (BINOP_RSH); } 02275 break; 02276 02277 case 105: 02278 02279 /* Line 1806 of yacc.c */ 02280 #line 614 "../../src/gdb/jv-exp.y" 02281 { write_exp_elt_opcode (BINOP_LESS); } 02282 break; 02283 02284 case 106: 02285 02286 /* Line 1806 of yacc.c */ 02287 #line 616 "../../src/gdb/jv-exp.y" 02288 { write_exp_elt_opcode (BINOP_GTR); } 02289 break; 02290 02291 case 107: 02292 02293 /* Line 1806 of yacc.c */ 02294 #line 618 "../../src/gdb/jv-exp.y" 02295 { write_exp_elt_opcode (BINOP_LEQ); } 02296 break; 02297 02298 case 108: 02299 02300 /* Line 1806 of yacc.c */ 02301 #line 620 "../../src/gdb/jv-exp.y" 02302 { write_exp_elt_opcode (BINOP_GEQ); } 02303 break; 02304 02305 case 110: 02306 02307 /* Line 1806 of yacc.c */ 02308 #line 627 "../../src/gdb/jv-exp.y" 02309 { write_exp_elt_opcode (BINOP_EQUAL); } 02310 break; 02311 02312 case 111: 02313 02314 /* Line 1806 of yacc.c */ 02315 #line 629 "../../src/gdb/jv-exp.y" 02316 { write_exp_elt_opcode (BINOP_NOTEQUAL); } 02317 break; 02318 02319 case 113: 02320 02321 /* Line 1806 of yacc.c */ 02322 #line 635 "../../src/gdb/jv-exp.y" 02323 { write_exp_elt_opcode (BINOP_BITWISE_AND); } 02324 break; 02325 02326 case 115: 02327 02328 /* Line 1806 of yacc.c */ 02329 #line 641 "../../src/gdb/jv-exp.y" 02330 { write_exp_elt_opcode (BINOP_BITWISE_XOR); } 02331 break; 02332 02333 case 117: 02334 02335 /* Line 1806 of yacc.c */ 02336 #line 646 "../../src/gdb/jv-exp.y" 02337 { write_exp_elt_opcode (BINOP_BITWISE_IOR); } 02338 break; 02339 02340 case 119: 02341 02342 /* Line 1806 of yacc.c */ 02343 #line 652 "../../src/gdb/jv-exp.y" 02344 { write_exp_elt_opcode (BINOP_LOGICAL_AND); } 02345 break; 02346 02347 case 121: 02348 02349 /* Line 1806 of yacc.c */ 02350 #line 658 "../../src/gdb/jv-exp.y" 02351 { write_exp_elt_opcode (BINOP_LOGICAL_OR); } 02352 break; 02353 02354 case 123: 02355 02356 /* Line 1806 of yacc.c */ 02357 #line 664 "../../src/gdb/jv-exp.y" 02358 { write_exp_elt_opcode (TERNOP_COND); } 02359 break; 02360 02361 case 126: 02362 02363 /* Line 1806 of yacc.c */ 02364 #line 674 "../../src/gdb/jv-exp.y" 02365 { write_exp_elt_opcode (BINOP_ASSIGN); } 02366 break; 02367 02368 case 127: 02369 02370 /* Line 1806 of yacc.c */ 02371 #line 676 "../../src/gdb/jv-exp.y" 02372 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); 02373 write_exp_elt_opcode ((yyvsp[(2) - (3)].opcode)); 02374 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); } 02375 break; 02376 02377 case 128: 02378 02379 /* Line 1806 of yacc.c */ 02380 #line 683 "../../src/gdb/jv-exp.y" 02381 { push_expression_name ((yyvsp[(1) - (1)].sval)); } 02382 break; 02383 02384 02385 02386 /* Line 1806 of yacc.c */ 02387 #line 2389 "jv-exp.c" 02388 default: break; 02389 } 02390 /* User semantic actions sometimes alter yychar, and that requires 02391 that yytoken be updated with the new translation. We take the 02392 approach of translating immediately before every use of yytoken. 02393 One alternative is translating here after every semantic action, 02394 but that translation would be missed if the semantic action invokes 02395 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 02396 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 02397 incorrect destructor might then be invoked immediately. In the 02398 case of YYERROR or YYBACKUP, subsequent parser actions might lead 02399 to an incorrect destructor call or verbose syntax error message 02400 before the lookahead is translated. */ 02401 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 02402 02403 YYPOPSTACK (yylen); 02404 yylen = 0; 02405 YY_STACK_PRINT (yyss, yyssp); 02406 02407 *++yyvsp = yyval; 02408 02409 /* Now `shift' the result of the reduction. Determine what state 02410 that goes to, based on the state we popped back to and the rule 02411 number reduced by. */ 02412 02413 yyn = yyr1[yyn]; 02414 02415 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 02416 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 02417 yystate = yytable[yystate]; 02418 else 02419 yystate = yydefgoto[yyn - YYNTOKENS]; 02420 02421 goto yynewstate; 02422 02423 02424 /*------------------------------------. 02425 | yyerrlab -- here on detecting error | 02426 `------------------------------------*/ 02427 yyerrlab: 02428 /* Make sure we have latest lookahead translation. See comments at 02429 user semantic actions for why this is necessary. */ 02430 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 02431 02432 /* If not already recovering from an error, report this error. */ 02433 if (!yyerrstatus) 02434 { 02435 ++yynerrs; 02436 #if ! YYERROR_VERBOSE 02437 yyerror (YY_("syntax error")); 02438 #else 02439 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 02440 yyssp, yytoken) 02441 { 02442 char const *yymsgp = YY_("syntax error"); 02443 int yysyntax_error_status; 02444 yysyntax_error_status = YYSYNTAX_ERROR; 02445 if (yysyntax_error_status == 0) 02446 yymsgp = yymsg; 02447 else if (yysyntax_error_status == 1) 02448 { 02449 if (yymsg != yymsgbuf) 02450 YYSTACK_FREE (yymsg); 02451 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 02452 if (!yymsg) 02453 { 02454 yymsg = yymsgbuf; 02455 yymsg_alloc = sizeof yymsgbuf; 02456 yysyntax_error_status = 2; 02457 } 02458 else 02459 { 02460 yysyntax_error_status = YYSYNTAX_ERROR; 02461 yymsgp = yymsg; 02462 } 02463 } 02464 yyerror (yymsgp); 02465 if (yysyntax_error_status == 2) 02466 goto yyexhaustedlab; 02467 } 02468 # undef YYSYNTAX_ERROR 02469 #endif 02470 } 02471 02472 02473 02474 if (yyerrstatus == 3) 02475 { 02476 /* If just tried and failed to reuse lookahead token after an 02477 error, discard it. */ 02478 02479 if (yychar <= YYEOF) 02480 { 02481 /* Return failure if at end of input. */ 02482 if (yychar == YYEOF) 02483 YYABORT; 02484 } 02485 else 02486 { 02487 yydestruct ("Error: discarding", 02488 yytoken, &yylval); 02489 yychar = YYEMPTY; 02490 } 02491 } 02492 02493 /* Else will try to reuse lookahead token after shifting the error 02494 token. */ 02495 goto yyerrlab1; 02496 02497 02498 /*---------------------------------------------------. 02499 | yyerrorlab -- error raised explicitly by YYERROR. | 02500 `---------------------------------------------------*/ 02501 yyerrorlab: 02502 02503 /* Pacify compilers like GCC when the user code never invokes 02504 YYERROR and the label yyerrorlab therefore never appears in user 02505 code. */ 02506 if (/*CONSTCOND*/ 0) 02507 goto yyerrorlab; 02508 02509 /* Do not reclaim the symbols of the rule which action triggered 02510 this YYERROR. */ 02511 YYPOPSTACK (yylen); 02512 yylen = 0; 02513 YY_STACK_PRINT (yyss, yyssp); 02514 yystate = *yyssp; 02515 goto yyerrlab1; 02516 02517 02518 /*-------------------------------------------------------------. 02519 | yyerrlab1 -- common code for both syntax error and YYERROR. | 02520 `-------------------------------------------------------------*/ 02521 yyerrlab1: 02522 yyerrstatus = 3; /* Each real token shifted decrements this. */ 02523 02524 for (;;) 02525 { 02526 yyn = yypact[yystate]; 02527 if (!yypact_value_is_default (yyn)) 02528 { 02529 yyn += YYTERROR; 02530 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 02531 { 02532 yyn = yytable[yyn]; 02533 if (0 < yyn) 02534 break; 02535 } 02536 } 02537 02538 /* Pop the current state because it cannot handle the error token. */ 02539 if (yyssp == yyss) 02540 YYABORT; 02541 02542 02543 yydestruct ("Error: popping", 02544 yystos[yystate], yyvsp); 02545 YYPOPSTACK (1); 02546 yystate = *yyssp; 02547 YY_STACK_PRINT (yyss, yyssp); 02548 } 02549 02550 *++yyvsp = yylval; 02551 02552 02553 /* Shift the error token. */ 02554 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 02555 02556 yystate = yyn; 02557 goto yynewstate; 02558 02559 02560 /*-------------------------------------. 02561 | yyacceptlab -- YYACCEPT comes here. | 02562 `-------------------------------------*/ 02563 yyacceptlab: 02564 yyresult = 0; 02565 goto yyreturn; 02566 02567 /*-----------------------------------. 02568 | yyabortlab -- YYABORT comes here. | 02569 `-----------------------------------*/ 02570 yyabortlab: 02571 yyresult = 1; 02572 goto yyreturn; 02573 02574 #if !defined(yyoverflow) || YYERROR_VERBOSE 02575 /*-------------------------------------------------. 02576 | yyexhaustedlab -- memory exhaustion comes here. | 02577 `-------------------------------------------------*/ 02578 yyexhaustedlab: 02579 yyerror (YY_("memory exhausted")); 02580 yyresult = 2; 02581 /* Fall through. */ 02582 #endif 02583 02584 yyreturn: 02585 if (yychar != YYEMPTY) 02586 { 02587 /* Make sure we have latest lookahead translation. See comments at 02588 user semantic actions for why this is necessary. */ 02589 yytoken = YYTRANSLATE (yychar); 02590 yydestruct ("Cleanup: discarding lookahead", 02591 yytoken, &yylval); 02592 } 02593 /* Do not reclaim the symbols of the rule which action triggered 02594 this YYABORT or YYACCEPT. */ 02595 YYPOPSTACK (yylen); 02596 YY_STACK_PRINT (yyss, yyssp); 02597 while (yyssp != yyss) 02598 { 02599 yydestruct ("Cleanup: popping", 02600 yystos[*yyssp], yyvsp); 02601 YYPOPSTACK (1); 02602 } 02603 #ifndef yyoverflow 02604 if (yyss != yyssa) 02605 YYSTACK_FREE (yyss); 02606 #endif 02607 #if YYERROR_VERBOSE 02608 if (yymsg != yymsgbuf) 02609 YYSTACK_FREE (yymsg); 02610 #endif 02611 /* Make sure YYID is used. */ 02612 return YYID (yyresult); 02613 } 02614 02615 02616 02617 /* Line 2067 of yacc.c */ 02618 #line 695 "../../src/gdb/jv-exp.y" 02619 02620 /* Take care of parsing a number (anything that starts with a digit). 02621 Set yylval and return the token type; update lexptr. 02622 LEN is the number of characters in it. */ 02623 02624 /*** Needs some error checking for the float case ***/ 02625 02626 static int 02627 parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere) 02628 { 02629 ULONGEST n = 0; 02630 ULONGEST limit, limit_div_base; 02631 02632 int c; 02633 int base = input_radix; 02634 02635 struct type *type; 02636 02637 if (parsed_float) 02638 { 02639 const char *suffix; 02640 int suffix_len; 02641 02642 if (! parse_float (p, len, &putithere->typed_val_float.dval, &suffix)) 02643 return ERROR; 02644 02645 suffix_len = p + len - suffix; 02646 02647 if (suffix_len == 0) 02648 putithere->typed_val_float.type = parse_type->builtin_double; 02649 else if (suffix_len == 1) 02650 { 02651 /* See if it has `f' or `d' suffix (float or double). */ 02652 if (tolower (*suffix) == 'f') 02653 putithere->typed_val_float.type = 02654 parse_type->builtin_float; 02655 else if (tolower (*suffix) == 'd') 02656 putithere->typed_val_float.type = 02657 parse_type->builtin_double; 02658 else 02659 return ERROR; 02660 } 02661 else 02662 return ERROR; 02663 02664 return FLOATING_POINT_LITERAL; 02665 } 02666 02667 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ 02668 if (p[0] == '0') 02669 switch (p[1]) 02670 { 02671 case 'x': 02672 case 'X': 02673 if (len >= 3) 02674 { 02675 p += 2; 02676 base = 16; 02677 len -= 2; 02678 } 02679 break; 02680 02681 case 't': 02682 case 'T': 02683 case 'd': 02684 case 'D': 02685 if (len >= 3) 02686 { 02687 p += 2; 02688 base = 10; 02689 len -= 2; 02690 } 02691 break; 02692 02693 default: 02694 base = 8; 02695 break; 02696 } 02697 02698 c = p[len-1]; 02699 /* A paranoid calculation of (1<<64)-1. */ 02700 limit = (ULONGEST)0xffffffff; 02701 limit = ((limit << 16) << 16) | limit; 02702 if (c == 'l' || c == 'L') 02703 { 02704 type = parse_java_type->builtin_long; 02705 len--; 02706 } 02707 else 02708 { 02709 type = parse_java_type->builtin_int; 02710 } 02711 limit_div_base = limit / (ULONGEST) base; 02712 02713 while (--len >= 0) 02714 { 02715 c = *p++; 02716 if (c >= '0' && c <= '9') 02717 c -= '0'; 02718 else if (c >= 'A' && c <= 'Z') 02719 c -= 'A' - 10; 02720 else if (c >= 'a' && c <= 'z') 02721 c -= 'a' - 10; 02722 else 02723 return ERROR; /* Char not a digit */ 02724 if (c >= base) 02725 return ERROR; 02726 if (n > limit_div_base 02727 || (n *= base) > limit - c) 02728 error (_("Numeric constant too large")); 02729 n += c; 02730 } 02731 02732 /* If the type is bigger than a 32-bit signed integer can be, implicitly 02733 promote to long. Java does not do this, so mark it as 02734 parse_type->builtin_uint64 rather than parse_java_type->builtin_long. 02735 0x80000000 will become -0x80000000 instead of 0x80000000L, because we 02736 don't know the sign at this point. */ 02737 if (type == parse_java_type->builtin_int && n > (ULONGEST)0x80000000) 02738 type = parse_type->builtin_uint64; 02739 02740 putithere->typed_val_int.val = n; 02741 putithere->typed_val_int.type = type; 02742 02743 return INTEGER_LITERAL; 02744 } 02745 02746 struct token 02747 { 02748 char *operator; 02749 int token; 02750 enum exp_opcode opcode; 02751 }; 02752 02753 static const struct token tokentab3[] = 02754 { 02755 {">>=", ASSIGN_MODIFY, BINOP_RSH}, 02756 {"<<=", ASSIGN_MODIFY, BINOP_LSH} 02757 }; 02758 02759 static const struct token tokentab2[] = 02760 { 02761 {"+=", ASSIGN_MODIFY, BINOP_ADD}, 02762 {"-=", ASSIGN_MODIFY, BINOP_SUB}, 02763 {"*=", ASSIGN_MODIFY, BINOP_MUL}, 02764 {"/=", ASSIGN_MODIFY, BINOP_DIV}, 02765 {"%=", ASSIGN_MODIFY, BINOP_REM}, 02766 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR}, 02767 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND}, 02768 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR}, 02769 {"++", INCREMENT, BINOP_END}, 02770 {"--", DECREMENT, BINOP_END}, 02771 {"&&", ANDAND, BINOP_END}, 02772 {"||", OROR, BINOP_END}, 02773 {"<<", LSH, BINOP_END}, 02774 {">>", RSH, BINOP_END}, 02775 {"==", EQUAL, BINOP_END}, 02776 {"!=", NOTEQUAL, BINOP_END}, 02777 {"<=", LEQ, BINOP_END}, 02778 {">=", GEQ, BINOP_END} 02779 }; 02780 02781 /* Read one token, getting characters through lexptr. */ 02782 02783 static int 02784 yylex (void) 02785 { 02786 int c; 02787 int namelen; 02788 unsigned int i; 02789 const char *tokstart; 02790 const char *tokptr; 02791 int tempbufindex; 02792 static char *tempbuf; 02793 static int tempbufsize; 02794 02795 retry: 02796 02797 prev_lexptr = lexptr; 02798 02799 tokstart = lexptr; 02800 /* See if it is a special token of length 3. */ 02801 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) 02802 if (strncmp (tokstart, tokentab3[i].operator, 3) == 0) 02803 { 02804 lexptr += 3; 02805 yylval.opcode = tokentab3[i].opcode; 02806 return tokentab3[i].token; 02807 } 02808 02809 /* See if it is a special token of length 2. */ 02810 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) 02811 if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) 02812 { 02813 lexptr += 2; 02814 yylval.opcode = tokentab2[i].opcode; 02815 return tokentab2[i].token; 02816 } 02817 02818 switch (c = *tokstart) 02819 { 02820 case 0: 02821 return 0; 02822 02823 case ' ': 02824 case '\t': 02825 case '\n': 02826 lexptr++; 02827 goto retry; 02828 02829 case '\'': 02830 /* We either have a character constant ('0' or '\177' for example) 02831 or we have a quoted symbol reference ('foo(int,int)' in C++ 02832 for example). */ 02833 lexptr++; 02834 c = *lexptr++; 02835 if (c == '\\') 02836 c = parse_escape (parse_gdbarch, &lexptr); 02837 else if (c == '\'') 02838 error (_("Empty character constant")); 02839 02840 yylval.typed_val_int.val = c; 02841 yylval.typed_val_int.type = parse_java_type->builtin_char; 02842 02843 c = *lexptr++; 02844 if (c != '\'') 02845 { 02846 namelen = skip_quoted (tokstart) - tokstart; 02847 if (namelen > 2) 02848 { 02849 lexptr = tokstart + namelen; 02850 if (lexptr[-1] != '\'') 02851 error (_("Unmatched single quote")); 02852 namelen -= 2; 02853 tokstart++; 02854 goto tryname; 02855 } 02856 error (_("Invalid character constant")); 02857 } 02858 return INTEGER_LITERAL; 02859 02860 case '(': 02861 paren_depth++; 02862 lexptr++; 02863 return c; 02864 02865 case ')': 02866 if (paren_depth == 0) 02867 return 0; 02868 paren_depth--; 02869 lexptr++; 02870 return c; 02871 02872 case ',': 02873 if (comma_terminates && paren_depth == 0) 02874 return 0; 02875 lexptr++; 02876 return c; 02877 02878 case '.': 02879 /* Might be a floating point number. */ 02880 if (lexptr[1] < '0' || lexptr[1] > '9') 02881 goto symbol; /* Nope, must be a symbol. */ 02882 /* FALL THRU into number case. */ 02883 02884 case '0': 02885 case '1': 02886 case '2': 02887 case '3': 02888 case '4': 02889 case '5': 02890 case '6': 02891 case '7': 02892 case '8': 02893 case '9': 02894 { 02895 /* It's a number. */ 02896 int got_dot = 0, got_e = 0, toktype; 02897 const char *p = tokstart; 02898 int hex = input_radix > 10; 02899 02900 if (c == '0' && (p[1] == 'x' || p[1] == 'X')) 02901 { 02902 p += 2; 02903 hex = 1; 02904 } 02905 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) 02906 { 02907 p += 2; 02908 hex = 0; 02909 } 02910 02911 for (;; ++p) 02912 { 02913 /* This test includes !hex because 'e' is a valid hex digit 02914 and thus does not indicate a floating point number when 02915 the radix is hex. */ 02916 if (!hex && !got_e && (*p == 'e' || *p == 'E')) 02917 got_dot = got_e = 1; 02918 /* This test does not include !hex, because a '.' always indicates 02919 a decimal floating point number regardless of the radix. */ 02920 else if (!got_dot && *p == '.') 02921 got_dot = 1; 02922 else if (got_e && (p[-1] == 'e' || p[-1] == 'E') 02923 && (*p == '-' || *p == '+')) 02924 /* This is the sign of the exponent, not the end of the 02925 number. */ 02926 continue; 02927 /* We will take any letters or digits. parse_number will 02928 complain if past the radix, or if L or U are not final. */ 02929 else if ((*p < '0' || *p > '9') 02930 && ((*p < 'a' || *p > 'z') 02931 && (*p < 'A' || *p > 'Z'))) 02932 break; 02933 } 02934 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval); 02935 if (toktype == ERROR) 02936 { 02937 char *err_copy = (char *) alloca (p - tokstart + 1); 02938 02939 memcpy (err_copy, tokstart, p - tokstart); 02940 err_copy[p - tokstart] = 0; 02941 error (_("Invalid number \"%s\""), err_copy); 02942 } 02943 lexptr = p; 02944 return toktype; 02945 } 02946 02947 case '+': 02948 case '-': 02949 case '*': 02950 case '/': 02951 case '%': 02952 case '|': 02953 case '&': 02954 case '^': 02955 case '~': 02956 case '!': 02957 case '<': 02958 case '>': 02959 case '[': 02960 case ']': 02961 case '?': 02962 case ':': 02963 case '=': 02964 case '{': 02965 case '}': 02966 symbol: 02967 lexptr++; 02968 return c; 02969 02970 case '"': 02971 02972 /* Build the gdb internal form of the input string in tempbuf, 02973 translating any standard C escape forms seen. Note that the 02974 buffer is null byte terminated *only* for the convenience of 02975 debugging gdb itself and printing the buffer contents when 02976 the buffer contains no embedded nulls. Gdb does not depend 02977 upon the buffer being null byte terminated, it uses the length 02978 string instead. This allows gdb to handle C strings (as well 02979 as strings in other languages) with embedded null bytes */ 02980 02981 tokptr = ++tokstart; 02982 tempbufindex = 0; 02983 02984 do { 02985 /* Grow the static temp buffer if necessary, including allocating 02986 the first one on demand. */ 02987 if (tempbufindex + 1 >= tempbufsize) 02988 { 02989 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64); 02990 } 02991 switch (*tokptr) 02992 { 02993 case '\0': 02994 case '"': 02995 /* Do nothing, loop will terminate. */ 02996 break; 02997 case '\\': 02998 tokptr++; 02999 c = parse_escape (parse_gdbarch, &tokptr); 03000 if (c == -1) 03001 { 03002 continue; 03003 } 03004 tempbuf[tempbufindex++] = c; 03005 break; 03006 default: 03007 tempbuf[tempbufindex++] = *tokptr++; 03008 break; 03009 } 03010 } while ((*tokptr != '"') && (*tokptr != '\0')); 03011 if (*tokptr++ != '"') 03012 { 03013 error (_("Unterminated string in expression")); 03014 } 03015 tempbuf[tempbufindex] = '\0'; /* See note above */ 03016 yylval.sval.ptr = tempbuf; 03017 yylval.sval.length = tempbufindex; 03018 lexptr = tokptr; 03019 return (STRING_LITERAL); 03020 } 03021 03022 if (!(c == '_' || c == '$' 03023 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) 03024 /* We must have come across a bad character (e.g. ';'). */ 03025 error (_("Invalid character '%c' in expression"), c); 03026 03027 /* It's a name. See how long it is. */ 03028 namelen = 0; 03029 for (c = tokstart[namelen]; 03030 (c == '_' 03031 || c == '$' 03032 || (c >= '0' && c <= '9') 03033 || (c >= 'a' && c <= 'z') 03034 || (c >= 'A' && c <= 'Z') 03035 || c == '<'); 03036 ) 03037 { 03038 if (c == '<') 03039 { 03040 int i = namelen; 03041 while (tokstart[++i] && tokstart[i] != '>'); 03042 if (tokstart[i] == '>') 03043 namelen = i; 03044 } 03045 c = tokstart[++namelen]; 03046 } 03047 03048 /* The token "if" terminates the expression and is NOT 03049 removed from the input stream. */ 03050 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') 03051 { 03052 return 0; 03053 } 03054 03055 lexptr += namelen; 03056 03057 tryname: 03058 03059 /* Catch specific keywords. Should be done with a data structure. */ 03060 switch (namelen) 03061 { 03062 case 7: 03063 if (strncmp (tokstart, "boolean", 7) == 0) 03064 return BOOLEAN; 03065 break; 03066 case 6: 03067 if (strncmp (tokstart, "double", 6) == 0) 03068 return DOUBLE; 03069 break; 03070 case 5: 03071 if (strncmp (tokstart, "short", 5) == 0) 03072 return SHORT; 03073 if (strncmp (tokstart, "false", 5) == 0) 03074 { 03075 yylval.lval = 0; 03076 return BOOLEAN_LITERAL; 03077 } 03078 if (strncmp (tokstart, "super", 5) == 0) 03079 return SUPER; 03080 if (strncmp (tokstart, "float", 5) == 0) 03081 return FLOAT; 03082 break; 03083 case 4: 03084 if (strncmp (tokstart, "long", 4) == 0) 03085 return LONG; 03086 if (strncmp (tokstart, "byte", 4) == 0) 03087 return BYTE; 03088 if (strncmp (tokstart, "char", 4) == 0) 03089 return CHAR; 03090 if (strncmp (tokstart, "true", 4) == 0) 03091 { 03092 yylval.lval = 1; 03093 return BOOLEAN_LITERAL; 03094 } 03095 break; 03096 case 3: 03097 if (strncmp (tokstart, "int", 3) == 0) 03098 return INT; 03099 if (strncmp (tokstart, "new", 3) == 0) 03100 return NEW; 03101 break; 03102 default: 03103 break; 03104 } 03105 03106 yylval.sval.ptr = tokstart; 03107 yylval.sval.length = namelen; 03108 03109 if (*tokstart == '$') 03110 { 03111 write_dollar_variable (yylval.sval); 03112 return VARIABLE; 03113 } 03114 03115 /* Input names that aren't symbols but ARE valid hex numbers, 03116 when the input radix permits them, can be names or numbers 03117 depending on the parse. Note we support radixes > 16 here. */ 03118 if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) || 03119 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) 03120 { 03121 YYSTYPE newlval; /* Its value is ignored. */ 03122 int hextype = parse_number (tokstart, namelen, 0, &newlval); 03123 if (hextype == INTEGER_LITERAL) 03124 return NAME_OR_INT; 03125 } 03126 return IDENTIFIER; 03127 } 03128 03129 void 03130 yyerror (char *msg) 03131 { 03132 if (prev_lexptr) 03133 lexptr = prev_lexptr; 03134 03135 if (msg) 03136 error (_("%s: near `%s'"), msg, lexptr); 03137 else 03138 error (_("error in expression, near `%s'"), lexptr); 03139 } 03140 03141 static struct type * 03142 java_type_from_name (struct stoken name) 03143 { 03144 char *tmp = copy_name (name); 03145 struct type *typ = java_lookup_class (tmp); 03146 if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT) 03147 error (_("No class named `%s'"), tmp); 03148 return typ; 03149 } 03150 03151 /* If NAME is a valid variable name in this scope, push it and return 1. 03152 Otherwise, return 0. */ 03153 03154 static int 03155 push_variable (struct stoken name) 03156 { 03157 char *tmp = copy_name (name); 03158 struct field_of_this_result is_a_field_of_this; 03159 struct symbol *sym; 03160 sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 03161 &is_a_field_of_this); 03162 if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF) 03163 { 03164 if (symbol_read_needs_frame (sym)) 03165 { 03166 if (innermost_block == 0 || 03167 contained_in (block_found, innermost_block)) 03168 innermost_block = block_found; 03169 } 03170 03171 write_exp_elt_opcode (OP_VAR_VALUE); 03172 /* We want to use the selected frame, not another more inner frame 03173 which happens to be in the same block. */ 03174 write_exp_elt_block (NULL); 03175 write_exp_elt_sym (sym); 03176 write_exp_elt_opcode (OP_VAR_VALUE); 03177 return 1; 03178 } 03179 if (is_a_field_of_this.type != NULL) 03180 { 03181 /* it hangs off of `this'. Must not inadvertently convert from a 03182 method call to data ref. */ 03183 if (innermost_block == 0 || 03184 contained_in (block_found, innermost_block)) 03185 innermost_block = block_found; 03186 write_exp_elt_opcode (OP_THIS); 03187 write_exp_elt_opcode (OP_THIS); 03188 write_exp_elt_opcode (STRUCTOP_PTR); 03189 write_exp_string (name); 03190 write_exp_elt_opcode (STRUCTOP_PTR); 03191 return 1; 03192 } 03193 return 0; 03194 } 03195 03196 /* Assuming a reference expression has been pushed, emit the 03197 STRUCTOP_PTR ops to access the field named NAME. If NAME is a 03198 qualified name (has '.'), generate a field access for each part. */ 03199 03200 static void 03201 push_fieldnames (struct stoken name) 03202 { 03203 int i; 03204 struct stoken token; 03205 token.ptr = name.ptr; 03206 for (i = 0; ; i++) 03207 { 03208 if (i == name.length || name.ptr[i] == '.') 03209 { 03210 /* token.ptr is start of current field name. */ 03211 token.length = &name.ptr[i] - token.ptr; 03212 write_exp_elt_opcode (STRUCTOP_PTR); 03213 write_exp_string (token); 03214 write_exp_elt_opcode (STRUCTOP_PTR); 03215 token.ptr += token.length + 1; 03216 } 03217 if (i >= name.length) 03218 break; 03219 } 03220 } 03221 03222 /* Helper routine for push_expression_name. 03223 Handle a qualified name, where DOT_INDEX is the index of the first '.' */ 03224 03225 static void 03226 push_qualified_expression_name (struct stoken name, int dot_index) 03227 { 03228 struct stoken token; 03229 char *tmp; 03230 struct type *typ; 03231 03232 token.ptr = name.ptr; 03233 token.length = dot_index; 03234 03235 if (push_variable (token)) 03236 { 03237 token.ptr = name.ptr + dot_index + 1; 03238 token.length = name.length - dot_index - 1; 03239 push_fieldnames (token); 03240 return; 03241 } 03242 03243 token.ptr = name.ptr; 03244 for (;;) 03245 { 03246 token.length = dot_index; 03247 tmp = copy_name (token); 03248 typ = java_lookup_class (tmp); 03249 if (typ != NULL) 03250 { 03251 if (dot_index == name.length) 03252 { 03253 write_exp_elt_opcode(OP_TYPE); 03254 write_exp_elt_type(typ); 03255 write_exp_elt_opcode(OP_TYPE); 03256 return; 03257 } 03258 dot_index++; /* Skip '.' */ 03259 name.ptr += dot_index; 03260 name.length -= dot_index; 03261 dot_index = 0; 03262 while (dot_index < name.length && name.ptr[dot_index] != '.') 03263 dot_index++; 03264 token.ptr = name.ptr; 03265 token.length = dot_index; 03266 write_exp_elt_opcode (OP_SCOPE); 03267 write_exp_elt_type (typ); 03268 write_exp_string (token); 03269 write_exp_elt_opcode (OP_SCOPE); 03270 if (dot_index < name.length) 03271 { 03272 dot_index++; 03273 name.ptr += dot_index; 03274 name.length -= dot_index; 03275 push_fieldnames (name); 03276 } 03277 return; 03278 } 03279 else if (dot_index >= name.length) 03280 break; 03281 dot_index++; /* Skip '.' */ 03282 while (dot_index < name.length && name.ptr[dot_index] != '.') 03283 dot_index++; 03284 } 03285 error (_("unknown type `%.*s'"), name.length, name.ptr); 03286 } 03287 03288 /* Handle Name in an expression (or LHS). 03289 Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */ 03290 03291 static void 03292 push_expression_name (struct stoken name) 03293 { 03294 char *tmp; 03295 struct type *typ; 03296 int i; 03297 03298 for (i = 0; i < name.length; i++) 03299 { 03300 if (name.ptr[i] == '.') 03301 { 03302 /* It's a Qualified Expression Name. */ 03303 push_qualified_expression_name (name, i); 03304 return; 03305 } 03306 } 03307 03308 /* It's a Simple Expression Name. */ 03309 03310 if (push_variable (name)) 03311 return; 03312 tmp = copy_name (name); 03313 typ = java_lookup_class (tmp); 03314 if (typ != NULL) 03315 { 03316 write_exp_elt_opcode(OP_TYPE); 03317 write_exp_elt_type(typ); 03318 write_exp_elt_opcode(OP_TYPE); 03319 } 03320 else 03321 { 03322 struct bound_minimal_symbol msymbol; 03323 03324 msymbol = lookup_bound_minimal_symbol (tmp); 03325 if (msymbol.minsym != NULL) 03326 write_exp_msymbol (msymbol); 03327 else if (!have_full_symbols () && !have_partial_symbols ()) 03328 error (_("No symbol table is loaded. Use the \"file\" command")); 03329 else 03330 error (_("No symbol \"%s\" in current context."), tmp); 03331 } 03332 03333 } 03334 03335 03336 /* The following two routines, copy_exp and insert_exp, aren't specific to 03337 Java, so they could go in parse.c, but their only purpose is to support 03338 the parsing kludges we use in this file, so maybe it's best to isolate 03339 them here. */ 03340 03341 /* Copy the expression whose last element is at index ENDPOS - 1 in EXPR 03342 into a freshly xmalloc'ed struct expression. Its language_defn is set 03343 to null. */ 03344 static struct expression * 03345 copy_exp (struct expression *expr, int endpos) 03346 { 03347 int len = length_of_subexp (expr, endpos); 03348 struct expression *new 03349 = (struct expression *) xmalloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len)); 03350 new->nelts = len; 03351 memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len)); 03352 new->language_defn = 0; 03353 03354 return new; 03355 } 03356 03357 /* Insert the expression NEW into the current expression (expout) at POS. */ 03358 static void 03359 insert_exp (int pos, struct expression *new) 03360 { 03361 int newlen = new->nelts; 03362 03363 /* Grow expout if necessary. In this function's only use at present, 03364 this should never be necessary. */ 03365 if (expout_ptr + newlen > expout_size) 03366 { 03367 expout_size = max (expout_size * 2, expout_ptr + newlen + 10); 03368 expout = (struct expression *) 03369 xrealloc ((char *) expout, (sizeof (struct expression) 03370 + EXP_ELEM_TO_BYTES (expout_size))); 03371 } 03372 03373 { 03374 int i; 03375 03376 for (i = expout_ptr - 1; i >= pos; i--) 03377 expout->elts[i + newlen] = expout->elts[i]; 03378 } 03379 03380 memcpy (expout->elts + pos, new->elts, EXP_ELEM_TO_BYTES (newlen)); 03381 expout_ptr += newlen; 03382 } 03383