Back to index

glibc  2.9
plural.c
Go to the documentation of this file.
00001 /* A Bison parser, made from plural.y
00002    by GNU bison 1.35.  */
00003 
00004 #define YYBISON 1  /* Identify Bison output.  */
00005 
00006 #define yyparse __gettextparse
00007 #define yylex __gettextlex
00008 #define yyerror __gettexterror
00009 #define yylval __gettextlval
00010 #define yychar __gettextchar
00011 #define yydebug __gettextdebug
00012 #define yynerrs __gettextnerrs
00013 # define      EQUOP2 257
00014 # define      CMPOP2 258
00015 # define      ADDOP2 259
00016 # define      MULOP2 260
00017 # define      NUMBER 261
00018 
00019 #line 1 "plural.y"
00020 
00021 /* Expression parsing for plural form selection.
00022    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
00023    This file is part of the GNU C Library.
00024    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
00025 
00026    The GNU C Library is free software; you can redistribute it and/or
00027    modify it under the terms of the GNU Lesser General Public
00028    License as published by the Free Software Foundation; either
00029    version 2.1 of the License, or (at your option) any later version.
00030 
00031    The GNU C Library is distributed in the hope that it will be useful,
00032    but WITHOUT ANY WARRANTY; without even the implied warranty of
00033    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00034    Lesser General Public License for more details.
00035 
00036    You should have received a copy of the GNU Lesser General Public
00037    License along with the GNU C Library; if not, write to the Free
00038    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00039    02111-1307 USA.  */
00040 
00041 /* The bison generated parser uses alloca.  AIX 3 forces us to put this
00042    declaration at the beginning of the file.  The declaration in bison's
00043    skeleton file comes too late.  This must come before <config.h>
00044    because <config.h> may include arbitrary system headers.  */
00045 #if defined _AIX && !defined __GNUC__
00046  #pragma alloca
00047 #endif
00048 #ifdef HAVE_CONFIG_H
00049 # include <config.h>
00050 #endif
00051 
00052 #include <stddef.h>
00053 #include <stdlib.h>
00054 #include <string.h>
00055 #include "plural-exp.h"
00056 
00057 /* The main function generated by the parser is called __gettextparse,
00058    but we want it to be called PLURAL_PARSE.  */
00059 #ifndef _LIBC
00060 # define __gettextparse PLURAL_PARSE
00061 #endif
00062 
00063 #define YYLEX_PARAM  &((struct parse_args *) arg)->cp
00064 #define YYPARSE_PARAM       arg
00065 
00066 #line 49 "plural.y"
00067 #ifndef YYSTYPE
00068 typedef union {
00069   unsigned long int num;
00070   enum operator op;
00071   struct expression *exp;
00072 } yystype;
00073 # define YYSTYPE yystype
00074 # define YYSTYPE_IS_TRIVIAL 1
00075 #endif
00076 #line 55 "plural.y"
00077 
00078 /* Prototypes for local functions.  */
00079 static struct expression *new_exp PARAMS ((int nargs, enum operator op,
00080                                       struct expression * const *args));
00081 static inline struct expression *new_exp_0 PARAMS ((enum operator op));
00082 static inline struct expression *new_exp_1 PARAMS ((enum operator op,
00083                                              struct expression *right));
00084 static struct expression *new_exp_2 PARAMS ((enum operator op,
00085                                         struct expression *left,
00086                                         struct expression *right));
00087 static inline struct expression *new_exp_3 PARAMS ((enum operator op,
00088                                              struct expression *bexp,
00089                                              struct expression *tbranch,
00090                                              struct expression *fbranch));
00091 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
00092 static void yyerror PARAMS ((const char *str));
00093 
00094 /* Allocation of expressions.  */
00095 
00096 static struct expression *
00097 new_exp (nargs, op, args)
00098      int nargs;
00099      enum operator op;
00100      struct expression * const *args;
00101 {
00102   int i;
00103   struct expression *newp;
00104 
00105   /* If any of the argument could not be malloc'ed, just return NULL.  */
00106   for (i = nargs - 1; i >= 0; i--)
00107     if (args[i] == NULL)
00108       goto fail;
00109 
00110   /* Allocate a new expression.  */
00111   newp = (struct expression *) malloc (sizeof (*newp));
00112   if (newp != NULL)
00113     {
00114       newp->nargs = nargs;
00115       newp->operation = op;
00116       for (i = nargs - 1; i >= 0; i--)
00117        newp->val.args[i] = args[i];
00118       return newp;
00119     }
00120 
00121  fail:
00122   for (i = nargs - 1; i >= 0; i--)
00123     FREE_EXPRESSION (args[i]);
00124 
00125   return NULL;
00126 }
00127 
00128 static inline struct expression *
00129 new_exp_0 (op)
00130      enum operator op;
00131 {
00132   return new_exp (0, op, NULL);
00133 }
00134 
00135 static inline struct expression *
00136 new_exp_1 (op, right)
00137      enum operator op;
00138      struct expression *right;
00139 {
00140   struct expression *args[1];
00141 
00142   args[0] = right;
00143   return new_exp (1, op, args);
00144 }
00145 
00146 static struct expression *
00147 new_exp_2 (op, left, right)
00148      enum operator op;
00149      struct expression *left;
00150      struct expression *right;
00151 {
00152   struct expression *args[2];
00153 
00154   args[0] = left;
00155   args[1] = right;
00156   return new_exp (2, op, args);
00157 }
00158 
00159 static inline struct expression *
00160 new_exp_3 (op, bexp, tbranch, fbranch)
00161      enum operator op;
00162      struct expression *bexp;
00163      struct expression *tbranch;
00164      struct expression *fbranch;
00165 {
00166   struct expression *args[3];
00167 
00168   args[0] = bexp;
00169   args[1] = tbranch;
00170   args[2] = fbranch;
00171   return new_exp (3, op, args);
00172 }
00173 
00174 #ifndef YYDEBUG
00175 # define YYDEBUG 0
00176 #endif
00177 
00178 
00179 
00180 #define       YYFINAL              27
00181 #define       YYFLAG        -32768
00182 #define       YYNTBASE      16
00183 
00184 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
00185 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
00186 
00187 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
00188 static const char yytranslate[] =
00189 {
00190        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00191        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00192        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00193        2,     2,     2,    10,     2,     2,     2,     2,     5,     2,
00194       14,    15,     2,     2,     2,     2,     2,     2,     2,     2,
00195        2,     2,     2,     2,     2,     2,     2,     2,    12,     2,
00196        2,     2,     2,     3,     2,     2,     2,     2,     2,     2,
00197        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00198        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00199        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00200        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00201       13,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00202        2,     2,     2,     2,     4,     2,     2,     2,     2,     2,
00203        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00204        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00205        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00206        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00207        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00208        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00209        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00210        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00211        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00212        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00213        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00214        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00215        2,     2,     2,     2,     2,     2,     1,     6,     7,     8,
00216        9,    11
00217 };
00218 
00219 #if YYDEBUG
00220 static const short yyprhs[] =
00221 {
00222        0,     0,     2,     8,    12,    16,    20,    24,    28,    32,
00223       35,    37,    39
00224 };
00225 static const short yyrhs[] =
00226 {
00227       17,     0,    17,     3,    17,    12,    17,     0,    17,     4,
00228       17,     0,    17,     5,    17,     0,    17,     6,    17,     0,
00229       17,     7,    17,     0,    17,     8,    17,     0,    17,     9,
00230       17,     0,    10,    17,     0,    13,     0,    11,     0,    14,
00231       17,    15,     0
00232 };
00233 
00234 #endif
00235 
00236 #if YYDEBUG
00237 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
00238 static const short yyrline[] =
00239 {
00240        0,   174,   182,   186,   190,   194,   198,   202,   206,   210,
00241      214,   218,   223
00242 };
00243 #endif
00244 
00245 
00246 #if (YYDEBUG) || defined YYERROR_VERBOSE
00247 
00248 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
00249 static const char *const yytname[] =
00250 {
00251   "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2", 
00252   "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'", 
00253   "start", "exp", 0
00254 };
00255 #endif
00256 
00257 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
00258 static const short yyr1[] =
00259 {
00260        0,    16,    17,    17,    17,    17,    17,    17,    17,    17,
00261       17,    17,    17
00262 };
00263 
00264 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
00265 static const short yyr2[] =
00266 {
00267        0,     1,     5,     3,     3,     3,     3,     3,     3,     2,
00268        1,     1,     3
00269 };
00270 
00271 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
00272    doesn't specify something else to do.  Zero means the default is an
00273    error. */
00274 static const short yydefact[] =
00275 {
00276        0,     0,    11,    10,     0,     1,     9,     0,     0,     0,
00277        0,     0,     0,     0,     0,    12,     0,     3,     4,     5,
00278        6,     7,     8,     0,     2,     0,     0,     0
00279 };
00280 
00281 static const short yydefgoto[] =
00282 {
00283       25,     5
00284 };
00285 
00286 static const short yypact[] =
00287 {
00288       -9,    -9,-32768,-32768,    -9,    34,-32768,    11,    -9,    -9,
00289       -9,    -9,    -9,    -9,    -9,-32768,    24,    39,    43,    16,
00290       26,    -3,-32768,    -9,    34,    21,    53,-32768
00291 };
00292 
00293 static const short yypgoto[] =
00294 {
00295   -32768,    -1
00296 };
00297 
00298 
00299 #define       YYLAST        53
00300 
00301 
00302 static const short yytable[] =
00303 {
00304        6,     1,     2,     7,     3,     4,    14,    16,    17,    18,
00305       19,    20,    21,    22,     8,     9,    10,    11,    12,    13,
00306       14,    26,    24,    12,    13,    14,    15,     8,     9,    10,
00307       11,    12,    13,    14,    13,    14,    23,     8,     9,    10,
00308       11,    12,    13,    14,    10,    11,    12,    13,    14,    11,
00309       12,    13,    14,    27
00310 };
00311 
00312 static const short yycheck[] =
00313 {
00314        1,    10,    11,     4,    13,    14,     9,     8,     9,    10,
00315       11,    12,    13,    14,     3,     4,     5,     6,     7,     8,
00316        9,     0,    23,     7,     8,     9,    15,     3,     4,     5,
00317        6,     7,     8,     9,     8,     9,    12,     3,     4,     5,
00318        6,     7,     8,     9,     5,     6,     7,     8,     9,     6,
00319        7,     8,     9,     0
00320 };
00321 #define YYPURE 1
00322 
00323 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
00324 #line 3 "/castro/street/H-alpha-linux/share/bison/bison.simple"
00325 
00326 /* Skeleton output parser for bison,
00327 
00328    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
00329    Foundation, Inc.
00330 
00331    This program is free software; you can redistribute it and/or modify
00332    it under the terms of the GNU General Public License as published by
00333    the Free Software Foundation; either version 2, or (at your option)
00334    any later version.
00335 
00336    This program is distributed in the hope that it will be useful,
00337    but WITHOUT ANY WARRANTY; without even the implied warranty of
00338    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00339    GNU General Public License for more details.
00340 
00341    You should have received a copy of the GNU General Public License
00342    along with this program; if not, write to the Free Software
00343    Foundation, Inc., 59 Temple Place - Suite 330,
00344    Boston, MA 02111-1307, USA.  */
00345 
00346 /* As a special exception, when this file is copied by Bison into a
00347    Bison output file, you may use that output file without restriction.
00348    This special exception was added by the Free Software Foundation
00349    in version 1.24 of Bison.  */
00350 
00351 /* This is the parser code that is written into each bison parser when
00352    the %semantic_parser declaration is not specified in the grammar.
00353    It was written by Richard Stallman by simplifying the hairy parser
00354    used when %semantic_parser is specified.  */
00355 
00356 /* All symbols defined below should begin with yy or YY, to avoid
00357    infringing on user name space.  This should be done even for local
00358    variables, as they might otherwise be expanded by user macros.
00359    There are some unavoidable exceptions within include files to
00360    define necessary library symbols; they are noted "INFRINGES ON
00361    USER NAME SPACE" below.  */
00362 
00363 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
00364 
00365 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00366 
00367 # if YYSTACK_USE_ALLOCA
00368 #  define YYSTACK_ALLOC alloca
00369 # else
00370 #  ifndef YYSTACK_USE_ALLOCA
00371 #   if defined (alloca) || defined (_ALLOCA_H)
00372 #    define YYSTACK_ALLOC alloca
00373 #   else
00374 #    ifdef __GNUC__
00375 #     define YYSTACK_ALLOC __builtin_alloca
00376 #    endif
00377 #   endif
00378 #  endif
00379 # endif
00380 
00381 # ifdef YYSTACK_ALLOC
00382    /* Pacify GCC's `empty if-body' warning. */
00383 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
00384 # else
00385 #  if defined (__STDC__) || defined (__cplusplus)
00386 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00387 #   define YYSIZE_T size_t
00388 #  endif
00389 #  define YYSTACK_ALLOC malloc
00390 #  define YYSTACK_FREE free
00391 # endif
00392 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
00393 
00394 
00395 #if (! defined (yyoverflow) \
00396      && (! defined (__cplusplus) \
00397         || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00398 
00399 /* A type that is properly aligned for any stack member.  */
00400 union yyalloc
00401 {
00402   short yyss;
00403   YYSTYPE yyvs;
00404 # if YYLSP_NEEDED
00405   YYLTYPE yyls;
00406 # endif
00407 };
00408 
00409 /* The size of the maximum gap between one aligned stack and the next.  */
00410 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
00411 
00412 /* The size of an array large to enough to hold all stacks, each with
00413    N elements.  */
00414 # if YYLSP_NEEDED
00415 #  define YYSTACK_BYTES(N) \
00416      ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))    \
00417       + 2 * YYSTACK_GAP_MAX)
00418 # else
00419 #  define YYSTACK_BYTES(N) \
00420      ((N) * (sizeof (short) + sizeof (YYSTYPE))                       \
00421       + YYSTACK_GAP_MAX)
00422 # endif
00423 
00424 /* Copy COUNT objects from FROM to TO.  The source and destination do
00425    not overlap.  */
00426 # ifndef YYCOPY
00427 #  if 1 < __GNUC__
00428 #   define YYCOPY(To, From, Count) \
00429       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00430 #  else
00431 #   define YYCOPY(To, From, Count)        \
00432       do                                  \
00433        {                                  \
00434          register YYSIZE_T yyi;           \
00435          for (yyi = 0; yyi < (Count); yyi++)     \
00436            (To)[yyi] = (From)[yyi];              \
00437        }                                  \
00438       while (0)
00439 #  endif
00440 # endif
00441 
00442 /* Relocate STACK from its old location to the new one.  The
00443    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00444    elements in the stack, and YYPTR gives the new location of the
00445    stack.  Advance YYPTR to a properly aligned location for the next
00446    stack.  */
00447 # define YYSTACK_RELOCATE(Stack)                               \
00448     do                                                         \
00449       {                                                               \
00450        YYSIZE_T yynewbytes;                                    \
00451        YYCOPY (&yyptr->Stack, Stack, yysize);                         \
00452        Stack = &yyptr->Stack;                                         \
00453        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;  \
00454        yyptr += yynewbytes / sizeof (*yyptr);                         \
00455       }                                                               \
00456     while (0)
00457 
00458 #endif
00459 
00460 
00461 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
00462 # define YYSIZE_T __SIZE_TYPE__
00463 #endif
00464 #if ! defined (YYSIZE_T) && defined (size_t)
00465 # define YYSIZE_T size_t
00466 #endif
00467 #if ! defined (YYSIZE_T)
00468 # if defined (__STDC__) || defined (__cplusplus)
00469 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00470 #  define YYSIZE_T size_t
00471 # endif
00472 #endif
00473 #if ! defined (YYSIZE_T)
00474 # define YYSIZE_T unsigned int
00475 #endif
00476 
00477 #define yyerrok             (yyerrstatus = 0)
00478 #define yyclearin    (yychar = YYEMPTY)
00479 #define YYEMPTY             -2
00480 #define YYEOF        0
00481 #define YYACCEPT     goto yyacceptlab
00482 #define YYABORT      goto yyabortlab
00483 #define YYERROR             goto yyerrlab1
00484 /* Like YYERROR except do call yyerror.  This remains here temporarily
00485    to ease the transition to the new meaning of YYERROR, for GCC.
00486    Once GCC version 2 has supplanted version 1, this can go.  */
00487 #define YYFAIL              goto yyerrlab
00488 #define YYRECOVERING()  (!!yyerrstatus)
00489 #define YYBACKUP(Token, Value)                                 \
00490 do                                                      \
00491   if (yychar == YYEMPTY && yylen == 1)                         \
00492     {                                                   \
00493       yychar = (Token);                                        \
00494       yylval = (Value);                                        \
00495       yychar1 = YYTRANSLATE (yychar);                          \
00496       YYPOPSTACK;                                       \
00497       goto yybackup;                                    \
00498     }                                                   \
00499   else                                                  \
00500     {                                                   \
00501       yyerror ("syntax error: cannot back up");                \
00502       YYERROR;                                                 \
00503     }                                                   \
00504 while (0)
00505 
00506 #define YYTERROR     1
00507 #define YYERRCODE    256
00508 
00509 
00510 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
00511    are run).
00512 
00513    When YYLLOC_DEFAULT is run, CURRENT is set the location of the
00514    first token.  By default, to implement support for ranges, extend
00515    its range to the last symbol.  */
00516 
00517 #ifndef YYLLOC_DEFAULT
00518 # define YYLLOC_DEFAULT(Current, Rhs, N)         \
00519    Current.last_line   = Rhs[N].last_line;       \
00520    Current.last_column = Rhs[N].last_column;
00521 #endif
00522 
00523 
00524 /* YYLEX -- calling `yylex' with the right arguments.  */
00525 
00526 #if YYPURE
00527 # if YYLSP_NEEDED
00528 #  ifdef YYLEX_PARAM
00529 #   define YYLEX            yylex (&yylval, &yylloc, YYLEX_PARAM)
00530 #  else
00531 #   define YYLEX            yylex (&yylval, &yylloc)
00532 #  endif
00533 # else /* !YYLSP_NEEDED */
00534 #  ifdef YYLEX_PARAM
00535 #   define YYLEX            yylex (&yylval, YYLEX_PARAM)
00536 #  else
00537 #   define YYLEX            yylex (&yylval)
00538 #  endif
00539 # endif /* !YYLSP_NEEDED */
00540 #else /* !YYPURE */
00541 # define YYLEX                     yylex ()
00542 #endif /* !YYPURE */
00543 
00544 
00545 /* Enable debugging if requested.  */
00546 #if YYDEBUG
00547 
00548 # ifndef YYFPRINTF
00549 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00550 #  define YYFPRINTF fprintf
00551 # endif
00552 
00553 # define YYDPRINTF(Args)                  \
00554 do {                                      \
00555   if (yydebug)                                   \
00556     YYFPRINTF Args;                       \
00557 } while (0)
00558 /* Nonzero means print parse trace.  It is left uninitialized so that
00559    multiple parsers can coexist.  */
00560 int yydebug;
00561 #else /* !YYDEBUG */
00562 # define YYDPRINTF(Args)
00563 #endif /* !YYDEBUG */
00564 
00565 /* YYINITDEPTH -- initial size of the parser's stacks.  */
00566 #ifndef       YYINITDEPTH
00567 # define YYINITDEPTH 200
00568 #endif
00569 
00570 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
00571    if the built-in stack extension method is used).
00572 
00573    Do not make this value too large; the results are undefined if
00574    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
00575    evaluated with infinite-precision integer arithmetic.  */
00576 
00577 #if YYMAXDEPTH == 0
00578 # undef YYMAXDEPTH
00579 #endif
00580 
00581 #ifndef YYMAXDEPTH
00582 # define YYMAXDEPTH 10000
00583 #endif
00584 
00585 #ifdef YYERROR_VERBOSE
00586 
00587 # ifndef yystrlen
00588 #  if defined (__GLIBC__) && defined (_STRING_H)
00589 #   define yystrlen strlen
00590 #  else
00591 /* Return the length of YYSTR.  */
00592 static YYSIZE_T
00593 #   if defined (__STDC__) || defined (__cplusplus)
00594 yystrlen (const char *yystr)
00595 #   else
00596 yystrlen (yystr)
00597      const char *yystr;
00598 #   endif
00599 {
00600   register const char *yys = yystr;
00601 
00602   while (*yys++ != '\0')
00603     continue;
00604 
00605   return yys - yystr - 1;
00606 }
00607 #  endif
00608 # endif
00609 
00610 # ifndef yystpcpy
00611 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
00612 #   define yystpcpy stpcpy
00613 #  else
00614 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
00615    YYDEST.  */
00616 static char *
00617 #   if defined (__STDC__) || defined (__cplusplus)
00618 yystpcpy (char *yydest, const char *yysrc)
00619 #   else
00620 yystpcpy (yydest, yysrc)
00621      char *yydest;
00622      const char *yysrc;
00623 #   endif
00624 {
00625   register char *yyd = yydest;
00626   register const char *yys = yysrc;
00627 
00628   while ((*yyd++ = *yys++) != '\0')
00629     continue;
00630 
00631   return yyd - 1;
00632 }
00633 #  endif
00634 # endif
00635 #endif
00636 
00637 #line 315 "/castro/street/H-alpha-linux/share/bison/bison.simple"
00638 
00639 
00640 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
00641    into yyparse.  The argument should have type void *.
00642    It should actually point to an object.
00643    Grammar actions can access the variable by casting it
00644    to the proper pointer type.  */
00645 
00646 #ifdef YYPARSE_PARAM
00647 # if defined (__STDC__) || defined (__cplusplus)
00648 #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
00649 #  define YYPARSE_PARAM_DECL
00650 # else
00651 #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
00652 #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
00653 # endif
00654 #else /* !YYPARSE_PARAM */
00655 # define YYPARSE_PARAM_ARG
00656 # define YYPARSE_PARAM_DECL
00657 #endif /* !YYPARSE_PARAM */
00658 
00659 /* Prevent warning if -Wstrict-prototypes.  */
00660 #ifdef __GNUC__
00661 # ifdef YYPARSE_PARAM
00662 int yyparse (void *);
00663 # else
00664 int yyparse (void);
00665 # endif
00666 #endif
00667 
00668 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
00669    variables are global, or local to YYPARSE.  */
00670 
00671 #define YY_DECL_NON_LSP_VARIABLES                \
00672 /* The lookahead symbol.  */                            \
00673 int yychar;                                      \
00674                                                  \
00675 /* The semantic value of the lookahead symbol. */       \
00676 YYSTYPE yylval;                                         \
00677                                                  \
00678 /* Number of parse errors so far.  */                   \
00679 int yynerrs;
00680 
00681 #if YYLSP_NEEDED
00682 # define YY_DECL_VARIABLES                \
00683 YY_DECL_NON_LSP_VARIABLES                 \
00684                                           \
00685 /* Location data for the lookahead symbol.  */   \
00686 YYLTYPE yylloc;
00687 #else
00688 # define YY_DECL_VARIABLES                \
00689 YY_DECL_NON_LSP_VARIABLES
00690 #endif
00691 
00692 
00693 /* If nonreentrant, generate the variables here. */
00694 
00695 #if !YYPURE
00696 YY_DECL_VARIABLES
00697 #endif  /* !YYPURE */
00698 
00699 int
00700 yyparse (YYPARSE_PARAM_ARG)
00701      YYPARSE_PARAM_DECL
00702 {
00703   /* If reentrant, generate the variables here. */
00704 #if YYPURE
00705   YY_DECL_VARIABLES
00706 #endif  /* !YYPURE */
00707 
00708   register int yystate;
00709   register int yyn;
00710   int yyresult;
00711   /* Number of tokens to shift before error messages enabled.  */
00712   int yyerrstatus;
00713   /* Lookahead token as an internal (translated) token number.  */
00714   int yychar1 = 0;
00715 
00716   /* Three stacks and their tools:
00717      `yyss': related to states,
00718      `yyvs': related to semantic values,
00719      `yyls': related to locations.
00720 
00721      Refer to the stacks thru separate pointers, to allow yyoverflow
00722      to reallocate them elsewhere.  */
00723 
00724   /* The state stack. */
00725   short       yyssa[YYINITDEPTH];
00726   short *yyss = yyssa;
00727   register short *yyssp;
00728 
00729   /* The semantic value stack.  */
00730   YYSTYPE yyvsa[YYINITDEPTH];
00731   YYSTYPE *yyvs = yyvsa;
00732   register YYSTYPE *yyvsp;
00733 
00734 #if YYLSP_NEEDED
00735   /* The location stack.  */
00736   YYLTYPE yylsa[YYINITDEPTH];
00737   YYLTYPE *yyls = yylsa;
00738   YYLTYPE *yylsp;
00739 #endif
00740 
00741 #if YYLSP_NEEDED
00742 # define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
00743 #else
00744 # define YYPOPSTACK   (yyvsp--, yyssp--)
00745 #endif
00746 
00747   YYSIZE_T yystacksize = YYINITDEPTH;
00748 
00749 
00750   /* The variables used to return semantic value and location from the
00751      action routines.  */
00752   YYSTYPE yyval;
00753 #if YYLSP_NEEDED
00754   YYLTYPE yyloc;
00755 #endif
00756 
00757   /* When reducing, the number of symbols on the RHS of the reduced
00758      rule. */
00759   int yylen;
00760 
00761   YYDPRINTF ((stderr, "Starting parse\n"));
00762 
00763   yystate = 0;
00764   yyerrstatus = 0;
00765   yynerrs = 0;
00766   yychar = YYEMPTY;         /* Cause a token to be read.  */
00767 
00768   /* Initialize stack pointers.
00769      Waste one element of value and location stack
00770      so that they stay on the same level as the state stack.
00771      The wasted elements are never initialized.  */
00772 
00773   yyssp = yyss;
00774   yyvsp = yyvs;
00775 #if YYLSP_NEEDED
00776   yylsp = yyls;
00777 #endif
00778   goto yysetstate;
00779 
00780 /*------------------------------------------------------------.
00781 | yynewstate -- Push a new state, which is found in yystate.  |
00782 `------------------------------------------------------------*/
00783  yynewstate:
00784   /* In all cases, when you get here, the value and location stacks
00785      have just been pushed. so pushing a state here evens the stacks.
00786      */
00787   yyssp++;
00788 
00789  yysetstate:
00790   *yyssp = yystate;
00791 
00792   if (yyssp >= yyss + yystacksize - 1)
00793     {
00794       /* Get the current used size of the three stacks, in elements.  */
00795       YYSIZE_T yysize = yyssp - yyss + 1;
00796 
00797 #ifdef yyoverflow
00798       {
00799        /* Give user a chance to reallocate the stack. Use copies of
00800           these so that the &'s don't force the real ones into
00801           memory.  */
00802        YYSTYPE *yyvs1 = yyvs;
00803        short *yyss1 = yyss;
00804 
00805        /* Each stack pointer address is followed by the size of the
00806           data in use in that stack, in bytes.  */
00807 # if YYLSP_NEEDED
00808        YYLTYPE *yyls1 = yyls;
00809        /* This used to be a conditional around just the two extra args,
00810           but that might be undefined if yyoverflow is a macro.  */
00811        yyoverflow ("parser stack overflow",
00812                   &yyss1, yysize * sizeof (*yyssp),
00813                   &yyvs1, yysize * sizeof (*yyvsp),
00814                   &yyls1, yysize * sizeof (*yylsp),
00815                   &yystacksize);
00816        yyls = yyls1;
00817 # else
00818        yyoverflow ("parser stack overflow",
00819                   &yyss1, yysize * sizeof (*yyssp),
00820                   &yyvs1, yysize * sizeof (*yyvsp),
00821                   &yystacksize);
00822 # endif
00823        yyss = yyss1;
00824        yyvs = yyvs1;
00825       }
00826 #else /* no yyoverflow */
00827 # ifndef YYSTACK_RELOCATE
00828       goto yyoverflowlab;
00829 # else
00830       /* Extend the stack our own way.  */
00831       if (yystacksize >= YYMAXDEPTH)
00832        goto yyoverflowlab;
00833       yystacksize *= 2;
00834       if (yystacksize > YYMAXDEPTH)
00835        yystacksize = YYMAXDEPTH;
00836 
00837       {
00838        short *yyss1 = yyss;
00839        union yyalloc *yyptr =
00840          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
00841        if (! yyptr)
00842          goto yyoverflowlab;
00843        YYSTACK_RELOCATE (yyss);
00844        YYSTACK_RELOCATE (yyvs);
00845 # if YYLSP_NEEDED
00846        YYSTACK_RELOCATE (yyls);
00847 # endif
00848 # undef YYSTACK_RELOCATE
00849        if (yyss1 != yyssa)
00850          YYSTACK_FREE (yyss1);
00851       }
00852 # endif
00853 #endif /* no yyoverflow */
00854 
00855       yyssp = yyss + yysize - 1;
00856       yyvsp = yyvs + yysize - 1;
00857 #if YYLSP_NEEDED
00858       yylsp = yyls + yysize - 1;
00859 #endif
00860 
00861       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
00862                 (unsigned long int) yystacksize));
00863 
00864       if (yyssp >= yyss + yystacksize - 1)
00865        YYABORT;
00866     }
00867 
00868   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
00869 
00870   goto yybackup;
00871 
00872 
00873 /*-----------.
00874 | yybackup.  |
00875 `-----------*/
00876 yybackup:
00877 
00878 /* Do appropriate processing given the current state.  */
00879 /* Read a lookahead token if we need one and don't already have one.  */
00880 /* yyresume: */
00881 
00882   /* First try to decide what to do without reference to lookahead token.  */
00883 
00884   yyn = yypact[yystate];
00885   if (yyn == YYFLAG)
00886     goto yydefault;
00887 
00888   /* Not known => get a lookahead token if don't already have one.  */
00889 
00890   /* yychar is either YYEMPTY or YYEOF
00891      or a valid token in external form.  */
00892 
00893   if (yychar == YYEMPTY)
00894     {
00895       YYDPRINTF ((stderr, "Reading a token: "));
00896       yychar = YYLEX;
00897     }
00898 
00899   /* Convert token to internal form (in yychar1) for indexing tables with */
00900 
00901   if (yychar <= 0)          /* This means end of input. */
00902     {
00903       yychar1 = 0;
00904       yychar = YYEOF;              /* Don't call YYLEX any more */
00905 
00906       YYDPRINTF ((stderr, "Now at end of input.\n"));
00907     }
00908   else
00909     {
00910       yychar1 = YYTRANSLATE (yychar);
00911 
00912 #if YYDEBUG
00913      /* We have to keep this `#if YYDEBUG', since we use variables
00914        which are defined only if `YYDEBUG' is set.  */
00915       if (yydebug)
00916        {
00917          YYFPRINTF (stderr, "Next token is %d (%s",
00918                    yychar, yytname[yychar1]);
00919          /* Give the individual parser a way to print the precise
00920             meaning of a token, for further debugging info.  */
00921 # ifdef YYPRINT
00922          YYPRINT (stderr, yychar, yylval);
00923 # endif
00924          YYFPRINTF (stderr, ")\n");
00925        }
00926 #endif
00927     }
00928 
00929   yyn += yychar1;
00930   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
00931     goto yydefault;
00932 
00933   yyn = yytable[yyn];
00934 
00935   /* yyn is what to do for this token type in this state.
00936      Negative => reduce, -yyn is rule number.
00937      Positive => shift, yyn is new state.
00938        New state is final state => don't bother to shift,
00939        just return success.
00940      0, or most negative number => error.  */
00941 
00942   if (yyn < 0)
00943     {
00944       if (yyn == YYFLAG)
00945        goto yyerrlab;
00946       yyn = -yyn;
00947       goto yyreduce;
00948     }
00949   else if (yyn == 0)
00950     goto yyerrlab;
00951 
00952   if (yyn == YYFINAL)
00953     YYACCEPT;
00954 
00955   /* Shift the lookahead token.  */
00956   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
00957              yychar, yytname[yychar1]));
00958 
00959   /* Discard the token being shifted unless it is eof.  */
00960   if (yychar != YYEOF)
00961     yychar = YYEMPTY;
00962 
00963   *++yyvsp = yylval;
00964 #if YYLSP_NEEDED
00965   *++yylsp = yylloc;
00966 #endif
00967 
00968   /* Count tokens shifted since error; after three, turn off error
00969      status.  */
00970   if (yyerrstatus)
00971     yyerrstatus--;
00972 
00973   yystate = yyn;
00974   goto yynewstate;
00975 
00976 
00977 /*-----------------------------------------------------------.
00978 | yydefault -- do the default action for the current state.  |
00979 `-----------------------------------------------------------*/
00980 yydefault:
00981   yyn = yydefact[yystate];
00982   if (yyn == 0)
00983     goto yyerrlab;
00984   goto yyreduce;
00985 
00986 
00987 /*-----------------------------.
00988 | yyreduce -- Do a reduction.  |
00989 `-----------------------------*/
00990 yyreduce:
00991   /* yyn is the number of a rule to reduce with.  */
00992   yylen = yyr2[yyn];
00993 
00994   /* If YYLEN is nonzero, implement the default value of the action:
00995      `$$ = $1'.
00996 
00997      Otherwise, the following line sets YYVAL to the semantic value of
00998      the lookahead token.  This behavior is undocumented and Bison
00999      users should not rely upon it.  Assigning to YYVAL
01000      unconditionally makes the parser a bit smaller, and it avoids a
01001      GCC warning that YYVAL may be used uninitialized.  */
01002   yyval = yyvsp[1-yylen];
01003 
01004 #if YYLSP_NEEDED
01005   /* Similarly for the default location.  Let the user run additional
01006      commands if for instance locations are ranges.  */
01007   yyloc = yylsp[1-yylen];
01008   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
01009 #endif
01010 
01011 #if YYDEBUG
01012   /* We have to keep this `#if YYDEBUG', since we use variables which
01013      are defined only if `YYDEBUG' is set.  */
01014   if (yydebug)
01015     {
01016       int yyi;
01017 
01018       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
01019                yyn, yyrline[yyn]);
01020 
01021       /* Print the symbols being reduced, and their result.  */
01022       for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
01023        YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
01024       YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
01025     }
01026 #endif
01027 
01028   switch (yyn) {
01029 
01030 case 1:
01031 #line 175 "plural.y"
01032 {
01033            if (yyvsp[0].exp == NULL)
01034              YYABORT;
01035            ((struct parse_args *) arg)->res = yyvsp[0].exp;
01036          }
01037     break;
01038 case 2:
01039 #line 183 "plural.y"
01040 {
01041            yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
01042          }
01043     break;
01044 case 3:
01045 #line 187 "plural.y"
01046 {
01047            yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
01048          }
01049     break;
01050 case 4:
01051 #line 191 "plural.y"
01052 {
01053            yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
01054          }
01055     break;
01056 case 5:
01057 #line 195 "plural.y"
01058 {
01059            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
01060          }
01061     break;
01062 case 6:
01063 #line 199 "plural.y"
01064 {
01065            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
01066          }
01067     break;
01068 case 7:
01069 #line 203 "plural.y"
01070 {
01071            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
01072          }
01073     break;
01074 case 8:
01075 #line 207 "plural.y"
01076 {
01077            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
01078          }
01079     break;
01080 case 9:
01081 #line 211 "plural.y"
01082 {
01083            yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
01084          }
01085     break;
01086 case 10:
01087 #line 215 "plural.y"
01088 {
01089            yyval.exp = new_exp_0 (var);
01090          }
01091     break;
01092 case 11:
01093 #line 219 "plural.y"
01094 {
01095            if ((yyval.exp = new_exp_0 (num)) != NULL)
01096              yyval.exp->val.num = yyvsp[0].num;
01097          }
01098     break;
01099 case 12:
01100 #line 224 "plural.y"
01101 {
01102            yyval.exp = yyvsp[-1].exp;
01103          }
01104     break;
01105 }
01106 
01107 #line 705 "/castro/street/H-alpha-linux/share/bison/bison.simple"
01108 
01109 
01110   yyvsp -= yylen;
01111   yyssp -= yylen;
01112 #if YYLSP_NEEDED
01113   yylsp -= yylen;
01114 #endif
01115 
01116 #if YYDEBUG
01117   if (yydebug)
01118     {
01119       short *yyssp1 = yyss - 1;
01120       YYFPRINTF (stderr, "state stack now");
01121       while (yyssp1 != yyssp)
01122        YYFPRINTF (stderr, " %d", *++yyssp1);
01123       YYFPRINTF (stderr, "\n");
01124     }
01125 #endif
01126 
01127   *++yyvsp = yyval;
01128 #if YYLSP_NEEDED
01129   *++yylsp = yyloc;
01130 #endif
01131 
01132   /* Now `shift' the result of the reduction.  Determine what state
01133      that goes to, based on the state we popped back to and the rule
01134      number reduced by.  */
01135 
01136   yyn = yyr1[yyn];
01137 
01138   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
01139   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01140     yystate = yytable[yystate];
01141   else
01142     yystate = yydefgoto[yyn - YYNTBASE];
01143 
01144   goto yynewstate;
01145 
01146 
01147 /*------------------------------------.
01148 | yyerrlab -- here on detecting error |
01149 `------------------------------------*/
01150 yyerrlab:
01151   /* If not already recovering from an error, report this error.  */
01152   if (!yyerrstatus)
01153     {
01154       ++yynerrs;
01155 
01156 #ifdef YYERROR_VERBOSE
01157       yyn = yypact[yystate];
01158 
01159       if (yyn > YYFLAG && yyn < YYLAST)
01160        {
01161          YYSIZE_T yysize = 0;
01162          char *yymsg;
01163          int yyx, yycount;
01164 
01165          yycount = 0;
01166          /* Start YYX at -YYN if negative to avoid negative indexes in
01167             YYCHECK.  */
01168          for (yyx = yyn < 0 ? -yyn : 0;
01169               yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
01170            if (yycheck[yyx + yyn] == yyx)
01171              yysize += yystrlen (yytname[yyx]) + 15, yycount++;
01172          yysize += yystrlen ("parse error, unexpected ") + 1;
01173          yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
01174          yymsg = (char *) YYSTACK_ALLOC (yysize);
01175          if (yymsg != 0)
01176            {
01177              char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
01178              yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
01179 
01180              if (yycount < 5)
01181               {
01182                 yycount = 0;
01183                 for (yyx = yyn < 0 ? -yyn : 0;
01184                      yyx < (int) (sizeof (yytname) / sizeof (char *));
01185                      yyx++)
01186                   if (yycheck[yyx + yyn] == yyx)
01187                     {
01188                      const char *yyq = ! yycount ? ", expecting " : " or ";
01189                      yyp = yystpcpy (yyp, yyq);
01190                      yyp = yystpcpy (yyp, yytname[yyx]);
01191                      yycount++;
01192                     }
01193               }
01194              yyerror (yymsg);
01195              YYSTACK_FREE (yymsg);
01196            }
01197          else
01198            yyerror ("parse error; also virtual memory exhausted");
01199        }
01200       else
01201 #endif /* defined (YYERROR_VERBOSE) */
01202        yyerror ("parse error");
01203     }
01204   goto yyerrlab1;
01205 
01206 
01207 /*--------------------------------------------------.
01208 | yyerrlab1 -- error raised explicitly by an action |
01209 `--------------------------------------------------*/
01210 yyerrlab1:
01211   if (yyerrstatus == 3)
01212     {
01213       /* If just tried and failed to reuse lookahead token after an
01214         error, discard it.  */
01215 
01216       /* return failure if at end of input */
01217       if (yychar == YYEOF)
01218        YYABORT;
01219       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
01220                 yychar, yytname[yychar1]));
01221       yychar = YYEMPTY;
01222     }
01223 
01224   /* Else will try to reuse lookahead token after shifting the error
01225      token.  */
01226 
01227   yyerrstatus = 3;          /* Each real token shifted decrements this */
01228 
01229   goto yyerrhandle;
01230 
01231 
01232 /*-------------------------------------------------------------------.
01233 | yyerrdefault -- current state does not do anything special for the |
01234 | error token.                                                       |
01235 `-------------------------------------------------------------------*/
01236 yyerrdefault:
01237 #if 0
01238   /* This is wrong; only states that explicitly want error tokens
01239      should shift them.  */
01240 
01241   /* If its default is to accept any token, ok.  Otherwise pop it.  */
01242   yyn = yydefact[yystate];
01243   if (yyn)
01244     goto yydefault;
01245 #endif
01246 
01247 
01248 /*---------------------------------------------------------------.
01249 | yyerrpop -- pop the current state because it cannot handle the |
01250 | error token                                                    |
01251 `---------------------------------------------------------------*/
01252 yyerrpop:
01253   if (yyssp == yyss)
01254     YYABORT;
01255   yyvsp--;
01256   yystate = *--yyssp;
01257 #if YYLSP_NEEDED
01258   yylsp--;
01259 #endif
01260 
01261 #if YYDEBUG
01262   if (yydebug)
01263     {
01264       short *yyssp1 = yyss - 1;
01265       YYFPRINTF (stderr, "Error: state stack now");
01266       while (yyssp1 != yyssp)
01267        YYFPRINTF (stderr, " %d", *++yyssp1);
01268       YYFPRINTF (stderr, "\n");
01269     }
01270 #endif
01271 
01272 /*--------------.
01273 | yyerrhandle.  |
01274 `--------------*/
01275 yyerrhandle:
01276   yyn = yypact[yystate];
01277   if (yyn == YYFLAG)
01278     goto yyerrdefault;
01279 
01280   yyn += YYTERROR;
01281   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01282     goto yyerrdefault;
01283 
01284   yyn = yytable[yyn];
01285   if (yyn < 0)
01286     {
01287       if (yyn == YYFLAG)
01288        goto yyerrpop;
01289       yyn = -yyn;
01290       goto yyreduce;
01291     }
01292   else if (yyn == 0)
01293     goto yyerrpop;
01294 
01295   if (yyn == YYFINAL)
01296     YYACCEPT;
01297 
01298   YYDPRINTF ((stderr, "Shifting error token, "));
01299 
01300   *++yyvsp = yylval;
01301 #if YYLSP_NEEDED
01302   *++yylsp = yylloc;
01303 #endif
01304 
01305   yystate = yyn;
01306   goto yynewstate;
01307 
01308 
01309 /*-------------------------------------.
01310 | yyacceptlab -- YYACCEPT comes here.  |
01311 `-------------------------------------*/
01312 yyacceptlab:
01313   yyresult = 0;
01314   goto yyreturn;
01315 
01316 /*-----------------------------------.
01317 | yyabortlab -- YYABORT comes here.  |
01318 `-----------------------------------*/
01319 yyabortlab:
01320   yyresult = 1;
01321   goto yyreturn;
01322 
01323 /*---------------------------------------------.
01324 | yyoverflowab -- parser overflow comes here.  |
01325 `---------------------------------------------*/
01326 yyoverflowlab:
01327   yyerror ("parser stack overflow");
01328   yyresult = 2;
01329   /* Fall through.  */
01330 
01331 yyreturn:
01332 #ifndef yyoverflow
01333   if (yyss != yyssa)
01334     YYSTACK_FREE (yyss);
01335 #endif
01336   return yyresult;
01337 }
01338 #line 229 "plural.y"
01339 
01340 
01341 void
01342 internal_function
01343 FREE_EXPRESSION (exp)
01344      struct expression *exp;
01345 {
01346   if (exp == NULL)
01347     return;
01348 
01349   /* Handle the recursive case.  */
01350   switch (exp->nargs)
01351     {
01352     case 3:
01353       FREE_EXPRESSION (exp->val.args[2]);
01354       /* FALLTHROUGH */
01355     case 2:
01356       FREE_EXPRESSION (exp->val.args[1]);
01357       /* FALLTHROUGH */
01358     case 1:
01359       FREE_EXPRESSION (exp->val.args[0]);
01360       /* FALLTHROUGH */
01361     default:
01362       break;
01363     }
01364 
01365   free (exp);
01366 }
01367 
01368 
01369 static int
01370 yylex (lval, pexp)
01371      YYSTYPE *lval;
01372      const char **pexp;
01373 {
01374   const char *exp = *pexp;
01375   int result;
01376 
01377   while (1)
01378     {
01379       if (exp[0] == '\0')
01380        {
01381          *pexp = exp;
01382          return YYEOF;
01383        }
01384 
01385       if (exp[0] != ' ' && exp[0] != '\t')
01386        break;
01387 
01388       ++exp;
01389     }
01390 
01391   result = *exp++;
01392   switch (result)
01393     {
01394     case '0': case '1': case '2': case '3': case '4':
01395     case '5': case '6': case '7': case '8': case '9':
01396       {
01397        unsigned long int n = result - '0';
01398        while (exp[0] >= '0' && exp[0] <= '9')
01399          {
01400            n *= 10;
01401            n += exp[0] - '0';
01402            ++exp;
01403          }
01404        lval->num = n;
01405        result = NUMBER;
01406       }
01407       break;
01408 
01409     case '=':
01410       if (exp[0] == '=')
01411        {
01412          ++exp;
01413          lval->op = equal;
01414          result = EQUOP2;
01415        }
01416       else
01417        result = YYERRCODE;
01418       break;
01419 
01420     case '!':
01421       if (exp[0] == '=')
01422        {
01423          ++exp;
01424          lval->op = not_equal;
01425          result = EQUOP2;
01426        }
01427       break;
01428 
01429     case '&':
01430     case '|':
01431       if (exp[0] == result)
01432        ++exp;
01433       else
01434        result = YYERRCODE;
01435       break;
01436 
01437     case '<':
01438       if (exp[0] == '=')
01439        {
01440          ++exp;
01441          lval->op = less_or_equal;
01442        }
01443       else
01444        lval->op = less_than;
01445       result = CMPOP2;
01446       break;
01447 
01448     case '>':
01449       if (exp[0] == '=')
01450        {
01451          ++exp;
01452          lval->op = greater_or_equal;
01453        }
01454       else
01455        lval->op = greater_than;
01456       result = CMPOP2;
01457       break;
01458 
01459     case '*':
01460       lval->op = mult;
01461       result = MULOP2;
01462       break;
01463 
01464     case '/':
01465       lval->op = divide;
01466       result = MULOP2;
01467       break;
01468 
01469     case '%':
01470       lval->op = module;
01471       result = MULOP2;
01472       break;
01473 
01474     case '+':
01475       lval->op = plus;
01476       result = ADDOP2;
01477       break;
01478 
01479     case '-':
01480       lval->op = minus;
01481       result = ADDOP2;
01482       break;
01483 
01484     case 'n':
01485     case '?':
01486     case ':':
01487     case '(':
01488     case ')':
01489       /* Nothing, just return the character.  */
01490       break;
01491 
01492     case ';':
01493     case '\n':
01494     case '\0':
01495       /* Be safe and let the user call this function again.  */
01496       --exp;
01497       result = YYEOF;
01498       break;
01499 
01500     default:
01501       result = YYERRCODE;
01502 #if YYDEBUG != 0
01503       --exp;
01504 #endif
01505       break;
01506     }
01507 
01508   *pexp = exp;
01509 
01510   return result;
01511 }
01512 
01513 
01514 static void
01515 yyerror (str)
01516      const char *str;
01517 {
01518   /* Do nothing.  We don't print error messages here.  */
01519 }