Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / src / cldr-plural.c
1 /* A Bison parser, made by GNU Bison 3.0.4.  */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 /* As a special exception, you may create a larger work that contains
21    part or all of the Bison parser skeleton and distribute that work
22    under terms of your choice, so long as that work isn't itself a
23    parser generator using the skeleton or a modified version thereof
24    as a parser skeleton.  Alternatively, if you modify or redistribute
25    the parser skeleton itself, you may (at your option) remove this
26    special exception, which will cause the skeleton and the resulting
27    Bison output files to be licensed under the GNU General Public
28    License without this special exception.
29
30    This special exception was added by the Free Software Foundation in
31    version 2.2 of Bison.  */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34    simplifying the original so-called "semantic" parser.  */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37    infringing on user name space.  This should be done even for local
38    variables, as they might otherwise be expanded by user macros.
39    There are some unavoidable exceptions within include files to
40    define necessary library symbols; they are noted "INFRINGES ON
41    USER NAME SPACE" below.  */
42
43 /* Identify Bison output.  */
44 #define YYBISON 1
45
46 /* Bison version.  */
47 #define YYBISON_VERSION "3.0.4"
48
49 /* Skeleton name.  */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers.  */
53 #define YYPURE 2
54
55 /* Push parsers.  */
56 #define YYPUSH 0
57
58 /* Pull parsers.  */
59 #define YYPULL 1
60
61
62
63
64 /* Copy the first part of user declarations.  */
65 #line 19 "cldr-plural.y" /* yacc.c:339  */
66
67 #ifdef HAVE_CONFIG_H
68 # include <config.h>
69 #endif
70
71 #include <stdio.h>
72 #include <stdlib.h>
73 #include <string.h>
74 #include <unistd.h>
75 #include "unistr.h"
76 #include "xalloc.h"
77
78 #include "cldr-plural-exp.h"
79 #include "cldr-plural.h"
80
81 /* Prototypes for local functions.  */
82 static int yylex (YYSTYPE *lval, struct cldr_plural_parse_args *arg);
83 static void yyerror (struct cldr_plural_parse_args *arg, const char *str);
84
85 /* Allocation of expressions.  */
86
87 static struct cldr_plural_rule_ty *
88 new_rule (char *name, struct cldr_plural_condition_ty *condition)
89 {
90   struct cldr_plural_rule_ty *result =
91     XMALLOC (struct cldr_plural_rule_ty);
92   result->name = name;
93   result->condition = condition;
94   return result;
95 }
96
97 static struct cldr_plural_condition_ty *
98 new_leaf_condition (struct cldr_plural_relation_ty *relation)
99 {
100   struct cldr_plural_condition_ty *result =
101     XMALLOC (struct cldr_plural_condition_ty);
102   result->type = CLDR_PLURAL_CONDITION_RELATION;
103   result->value.relation = relation;
104   return result;
105 }
106
107 static struct cldr_plural_condition_ty *
108 new_branch_condition (enum cldr_plural_condition type,
109                       struct cldr_plural_condition_ty *condition0,
110                       struct cldr_plural_condition_ty *condition1)
111 {
112   struct cldr_plural_condition_ty *result =
113     XMALLOC (struct cldr_plural_condition_ty);
114   result->type = type;
115   result->value.conditions[0] = condition0;
116   result->value.conditions[1] = condition1;
117   return result;
118 }
119
120 static struct cldr_plural_relation_ty *
121 new_relation (struct cldr_plural_expression_ty *expression,
122               enum cldr_plural_relation type,
123               struct cldr_plural_range_list_ty *ranges)
124 {
125   struct cldr_plural_relation_ty *result =
126     XMALLOC (struct cldr_plural_relation_ty);
127   result->expression = expression;
128   result->type = type;
129   result->ranges = ranges;
130   return result;
131 }
132
133 static struct cldr_plural_expression_ty *
134 new_expression (int operand, int mod)
135 {
136   struct cldr_plural_expression_ty *result =
137     XMALLOC (struct cldr_plural_expression_ty);
138   result->operand = operand;
139   result->mod = mod;
140   return result;
141 }
142
143 static struct cldr_plural_range_list_ty *
144 add_range (struct cldr_plural_range_list_ty *ranges,
145            struct cldr_plural_range_ty *range)
146 {
147   if (ranges->nitems == ranges->nitems_max)
148     {
149       ranges->nitems_max = ranges->nitems_max * 2 + 1;
150       ranges->items = xrealloc (ranges->items,
151                                 sizeof (struct cldr_plural_range_ty *)
152                                 * ranges->nitems_max);
153     }
154   ranges->items[ranges->nitems++] = range;
155   return ranges;
156 }
157
158 static struct cldr_plural_range_ty *
159 new_range (struct cldr_plural_operand_ty *start,
160            struct cldr_plural_operand_ty *end)
161 {
162   struct cldr_plural_range_ty *result =
163     XMALLOC (struct cldr_plural_range_ty);
164   result->start = start;
165   result->end = end;
166   return result;
167 }
168
169 #line 170 "cldr-plural.c" /* yacc.c:339  */
170
171 # ifndef YY_NULLPTR
172 #  if defined __cplusplus && 201103L <= __cplusplus
173 #   define YY_NULLPTR nullptr
174 #  else
175 #   define YY_NULLPTR 0
176 #  endif
177 # endif
178
179 /* Enabling verbose error messages.  */
180 #ifdef YYERROR_VERBOSE
181 # undef YYERROR_VERBOSE
182 # define YYERROR_VERBOSE 1
183 #else
184 # define YYERROR_VERBOSE 0
185 #endif
186
187 /* In a future release of Bison, this section will be replaced
188    by #include "y.tab.h".  */
189 #ifndef YY_YY_CLDR_PLURAL_H_INCLUDED
190 # define YY_YY_CLDR_PLURAL_H_INCLUDED
191 /* Debug traces.  */
192 #ifndef YYDEBUG
193 # define YYDEBUG 0
194 #endif
195 #if YYDEBUG
196 extern int yydebug;
197 #endif
198
199 /* Token type.  */
200 #ifndef YYTOKENTYPE
201 # define YYTOKENTYPE
202   enum yytokentype
203   {
204     AND = 258,
205     OR = 259,
206     RANGE = 260,
207     ELLIPSIS = 261,
208     OTHER = 262,
209     AT_INTEGER = 263,
210     AT_DECIMAL = 264,
211     KEYWORD = 265,
212     INTEGER = 266,
213     DECIMAL = 267,
214     OPERAND = 268
215   };
216 #endif
217 /* Tokens.  */
218 #define AND 258
219 #define OR 259
220 #define RANGE 260
221 #define ELLIPSIS 261
222 #define OTHER 262
223 #define AT_INTEGER 263
224 #define AT_DECIMAL 264
225 #define KEYWORD 265
226 #define INTEGER 266
227 #define DECIMAL 267
228 #define OPERAND 268
229
230 /* Value type.  */
231 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
232
233 union YYSTYPE
234 {
235 #line 127 "cldr-plural.y" /* yacc.c:355  */
236
237   char *sval;
238   struct cldr_plural_condition_ty *cval;
239   struct cldr_plural_relation_ty *lval;
240   struct cldr_plural_expression_ty *eval;
241   struct cldr_plural_range_ty *gval;
242   struct cldr_plural_operand_ty *oval;
243   struct cldr_plural_range_list_ty *rval;
244   int ival;
245
246 #line 247 "cldr-plural.c" /* yacc.c:355  */
247 };
248
249 typedef union YYSTYPE YYSTYPE;
250 # define YYSTYPE_IS_TRIVIAL 1
251 # define YYSTYPE_IS_DECLARED 1
252 #endif
253
254
255
256 int yyparse (struct cldr_plural_parse_args *arg);
257
258 #endif /* !YY_YY_CLDR_PLURAL_H_INCLUDED  */
259
260 /* Copy the second part of user declarations.  */
261
262 #line 263 "cldr-plural.c" /* yacc.c:358  */
263
264 #ifdef short
265 # undef short
266 #endif
267
268 #ifdef YYTYPE_UINT8
269 typedef YYTYPE_UINT8 yytype_uint8;
270 #else
271 typedef unsigned char yytype_uint8;
272 #endif
273
274 #ifdef YYTYPE_INT8
275 typedef YYTYPE_INT8 yytype_int8;
276 #else
277 typedef signed char yytype_int8;
278 #endif
279
280 #ifdef YYTYPE_UINT16
281 typedef YYTYPE_UINT16 yytype_uint16;
282 #else
283 typedef unsigned short int yytype_uint16;
284 #endif
285
286 #ifdef YYTYPE_INT16
287 typedef YYTYPE_INT16 yytype_int16;
288 #else
289 typedef short int yytype_int16;
290 #endif
291
292 #ifndef YYSIZE_T
293 # ifdef __SIZE_TYPE__
294 #  define YYSIZE_T __SIZE_TYPE__
295 # elif defined size_t
296 #  define YYSIZE_T size_t
297 # elif ! defined YYSIZE_T
298 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
299 #  define YYSIZE_T size_t
300 # else
301 #  define YYSIZE_T unsigned int
302 # endif
303 #endif
304
305 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
306
307 #ifndef YY_
308 # if defined YYENABLE_NLS && YYENABLE_NLS
309 #  if ENABLE_NLS
310 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
311 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
312 #  endif
313 # endif
314 # ifndef YY_
315 #  define YY_(Msgid) Msgid
316 # endif
317 #endif
318
319 #ifndef YY_ATTRIBUTE
320 # if (defined __GNUC__                                               \
321       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
322      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
323 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
324 # else
325 #  define YY_ATTRIBUTE(Spec) /* empty */
326 # endif
327 #endif
328
329 #ifndef YY_ATTRIBUTE_PURE
330 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
331 #endif
332
333 #ifndef YY_ATTRIBUTE_UNUSED
334 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
335 #endif
336
337 #if !defined _Noreturn \
338      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
339 # if defined _MSC_VER && 1200 <= _MSC_VER
340 #  define _Noreturn __declspec (noreturn)
341 # else
342 #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
343 # endif
344 #endif
345
346 /* Suppress unused-variable warnings by "using" E.  */
347 #if ! defined lint || defined __GNUC__
348 # define YYUSE(E) ((void) (E))
349 #else
350 # define YYUSE(E) /* empty */
351 #endif
352
353 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
354 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
355 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
356     _Pragma ("GCC diagnostic push") \
357     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
358     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
359 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
360     _Pragma ("GCC diagnostic pop")
361 #else
362 # define YY_INITIAL_VALUE(Value) Value
363 #endif
364 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
365 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
366 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
367 #endif
368 #ifndef YY_INITIAL_VALUE
369 # define YY_INITIAL_VALUE(Value) /* Nothing. */
370 #endif
371
372
373 #if ! defined yyoverflow || YYERROR_VERBOSE
374
375 /* The parser invokes alloca or malloc; define the necessary symbols.  */
376
377 # ifdef YYSTACK_USE_ALLOCA
378 #  if YYSTACK_USE_ALLOCA
379 #   ifdef __GNUC__
380 #    define YYSTACK_ALLOC __builtin_alloca
381 #   elif defined __BUILTIN_VA_ARG_INCR
382 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
383 #   elif defined _AIX
384 #    define YYSTACK_ALLOC __alloca
385 #   elif defined _MSC_VER
386 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
387 #    define alloca _alloca
388 #   else
389 #    define YYSTACK_ALLOC alloca
390 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
391 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
392       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
393 #     ifndef EXIT_SUCCESS
394 #      define EXIT_SUCCESS 0
395 #     endif
396 #    endif
397 #   endif
398 #  endif
399 # endif
400
401 # ifdef YYSTACK_ALLOC
402    /* Pacify GCC's 'empty if-body' warning.  */
403 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
404 #  ifndef YYSTACK_ALLOC_MAXIMUM
405     /* The OS might guarantee only one guard page at the bottom of the stack,
406        and a page size can be as small as 4096 bytes.  So we cannot safely
407        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
408        to allow for a few compiler-allocated temporary stack slots.  */
409 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
410 #  endif
411 # else
412 #  define YYSTACK_ALLOC YYMALLOC
413 #  define YYSTACK_FREE YYFREE
414 #  ifndef YYSTACK_ALLOC_MAXIMUM
415 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
416 #  endif
417 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
418        && ! ((defined YYMALLOC || defined malloc) \
419              && (defined YYFREE || defined free)))
420 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
421 #   ifndef EXIT_SUCCESS
422 #    define EXIT_SUCCESS 0
423 #   endif
424 #  endif
425 #  ifndef YYMALLOC
426 #   define YYMALLOC malloc
427 #   if ! defined malloc && ! defined EXIT_SUCCESS
428 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
429 #   endif
430 #  endif
431 #  ifndef YYFREE
432 #   define YYFREE free
433 #   if ! defined free && ! defined EXIT_SUCCESS
434 void free (void *); /* INFRINGES ON USER NAME SPACE */
435 #   endif
436 #  endif
437 # endif
438 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
439
440
441 #if (! defined yyoverflow \
442      && (! defined __cplusplus \
443          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
444
445 /* A type that is properly aligned for any stack member.  */
446 union yyalloc
447 {
448   yytype_int16 yyss_alloc;
449   YYSTYPE yyvs_alloc;
450 };
451
452 /* The size of the maximum gap between one aligned stack and the next.  */
453 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
454
455 /* The size of an array large to enough to hold all stacks, each with
456    N elements.  */
457 # define YYSTACK_BYTES(N) \
458      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
459       + YYSTACK_GAP_MAXIMUM)
460
461 # define YYCOPY_NEEDED 1
462
463 /* Relocate STACK from its old location to the new one.  The
464    local variables YYSIZE and YYSTACKSIZE give the old and new number of
465    elements in the stack, and YYPTR gives the new location of the
466    stack.  Advance YYPTR to a properly aligned location for the next
467    stack.  */
468 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
469     do                                                                  \
470       {                                                                 \
471         YYSIZE_T yynewbytes;                                            \
472         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
473         Stack = &yyptr->Stack_alloc;                                    \
474         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
475         yyptr += yynewbytes / sizeof (*yyptr);                          \
476       }                                                                 \
477     while (0)
478
479 #endif
480
481 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
482 /* Copy COUNT objects from SRC to DST.  The source and destination do
483    not overlap.  */
484 # ifndef YYCOPY
485 #  if defined __GNUC__ && 1 < __GNUC__
486 #   define YYCOPY(Dst, Src, Count) \
487       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
488 #  else
489 #   define YYCOPY(Dst, Src, Count)              \
490       do                                        \
491         {                                       \
492           YYSIZE_T yyi;                         \
493           for (yyi = 0; yyi < (Count); yyi++)   \
494             (Dst)[yyi] = (Src)[yyi];            \
495         }                                       \
496       while (0)
497 #  endif
498 # endif
499 #endif /* !YYCOPY_NEEDED */
500
501 /* YYFINAL -- State number of the termination state.  */
502 #define YYFINAL  7
503 /* YYLAST -- Last index in YYTABLE.  */
504 #define YYLAST   55
505
506 /* YYNTOKENS -- Number of terminals.  */
507 #define YYNTOKENS  21
508 /* YYNNTS -- Number of nonterminals.  */
509 #define YYNNTS  17
510 /* YYNRULES -- Number of rules.  */
511 #define YYNRULES  32
512 /* YYNSTATES -- Number of states.  */
513 #define YYNSTATES  52
514
515 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
516    by yylex, with out-of-bounds checking.  */
517 #define YYUNDEFTOK  2
518 #define YYMAXUTOK   268
519
520 #define YYTRANSLATE(YYX)                                                \
521   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
522
523 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
524    as returned by yylex, without out-of-bounds checking.  */
525 static const yytype_uint8 yytranslate[] =
526 {
527        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
528        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
529        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
530        2,     2,     2,    17,     2,     2,     2,    18,     2,     2,
531        2,     2,     2,     2,    19,     2,     2,     2,     2,     2,
532        2,     2,     2,     2,     2,     2,     2,     2,    15,    14,
533        2,    16,     2,     2,     2,     2,     2,     2,     2,     2,
534        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
535        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
536        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
537        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
538        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
539        2,     2,     2,     2,     2,     2,    20,     2,     2,     2,
540        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
541        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
542        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
543        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
544        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
545        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
546        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
547        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
548        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
549        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
550        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
551        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
552        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
553        5,     6,     7,     8,     9,    10,    11,    12,    13
554 };
555
556 #if YYDEBUG
557   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
558 static const yytype_uint16 yyrline[] =
559 {
560        0,   159,   159,   160,   163,   176,   179,   183,   189,   193,
561      201,   205,   211,   215,   221,   228,   234,   238,   244,   251,
562      254,   255,   258,   259,   262,   264,   265,   267,   268,   271,
563      273,   275,   277
564 };
565 #endif
566
567 #if YYDEBUG || YYERROR_VERBOSE || 0
568 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
569    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
570 static const char *const yytname[] =
571 {
572   "$end", "error", "$undefined", "AND", "OR", "RANGE", "ELLIPSIS",
573   "OTHER", "AT_INTEGER", "AT_DECIMAL", "KEYWORD", "INTEGER", "DECIMAL",
574   "OPERAND", "';'", "':'", "'='", "'!'", "'%'", "','", "'~'", "$accept",
575   "rules", "rule", "condition", "and_condition", "relation", "expression",
576   "range_list", "range_or_integer", "range", "samples", "at_integer",
577   "at_decimal", "sample_list", "sample_list1", "sample_ellipsis",
578   "sample_range", YY_NULLPTR
579 };
580 #endif
581
582 # ifdef YYPRINT
583 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
584    (internal) symbol number NUM (which must be that of a token).  */
585 static const yytype_uint16 yytoknum[] =
586 {
587        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
588      265,   266,   267,   268,    59,    58,    61,    33,    37,    44,
589      126
590 };
591 # endif
592
593 #define YYPACT_NINF -20
594
595 #define yypact_value_is_default(Yystate) \
596   (!!((Yystate) == (-20)))
597
598 #define YYTABLE_NINF -1
599
600 #define yytable_value_is_error(Yytable_value) \
601   0
602
603   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
604      STATE-NUM.  */
605 static const yytype_int8 yypact[] =
606 {
607        3,   -11,    -7,     0,   -20,     4,    -2,   -20,     3,    -9,
608      -20,     8,     2,     1,    15,   -20,    -1,   -20,     5,     6,
609      -20,     9,   -20,    -9,   -20,    10,    -2,   -20,    -2,    11,
610       11,    12,     7,    -5,   -20,   -20,   -20,    15,   -20,    19,
611       13,   -20,   -20,    13,   -20,   -20,   -20,   -20,    16,    11,
612      -20,   -20
613 };
614
615   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
616      Performed when YYTABLE does not specify something else to do.  Zero
617      means the default is an error.  */
618 static const yytype_uint8 yydefact[] =
619 {
620        0,     0,     0,     0,     2,    20,     0,     1,     0,     0,
621        5,    22,    12,    20,     6,     8,     0,     3,    31,    29,
622       21,    27,    25,     0,    19,     0,     0,     4,     0,     0,
623        0,     0,     0,     0,    24,    23,    13,     7,     9,    17,
624       10,    14,    16,    11,    32,    30,    28,    26,     0,     0,
625       18,    15
626 };
627
628   /* YYPGOTO[NTERM-NUM].  */
629 static const yytype_int8 yypgoto[] =
630 {
631      -20,   -20,    21,   -20,    14,    17,   -20,    18,   -19,   -20,
632       20,   -20,   -20,    23,   -20,   -20,    22
633 };
634
635   /* YYDEFGOTO[NTERM-NUM].  */
636 static const yytype_int8 yydefgoto[] =
637 {
638       -1,     3,     4,    13,    14,    15,    16,    40,    41,    42,
639       10,    11,    24,    20,    21,    34,    22
640 };
641
642   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
643      positive, shift that token.  If negative, reduce the rule whose
644      number is the opposite.  If YYTABLE_NINF, syntax error.  */
645 static const yytype_uint8 yytable[] =
646 {
647        7,    46,    18,    19,     5,    26,    18,    19,     6,     9,
648        1,    12,     9,     2,     8,    29,    30,    23,    28,    45,
649       25,    36,    39,    44,    48,    31,    32,    50,    33,    17,
650       51,     0,    49,    27,     0,     0,     0,     0,     0,     0,
651       37,     0,     0,     0,     0,    38,    35,     0,    43,     0,
652        0,     0,     0,     0,     0,    47
653 };
654
655 static const yytype_int8 yycheck[] =
656 {
657        0,     6,    11,    12,    15,     4,    11,    12,    15,     8,
658        7,    13,     8,    10,    14,    16,    17,     9,     3,    12,
659       18,    11,    11,    11,     5,    20,    20,    11,    19,     8,
660       49,    -1,    19,    13,    -1,    -1,    -1,    -1,    -1,    -1,
661       26,    -1,    -1,    -1,    -1,    28,    23,    -1,    30,    -1,
662       -1,    -1,    -1,    -1,    -1,    33
663 };
664
665   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
666      symbol of state STATE-NUM.  */
667 static const yytype_uint8 yystos[] =
668 {
669        0,     7,    10,    22,    23,    15,    15,     0,    14,     8,
670       31,    32,    13,    24,    25,    26,    27,    23,    11,    12,
671       34,    35,    37,     9,    33,    18,     4,    31,     3,    16,
672       17,    20,    20,    19,    36,    34,    11,    25,    26,    11,
673       28,    29,    30,    28,    11,    12,     6,    37,     5,    19,
674       11,    29
675 };
676
677   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
678 static const yytype_uint8 yyr1[] =
679 {
680        0,    21,    22,    22,    23,    23,    24,    24,    25,    25,
681       26,    26,    27,    27,    28,    28,    29,    29,    30,    31,
682       32,    32,    33,    33,    34,    35,    35,    36,    36,    37,
683       37,    37,    37
684 };
685
686   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
687 static const yytype_uint8 yyr2[] =
688 {
689        0,     2,     1,     3,     4,     3,     1,     3,     1,     3,
690        3,     3,     1,     3,     1,     3,     1,     1,     3,     2,
691        0,     2,     0,     2,     2,     1,     3,     0,     2,     1,
692        3,     1,     3
693 };
694
695
696 #define yyerrok         (yyerrstatus = 0)
697 #define yyclearin       (yychar = YYEMPTY)
698 #define YYEMPTY         (-2)
699 #define YYEOF           0
700
701 #define YYACCEPT        goto yyacceptlab
702 #define YYABORT         goto yyabortlab
703 #define YYERROR         goto yyerrorlab
704
705
706 #define YYRECOVERING()  (!!yyerrstatus)
707
708 #define YYBACKUP(Token, Value)                                  \
709 do                                                              \
710   if (yychar == YYEMPTY)                                        \
711     {                                                           \
712       yychar = (Token);                                         \
713       yylval = (Value);                                         \
714       YYPOPSTACK (yylen);                                       \
715       yystate = *yyssp;                                         \
716       goto yybackup;                                            \
717     }                                                           \
718   else                                                          \
719     {                                                           \
720       yyerror (arg, YY_("syntax error: cannot back up")); \
721       YYERROR;                                                  \
722     }                                                           \
723 while (0)
724
725 /* Error token number */
726 #define YYTERROR        1
727 #define YYERRCODE       256
728
729
730
731 /* Enable debugging if requested.  */
732 #if YYDEBUG
733
734 # ifndef YYFPRINTF
735 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
736 #  define YYFPRINTF fprintf
737 # endif
738
739 # define YYDPRINTF(Args)                        \
740 do {                                            \
741   if (yydebug)                                  \
742     YYFPRINTF Args;                             \
743 } while (0)
744
745 /* This macro is provided for backward compatibility. */
746 #ifndef YY_LOCATION_PRINT
747 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
748 #endif
749
750
751 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
752 do {                                                                      \
753   if (yydebug)                                                            \
754     {                                                                     \
755       YYFPRINTF (stderr, "%s ", Title);                                   \
756       yy_symbol_print (stderr,                                            \
757                   Type, Value, arg); \
758       YYFPRINTF (stderr, "\n");                                           \
759     }                                                                     \
760 } while (0)
761
762
763 /*----------------------------------------.
764 | Print this symbol's value on YYOUTPUT.  |
765 `----------------------------------------*/
766
767 static void
768 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct cldr_plural_parse_args *arg)
769 {
770   FILE *yyo = yyoutput;
771   YYUSE (yyo);
772   YYUSE (arg);
773   if (!yyvaluep)
774     return;
775 # ifdef YYPRINT
776   if (yytype < YYNTOKENS)
777     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
778 # endif
779   YYUSE (yytype);
780 }
781
782
783 /*--------------------------------.
784 | Print this symbol on YYOUTPUT.  |
785 `--------------------------------*/
786
787 static void
788 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct cldr_plural_parse_args *arg)
789 {
790   YYFPRINTF (yyoutput, "%s %s (",
791              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
792
793   yy_symbol_value_print (yyoutput, yytype, yyvaluep, arg);
794   YYFPRINTF (yyoutput, ")");
795 }
796
797 /*------------------------------------------------------------------.
798 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
799 | TOP (included).                                                   |
800 `------------------------------------------------------------------*/
801
802 static void
803 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
804 {
805   YYFPRINTF (stderr, "Stack now");
806   for (; yybottom <= yytop; yybottom++)
807     {
808       int yybot = *yybottom;
809       YYFPRINTF (stderr, " %d", yybot);
810     }
811   YYFPRINTF (stderr, "\n");
812 }
813
814 # define YY_STACK_PRINT(Bottom, Top)                            \
815 do {                                                            \
816   if (yydebug)                                                  \
817     yy_stack_print ((Bottom), (Top));                           \
818 } while (0)
819
820
821 /*------------------------------------------------.
822 | Report that the YYRULE is going to be reduced.  |
823 `------------------------------------------------*/
824
825 static void
826 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, struct cldr_plural_parse_args *arg)
827 {
828   unsigned long int yylno = yyrline[yyrule];
829   int yynrhs = yyr2[yyrule];
830   int yyi;
831   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
832              yyrule - 1, yylno);
833   /* The symbols being reduced.  */
834   for (yyi = 0; yyi < yynrhs; yyi++)
835     {
836       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
837       yy_symbol_print (stderr,
838                        yystos[yyssp[yyi + 1 - yynrhs]],
839                        &(yyvsp[(yyi + 1) - (yynrhs)])
840                                               , arg);
841       YYFPRINTF (stderr, "\n");
842     }
843 }
844
845 # define YY_REDUCE_PRINT(Rule)          \
846 do {                                    \
847   if (yydebug)                          \
848     yy_reduce_print (yyssp, yyvsp, Rule, arg); \
849 } while (0)
850
851 /* Nonzero means print parse trace.  It is left uninitialized so that
852    multiple parsers can coexist.  */
853 int yydebug;
854 #else /* !YYDEBUG */
855 # define YYDPRINTF(Args)
856 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
857 # define YY_STACK_PRINT(Bottom, Top)
858 # define YY_REDUCE_PRINT(Rule)
859 #endif /* !YYDEBUG */
860
861
862 /* YYINITDEPTH -- initial size of the parser's stacks.  */
863 #ifndef YYINITDEPTH
864 # define YYINITDEPTH 200
865 #endif
866
867 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
868    if the built-in stack extension method is used).
869
870    Do not make this value too large; the results are undefined if
871    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
872    evaluated with infinite-precision integer arithmetic.  */
873
874 #ifndef YYMAXDEPTH
875 # define YYMAXDEPTH 10000
876 #endif
877
878
879 #if YYERROR_VERBOSE
880
881 # ifndef yystrlen
882 #  if defined __GLIBC__ && defined _STRING_H
883 #   define yystrlen strlen
884 #  else
885 /* Return the length of YYSTR.  */
886 static YYSIZE_T
887 yystrlen (const char *yystr)
888 {
889   YYSIZE_T yylen;
890   for (yylen = 0; yystr[yylen]; yylen++)
891     continue;
892   return yylen;
893 }
894 #  endif
895 # endif
896
897 # ifndef yystpcpy
898 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
899 #   define yystpcpy stpcpy
900 #  else
901 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
902    YYDEST.  */
903 static char *
904 yystpcpy (char *yydest, const char *yysrc)
905 {
906   char *yyd = yydest;
907   const char *yys = yysrc;
908
909   while ((*yyd++ = *yys++) != '\0')
910     continue;
911
912   return yyd - 1;
913 }
914 #  endif
915 # endif
916
917 # ifndef yytnamerr
918 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
919    quotes and backslashes, so that it's suitable for yyerror.  The
920    heuristic is that double-quoting is unnecessary unless the string
921    contains an apostrophe, a comma, or backslash (other than
922    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
923    null, do not copy; instead, return the length of what the result
924    would have been.  */
925 static YYSIZE_T
926 yytnamerr (char *yyres, const char *yystr)
927 {
928   if (*yystr == '"')
929     {
930       YYSIZE_T yyn = 0;
931       char const *yyp = yystr;
932
933       for (;;)
934         switch (*++yyp)
935           {
936           case '\'':
937           case ',':
938             goto do_not_strip_quotes;
939
940           case '\\':
941             if (*++yyp != '\\')
942               goto do_not_strip_quotes;
943             /* Fall through.  */
944           default:
945             if (yyres)
946               yyres[yyn] = *yyp;
947             yyn++;
948             break;
949
950           case '"':
951             if (yyres)
952               yyres[yyn] = '\0';
953             return yyn;
954           }
955     do_not_strip_quotes: ;
956     }
957
958   if (! yyres)
959     return yystrlen (yystr);
960
961   return yystpcpy (yyres, yystr) - yyres;
962 }
963 # endif
964
965 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
966    about the unexpected token YYTOKEN for the state stack whose top is
967    YYSSP.
968
969    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
970    not large enough to hold the message.  In that case, also set
971    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
972    required number of bytes is too large to store.  */
973 static int
974 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
975                 yytype_int16 *yyssp, int yytoken)
976 {
977   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
978   YYSIZE_T yysize = yysize0;
979   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
980   /* Internationalized format string. */
981   const char *yyformat = YY_NULLPTR;
982   /* Arguments of yyformat. */
983   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
984   /* Number of reported tokens (one for the "unexpected", one per
985      "expected"). */
986   int yycount = 0;
987
988   /* There are many possibilities here to consider:
989      - If this state is a consistent state with a default action, then
990        the only way this function was invoked is if the default action
991        is an error action.  In that case, don't check for expected
992        tokens because there are none.
993      - The only way there can be no lookahead present (in yychar) is if
994        this state is a consistent state with a default action.  Thus,
995        detecting the absence of a lookahead is sufficient to determine
996        that there is no unexpected or expected token to report.  In that
997        case, just report a simple "syntax error".
998      - Don't assume there isn't a lookahead just because this state is a
999        consistent state with a default action.  There might have been a
1000        previous inconsistent state, consistent state with a non-default
1001        action, or user semantic action that manipulated yychar.
1002      - Of course, the expected token list depends on states to have
1003        correct lookahead information, and it depends on the parser not
1004        to perform extra reductions after fetching a lookahead from the
1005        scanner and before detecting a syntax error.  Thus, state merging
1006        (from LALR or IELR) and default reductions corrupt the expected
1007        token list.  However, the list is correct for canonical LR with
1008        one exception: it will still contain any token that will not be
1009        accepted due to an error action in a later state.
1010   */
1011   if (yytoken != YYEMPTY)
1012     {
1013       int yyn = yypact[*yyssp];
1014       yyarg[yycount++] = yytname[yytoken];
1015       if (!yypact_value_is_default (yyn))
1016         {
1017           /* Start YYX at -YYN if negative to avoid negative indexes in
1018              YYCHECK.  In other words, skip the first -YYN actions for
1019              this state because they are default actions.  */
1020           int yyxbegin = yyn < 0 ? -yyn : 0;
1021           /* Stay within bounds of both yycheck and yytname.  */
1022           int yychecklim = YYLAST - yyn + 1;
1023           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1024           int yyx;
1025
1026           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1027             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1028                 && !yytable_value_is_error (yytable[yyx + yyn]))
1029               {
1030                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1031                   {
1032                     yycount = 1;
1033                     yysize = yysize0;
1034                     break;
1035                   }
1036                 yyarg[yycount++] = yytname[yyx];
1037                 {
1038                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1039                   if (! (yysize <= yysize1
1040                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1041                     return 2;
1042                   yysize = yysize1;
1043                 }
1044               }
1045         }
1046     }
1047
1048   switch (yycount)
1049     {
1050 # define YYCASE_(N, S)                      \
1051       case N:                               \
1052         yyformat = S;                       \
1053       break
1054       YYCASE_(0, YY_("syntax error"));
1055       YYCASE_(1, YY_("syntax error, unexpected %s"));
1056       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1057       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1058       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1059       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1060 # undef YYCASE_
1061     }
1062
1063   {
1064     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1065     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1066       return 2;
1067     yysize = yysize1;
1068   }
1069
1070   if (*yymsg_alloc < yysize)
1071     {
1072       *yymsg_alloc = 2 * yysize;
1073       if (! (yysize <= *yymsg_alloc
1074              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1075         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1076       return 1;
1077     }
1078
1079   /* Avoid sprintf, as that infringes on the user's name space.
1080      Don't have undefined behavior even if the translation
1081      produced a string with the wrong number of "%s"s.  */
1082   {
1083     char *yyp = *yymsg;
1084     int yyi = 0;
1085     while ((*yyp = *yyformat) != '\0')
1086       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1087         {
1088           yyp += yytnamerr (yyp, yyarg[yyi++]);
1089           yyformat += 2;
1090         }
1091       else
1092         {
1093           yyp++;
1094           yyformat++;
1095         }
1096   }
1097   return 0;
1098 }
1099 #endif /* YYERROR_VERBOSE */
1100
1101 /*-----------------------------------------------.
1102 | Release the memory associated to this symbol.  |
1103 `-----------------------------------------------*/
1104
1105 static void
1106 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct cldr_plural_parse_args *arg)
1107 {
1108   YYUSE (yyvaluep);
1109   YYUSE (arg);
1110   if (!yymsg)
1111     yymsg = "Deleting";
1112   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1113
1114   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1115   switch (yytype)
1116     {
1117           case 10: /* KEYWORD  */
1118 #line 138 "cldr-plural.y" /* yacc.c:1257  */
1119       { free (((*yyvaluep).sval)); }
1120 #line 1121 "cldr-plural.c" /* yacc.c:1257  */
1121         break;
1122
1123     case 11: /* INTEGER  */
1124 #line 143 "cldr-plural.y" /* yacc.c:1257  */
1125       { free (((*yyvaluep).oval)); }
1126 #line 1127 "cldr-plural.c" /* yacc.c:1257  */
1127         break;
1128
1129     case 12: /* DECIMAL  */
1130 #line 143 "cldr-plural.y" /* yacc.c:1257  */
1131       { free (((*yyvaluep).oval)); }
1132 #line 1133 "cldr-plural.c" /* yacc.c:1257  */
1133         break;
1134
1135     case 13: /* OPERAND  */
1136 #line 145 "cldr-plural.y" /* yacc.c:1257  */
1137       { }
1138 #line 1139 "cldr-plural.c" /* yacc.c:1257  */
1139         break;
1140
1141     case 24: /* condition  */
1142 #line 139 "cldr-plural.y" /* yacc.c:1257  */
1143       { cldr_plural_condition_free (((*yyvaluep).cval)); }
1144 #line 1145 "cldr-plural.c" /* yacc.c:1257  */
1145         break;
1146
1147     case 25: /* and_condition  */
1148 #line 139 "cldr-plural.y" /* yacc.c:1257  */
1149       { cldr_plural_condition_free (((*yyvaluep).cval)); }
1150 #line 1151 "cldr-plural.c" /* yacc.c:1257  */
1151         break;
1152
1153     case 26: /* relation  */
1154 #line 140 "cldr-plural.y" /* yacc.c:1257  */
1155       { cldr_plural_relation_free (((*yyvaluep).lval)); }
1156 #line 1157 "cldr-plural.c" /* yacc.c:1257  */
1157         break;
1158
1159     case 27: /* expression  */
1160 #line 141 "cldr-plural.y" /* yacc.c:1257  */
1161       { free (((*yyvaluep).eval)); }
1162 #line 1163 "cldr-plural.c" /* yacc.c:1257  */
1163         break;
1164
1165     case 28: /* range_list  */
1166 #line 144 "cldr-plural.y" /* yacc.c:1257  */
1167       { cldr_plural_range_list_free (((*yyvaluep).rval)); }
1168 #line 1169 "cldr-plural.c" /* yacc.c:1257  */
1169         break;
1170
1171     case 29: /* range_or_integer  */
1172 #line 142 "cldr-plural.y" /* yacc.c:1257  */
1173       { cldr_plural_range_free (((*yyvaluep).gval)); }
1174 #line 1175 "cldr-plural.c" /* yacc.c:1257  */
1175         break;
1176
1177     case 30: /* range  */
1178 #line 142 "cldr-plural.y" /* yacc.c:1257  */
1179       { cldr_plural_range_free (((*yyvaluep).gval)); }
1180 #line 1181 "cldr-plural.c" /* yacc.c:1257  */
1181         break;
1182
1183
1184       default:
1185         break;
1186     }
1187   YY_IGNORE_MAYBE_UNINITIALIZED_END
1188 }
1189
1190
1191
1192
1193 /*----------.
1194 | yyparse.  |
1195 `----------*/
1196
1197 int
1198 yyparse (struct cldr_plural_parse_args *arg)
1199 {
1200 /* The lookahead symbol.  */
1201 int yychar;
1202
1203
1204 /* The semantic value of the lookahead symbol.  */
1205 /* Default value used for initialization, for pacifying older GCCs
1206    or non-GCC compilers.  */
1207 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1208 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1209
1210     /* Number of syntax errors so far.  */
1211     int yynerrs;
1212
1213     int yystate;
1214     /* Number of tokens to shift before error messages enabled.  */
1215     int yyerrstatus;
1216
1217     /* The stacks and their tools:
1218        'yyss': related to states.
1219        'yyvs': related to semantic values.
1220
1221        Refer to the stacks through separate pointers, to allow yyoverflow
1222        to reallocate them elsewhere.  */
1223
1224     /* The state stack.  */
1225     yytype_int16 yyssa[YYINITDEPTH];
1226     yytype_int16 *yyss;
1227     yytype_int16 *yyssp;
1228
1229     /* The semantic value stack.  */
1230     YYSTYPE yyvsa[YYINITDEPTH];
1231     YYSTYPE *yyvs;
1232     YYSTYPE *yyvsp;
1233
1234     YYSIZE_T yystacksize;
1235
1236   int yyn;
1237   int yyresult;
1238   /* Lookahead token as an internal (translated) token number.  */
1239   int yytoken = 0;
1240   /* The variables used to return semantic value and location from the
1241      action routines.  */
1242   YYSTYPE yyval;
1243
1244 #if YYERROR_VERBOSE
1245   /* Buffer for error messages, and its allocated size.  */
1246   char yymsgbuf[128];
1247   char *yymsg = yymsgbuf;
1248   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1249 #endif
1250
1251 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1252
1253   /* The number of symbols on the RHS of the reduced rule.
1254      Keep to zero when no symbol should be popped.  */
1255   int yylen = 0;
1256
1257   yyssp = yyss = yyssa;
1258   yyvsp = yyvs = yyvsa;
1259   yystacksize = YYINITDEPTH;
1260
1261   YYDPRINTF ((stderr, "Starting parse\n"));
1262
1263   yystate = 0;
1264   yyerrstatus = 0;
1265   yynerrs = 0;
1266   yychar = YYEMPTY; /* Cause a token to be read.  */
1267   goto yysetstate;
1268
1269 /*------------------------------------------------------------.
1270 | yynewstate -- Push a new state, which is found in yystate.  |
1271 `------------------------------------------------------------*/
1272  yynewstate:
1273   /* In all cases, when you get here, the value and location stacks
1274      have just been pushed.  So pushing a state here evens the stacks.  */
1275   yyssp++;
1276
1277  yysetstate:
1278   *yyssp = yystate;
1279
1280   if (yyss + yystacksize - 1 <= yyssp)
1281     {
1282       /* Get the current used size of the three stacks, in elements.  */
1283       YYSIZE_T yysize = yyssp - yyss + 1;
1284
1285 #ifdef yyoverflow
1286       {
1287         /* Give user a chance to reallocate the stack.  Use copies of
1288            these so that the &'s don't force the real ones into
1289            memory.  */
1290         YYSTYPE *yyvs1 = yyvs;
1291         yytype_int16 *yyss1 = yyss;
1292
1293         /* Each stack pointer address is followed by the size of the
1294            data in use in that stack, in bytes.  This used to be a
1295            conditional around just the two extra args, but that might
1296            be undefined if yyoverflow is a macro.  */
1297         yyoverflow (YY_("memory exhausted"),
1298                     &yyss1, yysize * sizeof (*yyssp),
1299                     &yyvs1, yysize * sizeof (*yyvsp),
1300                     &yystacksize);
1301
1302         yyss = yyss1;
1303         yyvs = yyvs1;
1304       }
1305 #else /* no yyoverflow */
1306 # ifndef YYSTACK_RELOCATE
1307       goto yyexhaustedlab;
1308 # else
1309       /* Extend the stack our own way.  */
1310       if (YYMAXDEPTH <= yystacksize)
1311         goto yyexhaustedlab;
1312       yystacksize *= 2;
1313       if (YYMAXDEPTH < yystacksize)
1314         yystacksize = YYMAXDEPTH;
1315
1316       {
1317         yytype_int16 *yyss1 = yyss;
1318         union yyalloc *yyptr =
1319           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1320         if (! yyptr)
1321           goto yyexhaustedlab;
1322         YYSTACK_RELOCATE (yyss_alloc, yyss);
1323         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1324 #  undef YYSTACK_RELOCATE
1325         if (yyss1 != yyssa)
1326           YYSTACK_FREE (yyss1);
1327       }
1328 # endif
1329 #endif /* no yyoverflow */
1330
1331       yyssp = yyss + yysize - 1;
1332       yyvsp = yyvs + yysize - 1;
1333
1334       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1335                   (unsigned long int) yystacksize));
1336
1337       if (yyss + yystacksize - 1 <= yyssp)
1338         YYABORT;
1339     }
1340
1341   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1342
1343   if (yystate == YYFINAL)
1344     YYACCEPT;
1345
1346   goto yybackup;
1347
1348 /*-----------.
1349 | yybackup.  |
1350 `-----------*/
1351 yybackup:
1352
1353   /* Do appropriate processing given the current state.  Read a
1354      lookahead token if we need one and don't already have one.  */
1355
1356   /* First try to decide what to do without reference to lookahead token.  */
1357   yyn = yypact[yystate];
1358   if (yypact_value_is_default (yyn))
1359     goto yydefault;
1360
1361   /* Not known => get a lookahead token if don't already have one.  */
1362
1363   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1364   if (yychar == YYEMPTY)
1365     {
1366       YYDPRINTF ((stderr, "Reading a token: "));
1367       yychar = yylex (&yylval, arg);
1368     }
1369
1370   if (yychar <= YYEOF)
1371     {
1372       yychar = yytoken = YYEOF;
1373       YYDPRINTF ((stderr, "Now at end of input.\n"));
1374     }
1375   else
1376     {
1377       yytoken = YYTRANSLATE (yychar);
1378       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1379     }
1380
1381   /* If the proper action on seeing token YYTOKEN is to reduce or to
1382      detect an error, take that action.  */
1383   yyn += yytoken;
1384   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1385     goto yydefault;
1386   yyn = yytable[yyn];
1387   if (yyn <= 0)
1388     {
1389       if (yytable_value_is_error (yyn))
1390         goto yyerrlab;
1391       yyn = -yyn;
1392       goto yyreduce;
1393     }
1394
1395   /* Count tokens shifted since error; after three, turn off error
1396      status.  */
1397   if (yyerrstatus)
1398     yyerrstatus--;
1399
1400   /* Shift the lookahead token.  */
1401   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1402
1403   /* Discard the shifted token.  */
1404   yychar = YYEMPTY;
1405
1406   yystate = yyn;
1407   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1408   *++yyvsp = yylval;
1409   YY_IGNORE_MAYBE_UNINITIALIZED_END
1410
1411   goto yynewstate;
1412
1413
1414 /*-----------------------------------------------------------.
1415 | yydefault -- do the default action for the current state.  |
1416 `-----------------------------------------------------------*/
1417 yydefault:
1418   yyn = yydefact[yystate];
1419   if (yyn == 0)
1420     goto yyerrlab;
1421   goto yyreduce;
1422
1423
1424 /*-----------------------------.
1425 | yyreduce -- Do a reduction.  |
1426 `-----------------------------*/
1427 yyreduce:
1428   /* yyn is the number of a rule to reduce with.  */
1429   yylen = yyr2[yyn];
1430
1431   /* If YYLEN is nonzero, implement the default value of the action:
1432      '$$ = $1'.
1433
1434      Otherwise, the following line sets YYVAL to garbage.
1435      This behavior is undocumented and Bison
1436      users should not rely upon it.  Assigning to YYVAL
1437      unconditionally makes the parser a bit smaller, and it avoids a
1438      GCC warning that YYVAL may be used uninitialized.  */
1439   yyval = yyvsp[1-yylen];
1440
1441
1442   YY_REDUCE_PRINT (yyn);
1443   switch (yyn)
1444     {
1445         case 4:
1446 #line 164 "cldr-plural.y" /* yacc.c:1646  */
1447     {
1448           struct cldr_plural_rule_ty *rule = new_rule ((yyvsp[-3].sval), (yyvsp[-1].cval));
1449           struct cldr_plural_rule_list_ty *result = arg->result;
1450           if (result->nitems == result->nitems_max)
1451             {
1452               result->nitems_max = result->nitems_max * 2 + 1;
1453               result->items = xrealloc (result->items,
1454                                         sizeof (struct cldr_plural_rule_ty *)
1455                                         * result->nitems_max);
1456             }
1457           result->items[result->nitems++] = rule;
1458         }
1459 #line 1460 "cldr-plural.c" /* yacc.c:1646  */
1460     break;
1461
1462   case 6:
1463 #line 180 "cldr-plural.y" /* yacc.c:1646  */
1464     {
1465           (yyval.cval) = (yyvsp[0].cval);
1466         }
1467 #line 1468 "cldr-plural.c" /* yacc.c:1646  */
1468     break;
1469
1470   case 7:
1471 #line 184 "cldr-plural.y" /* yacc.c:1646  */
1472     {
1473           (yyval.cval) = new_branch_condition (CLDR_PLURAL_CONDITION_OR, (yyvsp[-2].cval), (yyvsp[0].cval));
1474         }
1475 #line 1476 "cldr-plural.c" /* yacc.c:1646  */
1476     break;
1477
1478   case 8:
1479 #line 190 "cldr-plural.y" /* yacc.c:1646  */
1480     {
1481           (yyval.cval) = new_leaf_condition ((yyvsp[0].lval));
1482         }
1483 #line 1484 "cldr-plural.c" /* yacc.c:1646  */
1484     break;
1485
1486   case 9:
1487 #line 194 "cldr-plural.y" /* yacc.c:1646  */
1488     {
1489           (yyval.cval) = new_branch_condition (CLDR_PLURAL_CONDITION_AND,
1490                                      (yyvsp[-2].cval),
1491                                      new_leaf_condition ((yyvsp[0].lval)));
1492         }
1493 #line 1494 "cldr-plural.c" /* yacc.c:1646  */
1494     break;
1495
1496   case 10:
1497 #line 202 "cldr-plural.y" /* yacc.c:1646  */
1498     {
1499           (yyval.lval) = new_relation ((yyvsp[-2].eval), CLDR_PLURAL_RELATION_EQUAL, (yyvsp[0].rval));
1500         }
1501 #line 1502 "cldr-plural.c" /* yacc.c:1646  */
1502     break;
1503
1504   case 11:
1505 #line 206 "cldr-plural.y" /* yacc.c:1646  */
1506     {
1507           (yyval.lval) = new_relation ((yyvsp[-2].eval), CLDR_PLURAL_RELATION_NOT_EQUAL, (yyvsp[0].rval));
1508         }
1509 #line 1510 "cldr-plural.c" /* yacc.c:1646  */
1510     break;
1511
1512   case 12:
1513 #line 212 "cldr-plural.y" /* yacc.c:1646  */
1514     {
1515           (yyval.eval) = new_expression ((yyvsp[0].ival), 0);
1516         }
1517 #line 1518 "cldr-plural.c" /* yacc.c:1646  */
1518     break;
1519
1520   case 13:
1521 #line 216 "cldr-plural.y" /* yacc.c:1646  */
1522     {
1523           (yyval.eval) = new_expression ((yyvsp[-2].ival), (yyvsp[0].oval)->value.ival);
1524         }
1525 #line 1526 "cldr-plural.c" /* yacc.c:1646  */
1526     break;
1527
1528   case 14:
1529 #line 222 "cldr-plural.y" /* yacc.c:1646  */
1530     {
1531           struct cldr_plural_range_list_ty *ranges =
1532             XMALLOC (struct cldr_plural_range_list_ty);
1533           memset (ranges, 0, sizeof (struct cldr_plural_range_list_ty));
1534           (yyval.rval) = add_range (ranges, (yyvsp[0].gval));
1535         }
1536 #line 1537 "cldr-plural.c" /* yacc.c:1646  */
1537     break;
1538
1539   case 15:
1540 #line 229 "cldr-plural.y" /* yacc.c:1646  */
1541     {
1542           (yyval.rval) = add_range ((yyvsp[-2].rval), (yyvsp[0].gval));
1543         }
1544 #line 1545 "cldr-plural.c" /* yacc.c:1646  */
1545     break;
1546
1547   case 16:
1548 #line 235 "cldr-plural.y" /* yacc.c:1646  */
1549     {
1550           (yyval.gval) = (yyvsp[0].gval);
1551         }
1552 #line 1553 "cldr-plural.c" /* yacc.c:1646  */
1553     break;
1554
1555   case 17:
1556 #line 239 "cldr-plural.y" /* yacc.c:1646  */
1557     {
1558           (yyval.gval) = new_range ((yyvsp[0].oval), (yyvsp[0].oval));
1559         }
1560 #line 1561 "cldr-plural.c" /* yacc.c:1646  */
1561     break;
1562
1563   case 18:
1564 #line 245 "cldr-plural.y" /* yacc.c:1646  */
1565     {
1566           (yyval.gval) = new_range ((yyvsp[-2].oval), (yyvsp[0].oval));
1567         }
1568 #line 1569 "cldr-plural.c" /* yacc.c:1646  */
1569     break;
1570
1571   case 29:
1572 #line 272 "cldr-plural.y" /* yacc.c:1646  */
1573     { free ((yyvsp[0].oval)); }
1574 #line 1575 "cldr-plural.c" /* yacc.c:1646  */
1575     break;
1576
1577   case 30:
1578 #line 274 "cldr-plural.y" /* yacc.c:1646  */
1579     { free ((yyvsp[-2].oval)); free ((yyvsp[0].oval)); }
1580 #line 1581 "cldr-plural.c" /* yacc.c:1646  */
1581     break;
1582
1583   case 31:
1584 #line 276 "cldr-plural.y" /* yacc.c:1646  */
1585     { free ((yyvsp[0].oval)); }
1586 #line 1587 "cldr-plural.c" /* yacc.c:1646  */
1587     break;
1588
1589   case 32:
1590 #line 278 "cldr-plural.y" /* yacc.c:1646  */
1591     { free ((yyvsp[-2].oval)); free ((yyvsp[0].oval)); }
1592 #line 1593 "cldr-plural.c" /* yacc.c:1646  */
1593     break;
1594
1595
1596 #line 1597 "cldr-plural.c" /* yacc.c:1646  */
1597       default: break;
1598     }
1599   /* User semantic actions sometimes alter yychar, and that requires
1600      that yytoken be updated with the new translation.  We take the
1601      approach of translating immediately before every use of yytoken.
1602      One alternative is translating here after every semantic action,
1603      but that translation would be missed if the semantic action invokes
1604      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1605      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1606      incorrect destructor might then be invoked immediately.  In the
1607      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1608      to an incorrect destructor call or verbose syntax error message
1609      before the lookahead is translated.  */
1610   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1611
1612   YYPOPSTACK (yylen);
1613   yylen = 0;
1614   YY_STACK_PRINT (yyss, yyssp);
1615
1616   *++yyvsp = yyval;
1617
1618   /* Now 'shift' the result of the reduction.  Determine what state
1619      that goes to, based on the state we popped back to and the rule
1620      number reduced by.  */
1621
1622   yyn = yyr1[yyn];
1623
1624   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1625   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1626     yystate = yytable[yystate];
1627   else
1628     yystate = yydefgoto[yyn - YYNTOKENS];
1629
1630   goto yynewstate;
1631
1632
1633 /*--------------------------------------.
1634 | yyerrlab -- here on detecting error.  |
1635 `--------------------------------------*/
1636 yyerrlab:
1637   /* Make sure we have latest lookahead translation.  See comments at
1638      user semantic actions for why this is necessary.  */
1639   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1640
1641   /* If not already recovering from an error, report this error.  */
1642   if (!yyerrstatus)
1643     {
1644       ++yynerrs;
1645 #if ! YYERROR_VERBOSE
1646       yyerror (arg, YY_("syntax error"));
1647 #else
1648 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1649                                         yyssp, yytoken)
1650       {
1651         char const *yymsgp = YY_("syntax error");
1652         int yysyntax_error_status;
1653         yysyntax_error_status = YYSYNTAX_ERROR;
1654         if (yysyntax_error_status == 0)
1655           yymsgp = yymsg;
1656         else if (yysyntax_error_status == 1)
1657           {
1658             if (yymsg != yymsgbuf)
1659               YYSTACK_FREE (yymsg);
1660             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1661             if (!yymsg)
1662               {
1663                 yymsg = yymsgbuf;
1664                 yymsg_alloc = sizeof yymsgbuf;
1665                 yysyntax_error_status = 2;
1666               }
1667             else
1668               {
1669                 yysyntax_error_status = YYSYNTAX_ERROR;
1670                 yymsgp = yymsg;
1671               }
1672           }
1673         yyerror (arg, yymsgp);
1674         if (yysyntax_error_status == 2)
1675           goto yyexhaustedlab;
1676       }
1677 # undef YYSYNTAX_ERROR
1678 #endif
1679     }
1680
1681
1682
1683   if (yyerrstatus == 3)
1684     {
1685       /* If just tried and failed to reuse lookahead token after an
1686          error, discard it.  */
1687
1688       if (yychar <= YYEOF)
1689         {
1690           /* Return failure if at end of input.  */
1691           if (yychar == YYEOF)
1692             YYABORT;
1693         }
1694       else
1695         {
1696           yydestruct ("Error: discarding",
1697                       yytoken, &yylval, arg);
1698           yychar = YYEMPTY;
1699         }
1700     }
1701
1702   /* Else will try to reuse lookahead token after shifting the error
1703      token.  */
1704   goto yyerrlab1;
1705
1706
1707 /*---------------------------------------------------.
1708 | yyerrorlab -- error raised explicitly by YYERROR.  |
1709 `---------------------------------------------------*/
1710 yyerrorlab:
1711
1712   /* Pacify compilers like GCC when the user code never invokes
1713      YYERROR and the label yyerrorlab therefore never appears in user
1714      code.  */
1715   if (/*CONSTCOND*/ 0)
1716      goto yyerrorlab;
1717
1718   /* Do not reclaim the symbols of the rule whose action triggered
1719      this YYERROR.  */
1720   YYPOPSTACK (yylen);
1721   yylen = 0;
1722   YY_STACK_PRINT (yyss, yyssp);
1723   yystate = *yyssp;
1724   goto yyerrlab1;
1725
1726
1727 /*-------------------------------------------------------------.
1728 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1729 `-------------------------------------------------------------*/
1730 yyerrlab1:
1731   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1732
1733   for (;;)
1734     {
1735       yyn = yypact[yystate];
1736       if (!yypact_value_is_default (yyn))
1737         {
1738           yyn += YYTERROR;
1739           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1740             {
1741               yyn = yytable[yyn];
1742               if (0 < yyn)
1743                 break;
1744             }
1745         }
1746
1747       /* Pop the current state because it cannot handle the error token.  */
1748       if (yyssp == yyss)
1749         YYABORT;
1750
1751
1752       yydestruct ("Error: popping",
1753                   yystos[yystate], yyvsp, arg);
1754       YYPOPSTACK (1);
1755       yystate = *yyssp;
1756       YY_STACK_PRINT (yyss, yyssp);
1757     }
1758
1759   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1760   *++yyvsp = yylval;
1761   YY_IGNORE_MAYBE_UNINITIALIZED_END
1762
1763
1764   /* Shift the error token.  */
1765   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1766
1767   yystate = yyn;
1768   goto yynewstate;
1769
1770
1771 /*-------------------------------------.
1772 | yyacceptlab -- YYACCEPT comes here.  |
1773 `-------------------------------------*/
1774 yyacceptlab:
1775   yyresult = 0;
1776   goto yyreturn;
1777
1778 /*-----------------------------------.
1779 | yyabortlab -- YYABORT comes here.  |
1780 `-----------------------------------*/
1781 yyabortlab:
1782   yyresult = 1;
1783   goto yyreturn;
1784
1785 #if !defined yyoverflow || YYERROR_VERBOSE
1786 /*-------------------------------------------------.
1787 | yyexhaustedlab -- memory exhaustion comes here.  |
1788 `-------------------------------------------------*/
1789 yyexhaustedlab:
1790   yyerror (arg, YY_("memory exhausted"));
1791   yyresult = 2;
1792   /* Fall through.  */
1793 #endif
1794
1795 yyreturn:
1796   if (yychar != YYEMPTY)
1797     {
1798       /* Make sure we have latest lookahead translation.  See comments at
1799          user semantic actions for why this is necessary.  */
1800       yytoken = YYTRANSLATE (yychar);
1801       yydestruct ("Cleanup: discarding lookahead",
1802                   yytoken, &yylval, arg);
1803     }
1804   /* Do not reclaim the symbols of the rule whose action triggered
1805      this YYABORT or YYACCEPT.  */
1806   YYPOPSTACK (yylen);
1807   YY_STACK_PRINT (yyss, yyssp);
1808   while (yyssp != yyss)
1809     {
1810       yydestruct ("Cleanup: popping",
1811                   yystos[*yyssp], yyvsp, arg);
1812       YYPOPSTACK (1);
1813     }
1814 #ifndef yyoverflow
1815   if (yyss != yyssa)
1816     YYSTACK_FREE (yyss);
1817 #endif
1818 #if YYERROR_VERBOSE
1819   if (yymsg != yymsgbuf)
1820     YYSTACK_FREE (yymsg);
1821 #endif
1822   return yyresult;
1823 }
1824 #line 281 "cldr-plural.y" /* yacc.c:1906  */
1825
1826
1827 static int
1828 yylex (YYSTYPE *lval, struct cldr_plural_parse_args *arg)
1829 {
1830   const char *exp = arg->cp;
1831   ucs4_t uc;
1832   int length;
1833   int result;
1834   static char *buffer;
1835   static size_t bufmax;
1836   size_t bufpos;
1837
1838   while (1)
1839     {
1840       if (exp[0] == '\0')
1841         {
1842           arg->cp = exp;
1843           return YYEOF;
1844         }
1845
1846       if (exp[0] != ' ' && exp[0] != '\t')
1847         break;
1848
1849       ++exp;
1850     }
1851
1852   length = u8_mbtouc (&uc, (const uint8_t *) exp, arg->cp_end - exp);
1853   if (uc == 0x2026)
1854     {
1855       arg->cp = exp + length;
1856       return ELLIPSIS;
1857     }
1858   else if (strncmp ("...", exp, 3) == 0)
1859     {
1860       arg->cp = exp + 3;
1861       return ELLIPSIS;
1862     }
1863   else if (strncmp ("..", exp, 2) == 0)
1864     {
1865       arg->cp = exp + 2;
1866       return RANGE;
1867     }
1868   else if (strncmp ("other", exp, 5) == 0)
1869     {
1870       arg->cp = exp + 5;
1871       return OTHER;
1872     }
1873   else if (strncmp ("@integer", exp, 8) == 0)
1874     {
1875       arg->cp = exp + 8;
1876       return AT_INTEGER;
1877     }
1878   else if (strncmp ("@decimal", exp, 8) == 0)
1879     {
1880       arg->cp = exp + 8;
1881       return AT_DECIMAL;
1882     }
1883
1884   result = *exp++;
1885   switch (result)
1886     {
1887     case '0': case '1': case '2': case '3': case '4':
1888     case '5': case '6': case '7': case '8': case '9':
1889       {
1890         unsigned long int ival = result - '0';
1891
1892         while (exp[0] >= '0' && exp[0] <= '9')
1893           {
1894             ival *= 10;
1895             ival += exp[0] - '0';
1896             ++exp;
1897           }
1898
1899         lval->oval = XMALLOC (struct cldr_plural_operand_ty);
1900         if (exp[0] == '.' && exp[1] >= '0' && exp[1] <= '9')
1901           {
1902             double dval = ival;
1903             int denominator = 10, nfractions = 0;
1904             ++exp;
1905             while (exp[0] >= '0' && exp[0] <= '9')
1906               {
1907                 dval += (exp[0] - '0') / (double) denominator;
1908                 denominator *= 10;
1909                 ++nfractions;
1910                 ++exp;
1911               }
1912             lval->oval->type = CLDR_PLURAL_OPERAND_DECIMAL;
1913             lval->oval->value.dval.d = dval;
1914             lval->oval->value.dval.nfractions = nfractions;
1915             result = DECIMAL;
1916           }
1917         else
1918           {
1919             lval->oval->type = CLDR_PLURAL_OPERAND_INTEGER;
1920             lval->oval->value.ival = ival;
1921             result = INTEGER;
1922           }
1923       }
1924       break;
1925     case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
1926     case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
1927     case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
1928     case 'v': case 'w': case 'x': case 'y': case 'z':
1929       bufpos = 0;
1930       for (;;)
1931         {
1932           if (bufpos >= bufmax)
1933             {
1934               bufmax = 2 * bufmax + 10;
1935               buffer = xrealloc (buffer, bufmax);
1936             }
1937           buffer[bufpos++] = result;
1938           result = *exp;
1939           switch (result)
1940             {
1941             case 'a': case 'b': case 'c': case 'd': case 'e':
1942             case 'f': case 'g': case 'h': case 'i': case 'j':
1943             case 'k': case 'l': case 'm': case 'n': case 'o':
1944             case 'p': case 'q': case 'r': case 's': case 't':
1945             case 'u': case 'v': case 'w': case 'x': case 'y':
1946             case 'z':
1947               ++exp;
1948               continue;
1949             default:
1950               break;
1951             }
1952           break;
1953         }
1954
1955       if (bufpos >= bufmax)
1956         {
1957           bufmax = 2 * bufmax + 10;
1958           buffer = xrealloc (buffer, bufmax);
1959         }
1960       buffer[bufpos] = '\0';
1961
1962       /* Operands.  */
1963       if (bufpos == 1)
1964         {
1965           switch (buffer[0])
1966             {
1967             case 'n': case 'i': case 'f': case 't': case 'v': case 'w':
1968               arg->cp = exp;
1969               lval->ival = buffer[0];
1970               return OPERAND;
1971             default:
1972               break;
1973             }
1974         }
1975
1976       /* Keywords.  */
1977       if (strcmp (buffer, "and") == 0)
1978         {
1979           arg->cp = exp;
1980           return AND;
1981         }
1982       else if (strcmp (buffer, "or") == 0)
1983         {
1984           arg->cp = exp;
1985           return OR;
1986         }
1987
1988       lval->sval = xstrdup (buffer);
1989       result = KEYWORD;
1990       break;
1991     case '!':
1992       if (exp[0] == '=')
1993         {
1994           ++exp;
1995           result = '!';
1996         }
1997       else
1998         result = YYERRCODE;
1999       break;
2000     default:
2001       break;
2002     }
2003
2004   arg->cp = exp;
2005
2006   return result;
2007 }
2008
2009 static void
2010 yyerror (struct cldr_plural_parse_args *arg, char const *s)
2011 {
2012   fprintf (stderr, "%s\n", s);
2013 }