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