Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

plural.c

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

Generated on Tue Dec 20 10:14:20 2005 for vlc-0.8.4a by  doxygen 1.4.2