Andreas Krennmair:
[apps/madmutt.git] / intl / plural.c
1 /* A Bison parser, made by GNU Bison 1.875a.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 /* As a special exception, when this file is copied by Bison into a
22    Bison output file, you may use that output file without restriction.
23    This special exception was added by the Free Software Foundation
24    in version 1.24 of Bison.  */
25
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30    infringing on user name space.  This should be done even for local
31    variables, as they might otherwise be expanded by user macros.
32    There are some unavoidable exceptions within include files to
33    define necessary library symbols; they are noted "INFRINGES ON
34    USER NAME SPACE" below.  */
35
36 /* Identify Bison output.  */
37 #define YYBISON 1
38
39 /* Skeleton name.  */
40 #define YYSKELETON_NAME "yacc.c"
41
42 /* Pure parsers.  */
43 #define YYPURE 1
44
45 /* Using locations.  */
46 #define YYLSP_NEEDED 0
47
48 /* If NAME_PREFIX is specified substitute the variables and functions
49    names.  */
50 #define yyparse __gettextparse
51 #define yylex   __gettextlex
52 #define yyerror __gettexterror
53 #define yylval  __gettextlval
54 #define yychar  __gettextchar
55 #define yydebug __gettextdebug
56 #define yynerrs __gettextnerrs
57
58
59 /* Tokens.  */
60 #ifndef YYTOKENTYPE
61 # define YYTOKENTYPE
62    /* Put the tokens into the symbol table, so that GDB and other debuggers
63       know about them.  */
64    enum yytokentype {
65      EQUOP2 = 258,
66      CMPOP2 = 259,
67      ADDOP2 = 260,
68      MULOP2 = 261,
69      NUMBER = 262
70    };
71 #endif
72 #define EQUOP2 258
73 #define CMPOP2 259
74 #define ADDOP2 260
75 #define MULOP2 261
76 #define NUMBER 262
77
78
79
80
81 /* Copy the first part of user declarations.  */
82 #line 1 "plural.y"
83
84 /* Expression parsing for plural form selection.
85    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
86    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
87
88    This program is free software; you can redistribute it and/or modify it
89    under the terms of the GNU Library General Public License as published
90    by the Free Software Foundation; either version 2, or (at your option)
91    any later version.
92
93    This program is distributed in the hope that it will be useful,
94    but WITHOUT ANY WARRANTY; without even the implied warranty of
95    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
96    Library General Public License for more details.
97
98    You should have received a copy of the GNU Library General Public
99    License along with this program; if not, write to the Free Software
100    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
101    USA.  */
102
103 /* The bison generated parser uses alloca.  AIX 3 forces us to put this
104    declaration at the beginning of the file.  The declaration in bison's
105    skeleton file comes too late.  This must come before <config.h>
106    because <config.h> may include arbitrary system headers.  */
107 #if defined _AIX && !defined __GNUC__
108  #pragma alloca
109 #endif
110
111 #ifdef HAVE_CONFIG_H
112 # include <config.h>
113 #endif
114
115 #include <stdlib.h>
116 #include "gettextP.h"
117
118 /* Names for the libintl functions are a problem.  They must not clash
119    with existing names and they should follow ANSI C.  But this source
120    code is also used in GNU C Library where the names have a __
121    prefix.  So we have to make a difference here.  */
122 #ifdef _LIBC
123 # define FREE_EXPRESSION __gettext_free_exp
124 #else
125 # define FREE_EXPRESSION gettext_free_exp__
126 # define __gettextparse gettextparse__
127 #endif
128
129 #define YYLEX_PARAM     &((struct parse_args *) arg)->cp
130 #define YYPARSE_PARAM   arg
131
132
133 /* Enabling traces.  */
134 #ifndef YYDEBUG
135 # define YYDEBUG 0
136 #endif
137
138 /* Enabling verbose error messages.  */
139 #ifdef YYERROR_VERBOSE
140 # undef YYERROR_VERBOSE
141 # define YYERROR_VERBOSE 1
142 #else
143 # define YYERROR_VERBOSE 0
144 #endif
145
146 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
147 #line 53 "plural.y"
148 typedef union YYSTYPE {
149   unsigned long int num;
150   enum operator op;
151   struct expression *exp;
152 } YYSTYPE;
153 /* Line 191 of yacc.c.  */
154 #line 155 "plural.c"
155 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
156 # define YYSTYPE_IS_DECLARED 1
157 # define YYSTYPE_IS_TRIVIAL 1
158 #endif
159
160
161
162 /* Copy the second part of user declarations.  */
163 #line 59 "plural.y"
164
165 /* Prototypes for local functions.  */
166 static struct expression *new_exp PARAMS ((int nargs, enum operator op,
167                                            struct expression * const *args));
168 static inline struct expression *new_exp_0 PARAMS ((enum operator op));
169 static inline struct expression *new_exp_1 PARAMS ((enum operator op,
170                                                    struct expression *right));
171 static struct expression *new_exp_2 PARAMS ((enum operator op,
172                                              struct expression *left,
173                                              struct expression *right));
174 static inline struct expression *new_exp_3 PARAMS ((enum operator op,
175                                                    struct expression *bexp,
176                                                    struct expression *tbranch,
177                                                    struct expression *fbranch));
178 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
179 static void yyerror PARAMS ((const char *str));
180
181 /* Allocation of expressions.  */
182
183 static struct expression *
184 new_exp (nargs, op, args)
185      int nargs;
186      enum operator op;
187      struct expression * const *args;
188 {
189   int i;
190   struct expression *newp;
191
192   /* If any of the argument could not be malloc'ed, just return NULL.  */
193   for (i = nargs - 1; i >= 0; i--)
194     if (args[i] == NULL)
195       goto fail;
196
197   /* Allocate a new expression.  */
198   newp = (struct expression *) malloc (sizeof (*newp));
199   if (newp != NULL)
200     {
201       newp->nargs = nargs;
202       newp->operation = op;
203       for (i = nargs - 1; i >= 0; i--)
204         newp->val.args[i] = args[i];
205       return newp;
206     }
207
208  fail:
209   for (i = nargs - 1; i >= 0; i--)
210     FREE_EXPRESSION (args[i]);
211
212   return NULL;
213 }
214
215 static inline struct expression *
216 new_exp_0 (op)
217      enum operator op;
218 {
219   return new_exp (0, op, NULL);
220 }
221
222 static inline struct expression *
223 new_exp_1 (op, right)
224      enum operator op;
225      struct expression *right;
226 {
227   struct expression *args[1];
228
229   args[0] = right;
230   return new_exp (1, op, args);
231 }
232
233 static struct expression *
234 new_exp_2 (op, left, right)
235      enum operator op;
236      struct expression *left;
237      struct expression *right;
238 {
239   struct expression *args[2];
240
241   args[0] = left;
242   args[1] = right;
243   return new_exp (2, op, args);
244 }
245
246 static inline struct expression *
247 new_exp_3 (op, bexp, tbranch, fbranch)
248      enum operator op;
249      struct expression *bexp;
250      struct expression *tbranch;
251      struct expression *fbranch;
252 {
253   struct expression *args[3];
254
255   args[0] = bexp;
256   args[1] = tbranch;
257   args[2] = fbranch;
258   return new_exp (3, op, args);
259 }
260
261
262
263 /* Line 214 of yacc.c.  */
264 #line 265 "plural.c"
265
266 #if ! defined (yyoverflow) || YYERROR_VERBOSE
267
268 /* The parser invokes alloca or malloc; define the necessary symbols.  */
269
270 # if YYSTACK_USE_ALLOCA
271 #  define YYSTACK_ALLOC alloca
272 # else
273 #  ifndef YYSTACK_USE_ALLOCA
274 #   if defined (alloca) || defined (_ALLOCA_H)
275 #    define YYSTACK_ALLOC alloca
276 #   else
277 #    ifdef __GNUC__
278 #     define YYSTACK_ALLOC __builtin_alloca
279 #    endif
280 #   endif
281 #  endif
282 # endif
283
284 # ifdef YYSTACK_ALLOC
285    /* Pacify GCC's `empty if-body' warning. */
286 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
287 # else
288 #  if defined (__STDC__) || defined (__cplusplus)
289 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
290 #   define YYSIZE_T size_t
291 #  endif
292 #  define YYSTACK_ALLOC malloc
293 #  define YYSTACK_FREE free
294 # endif
295 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
296
297
298 #if (! defined (yyoverflow) \
299      && (! defined (__cplusplus) \
300          || (YYSTYPE_IS_TRIVIAL)))
301
302 /* A type that is properly aligned for any stack member.  */
303 union yyalloc
304 {
305   short yyss;
306   YYSTYPE yyvs;
307   };
308
309 /* The size of the maximum gap between one aligned stack and the next.  */
310 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
311
312 /* The size of an array large to enough to hold all stacks, each with
313    N elements.  */
314 # define YYSTACK_BYTES(N) \
315      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
316       + YYSTACK_GAP_MAXIMUM)
317
318 /* Copy COUNT objects from FROM to TO.  The source and destination do
319    not overlap.  */
320 # ifndef YYCOPY
321 #  if 1 < __GNUC__
322 #   define YYCOPY(To, From, Count) \
323       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
324 #  else
325 #   define YYCOPY(To, From, Count)              \
326       do                                        \
327         {                                       \
328           register YYSIZE_T yyi;                \
329           for (yyi = 0; yyi < (Count); yyi++)   \
330             (To)[yyi] = (From)[yyi];            \
331         }                                       \
332       while (0)
333 #  endif
334 # endif
335
336 /* Relocate STACK from its old location to the new one.  The
337    local variables YYSIZE and YYSTACKSIZE give the old and new number of
338    elements in the stack, and YYPTR gives the new location of the
339    stack.  Advance YYPTR to a properly aligned location for the next
340    stack.  */
341 # define YYSTACK_RELOCATE(Stack)                                        \
342     do                                                                  \
343       {                                                                 \
344         YYSIZE_T yynewbytes;                                            \
345         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
346         Stack = &yyptr->Stack;                                          \
347         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
348         yyptr += yynewbytes / sizeof (*yyptr);                          \
349       }                                                                 \
350     while (0)
351
352 #endif
353
354 #if defined (__STDC__) || defined (__cplusplus)
355    typedef signed char yysigned_char;
356 #else
357    typedef short yysigned_char;
358 #endif
359
360 /* YYFINAL -- State number of the termination state. */
361 #define YYFINAL  9
362 /* YYLAST -- Last index in YYTABLE.  */
363 #define YYLAST   54
364
365 /* YYNTOKENS -- Number of terminals. */
366 #define YYNTOKENS  16
367 /* YYNNTS -- Number of nonterminals. */
368 #define YYNNTS  3
369 /* YYNRULES -- Number of rules. */
370 #define YYNRULES  13
371 /* YYNRULES -- Number of states. */
372 #define YYNSTATES  27
373
374 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
375 #define YYUNDEFTOK  2
376 #define YYMAXUTOK   262
377
378 #define YYTRANSLATE(YYX)                                                \
379   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
380
381 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
382 static const unsigned char yytranslate[] =
383 {
384        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
385        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
386        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
387        2,     2,     2,    10,     2,     2,     2,     2,     5,     2,
388       14,    15,     2,     2,     2,     2,     2,     2,     2,     2,
389        2,     2,     2,     2,     2,     2,     2,     2,    12,     2,
390        2,     2,     2,     3,     2,     2,     2,     2,     2,     2,
391        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
392        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
393        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
394        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
395       13,     2,     2,     2,     2,     2,     2,     2,     2,     2,
396        2,     2,     2,     2,     4,     2,     2,     2,     2,     2,
397        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
398        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
399        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
400        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
401        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
402        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
403        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
404        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
405        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
406        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
407        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
408        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
409        2,     2,     2,     2,     2,     2,     1,     2,     6,     7,
410        8,     9,    11
411 };
412
413 #if YYDEBUG
414 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
415    YYRHS.  */
416 static const unsigned char yyprhs[] =
417 {
418        0,     0,     3,     5,    11,    15,    19,    23,    27,    31,
419       35,    38,    40,    42
420 };
421
422 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
423 static const yysigned_char yyrhs[] =
424 {
425       17,     0,    -1,    18,    -1,    18,     3,    18,    12,    18,
426       -1,    18,     4,    18,    -1,    18,     5,    18,    -1,    18,
427        6,    18,    -1,    18,     7,    18,    -1,    18,     8,    18,
428       -1,    18,     9,    18,    -1,    10,    18,    -1,    13,    -1,
429       11,    -1,    14,    18,    15,    -1
430 };
431
432 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
433 static const unsigned char yyrline[] =
434 {
435        0,   178,   178,   186,   190,   194,   198,   202,   206,   210,
436      214,   218,   222,   227
437 };
438 #endif
439
440 #if YYDEBUG || YYERROR_VERBOSE
441 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
442    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
443 static const char *const yytname[] =
444 {
445   "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2", 
446   "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'", 
447   "$accept", "start", "exp", 0
448 };
449 #endif
450
451 # ifdef YYPRINT
452 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
453    token YYLEX-NUM.  */
454 static const unsigned short yytoknum[] =
455 {
456        0,   256,   257,    63,   124,    38,   258,   259,   260,   261,
457       33,   262,    58,   110,    40,    41
458 };
459 # endif
460
461 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
462 static const unsigned char yyr1[] =
463 {
464        0,    16,    17,    18,    18,    18,    18,    18,    18,    18,
465       18,    18,    18,    18
466 };
467
468 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
469 static const unsigned char yyr2[] =
470 {
471        0,     2,     1,     5,     3,     3,     3,     3,     3,     3,
472        2,     1,     1,     3
473 };
474
475 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
476    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
477    means the default is an error.  */
478 static const unsigned char yydefact[] =
479 {
480        0,     0,    12,    11,     0,     0,     2,    10,     0,     1,
481        0,     0,     0,     0,     0,     0,     0,    13,     0,     4,
482        5,     6,     7,     8,     9,     0,     3
483 };
484
485 /* YYDEFGOTO[NTERM-NUM]. */
486 static const yysigned_char yydefgoto[] =
487 {
488       -1,     5,     6
489 };
490
491 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
492    STATE-NUM.  */
493 #define YYPACT_NINF -10
494 static const yysigned_char yypact[] =
495 {
496       -9,    -9,   -10,   -10,    -9,     8,    36,   -10,    13,   -10,
497       -9,    -9,    -9,    -9,    -9,    -9,    -9,   -10,    26,    41,
498       45,    18,    -2,    14,   -10,    -9,    36
499 };
500
501 /* YYPGOTO[NTERM-NUM].  */
502 static const yysigned_char yypgoto[] =
503 {
504      -10,   -10,    -1
505 };
506
507 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
508    positive, shift that token.  If negative, reduce the rule which
509    number is the opposite.  If zero, do what YYDEFACT says.
510    If YYTABLE_NINF, syntax error.  */
511 #define YYTABLE_NINF -1
512 static const unsigned char yytable[] =
513 {
514        7,     1,     2,     8,     3,     4,    15,    16,     9,    18,
515       19,    20,    21,    22,    23,    24,    10,    11,    12,    13,
516       14,    15,    16,    16,    26,    14,    15,    16,    17,    10,
517       11,    12,    13,    14,    15,    16,     0,     0,    25,    10,
518       11,    12,    13,    14,    15,    16,    12,    13,    14,    15,
519       16,    13,    14,    15,    16
520 };
521
522 static const yysigned_char yycheck[] =
523 {
524        1,    10,    11,     4,    13,    14,     8,     9,     0,    10,
525       11,    12,    13,    14,    15,    16,     3,     4,     5,     6,
526        7,     8,     9,     9,    25,     7,     8,     9,    15,     3,
527        4,     5,     6,     7,     8,     9,    -1,    -1,    12,     3,
528        4,     5,     6,     7,     8,     9,     5,     6,     7,     8,
529        9,     6,     7,     8,     9
530 };
531
532 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
533    symbol of state STATE-NUM.  */
534 static const unsigned char yystos[] =
535 {
536        0,    10,    11,    13,    14,    17,    18,    18,    18,     0,
537        3,     4,     5,     6,     7,     8,     9,    15,    18,    18,
538       18,    18,    18,    18,    18,    12,    18
539 };
540
541 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
542 # define YYSIZE_T __SIZE_TYPE__
543 #endif
544 #if ! defined (YYSIZE_T) && defined (size_t)
545 # define YYSIZE_T size_t
546 #endif
547 #if ! defined (YYSIZE_T)
548 # if defined (__STDC__) || defined (__cplusplus)
549 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
550 #  define YYSIZE_T size_t
551 # endif
552 #endif
553 #if ! defined (YYSIZE_T)
554 # define YYSIZE_T unsigned int
555 #endif
556
557 #define yyerrok         (yyerrstatus = 0)
558 #define yyclearin       (yychar = YYEMPTY)
559 #define YYEMPTY         (-2)
560 #define YYEOF           0
561
562 #define YYACCEPT        goto yyacceptlab
563 #define YYABORT         goto yyabortlab
564 #define YYERROR         goto yyerrlab1
565
566
567 /* Like YYERROR except do call yyerror.  This remains here temporarily
568    to ease the transition to the new meaning of YYERROR, for GCC.
569    Once GCC version 2 has supplanted version 1, this can go.  */
570
571 #define YYFAIL          goto yyerrlab
572
573 #define YYRECOVERING()  (!!yyerrstatus)
574
575 #define YYBACKUP(Token, Value)                                  \
576 do                                                              \
577   if (yychar == YYEMPTY && yylen == 1)                          \
578     {                                                           \
579       yychar = (Token);                                         \
580       yylval = (Value);                                         \
581       yytoken = YYTRANSLATE (yychar);                           \
582       YYPOPSTACK;                                               \
583       goto yybackup;                                            \
584     }                                                           \
585   else                                                          \
586     {                                                           \
587       yyerror ("syntax error: cannot back up");\
588       YYERROR;                                                  \
589     }                                                           \
590 while (0)
591
592 #define YYTERROR        1
593 #define YYERRCODE       256
594
595 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
596    are run).  */
597
598 #ifndef YYLLOC_DEFAULT
599 # define YYLLOC_DEFAULT(Current, Rhs, N)         \
600   Current.first_line   = Rhs[1].first_line;      \
601   Current.first_column = Rhs[1].first_column;    \
602   Current.last_line    = Rhs[N].last_line;       \
603   Current.last_column  = Rhs[N].last_column;
604 #endif
605
606 /* YYLEX -- calling `yylex' with the right arguments.  */
607
608 #ifdef YYLEX_PARAM
609 # define YYLEX yylex (&yylval, YYLEX_PARAM)
610 #else
611 # define YYLEX yylex (&yylval)
612 #endif
613
614 /* Enable debugging if requested.  */
615 #if YYDEBUG
616
617 # ifndef YYFPRINTF
618 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
619 #  define YYFPRINTF fprintf
620 # endif
621
622 # define YYDPRINTF(Args)                        \
623 do {                                            \
624   if (yydebug)                                  \
625     YYFPRINTF Args;                             \
626 } while (0)
627
628 # define YYDSYMPRINT(Args)                      \
629 do {                                            \
630   if (yydebug)                                  \
631     yysymprint Args;                            \
632 } while (0)
633
634 # define YYDSYMPRINTF(Title, Token, Value, Location)            \
635 do {                                                            \
636   if (yydebug)                                                  \
637     {                                                           \
638       YYFPRINTF (stderr, "%s ", Title);                         \
639       yysymprint (stderr,                                       \
640                   Token, Value);        \
641       YYFPRINTF (stderr, "\n");                                 \
642     }                                                           \
643 } while (0)
644
645 /*------------------------------------------------------------------.
646 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
647 | TOP (cinluded).                                                   |
648 `------------------------------------------------------------------*/
649
650 #if defined (__STDC__) || defined (__cplusplus)
651 static void
652 yy_stack_print (short *bottom, short *top)
653 #else
654 static void
655 yy_stack_print (bottom, top)
656     short *bottom;
657     short *top;
658 #endif
659 {
660   YYFPRINTF (stderr, "Stack now");
661   for (/* Nothing. */; bottom <= top; ++bottom)
662     YYFPRINTF (stderr, " %d", *bottom);
663   YYFPRINTF (stderr, "\n");
664 }
665
666 # define YY_STACK_PRINT(Bottom, Top)                            \
667 do {                                                            \
668   if (yydebug)                                                  \
669     yy_stack_print ((Bottom), (Top));                           \
670 } while (0)
671
672
673 /*------------------------------------------------.
674 | Report that the YYRULE is going to be reduced.  |
675 `------------------------------------------------*/
676
677 #if defined (__STDC__) || defined (__cplusplus)
678 static void
679 yy_reduce_print (int yyrule)
680 #else
681 static void
682 yy_reduce_print (yyrule)
683     int yyrule;
684 #endif
685 {
686   int yyi;
687   unsigned int yylineno = yyrline[yyrule];
688   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
689              yyrule - 1, yylineno);
690   /* Print the symbols being reduced, and their result.  */
691   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
692     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
693   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
694 }
695
696 # define YY_REDUCE_PRINT(Rule)          \
697 do {                                    \
698   if (yydebug)                          \
699     yy_reduce_print (Rule);             \
700 } while (0)
701
702 /* Nonzero means print parse trace.  It is left uninitialized so that
703    multiple parsers can coexist.  */
704 int yydebug;
705 #else /* !YYDEBUG */
706 # define YYDPRINTF(Args)
707 # define YYDSYMPRINT(Args)
708 # define YYDSYMPRINTF(Title, Token, Value, Location)
709 # define YY_STACK_PRINT(Bottom, Top)
710 # define YY_REDUCE_PRINT(Rule)
711 #endif /* !YYDEBUG */
712
713
714 /* YYINITDEPTH -- initial size of the parser's stacks.  */
715 #ifndef YYINITDEPTH
716 # define YYINITDEPTH 200
717 #endif
718
719 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
720    if the built-in stack extension method is used).
721
722    Do not make this value too large; the results are undefined if
723    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
724    evaluated with infinite-precision integer arithmetic.  */
725
726 #if YYMAXDEPTH == 0
727 # undef YYMAXDEPTH
728 #endif
729
730 #ifndef YYMAXDEPTH
731 # define YYMAXDEPTH 10000
732 #endif
733
734 \f
735
736 #if YYERROR_VERBOSE
737
738 # ifndef yystrlen
739 #  if defined (__GLIBC__) && defined (_STRING_H)
740 #   define yystrlen strlen
741 #  else
742 /* Return the length of YYSTR.  */
743 static YYSIZE_T
744 #   if defined (__STDC__) || defined (__cplusplus)
745 yystrlen (const char *yystr)
746 #   else
747 yystrlen (yystr)
748      const char *yystr;
749 #   endif
750 {
751   register const char *yys = yystr;
752
753   while (*yys++ != '\0')
754     continue;
755
756   return yys - yystr - 1;
757 }
758 #  endif
759 # endif
760
761 # ifndef yystpcpy
762 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
763 #   define yystpcpy stpcpy
764 #  else
765 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
766    YYDEST.  */
767 static char *
768 #   if defined (__STDC__) || defined (__cplusplus)
769 yystpcpy (char *yydest, const char *yysrc)
770 #   else
771 yystpcpy (yydest, yysrc)
772      char *yydest;
773      const char *yysrc;
774 #   endif
775 {
776   register char *yyd = yydest;
777   register const char *yys = yysrc;
778
779   while ((*yyd++ = *yys++) != '\0')
780     continue;
781
782   return yyd - 1;
783 }
784 #  endif
785 # endif
786
787 #endif /* !YYERROR_VERBOSE */
788
789 \f
790
791 #if YYDEBUG
792 /*--------------------------------.
793 | Print this symbol on YYOUTPUT.  |
794 `--------------------------------*/
795
796 #if defined (__STDC__) || defined (__cplusplus)
797 static void
798 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
799 #else
800 static void
801 yysymprint (yyoutput, yytype, yyvaluep)
802     FILE *yyoutput;
803     int yytype;
804     YYSTYPE *yyvaluep;
805 #endif
806 {
807   /* Pacify ``unused variable'' warnings.  */
808   (void) yyvaluep;
809
810   if (yytype < YYNTOKENS)
811     {
812       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
813 # ifdef YYPRINT
814       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
815 # endif
816     }
817   else
818     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
819
820   switch (yytype)
821     {
822       default:
823         break;
824     }
825   YYFPRINTF (yyoutput, ")");
826 }
827
828 #endif /* ! YYDEBUG */
829 /*-----------------------------------------------.
830 | Release the memory associated to this symbol.  |
831 `-----------------------------------------------*/
832
833 #if defined (__STDC__) || defined (__cplusplus)
834 static void
835 yydestruct (int yytype, YYSTYPE *yyvaluep)
836 #else
837 static void
838 yydestruct (yytype, yyvaluep)
839     int yytype;
840     YYSTYPE *yyvaluep;
841 #endif
842 {
843   /* Pacify ``unused variable'' warnings.  */
844   (void) yyvaluep;
845
846   switch (yytype)
847     {
848
849       default:
850         break;
851     }
852 }
853 \f
854
855 /* Prevent warnings from -Wmissing-prototypes.  */
856
857 #ifdef YYPARSE_PARAM
858 # if defined (__STDC__) || defined (__cplusplus)
859 int yyparse (void *YYPARSE_PARAM);
860 # else
861 int yyparse ();
862 # endif
863 #else /* ! YYPARSE_PARAM */
864 #if defined (__STDC__) || defined (__cplusplus)
865 int yyparse (void);
866 #else
867 int yyparse ();
868 #endif
869 #endif /* ! YYPARSE_PARAM */
870
871
872
873
874
875
876 /*----------.
877 | yyparse.  |
878 `----------*/
879
880 #ifdef YYPARSE_PARAM
881 # if defined (__STDC__) || defined (__cplusplus)
882 int yyparse (void *YYPARSE_PARAM)
883 # else
884 int yyparse (YYPARSE_PARAM)
885   void *YYPARSE_PARAM;
886 # endif
887 #else /* ! YYPARSE_PARAM */
888 #if defined (__STDC__) || defined (__cplusplus)
889 int
890 yyparse (void)
891 #else
892 int
893 yyparse ()
894
895 #endif
896 #endif
897 {
898   /* The lookahead symbol.  */
899 int yychar;
900
901 /* The semantic value of the lookahead symbol.  */
902 YYSTYPE yylval;
903
904 /* Number of syntax errors so far.  */
905 int yynerrs;
906
907   register int yystate;
908   register int yyn;
909   int yyresult;
910   /* Number of tokens to shift before error messages enabled.  */
911   int yyerrstatus;
912   /* Lookahead token as an internal (translated) token number.  */
913   int yytoken = 0;
914
915   /* Three stacks and their tools:
916      `yyss': related to states,
917      `yyvs': related to semantic values,
918      `yyls': related to locations.
919
920      Refer to the stacks thru separate pointers, to allow yyoverflow
921      to reallocate them elsewhere.  */
922
923   /* The state stack.  */
924   short yyssa[YYINITDEPTH];
925   short *yyss = yyssa;
926   register short *yyssp;
927
928   /* The semantic value stack.  */
929   YYSTYPE yyvsa[YYINITDEPTH];
930   YYSTYPE *yyvs = yyvsa;
931   register YYSTYPE *yyvsp;
932
933
934
935 #define YYPOPSTACK   (yyvsp--, yyssp--)
936
937   YYSIZE_T yystacksize = YYINITDEPTH;
938
939   /* The variables used to return semantic value and location from the
940      action routines.  */
941   YYSTYPE yyval;
942
943
944   /* When reducing, the number of symbols on the RHS of the reduced
945      rule.  */
946   int yylen;
947
948   YYDPRINTF ((stderr, "Starting parse\n"));
949
950   yystate = 0;
951   yyerrstatus = 0;
952   yynerrs = 0;
953   yychar = YYEMPTY;             /* Cause a token to be read.  */
954
955   /* Initialize stack pointers.
956      Waste one element of value and location stack
957      so that they stay on the same level as the state stack.
958      The wasted elements are never initialized.  */
959
960   yyssp = yyss;
961   yyvsp = yyvs;
962
963   goto yysetstate;
964
965 /*------------------------------------------------------------.
966 | yynewstate -- Push a new state, which is found in yystate.  |
967 `------------------------------------------------------------*/
968  yynewstate:
969   /* In all cases, when you get here, the value and location stacks
970      have just been pushed. so pushing a state here evens the stacks.
971      */
972   yyssp++;
973
974  yysetstate:
975   *yyssp = yystate;
976
977   if (yyss + yystacksize - 1 <= yyssp)
978     {
979       /* Get the current used size of the three stacks, in elements.  */
980       YYSIZE_T yysize = yyssp - yyss + 1;
981
982 #ifdef yyoverflow
983       {
984         /* Give user a chance to reallocate the stack. Use copies of
985            these so that the &'s don't force the real ones into
986            memory.  */
987         YYSTYPE *yyvs1 = yyvs;
988         short *yyss1 = yyss;
989
990
991         /* Each stack pointer address is followed by the size of the
992            data in use in that stack, in bytes.  This used to be a
993            conditional around just the two extra args, but that might
994            be undefined if yyoverflow is a macro.  */
995         yyoverflow ("parser stack overflow",
996                     &yyss1, yysize * sizeof (*yyssp),
997                     &yyvs1, yysize * sizeof (*yyvsp),
998
999                     &yystacksize);
1000
1001         yyss = yyss1;
1002         yyvs = yyvs1;
1003       }
1004 #else /* no yyoverflow */
1005 # ifndef YYSTACK_RELOCATE
1006       goto yyoverflowlab;
1007 # else
1008       /* Extend the stack our own way.  */
1009       if (YYMAXDEPTH <= yystacksize)
1010         goto yyoverflowlab;
1011       yystacksize *= 2;
1012       if (YYMAXDEPTH < yystacksize)
1013         yystacksize = YYMAXDEPTH;
1014
1015       {
1016         short *yyss1 = yyss;
1017         union yyalloc *yyptr =
1018           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1019         if (! yyptr)
1020           goto yyoverflowlab;
1021         YYSTACK_RELOCATE (yyss);
1022         YYSTACK_RELOCATE (yyvs);
1023
1024 #  undef YYSTACK_RELOCATE
1025         if (yyss1 != yyssa)
1026           YYSTACK_FREE (yyss1);
1027       }
1028 # endif
1029 #endif /* no yyoverflow */
1030
1031       yyssp = yyss + yysize - 1;
1032       yyvsp = yyvs + yysize - 1;
1033
1034
1035       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1036                   (unsigned long int) yystacksize));
1037
1038       if (yyss + yystacksize - 1 <= yyssp)
1039         YYABORT;
1040     }
1041
1042   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1043
1044   goto yybackup;
1045
1046 /*-----------.
1047 | yybackup.  |
1048 `-----------*/
1049 yybackup:
1050
1051 /* Do appropriate processing given the current state.  */
1052 /* Read a lookahead token if we need one and don't already have one.  */
1053 /* yyresume: */
1054
1055   /* First try to decide what to do without reference to lookahead token.  */
1056
1057   yyn = yypact[yystate];
1058   if (yyn == YYPACT_NINF)
1059     goto yydefault;
1060
1061   /* Not known => get a lookahead token if don't already have one.  */
1062
1063   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1064   if (yychar == YYEMPTY)
1065     {
1066       YYDPRINTF ((stderr, "Reading a token: "));
1067       yychar = YYLEX;
1068     }
1069
1070   if (yychar <= YYEOF)
1071     {
1072       yychar = yytoken = YYEOF;
1073       YYDPRINTF ((stderr, "Now at end of input.\n"));
1074     }
1075   else
1076     {
1077       yytoken = YYTRANSLATE (yychar);
1078       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1079     }
1080
1081   /* If the proper action on seeing token YYTOKEN is to reduce or to
1082      detect an error, take that action.  */
1083   yyn += yytoken;
1084   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1085     goto yydefault;
1086   yyn = yytable[yyn];
1087   if (yyn <= 0)
1088     {
1089       if (yyn == 0 || yyn == YYTABLE_NINF)
1090         goto yyerrlab;
1091       yyn = -yyn;
1092       goto yyreduce;
1093     }
1094
1095   if (yyn == YYFINAL)
1096     YYACCEPT;
1097
1098   /* Shift the lookahead token.  */
1099   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1100
1101   /* Discard the token being shifted unless it is eof.  */
1102   if (yychar != YYEOF)
1103     yychar = YYEMPTY;
1104
1105   *++yyvsp = yylval;
1106
1107
1108   /* Count tokens shifted since error; after three, turn off error
1109      status.  */
1110   if (yyerrstatus)
1111     yyerrstatus--;
1112
1113   yystate = yyn;
1114   goto yynewstate;
1115
1116
1117 /*-----------------------------------------------------------.
1118 | yydefault -- do the default action for the current state.  |
1119 `-----------------------------------------------------------*/
1120 yydefault:
1121   yyn = yydefact[yystate];
1122   if (yyn == 0)
1123     goto yyerrlab;
1124   goto yyreduce;
1125
1126
1127 /*-----------------------------.
1128 | yyreduce -- Do a reduction.  |
1129 `-----------------------------*/
1130 yyreduce:
1131   /* yyn is the number of a rule to reduce with.  */
1132   yylen = yyr2[yyn];
1133
1134   /* If YYLEN is nonzero, implement the default value of the action:
1135      `$$ = $1'.
1136
1137      Otherwise, the following line sets YYVAL to garbage.
1138      This behavior is undocumented and Bison
1139      users should not rely upon it.  Assigning to YYVAL
1140      unconditionally makes the parser a bit smaller, and it avoids a
1141      GCC warning that YYVAL may be used uninitialized.  */
1142   yyval = yyvsp[1-yylen];
1143
1144
1145   YY_REDUCE_PRINT (yyn);
1146   switch (yyn)
1147     {
1148         case 2:
1149 #line 179 "plural.y"
1150     {
1151             if (yyvsp[0].exp == NULL)
1152               YYABORT;
1153             ((struct parse_args *) arg)->res = yyvsp[0].exp;
1154           }
1155     break;
1156
1157   case 3:
1158 #line 187 "plural.y"
1159     {
1160             yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
1161           }
1162     break;
1163
1164   case 4:
1165 #line 191 "plural.y"
1166     {
1167             yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
1168           }
1169     break;
1170
1171   case 5:
1172 #line 195 "plural.y"
1173     {
1174             yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
1175           }
1176     break;
1177
1178   case 6:
1179 #line 199 "plural.y"
1180     {
1181             yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1182           }
1183     break;
1184
1185   case 7:
1186 #line 203 "plural.y"
1187     {
1188             yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1189           }
1190     break;
1191
1192   case 8:
1193 #line 207 "plural.y"
1194     {
1195             yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1196           }
1197     break;
1198
1199   case 9:
1200 #line 211 "plural.y"
1201     {
1202             yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1203           }
1204     break;
1205
1206   case 10:
1207 #line 215 "plural.y"
1208     {
1209             yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
1210           }
1211     break;
1212
1213   case 11:
1214 #line 219 "plural.y"
1215     {
1216             yyval.exp = new_exp_0 (var);
1217           }
1218     break;
1219
1220   case 12:
1221 #line 223 "plural.y"
1222     {
1223             if ((yyval.exp = new_exp_0 (num)) != NULL)
1224               yyval.exp->val.num = yyvsp[0].num;
1225           }
1226     break;
1227
1228   case 13:
1229 #line 228 "plural.y"
1230     {
1231             yyval.exp = yyvsp[-1].exp;
1232           }
1233     break;
1234
1235
1236     }
1237
1238 /* Line 999 of yacc.c.  */
1239 #line 1240 "plural.c"
1240 \f
1241   yyvsp -= yylen;
1242   yyssp -= yylen;
1243
1244
1245   YY_STACK_PRINT (yyss, yyssp);
1246
1247   *++yyvsp = yyval;
1248
1249
1250   /* Now `shift' the result of the reduction.  Determine what state
1251      that goes to, based on the state we popped back to and the rule
1252      number reduced by.  */
1253
1254   yyn = yyr1[yyn];
1255
1256   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1257   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1258     yystate = yytable[yystate];
1259   else
1260     yystate = yydefgoto[yyn - YYNTOKENS];
1261
1262   goto yynewstate;
1263
1264
1265 /*------------------------------------.
1266 | yyerrlab -- here on detecting error |
1267 `------------------------------------*/
1268 yyerrlab:
1269   /* If not already recovering from an error, report this error.  */
1270   if (!yyerrstatus)
1271     {
1272       ++yynerrs;
1273 #if YYERROR_VERBOSE
1274       yyn = yypact[yystate];
1275
1276       if (YYPACT_NINF < yyn && yyn < YYLAST)
1277         {
1278           YYSIZE_T yysize = 0;
1279           int yytype = YYTRANSLATE (yychar);
1280           char *yymsg;
1281           int yyx, yycount;
1282
1283           yycount = 0;
1284           /* Start YYX at -YYN if negative to avoid negative indexes in
1285              YYCHECK.  */
1286           for (yyx = yyn < 0 ? -yyn : 0;
1287                yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1288             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1289               yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1290           yysize += yystrlen ("syntax error, unexpected ") + 1;
1291           yysize += yystrlen (yytname[yytype]);
1292           yymsg = (char *) YYSTACK_ALLOC (yysize);
1293           if (yymsg != 0)
1294             {
1295               char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1296               yyp = yystpcpy (yyp, yytname[yytype]);
1297
1298               if (yycount < 5)
1299                 {
1300                   yycount = 0;
1301                   for (yyx = yyn < 0 ? -yyn : 0;
1302                        yyx < (int) (sizeof (yytname) / sizeof (char *));
1303                        yyx++)
1304                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1305                       {
1306                         const char *yyq = ! yycount ? ", expecting " : " or ";
1307                         yyp = yystpcpy (yyp, yyq);
1308                         yyp = yystpcpy (yyp, yytname[yyx]);
1309                         yycount++;
1310                       }
1311                 }
1312               yyerror (yymsg);
1313               YYSTACK_FREE (yymsg);
1314             }
1315           else
1316             yyerror ("syntax error; also virtual memory exhausted");
1317         }
1318       else
1319 #endif /* YYERROR_VERBOSE */
1320         yyerror ("syntax error");
1321     }
1322
1323
1324
1325   if (yyerrstatus == 3)
1326     {
1327       /* If just tried and failed to reuse lookahead token after an
1328          error, discard it.  */
1329
1330       /* Return failure if at end of input.  */
1331       if (yychar == YYEOF)
1332         {
1333           /* Pop the error token.  */
1334           YYPOPSTACK;
1335           /* Pop the rest of the stack.  */
1336           while (yyss < yyssp)
1337             {
1338               YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1339               yydestruct (yystos[*yyssp], yyvsp);
1340               YYPOPSTACK;
1341             }
1342           YYABORT;
1343         }
1344
1345       YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1346       yydestruct (yytoken, &yylval);
1347       yychar = YYEMPTY;
1348
1349     }
1350
1351   /* Else will try to reuse lookahead token after shifting the error
1352      token.  */
1353   goto yyerrlab1;
1354
1355
1356 /*----------------------------------------------------.
1357 | yyerrlab1 -- error raised explicitly by an action.  |
1358 `----------------------------------------------------*/
1359 yyerrlab1:
1360   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1361
1362   for (;;)
1363     {
1364       yyn = yypact[yystate];
1365       if (yyn != YYPACT_NINF)
1366         {
1367           yyn += YYTERROR;
1368           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1369             {
1370               yyn = yytable[yyn];
1371               if (0 < yyn)
1372                 break;
1373             }
1374         }
1375
1376       /* Pop the current state because it cannot handle the error token.  */
1377       if (yyssp == yyss)
1378         YYABORT;
1379
1380       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1381       yydestruct (yystos[yystate], yyvsp);
1382       yyvsp--;
1383       yystate = *--yyssp;
1384
1385       YY_STACK_PRINT (yyss, yyssp);
1386     }
1387
1388   if (yyn == YYFINAL)
1389     YYACCEPT;
1390
1391   YYDPRINTF ((stderr, "Shifting error token, "));
1392
1393   *++yyvsp = yylval;
1394
1395
1396   yystate = yyn;
1397   goto yynewstate;
1398
1399
1400 /*-------------------------------------.
1401 | yyacceptlab -- YYACCEPT comes here.  |
1402 `-------------------------------------*/
1403 yyacceptlab:
1404   yyresult = 0;
1405   goto yyreturn;
1406
1407 /*-----------------------------------.
1408 | yyabortlab -- YYABORT comes here.  |
1409 `-----------------------------------*/
1410 yyabortlab:
1411   yyresult = 1;
1412   goto yyreturn;
1413
1414 #ifndef yyoverflow
1415 /*----------------------------------------------.
1416 | yyoverflowlab -- parser overflow comes here.  |
1417 `----------------------------------------------*/
1418 yyoverflowlab:
1419   yyerror ("parser stack overflow");
1420   yyresult = 2;
1421   /* Fall through.  */
1422 #endif
1423
1424 yyreturn:
1425 #ifndef yyoverflow
1426   if (yyss != yyssa)
1427     YYSTACK_FREE (yyss);
1428 #endif
1429   return yyresult;
1430 }
1431
1432
1433 #line 233 "plural.y"
1434
1435
1436 void
1437 internal_function
1438 FREE_EXPRESSION (exp)
1439      struct expression *exp;
1440 {
1441   if (exp == NULL)
1442     return;
1443
1444   /* Handle the recursive case.  */
1445   switch (exp->nargs)
1446     {
1447     case 3:
1448       FREE_EXPRESSION (exp->val.args[2]);
1449       /* FALLTHROUGH */
1450     case 2:
1451       FREE_EXPRESSION (exp->val.args[1]);
1452       /* FALLTHROUGH */
1453     case 1:
1454       FREE_EXPRESSION (exp->val.args[0]);
1455       /* FALLTHROUGH */
1456     default:
1457       break;
1458     }
1459
1460   free (exp);
1461 }
1462
1463
1464 static int
1465 yylex (lval, pexp)
1466      YYSTYPE *lval;
1467      const char **pexp;
1468 {
1469   const char *exp = *pexp;
1470   int result;
1471
1472   while (1)
1473     {
1474       if (exp[0] == '\0')
1475         {
1476           *pexp = exp;
1477           return YYEOF;
1478         }
1479
1480       if (exp[0] != ' ' && exp[0] != '\t')
1481         break;
1482
1483       ++exp;
1484     }
1485
1486   result = *exp++;
1487   switch (result)
1488     {
1489     case '0': case '1': case '2': case '3': case '4':
1490     case '5': case '6': case '7': case '8': case '9':
1491       {
1492         unsigned long int n = result - '0';
1493         while (exp[0] >= '0' && exp[0] <= '9')
1494           {
1495             n *= 10;
1496             n += exp[0] - '0';
1497             ++exp;
1498           }
1499         lval->num = n;
1500         result = NUMBER;
1501       }
1502       break;
1503
1504     case '=':
1505       if (exp[0] == '=')
1506         {
1507           ++exp;
1508           lval->op = equal;
1509           result = EQUOP2;
1510         }
1511       else
1512         result = YYERRCODE;
1513       break;
1514
1515     case '!':
1516       if (exp[0] == '=')
1517         {
1518           ++exp;
1519           lval->op = not_equal;
1520           result = EQUOP2;
1521         }
1522       break;
1523
1524     case '&':
1525     case '|':
1526       if (exp[0] == result)
1527         ++exp;
1528       else
1529         result = YYERRCODE;
1530       break;
1531
1532     case '<':
1533       if (exp[0] == '=')
1534         {
1535           ++exp;
1536           lval->op = less_or_equal;
1537         }
1538       else
1539         lval->op = less_than;
1540       result = CMPOP2;
1541       break;
1542
1543     case '>':
1544       if (exp[0] == '=')
1545         {
1546           ++exp;
1547           lval->op = greater_or_equal;
1548         }
1549       else
1550         lval->op = greater_than;
1551       result = CMPOP2;
1552       break;
1553
1554     case '*':
1555       lval->op = mult;
1556       result = MULOP2;
1557       break;
1558
1559     case '/':
1560       lval->op = divide;
1561       result = MULOP2;
1562       break;
1563
1564     case '%':
1565       lval->op = module;
1566       result = MULOP2;
1567       break;
1568
1569     case '+':
1570       lval->op = plus;
1571       result = ADDOP2;
1572       break;
1573
1574     case '-':
1575       lval->op = minus;
1576       result = ADDOP2;
1577       break;
1578
1579     case 'n':
1580     case '?':
1581     case ':':
1582     case '(':
1583     case ')':
1584       /* Nothing, just return the character.  */
1585       break;
1586
1587     case ';':
1588     case '\n':
1589     case '\0':
1590       /* Be safe and let the user call this function again.  */
1591       --exp;
1592       result = YYEOF;
1593       break;
1594
1595     default:
1596       result = YYERRCODE;
1597 #if YYDEBUG != 0
1598       --exp;
1599 #endif
1600       break;
1601     }
1602
1603   *pexp = exp;
1604
1605   return result;
1606 }
1607
1608
1609 static void
1610 yyerror (str)
1611      const char *str;
1612 {
1613   /* Do nothing.  We don't print error messages here.  */
1614 }
1615