pcb 4.1.1
An interactive printed circuit board layout editor.
|
00001 00002 /* A Bison parser, made by GNU Bison 2.4.1. */ 00003 00004 /* Skeleton implementation for Bison's Yacc-like parsers in C 00005 00006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00007 Free Software Foundation, Inc. 00008 00009 This program is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00021 00022 /* As a special exception, you may create a larger work that contains 00023 part or all of the Bison parser skeleton and distribute that work 00024 under terms of your choice, so long as that work isn't itself a 00025 parser generator using the skeleton or a modified version thereof 00026 as a parser skeleton. Alternatively, if you modify or redistribute 00027 the parser skeleton itself, you may (at your option) remove this 00028 special exception, which will cause the skeleton and the resulting 00029 Bison output files to be licensed under the GNU General Public 00030 License without this special exception. 00031 00032 This special exception was added by the Free Software Foundation in 00033 version 2.2 of Bison. */ 00034 00035 /* C LALR(1) parser skeleton written by Richard Stallman, by 00036 simplifying the original so-called "semantic" parser. */ 00037 00038 /* All symbols defined below should begin with yy or YY, to avoid 00039 infringing on user name space. This should be done even for local 00040 variables, as they might otherwise be expanded by user macros. 00041 There are some unavoidable exceptions within include files to 00042 define necessary library symbols; they are noted "INFRINGES ON 00043 USER NAME SPACE" below. */ 00044 00045 /* Identify Bison output. */ 00046 #define YYBISON 1 00047 00048 /* Bison version. */ 00049 #define YYBISON_VERSION "2.4.1" 00050 00051 /* Skeleton name. */ 00052 #define YYSKELETON_NAME "yacc.c" 00053 00054 /* Pure parsers. */ 00055 #define YYPURE 0 00056 00057 /* Push parsers. */ 00058 #define YYPUSH 0 00059 00060 /* Pull parsers. */ 00061 #define YYPULL 1 00062 00063 /* Using locations. */ 00064 #define YYLSP_NEEDED 0 00065 00066 /* Substitute the variable and function names. */ 00067 #define yyparse resparse 00068 #define yylex reslex 00069 #define yyerror reserror 00070 #define yylval reslval 00071 #define yychar reschar 00072 #define yydebug resdebug 00073 #define yynerrs resnerrs 00074 00075 00076 /* Copy the first part of user declarations. */ 00077 00078 /* Line 189 of yacc.c */ 00079 #line 1 "res_parse.y" 00080 00081 00082 #ifdef HAVE_CONFIG_H 00083 #include "config.h" 00084 #endif 00085 00086 #include <stdio.h> 00087 #include <stdlib.h> 00088 00089 #ifdef HAVE_STRING_H 00090 #include <string.h> 00091 #endif 00092 00093 #define YYDEBUG 0 00094 #define YYERROR_VERBOSE 1 00095 00096 /* #define YYSTYPE void * */ 00097 00098 #include "global.h" 00099 #include "resource.h" 00100 #include "res_parse.h" 00101 00102 #ifdef HAVE_LIBDMALLOC 00103 #include <dmalloc.h> 00104 #endif 00105 00106 static Resource *parsed_res; 00107 static Resource *current_res; 00108 00109 int reserror(const char *); 00110 int reslex(); 00111 00112 #define f(x) current_res->flags |= x 00113 00114 00115 00116 /* Line 189 of yacc.c */ 00117 #line 118 "res_parse.c" 00118 00119 /* Enabling traces. */ 00120 #ifndef YYDEBUG 00121 # define YYDEBUG 0 00122 #endif 00123 00124 /* Enabling verbose error messages. */ 00125 #ifdef YYERROR_VERBOSE 00126 # undef YYERROR_VERBOSE 00127 # define YYERROR_VERBOSE 1 00128 #else 00129 # define YYERROR_VERBOSE 0 00130 #endif 00131 00132 /* Enabling the token table. */ 00133 #ifndef YYTOKEN_TABLE 00134 # define YYTOKEN_TABLE 0 00135 #endif 00136 00137 00138 /* Tokens. */ 00139 #ifndef YYTOKENTYPE 00140 # define YYTOKENTYPE 00141 /* Put the tokens into the symbol table, so that GDB and other debuggers 00142 know about them. */ 00143 enum yytokentype { 00144 STRING = 258, 00145 INCLUDE = 259 00146 }; 00147 #endif 00148 /* Tokens. */ 00149 #define STRING 258 00150 #define INCLUDE 259 00151 00152 00153 00154 00155 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00156 typedef union YYSTYPE 00157 { 00158 00159 /* Line 214 of yacc.c */ 00160 #line 40 "res_parse.y" 00161 00162 int ival; 00163 char *sval; 00164 Resource *rval; 00165 00166 00167 00168 /* Line 214 of yacc.c */ 00169 #line 170 "res_parse.c" 00170 } YYSTYPE; 00171 # define YYSTYPE_IS_TRIVIAL 1 00172 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00173 # define YYSTYPE_IS_DECLARED 1 00174 #endif 00175 00176 00177 /* Copy the second part of user declarations. */ 00178 00179 00180 /* Line 264 of yacc.c */ 00181 #line 182 "res_parse.c" 00182 00183 #ifdef short 00184 # undef short 00185 #endif 00186 00187 #ifdef YYTYPE_UINT8 00188 typedef YYTYPE_UINT8 yytype_uint8; 00189 #else 00190 typedef unsigned char yytype_uint8; 00191 #endif 00192 00193 #ifdef YYTYPE_INT8 00194 typedef YYTYPE_INT8 yytype_int8; 00195 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00196 || defined __cplusplus || defined _MSC_VER) 00197 typedef signed char yytype_int8; 00198 #else 00199 typedef short int yytype_int8; 00200 #endif 00201 00202 #ifdef YYTYPE_UINT16 00203 typedef YYTYPE_UINT16 yytype_uint16; 00204 #else 00205 typedef unsigned short int yytype_uint16; 00206 #endif 00207 00208 #ifdef YYTYPE_INT16 00209 typedef YYTYPE_INT16 yytype_int16; 00210 #else 00211 typedef short int yytype_int16; 00212 #endif 00213 00214 #ifndef YYSIZE_T 00215 # ifdef __SIZE_TYPE__ 00216 # define YYSIZE_T __SIZE_TYPE__ 00217 # elif defined size_t 00218 # define YYSIZE_T size_t 00219 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00220 || defined __cplusplus || defined _MSC_VER) 00221 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00222 # define YYSIZE_T size_t 00223 # else 00224 # define YYSIZE_T unsigned int 00225 # endif 00226 #endif 00227 00228 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00229 00230 #ifndef YY_ 00231 # if YYENABLE_NLS 00232 # if ENABLE_NLS 00233 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00234 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00235 # endif 00236 # endif 00237 # ifndef YY_ 00238 # define YY_(msgid) msgid 00239 # endif 00240 #endif 00241 00242 /* Suppress unused-variable warnings by "using" E. */ 00243 #if ! defined lint || defined __GNUC__ 00244 # define YYUSE(e) ((void) (e)) 00245 #else 00246 # define YYUSE(e) /* empty */ 00247 #endif 00248 00249 /* Identity function, used to suppress warnings about constant conditions. */ 00250 #ifndef lint 00251 # define YYID(n) (n) 00252 #else 00253 #if (defined __STDC__ || defined __C99__FUNC__ \ 00254 || defined __cplusplus || defined _MSC_VER) 00255 static int 00256 YYID (int yyi) 00257 #else 00258 static int 00259 YYID (yyi) 00260 int yyi; 00261 #endif 00262 { 00263 return yyi; 00264 } 00265 #endif 00266 00267 #if ! defined yyoverflow || YYERROR_VERBOSE 00268 00269 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00270 00271 # ifdef YYSTACK_USE_ALLOCA 00272 # if YYSTACK_USE_ALLOCA 00273 # ifdef __GNUC__ 00274 # define YYSTACK_ALLOC __builtin_alloca 00275 # elif defined __BUILTIN_VA_ARG_INCR 00276 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00277 # elif defined _AIX 00278 # define YYSTACK_ALLOC __alloca 00279 # elif defined _MSC_VER 00280 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00281 # define alloca _alloca 00282 # else 00283 # define YYSTACK_ALLOC alloca 00284 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00285 || defined __cplusplus || defined _MSC_VER) 00286 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00287 # ifndef _STDLIB_H 00288 # define _STDLIB_H 1 00289 # endif 00290 # endif 00291 # endif 00292 # endif 00293 # endif 00294 00295 # ifdef YYSTACK_ALLOC 00296 /* Pacify GCC's `empty if-body' warning. */ 00297 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00298 # ifndef YYSTACK_ALLOC_MAXIMUM 00299 /* The OS might guarantee only one guard page at the bottom of the stack, 00300 and a page size can be as small as 4096 bytes. So we cannot safely 00301 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00302 to allow for a few compiler-allocated temporary stack slots. */ 00303 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00304 # endif 00305 # else 00306 # define YYSTACK_ALLOC YYMALLOC 00307 # define YYSTACK_FREE YYFREE 00308 # ifndef YYSTACK_ALLOC_MAXIMUM 00309 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00310 # endif 00311 # if (defined __cplusplus && ! defined _STDLIB_H \ 00312 && ! ((defined YYMALLOC || defined malloc) \ 00313 && (defined YYFREE || defined free))) 00314 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00315 # ifndef _STDLIB_H 00316 # define _STDLIB_H 1 00317 # endif 00318 # endif 00319 # ifndef YYMALLOC 00320 # define YYMALLOC malloc 00321 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00322 || defined __cplusplus || defined _MSC_VER) 00323 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00324 # endif 00325 # endif 00326 # ifndef YYFREE 00327 # define YYFREE free 00328 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00329 || defined __cplusplus || defined _MSC_VER) 00330 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00331 # endif 00332 # endif 00333 # endif 00334 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00335 00336 00337 #if (! defined yyoverflow \ 00338 && (! defined __cplusplus \ 00339 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00340 00341 /* A type that is properly aligned for any stack member. */ 00342 union yyalloc 00343 { 00344 yytype_int16 yyss_alloc; 00345 YYSTYPE yyvs_alloc; 00346 }; 00347 00348 /* The size of the maximum gap between one aligned stack and the next. */ 00349 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00350 00351 /* The size of an array large to enough to hold all stacks, each with 00352 N elements. */ 00353 # define YYSTACK_BYTES(N) \ 00354 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00355 + YYSTACK_GAP_MAXIMUM) 00356 00357 /* Copy COUNT objects from FROM to TO. The source and destination do 00358 not overlap. */ 00359 # ifndef YYCOPY 00360 # if defined __GNUC__ && 1 < __GNUC__ 00361 # define YYCOPY(To, From, Count) \ 00362 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00363 # else 00364 # define YYCOPY(To, From, Count) \ 00365 do \ 00366 { \ 00367 YYSIZE_T yyi; \ 00368 for (yyi = 0; yyi < (Count); yyi++) \ 00369 (To)[yyi] = (From)[yyi]; \ 00370 } \ 00371 while (YYID (0)) 00372 # endif 00373 # endif 00374 00375 /* Relocate STACK from its old location to the new one. The 00376 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00377 elements in the stack, and YYPTR gives the new location of the 00378 stack. Advance YYPTR to a properly aligned location for the next 00379 stack. */ 00380 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00381 do \ 00382 { \ 00383 YYSIZE_T yynewbytes; \ 00384 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00385 Stack = &yyptr->Stack_alloc; \ 00386 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00387 yyptr += yynewbytes / sizeof (*yyptr); \ 00388 } \ 00389 while (YYID (0)) 00390 00391 #endif 00392 00393 /* YYFINAL -- State number of the termination state. */ 00394 #define YYFINAL 3 00395 /* YYLAST -- Last index in YYTABLE. */ 00396 #define YYLAST 25 00397 00398 /* YYNTOKENS -- Number of terminals. */ 00399 #define YYNTOKENS 8 00400 /* YYNNTS -- Number of nonterminals. */ 00401 #define YYNNTS 7 00402 /* YYNRULES -- Number of rules. */ 00403 #define YYNRULES 13 00404 /* YYNRULES -- Number of states. */ 00405 #define YYNSTATES 18 00406 00407 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00408 #define YYUNDEFTOK 2 00409 #define YYMAXUTOK 259 00410 00411 #define YYTRANSLATE(YYX) \ 00412 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00413 00414 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00415 static const yytype_uint8 yytranslate[] = 00416 { 00417 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00423 2, 7, 2, 2, 2, 2, 2, 2, 2, 2, 00424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00429 2, 2, 2, 5, 2, 6, 2, 2, 2, 2, 00430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00442 2, 2, 2, 2, 2, 2, 1, 2, 3, 4 00443 }; 00444 00445 #if YYDEBUG 00446 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00447 YYRHS. */ 00448 static const yytype_uint8 yyprhs[] = 00449 { 00450 0, 0, 3, 4, 7, 8, 13, 16, 17, 19, 00451 23, 25, 27, 31 00452 }; 00453 00454 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00455 static const yytype_int8 yyrhs[] = 00456 { 00457 9, 0, -1, -1, 10, 13, -1, -1, 12, 5, 00458 13, 6, -1, 14, 13, -1, -1, 3, -1, 3, 00459 7, 3, -1, 4, -1, 11, -1, 3, 7, 11, 00460 -1, 1, -1 00461 }; 00462 00463 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00464 static const yytype_uint8 yyrline[] = 00465 { 00466 0, 52, 52, 52, 57, 57, 62, 62, 64, 65, 00467 66, 67, 68, 69 00468 }; 00469 #endif 00470 00471 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00472 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00473 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00474 static const char *const yytname[] = 00475 { 00476 "$end", "error", "$undefined", "STRING", "INCLUDE", "'{'", "'}'", "'='", 00477 "$accept", "top_res", "$@1", "res", "$@2", "res_item_zm", "res_item", 0 00478 }; 00479 #endif 00480 00481 # ifdef YYPRINT 00482 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00483 token YYLEX-NUM. */ 00484 static const yytype_uint16 yytoknum[] = 00485 { 00486 0, 256, 257, 258, 259, 123, 125, 61 00487 }; 00488 # endif 00489 00490 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00491 static const yytype_uint8 yyr1[] = 00492 { 00493 0, 8, 10, 9, 12, 11, 13, 13, 14, 14, 00494 14, 14, 14, 14 00495 }; 00496 00497 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00498 static const yytype_uint8 yyr2[] = 00499 { 00500 0, 2, 0, 2, 0, 4, 2, 0, 1, 3, 00501 1, 1, 3, 1 00502 }; 00503 00504 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 00505 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 00506 means the default is an error. */ 00507 static const yytype_uint8 yydefact[] = 00508 { 00509 2, 0, 0, 1, 13, 8, 10, 11, 0, 3, 00510 0, 4, 0, 6, 9, 12, 0, 5 00511 }; 00512 00513 /* YYDEFGOTO[NTERM-NUM]. */ 00514 static const yytype_int8 yydefgoto[] = 00515 { 00516 -1, 1, 2, 7, 8, 9, 10 00517 }; 00518 00519 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00520 STATE-NUM. */ 00521 #define YYPACT_NINF -1 00522 static const yytype_int8 yypact[] = 00523 { 00524 -1, 2, 7, -1, -1, 13, -1, -1, 4, -1, 00525 0, 11, 12, -1, -1, -1, 16, -1 00526 }; 00527 00528 /* YYPGOTO[NTERM-NUM]. */ 00529 static const yytype_int8 yypgoto[] = 00530 { 00531 -1, -1, -1, 14, -1, 9, -1 00532 }; 00533 00534 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00535 positive, shift that token. If negative, reduce the rule which 00536 number is the opposite. If zero, do what YYDEFACT says. 00537 If YYTABLE_NINF, syntax error. */ 00538 #define YYTABLE_NINF -8 00539 static const yytype_int8 yytable[] = 00540 { 00541 -7, 4, 3, 5, 6, -4, -7, -7, 4, 12, 00542 5, 6, -4, 4, 14, 5, 6, -4, -7, 13, 00543 11, 16, 17, 0, 0, 15 00544 }; 00545 00546 static const yytype_int8 yycheck[] = 00547 { 00548 0, 1, 0, 3, 4, 5, 6, 0, 1, 5, 00549 3, 4, 5, 1, 3, 3, 4, 5, 6, 10, 00550 7, 12, 6, -1, -1, 11 00551 }; 00552 00553 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00554 symbol of state STATE-NUM. */ 00555 static const yytype_uint8 yystos[] = 00556 { 00557 0, 9, 10, 0, 1, 3, 4, 11, 12, 13, 00558 14, 7, 5, 13, 3, 11, 13, 6 00559 }; 00560 00561 #define yyerrok (yyerrstatus = 0) 00562 #define yyclearin (yychar = YYEMPTY) 00563 #define YYEMPTY (-2) 00564 #define YYEOF 0 00565 00566 #define YYACCEPT goto yyacceptlab 00567 #define YYABORT goto yyabortlab 00568 #define YYERROR goto yyerrorlab 00569 00570 00571 /* Like YYERROR except do call yyerror. This remains here temporarily 00572 to ease the transition to the new meaning of YYERROR, for GCC. 00573 Once GCC version 2 has supplanted version 1, this can go. */ 00574 00575 #define YYFAIL goto yyerrlab 00576 00577 #define YYRECOVERING() (!!yyerrstatus) 00578 00579 #define YYBACKUP(Token, Value) \ 00580 do \ 00581 if (yychar == YYEMPTY && yylen == 1) \ 00582 { \ 00583 yychar = (Token); \ 00584 yylval = (Value); \ 00585 yytoken = YYTRANSLATE (yychar); \ 00586 YYPOPSTACK (1); \ 00587 goto yybackup; \ 00588 } \ 00589 else \ 00590 { \ 00591 yyerror (YY_("syntax error: cannot back up")); \ 00592 YYERROR; \ 00593 } \ 00594 while (YYID (0)) 00595 00596 00597 #define YYTERROR 1 00598 #define YYERRCODE 256 00599 00600 00601 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00602 If N is 0, then set CURRENT to the empty location which ends 00603 the previous symbol: RHS[0] (always defined). */ 00604 00605 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00606 #ifndef YYLLOC_DEFAULT 00607 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00608 do \ 00609 if (YYID (N)) \ 00610 { \ 00611 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 00612 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 00613 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 00614 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 00615 } \ 00616 else \ 00617 { \ 00618 (Current).first_line = (Current).last_line = \ 00619 YYRHSLOC (Rhs, 0).last_line; \ 00620 (Current).first_column = (Current).last_column = \ 00621 YYRHSLOC (Rhs, 0).last_column; \ 00622 } \ 00623 while (YYID (0)) 00624 #endif 00625 00626 00627 /* YY_LOCATION_PRINT -- Print the location on the stream. 00628 This macro was not mandated originally: define only if we know 00629 we won't break user code: when these are the locations we know. */ 00630 00631 #ifndef YY_LOCATION_PRINT 00632 # if YYLTYPE_IS_TRIVIAL 00633 # define YY_LOCATION_PRINT(File, Loc) \ 00634 fprintf (File, "%d.%d-%d.%d", \ 00635 (Loc).first_line, (Loc).first_column, \ 00636 (Loc).last_line, (Loc).last_column) 00637 # else 00638 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 00639 # endif 00640 #endif 00641 00642 00643 /* YYLEX -- calling `yylex' with the right arguments. */ 00644 00645 #ifdef YYLEX_PARAM 00646 # define YYLEX yylex (YYLEX_PARAM) 00647 #else 00648 # define YYLEX yylex () 00649 #endif 00650 00651 /* Enable debugging if requested. */ 00652 #if YYDEBUG 00653 00654 # ifndef YYFPRINTF 00655 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 00656 # define YYFPRINTF fprintf 00657 # endif 00658 00659 # define YYDPRINTF(Args) \ 00660 do { \ 00661 if (yydebug) \ 00662 YYFPRINTF Args; \ 00663 } while (YYID (0)) 00664 00665 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 00666 do { \ 00667 if (yydebug) \ 00668 { \ 00669 YYFPRINTF (stderr, "%s ", Title); \ 00670 yy_symbol_print (stderr, \ 00671 Type, Value); \ 00672 YYFPRINTF (stderr, "\n"); \ 00673 } \ 00674 } while (YYID (0)) 00675 00676 00677 /*--------------------------------. 00678 | Print this symbol on YYOUTPUT. | 00679 `--------------------------------*/ 00680 00681 /*ARGSUSED*/ 00682 #if (defined __STDC__ || defined __C99__FUNC__ \ 00683 || defined __cplusplus || defined _MSC_VER) 00684 static void 00685 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 00686 #else 00687 static void 00688 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 00689 FILE *yyoutput; 00690 int yytype; 00691 YYSTYPE const * const yyvaluep; 00692 #endif 00693 { 00694 if (!yyvaluep) 00695 return; 00696 # ifdef YYPRINT 00697 if (yytype < YYNTOKENS) 00698 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 00699 # else 00700 YYUSE (yyoutput); 00701 # endif 00702 switch (yytype) 00703 { 00704 default: 00705 break; 00706 } 00707 } 00708 00709 00710 /*--------------------------------. 00711 | Print this symbol on YYOUTPUT. | 00712 `--------------------------------*/ 00713 00714 #if (defined __STDC__ || defined __C99__FUNC__ \ 00715 || defined __cplusplus || defined _MSC_VER) 00716 static void 00717 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 00718 #else 00719 static void 00720 yy_symbol_print (yyoutput, yytype, yyvaluep) 00721 FILE *yyoutput; 00722 int yytype; 00723 YYSTYPE const * const yyvaluep; 00724 #endif 00725 { 00726 if (yytype < YYNTOKENS) 00727 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 00728 else 00729 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 00730 00731 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 00732 YYFPRINTF (yyoutput, ")"); 00733 } 00734 00735 /*------------------------------------------------------------------. 00736 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 00737 | TOP (included). | 00738 `------------------------------------------------------------------*/ 00739 00740 #if (defined __STDC__ || defined __C99__FUNC__ \ 00741 || defined __cplusplus || defined _MSC_VER) 00742 static void 00743 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 00744 #else 00745 static void 00746 yy_stack_print (yybottom, yytop) 00747 yytype_int16 *yybottom; 00748 yytype_int16 *yytop; 00749 #endif 00750 { 00751 YYFPRINTF (stderr, "Stack now"); 00752 for (; yybottom <= yytop; yybottom++) 00753 { 00754 int yybot = *yybottom; 00755 YYFPRINTF (stderr, " %d", yybot); 00756 } 00757 YYFPRINTF (stderr, "\n"); 00758 } 00759 00760 # define YY_STACK_PRINT(Bottom, Top) \ 00761 do { \ 00762 if (yydebug) \ 00763 yy_stack_print ((Bottom), (Top)); \ 00764 } while (YYID (0)) 00765 00766 00767 /*------------------------------------------------. 00768 | Report that the YYRULE is going to be reduced. | 00769 `------------------------------------------------*/ 00770 00771 #if (defined __STDC__ || defined __C99__FUNC__ \ 00772 || defined __cplusplus || defined _MSC_VER) 00773 static void 00774 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 00775 #else 00776 static void 00777 yy_reduce_print (yyvsp, yyrule) 00778 YYSTYPE *yyvsp; 00779 int yyrule; 00780 #endif 00781 { 00782 int yynrhs = yyr2[yyrule]; 00783 int yyi; 00784 unsigned long int yylno = yyrline[yyrule]; 00785 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 00786 yyrule - 1, yylno); 00787 /* The symbols being reduced. */ 00788 for (yyi = 0; yyi < yynrhs; yyi++) 00789 { 00790 YYFPRINTF (stderr, " $%d = ", yyi + 1); 00791 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 00792 &(yyvsp[(yyi + 1) - (yynrhs)]) 00793 ); 00794 YYFPRINTF (stderr, "\n"); 00795 } 00796 } 00797 00798 # define YY_REDUCE_PRINT(Rule) \ 00799 do { \ 00800 if (yydebug) \ 00801 yy_reduce_print (yyvsp, Rule); \ 00802 } while (YYID (0)) 00803 00804 /* Nonzero means print parse trace. It is left uninitialized so that 00805 multiple parsers can coexist. */ 00806 int yydebug; 00807 #else /* !YYDEBUG */ 00808 # define YYDPRINTF(Args) 00809 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 00810 # define YY_STACK_PRINT(Bottom, Top) 00811 # define YY_REDUCE_PRINT(Rule) 00812 #endif /* !YYDEBUG */ 00813 00814 00815 /* YYINITDEPTH -- initial size of the parser's stacks. */ 00816 #ifndef YYINITDEPTH 00817 # define YYINITDEPTH 200 00818 #endif 00819 00820 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 00821 if the built-in stack extension method is used). 00822 00823 Do not make this value too large; the results are undefined if 00824 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 00825 evaluated with infinite-precision integer arithmetic. */ 00826 00827 #ifndef YYMAXDEPTH 00828 # define YYMAXDEPTH 10000 00829 #endif 00830 00831 00832 00833 #if YYERROR_VERBOSE 00834 00835 # ifndef yystrlen 00836 # if defined __GLIBC__ && defined _STRING_H 00837 # define yystrlen strlen 00838 # else 00839 /* Return the length of YYSTR. */ 00840 #if (defined __STDC__ || defined __C99__FUNC__ \ 00841 || defined __cplusplus || defined _MSC_VER) 00842 static YYSIZE_T 00843 yystrlen (const char *yystr) 00844 #else 00845 static YYSIZE_T 00846 yystrlen (yystr) 00847 const char *yystr; 00848 #endif 00849 { 00850 YYSIZE_T yylen; 00851 for (yylen = 0; yystr[yylen]; yylen++) 00852 continue; 00853 return yylen; 00854 } 00855 # endif 00856 # endif 00857 00858 # ifndef yystpcpy 00859 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 00860 # define yystpcpy stpcpy 00861 # else 00862 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 00863 YYDEST. */ 00864 #if (defined __STDC__ || defined __C99__FUNC__ \ 00865 || defined __cplusplus || defined _MSC_VER) 00866 static char * 00867 yystpcpy (char *yydest, const char *yysrc) 00868 #else 00869 static char * 00870 yystpcpy (yydest, yysrc) 00871 char *yydest; 00872 const char *yysrc; 00873 #endif 00874 { 00875 char *yyd = yydest; 00876 const char *yys = yysrc; 00877 00878 while ((*yyd++ = *yys++) != '\0') 00879 continue; 00880 00881 return yyd - 1; 00882 } 00883 # endif 00884 # endif 00885 00886 # ifndef yytnamerr 00887 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 00888 quotes and backslashes, so that it's suitable for yyerror. The 00889 heuristic is that double-quoting is unnecessary unless the string 00890 contains an apostrophe, a comma, or backslash (other than 00891 backslash-backslash). YYSTR is taken from yytname. If YYRES is 00892 null, do not copy; instead, return the length of what the result 00893 would have been. */ 00894 static YYSIZE_T 00895 yytnamerr (char *yyres, const char *yystr) 00896 { 00897 if (*yystr == '"') 00898 { 00899 YYSIZE_T yyn = 0; 00900 char const *yyp = yystr; 00901 00902 for (;;) 00903 switch (*++yyp) 00904 { 00905 case '\'': 00906 case ',': 00907 goto do_not_strip_quotes; 00908 00909 case '\\': 00910 if (*++yyp != '\\') 00911 goto do_not_strip_quotes; 00912 /* Fall through. */ 00913 default: 00914 if (yyres) 00915 yyres[yyn] = *yyp; 00916 yyn++; 00917 break; 00918 00919 case '"': 00920 if (yyres) 00921 yyres[yyn] = '\0'; 00922 return yyn; 00923 } 00924 do_not_strip_quotes: ; 00925 } 00926 00927 if (! yyres) 00928 return yystrlen (yystr); 00929 00930 return yystpcpy (yyres, yystr) - yyres; 00931 } 00932 # endif 00933 00934 /* Copy into YYRESULT an error message about the unexpected token 00935 YYCHAR while in state YYSTATE. Return the number of bytes copied, 00936 including the terminating null byte. If YYRESULT is null, do not 00937 copy anything; just return the number of bytes that would be 00938 copied. As a special case, return 0 if an ordinary "syntax error" 00939 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 00940 size calculation. */ 00941 static YYSIZE_T 00942 yysyntax_error (char *yyresult, int yystate, int yychar) 00943 { 00944 int yyn = yypact[yystate]; 00945 00946 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 00947 return 0; 00948 else 00949 { 00950 int yytype = YYTRANSLATE (yychar); 00951 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 00952 YYSIZE_T yysize = yysize0; 00953 YYSIZE_T yysize1; 00954 int yysize_overflow = 0; 00955 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 00956 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 00957 int yyx; 00958 00959 # if 0 00960 /* This is so xgettext sees the translatable formats that are 00961 constructed on the fly. */ 00962 YY_("syntax error, unexpected %s"); 00963 YY_("syntax error, unexpected %s, expecting %s"); 00964 YY_("syntax error, unexpected %s, expecting %s or %s"); 00965 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 00966 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 00967 # endif 00968 char *yyfmt; 00969 char const *yyf; 00970 static char const yyunexpected[] = "syntax error, unexpected %s"; 00971 static char const yyexpecting[] = ", expecting %s"; 00972 static char const yyor[] = " or %s"; 00973 char yyformat[sizeof yyunexpected 00974 + sizeof yyexpecting - 1 00975 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 00976 * (sizeof yyor - 1))]; 00977 char const *yyprefix = yyexpecting; 00978 00979 /* Start YYX at -YYN if negative to avoid negative indexes in 00980 YYCHECK. */ 00981 int yyxbegin = yyn < 0 ? -yyn : 0; 00982 00983 /* Stay within bounds of both yycheck and yytname. */ 00984 int yychecklim = YYLAST - yyn + 1; 00985 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 00986 int yycount = 1; 00987 00988 yyarg[0] = yytname[yytype]; 00989 yyfmt = yystpcpy (yyformat, yyunexpected); 00990 00991 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 00992 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 00993 { 00994 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 00995 { 00996 yycount = 1; 00997 yysize = yysize0; 00998 yyformat[sizeof yyunexpected - 1] = '\0'; 00999 break; 01000 } 01001 yyarg[yycount++] = yytname[yyx]; 01002 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01003 yysize_overflow |= (yysize1 < yysize); 01004 yysize = yysize1; 01005 yyfmt = yystpcpy (yyfmt, yyprefix); 01006 yyprefix = yyor; 01007 } 01008 01009 yyf = YY_(yyformat); 01010 yysize1 = yysize + yystrlen (yyf); 01011 yysize_overflow |= (yysize1 < yysize); 01012 yysize = yysize1; 01013 01014 if (yysize_overflow) 01015 return YYSIZE_MAXIMUM; 01016 01017 if (yyresult) 01018 { 01019 /* Avoid sprintf, as that infringes on the user's name space. 01020 Don't have undefined behavior even if the translation 01021 produced a string with the wrong number of "%s"s. */ 01022 char *yyp = yyresult; 01023 int yyi = 0; 01024 while ((*yyp = *yyf) != '\0') 01025 { 01026 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 01027 { 01028 yyp += yytnamerr (yyp, yyarg[yyi++]); 01029 yyf += 2; 01030 } 01031 else 01032 { 01033 yyp++; 01034 yyf++; 01035 } 01036 } 01037 } 01038 return yysize; 01039 } 01040 } 01041 #endif /* YYERROR_VERBOSE */ 01042 01043 01044 /*-----------------------------------------------. 01045 | Release the memory associated to this symbol. | 01046 `-----------------------------------------------*/ 01047 01048 /*ARGSUSED*/ 01049 #if (defined __STDC__ || defined __C99__FUNC__ \ 01050 || defined __cplusplus || defined _MSC_VER) 01051 static void 01052 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01053 #else 01054 static void 01055 yydestruct (yymsg, yytype, yyvaluep) 01056 const char *yymsg; 01057 int yytype; 01058 YYSTYPE *yyvaluep; 01059 #endif 01060 { 01061 YYUSE (yyvaluep); 01062 01063 if (!yymsg) 01064 yymsg = "Deleting"; 01065 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01066 01067 switch (yytype) 01068 { 01069 01070 default: 01071 break; 01072 } 01073 } 01074 01075 /* Prevent warnings from -Wmissing-prototypes. */ 01076 #ifdef YYPARSE_PARAM 01077 #if defined __STDC__ || defined __cplusplus 01078 int yyparse (void *YYPARSE_PARAM); 01079 #else 01080 int yyparse (); 01081 #endif 01082 #else /* ! YYPARSE_PARAM */ 01083 #if defined __STDC__ || defined __cplusplus 01084 int yyparse (void); 01085 #else 01086 int yyparse (); 01087 #endif 01088 #endif /* ! YYPARSE_PARAM */ 01089 01090 01091 /* The lookahead symbol. */ 01092 int yychar; 01093 01094 /* The semantic value of the lookahead symbol. */ 01095 YYSTYPE yylval; 01096 01097 /* Number of syntax errors so far. */ 01098 int yynerrs; 01099 01100 01101 01102 /*-------------------------. 01103 | yyparse or yypush_parse. | 01104 `-------------------------*/ 01105 01106 #ifdef YYPARSE_PARAM 01107 #if (defined __STDC__ || defined __C99__FUNC__ \ 01108 || defined __cplusplus || defined _MSC_VER) 01109 int 01110 yyparse (void *YYPARSE_PARAM) 01111 #else 01112 int 01113 yyparse (YYPARSE_PARAM) 01114 void *YYPARSE_PARAM; 01115 #endif 01116 #else /* ! YYPARSE_PARAM */ 01117 #if (defined __STDC__ || defined __C99__FUNC__ \ 01118 || defined __cplusplus || defined _MSC_VER) 01119 int 01120 yyparse (void) 01121 #else 01122 int 01123 yyparse () 01124 01125 #endif 01126 #endif 01127 { 01128 01129 01130 int yystate; 01131 /* Number of tokens to shift before error messages enabled. */ 01132 int yyerrstatus; 01133 01134 /* The stacks and their tools: 01135 `yyss': related to states. 01136 `yyvs': related to semantic values. 01137 01138 Refer to the stacks thru separate pointers, to allow yyoverflow 01139 to reallocate them elsewhere. */ 01140 01141 /* The state stack. */ 01142 yytype_int16 yyssa[YYINITDEPTH]; 01143 yytype_int16 *yyss; 01144 yytype_int16 *yyssp; 01145 01146 /* The semantic value stack. */ 01147 YYSTYPE yyvsa[YYINITDEPTH]; 01148 YYSTYPE *yyvs; 01149 YYSTYPE *yyvsp; 01150 01151 YYSIZE_T yystacksize; 01152 01153 int yyn; 01154 int yyresult; 01155 /* Lookahead token as an internal (translated) token number. */ 01156 int yytoken; 01157 /* The variables used to return semantic value and location from the 01158 action routines. */ 01159 YYSTYPE yyval; 01160 01161 #if YYERROR_VERBOSE 01162 /* Buffer for error messages, and its allocated size. */ 01163 char yymsgbuf[128]; 01164 char *yymsg = yymsgbuf; 01165 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01166 #endif 01167 01168 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01169 01170 /* The number of symbols on the RHS of the reduced rule. 01171 Keep to zero when no symbol should be popped. */ 01172 int yylen = 0; 01173 01174 yytoken = 0; 01175 yyss = yyssa; 01176 yyvs = yyvsa; 01177 yystacksize = YYINITDEPTH; 01178 01179 YYDPRINTF ((stderr, "Starting parse\n")); 01180 01181 yystate = 0; 01182 yyerrstatus = 0; 01183 yynerrs = 0; 01184 yychar = YYEMPTY; /* Cause a token to be read. */ 01185 01186 /* Initialize stack pointers. 01187 Waste one element of value and location stack 01188 so that they stay on the same level as the state stack. 01189 The wasted elements are never initialized. */ 01190 yyssp = yyss; 01191 yyvsp = yyvs; 01192 01193 goto yysetstate; 01194 01195 /*------------------------------------------------------------. 01196 | yynewstate -- Push a new state, which is found in yystate. | 01197 `------------------------------------------------------------*/ 01198 yynewstate: 01199 /* In all cases, when you get here, the value and location stacks 01200 have just been pushed. So pushing a state here evens the stacks. */ 01201 yyssp++; 01202 01203 yysetstate: 01204 *yyssp = yystate; 01205 01206 if (yyss + yystacksize - 1 <= yyssp) 01207 { 01208 /* Get the current used size of the three stacks, in elements. */ 01209 YYSIZE_T yysize = yyssp - yyss + 1; 01210 01211 #ifdef yyoverflow 01212 { 01213 /* Give user a chance to reallocate the stack. Use copies of 01214 these so that the &'s don't force the real ones into 01215 memory. */ 01216 YYSTYPE *yyvs1 = yyvs; 01217 yytype_int16 *yyss1 = yyss; 01218 01219 /* Each stack pointer address is followed by the size of the 01220 data in use in that stack, in bytes. This used to be a 01221 conditional around just the two extra args, but that might 01222 be undefined if yyoverflow is a macro. */ 01223 yyoverflow (YY_("memory exhausted"), 01224 &yyss1, yysize * sizeof (*yyssp), 01225 &yyvs1, yysize * sizeof (*yyvsp), 01226 &yystacksize); 01227 01228 yyss = yyss1; 01229 yyvs = yyvs1; 01230 } 01231 #else /* no yyoverflow */ 01232 # ifndef YYSTACK_RELOCATE 01233 goto yyexhaustedlab; 01234 # else 01235 /* Extend the stack our own way. */ 01236 if (YYMAXDEPTH <= yystacksize) 01237 goto yyexhaustedlab; 01238 yystacksize *= 2; 01239 if (YYMAXDEPTH < yystacksize) 01240 yystacksize = YYMAXDEPTH; 01241 01242 { 01243 yytype_int16 *yyss1 = yyss; 01244 union yyalloc *yyptr = 01245 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01246 if (! yyptr) 01247 goto yyexhaustedlab; 01248 YYSTACK_RELOCATE (yyss_alloc, yyss); 01249 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01250 # undef YYSTACK_RELOCATE 01251 if (yyss1 != yyssa) 01252 YYSTACK_FREE (yyss1); 01253 } 01254 # endif 01255 #endif /* no yyoverflow */ 01256 01257 yyssp = yyss + yysize - 1; 01258 yyvsp = yyvs + yysize - 1; 01259 01260 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01261 (unsigned long int) yystacksize)); 01262 01263 if (yyss + yystacksize - 1 <= yyssp) 01264 YYABORT; 01265 } 01266 01267 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01268 01269 if (yystate == YYFINAL) 01270 YYACCEPT; 01271 01272 goto yybackup; 01273 01274 /*-----------. 01275 | yybackup. | 01276 `-----------*/ 01277 yybackup: 01278 01279 /* Do appropriate processing given the current state. Read a 01280 lookahead token if we need one and don't already have one. */ 01281 01282 /* First try to decide what to do without reference to lookahead token. */ 01283 yyn = yypact[yystate]; 01284 if (yyn == YYPACT_NINF) 01285 goto yydefault; 01286 01287 /* Not known => get a lookahead token if don't already have one. */ 01288 01289 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01290 if (yychar == YYEMPTY) 01291 { 01292 YYDPRINTF ((stderr, "Reading a token: ")); 01293 yychar = YYLEX; 01294 } 01295 01296 if (yychar <= YYEOF) 01297 { 01298 yychar = yytoken = YYEOF; 01299 YYDPRINTF ((stderr, "Now at end of input.\n")); 01300 } 01301 else 01302 { 01303 yytoken = YYTRANSLATE (yychar); 01304 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01305 } 01306 01307 /* If the proper action on seeing token YYTOKEN is to reduce or to 01308 detect an error, take that action. */ 01309 yyn += yytoken; 01310 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01311 goto yydefault; 01312 yyn = yytable[yyn]; 01313 if (yyn <= 0) 01314 { 01315 if (yyn == 0 || yyn == YYTABLE_NINF) 01316 goto yyerrlab; 01317 yyn = -yyn; 01318 goto yyreduce; 01319 } 01320 01321 /* Count tokens shifted since error; after three, turn off error 01322 status. */ 01323 if (yyerrstatus) 01324 yyerrstatus--; 01325 01326 /* Shift the lookahead token. */ 01327 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01328 01329 /* Discard the shifted token. */ 01330 yychar = YYEMPTY; 01331 01332 yystate = yyn; 01333 *++yyvsp = yylval; 01334 01335 goto yynewstate; 01336 01337 01338 /*-----------------------------------------------------------. 01339 | yydefault -- do the default action for the current state. | 01340 `-----------------------------------------------------------*/ 01341 yydefault: 01342 yyn = yydefact[yystate]; 01343 if (yyn == 0) 01344 goto yyerrlab; 01345 goto yyreduce; 01346 01347 01348 /*-----------------------------. 01349 | yyreduce -- Do a reduction. | 01350 `-----------------------------*/ 01351 yyreduce: 01352 /* yyn is the number of a rule to reduce with. */ 01353 yylen = yyr2[yyn]; 01354 01355 /* If YYLEN is nonzero, implement the default value of the action: 01356 `$$ = $1'. 01357 01358 Otherwise, the following line sets YYVAL to garbage. 01359 This behavior is undocumented and Bison 01360 users should not rely upon it. Assigning to YYVAL 01361 unconditionally makes the parser a bit smaller, and it avoids a 01362 GCC warning that YYVAL may be used uninitialized. */ 01363 yyval = yyvsp[1-yylen]; 01364 01365 01366 YY_REDUCE_PRINT (yyn); 01367 switch (yyn) 01368 { 01369 case 2: 01370 01371 /* Line 1455 of yacc.c */ 01372 #line 52 "res_parse.y" 01373 { current_res = parsed_res = resource_create(NULL); } 01374 break; 01375 01376 case 4: 01377 01378 /* Line 1455 of yacc.c */ 01379 #line 57 "res_parse.y" 01380 { current_res = resource_create(current_res); } 01381 break; 01382 01383 case 5: 01384 01385 /* Line 1455 of yacc.c */ 01386 #line 59 "res_parse.y" 01387 { (yyval.rval) = current_res; current_res = current_res->parent; } 01388 break; 01389 01390 case 8: 01391 01392 /* Line 1455 of yacc.c */ 01393 #line 64 "res_parse.y" 01394 { resource_add_val(current_res, 0, (yyvsp[(1) - (1)].sval), 0); f(FLAG_V); } 01395 break; 01396 01397 case 9: 01398 01399 /* Line 1455 of yacc.c */ 01400 #line 65 "res_parse.y" 01401 { resource_add_val(current_res, (yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].sval), 0); f(FLAG_NV); } 01402 break; 01403 01404 case 10: 01405 01406 /* Line 1455 of yacc.c */ 01407 #line 66 "res_parse.y" 01408 { resource_add_val(current_res, 0, (yyvsp[(1) - (1)].sval), 0); f(FLAG_S); } 01409 break; 01410 01411 case 11: 01412 01413 /* Line 1455 of yacc.c */ 01414 #line 67 "res_parse.y" 01415 { resource_add_val(current_res, 0, 0, (yyvsp[(1) - (1)].rval)); f(FLAG_S); } 01416 break; 01417 01418 case 12: 01419 01420 /* Line 1455 of yacc.c */ 01421 #line 68 "res_parse.y" 01422 { resource_add_val(current_res, (yyvsp[(1) - (3)].sval), 0, (yyvsp[(3) - (3)].rval)); f(FLAG_NS); } 01423 break; 01424 01425 01426 01427 /* Line 1455 of yacc.c */ 01428 #line 1429 "res_parse.c" 01429 default: break; 01430 } 01431 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 01432 01433 YYPOPSTACK (yylen); 01434 yylen = 0; 01435 YY_STACK_PRINT (yyss, yyssp); 01436 01437 *++yyvsp = yyval; 01438 01439 /* Now `shift' the result of the reduction. Determine what state 01440 that goes to, based on the state we popped back to and the rule 01441 number reduced by. */ 01442 01443 yyn = yyr1[yyn]; 01444 01445 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 01446 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 01447 yystate = yytable[yystate]; 01448 else 01449 yystate = yydefgoto[yyn - YYNTOKENS]; 01450 01451 goto yynewstate; 01452 01453 01454 /*------------------------------------. 01455 | yyerrlab -- here on detecting error | 01456 `------------------------------------*/ 01457 yyerrlab: 01458 /* If not already recovering from an error, report this error. */ 01459 if (!yyerrstatus) 01460 { 01461 ++yynerrs; 01462 #if ! YYERROR_VERBOSE 01463 yyerror (YY_("syntax error")); 01464 #else 01465 { 01466 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 01467 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 01468 { 01469 YYSIZE_T yyalloc = 2 * yysize; 01470 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 01471 yyalloc = YYSTACK_ALLOC_MAXIMUM; 01472 if (yymsg != yymsgbuf) 01473 YYSTACK_FREE (yymsg); 01474 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 01475 if (yymsg) 01476 yymsg_alloc = yyalloc; 01477 else 01478 { 01479 yymsg = yymsgbuf; 01480 yymsg_alloc = sizeof yymsgbuf; 01481 } 01482 } 01483 01484 if (0 < yysize && yysize <= yymsg_alloc) 01485 { 01486 (void) yysyntax_error (yymsg, yystate, yychar); 01487 yyerror (yymsg); 01488 } 01489 else 01490 { 01491 yyerror (YY_("syntax error")); 01492 if (yysize != 0) 01493 goto yyexhaustedlab; 01494 } 01495 } 01496 #endif 01497 } 01498 01499 01500 01501 if (yyerrstatus == 3) 01502 { 01503 /* If just tried and failed to reuse lookahead token after an 01504 error, discard it. */ 01505 01506 if (yychar <= YYEOF) 01507 { 01508 /* Return failure if at end of input. */ 01509 if (yychar == YYEOF) 01510 YYABORT; 01511 } 01512 else 01513 { 01514 yydestruct ("Error: discarding", 01515 yytoken, &yylval); 01516 yychar = YYEMPTY; 01517 } 01518 } 01519 01520 /* Else will try to reuse lookahead token after shifting the error 01521 token. */ 01522 goto yyerrlab1; 01523 01524 01525 /*---------------------------------------------------. 01526 | yyerrorlab -- error raised explicitly by YYERROR. | 01527 `---------------------------------------------------*/ 01528 yyerrorlab: 01529 01530 /* Pacify compilers like GCC when the user code never invokes 01531 YYERROR and the label yyerrorlab therefore never appears in user 01532 code. */ 01533 if (/*CONSTCOND*/ 0) 01534 goto yyerrorlab; 01535 01536 /* Do not reclaim the symbols of the rule which action triggered 01537 this YYERROR. */ 01538 YYPOPSTACK (yylen); 01539 yylen = 0; 01540 YY_STACK_PRINT (yyss, yyssp); 01541 yystate = *yyssp; 01542 goto yyerrlab1; 01543 01544 01545 /*-------------------------------------------------------------. 01546 | yyerrlab1 -- common code for both syntax error and YYERROR. | 01547 `-------------------------------------------------------------*/ 01548 yyerrlab1: 01549 yyerrstatus = 3; /* Each real token shifted decrements this. */ 01550 01551 for (;;) 01552 { 01553 yyn = yypact[yystate]; 01554 if (yyn != YYPACT_NINF) 01555 { 01556 yyn += YYTERROR; 01557 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 01558 { 01559 yyn = yytable[yyn]; 01560 if (0 < yyn) 01561 break; 01562 } 01563 } 01564 01565 /* Pop the current state because it cannot handle the error token. */ 01566 if (yyssp == yyss) 01567 YYABORT; 01568 01569 01570 yydestruct ("Error: popping", 01571 yystos[yystate], yyvsp); 01572 YYPOPSTACK (1); 01573 yystate = *yyssp; 01574 YY_STACK_PRINT (yyss, yyssp); 01575 } 01576 01577 *++yyvsp = yylval; 01578 01579 01580 /* Shift the error token. */ 01581 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 01582 01583 yystate = yyn; 01584 goto yynewstate; 01585 01586 01587 /*-------------------------------------. 01588 | yyacceptlab -- YYACCEPT comes here. | 01589 `-------------------------------------*/ 01590 yyacceptlab: 01591 yyresult = 0; 01592 goto yyreturn; 01593 01594 /*-----------------------------------. 01595 | yyabortlab -- YYABORT comes here. | 01596 `-----------------------------------*/ 01597 yyabortlab: 01598 yyresult = 1; 01599 goto yyreturn; 01600 01601 #if !defined(yyoverflow) || YYERROR_VERBOSE 01602 /*-------------------------------------------------. 01603 | yyexhaustedlab -- memory exhaustion comes here. | 01604 `-------------------------------------------------*/ 01605 yyexhaustedlab: 01606 yyerror (YY_("memory exhausted")); 01607 yyresult = 2; 01608 /* Fall through. */ 01609 #endif 01610 01611 yyreturn: 01612 if (yychar != YYEMPTY) 01613 yydestruct ("Cleanup: discarding lookahead", 01614 yytoken, &yylval); 01615 /* Do not reclaim the symbols of the rule which action triggered 01616 this YYABORT or YYACCEPT. */ 01617 YYPOPSTACK (yylen); 01618 YY_STACK_PRINT (yyss, yyssp); 01619 while (yyssp != yyss) 01620 { 01621 yydestruct ("Cleanup: popping", 01622 yystos[*yyssp], yyvsp); 01623 YYPOPSTACK (1); 01624 } 01625 #ifndef yyoverflow 01626 if (yyss != yyssa) 01627 YYSTACK_FREE (yyss); 01628 #endif 01629 #if YYERROR_VERBOSE 01630 if (yymsg != yymsgbuf) 01631 YYSTACK_FREE (yymsg); 01632 #endif 01633 /* Make sure YYID is used. */ 01634 return YYID (yyresult); 01635 } 01636 01637 01638 01639 /* Line 1675 of yacc.c */ 01640 #line 72 "res_parse.y" 01641 01642 01643 static const char *res_filename = NULL; 01644 static FILE *res_file = NULL; 01645 static const char **res_strings = NULL; 01646 static int res_string_idx = 0; 01647 int res_lineno; 01648 01649 int 01650 res_parse_getchars(char *buf, int max_size) 01651 { 01652 if (res_file) 01653 { 01654 int i = fgetc(res_file); 01655 buf[0] = i; 01656 if (i == EOF) 01657 return 0; 01658 } 01659 else 01660 { 01661 if (res_strings[0] == 0) 01662 return 0; 01663 buf[0] = res_strings[0][res_string_idx]; 01664 res_string_idx ++; 01665 if (buf[0] == 0) 01666 { 01667 res_strings ++; 01668 res_string_idx = 0; 01669 buf[0] = '\n'; 01670 return 1; 01671 } 01672 } 01673 return 1; 01674 } 01675 01676 Resource * 01677 resource_parse(const char *filename, const char **strings) 01678 { 01679 res_lineno = 1; 01680 if (filename) 01681 { 01682 res_file = fopen (filename, "r"); 01683 if (res_file == NULL) 01684 { 01685 perror(filename); 01686 return NULL; 01687 } 01688 res_filename = filename; 01689 } 01690 else if (strings) 01691 { 01692 res_strings = strings; 01693 res_string_idx = 0; 01694 } 01695 else 01696 return NULL; 01697 #if YYDEBUG 01698 yydebug = 1; 01699 #endif 01700 if (resparse()) 01701 parsed_res = NULL; 01702 if (filename) 01703 { 01704 fclose (res_file); 01705 res_filename = NULL; 01706 res_file = NULL; 01707 } 01708 else 01709 res_strings = NULL; 01710 return parsed_res; 01711 } 01712 01713 Resource * 01714 resource_create(Resource *parent) 01715 { 01716 Resource *rv = (Resource *)malloc(sizeof(Resource)); 01717 rv->parent = parent; 01718 rv->flags = 0; 01719 rv->c = 0; 01720 rv->v = (ResourceVal *)malloc(sizeof(ResourceVal)); 01721 return rv; 01722 } 01723 01724 void 01725 resource_add_val(Resource *n, char *name, char *value, Resource *subres) 01726 { 01727 n->v = (ResourceVal *)realloc(n->v, sizeof(ResourceVal)*(n->c+1)); 01728 n->v[n->c].name = name; 01729 n->v[n->c].value = value; 01730 n->v[n->c].subres = subres; 01731 n->c++; 01732 } 01733 01734 char * 01735 resource_value(const Resource *res, char *name) 01736 { 01737 int i; 01738 if (res == 0 || name == 0) 01739 return 0; 01740 for (i=0; i<res->c; i++) 01741 if (res->v[i].name && res->v[i].value 01742 && NSTRCMP(res->v[i].name, name) == 0) 01743 return res->v[i].value; 01744 return 0; 01745 } 01746 01747 Resource * 01748 resource_subres(const Resource *res, const char *name) 01749 { 01750 int i; 01751 if (res == 0 || name == 0) 01752 return 0; 01753 for (i=0; i<res->c; i++) 01754 if (res->v[i].name && res->v[i].subres 01755 && NSTRCMP(res->v[i].name, name) == 0) 01756 return res->v[i].subres; 01757 return 0; 01758 } 01759 01760 int 01761 reserror(const char *str) 01762 { 01763 fprintf(stderr, "Error: %s around line %d: %s\n", 01764 res_file ? res_filename : "internal strings", 01765 res_lineno, str); 01766 return 0; 01767 } 01768 01769 static void 01770 dump_res(Resource *n, int l) 01771 { 01772 int i; 01773 for (i=0; i<n->c; i++) 01774 { 01775 if (n->v[i].subres) 01776 { 01777 printf("%*cn[%s] = {\n", l, ' ', n->v[i].name? n->v[i].name :""); 01778 dump_res(n->v[i].subres, l+3); 01779 printf("%*c}\n", l, ' '); 01780 } 01781 else 01782 printf("%*cn[%s] = v[%s]\n", l, ' ', n->v[i].name? n->v[i].name :"", n->v[i].value? n->v[i].value :""); 01783 } 01784 } 01785 01786 void 01787 resource_dump (Resource *r) 01788 { 01789 dump_res (r, 0); 01790 } 01791 01792