search

search_parser.cxx

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

Generated on Sun Jun 8 10:56:40 2008 for GNUmifluz by doxygen 1.5.5

AltStyle によって変換されたページ (->オリジナル) /