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