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