1 /* A Bison parser, made by GNU Bison 3.0.4. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
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.
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.
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/>. */
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.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
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. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.4"
50 #define YYSKELETON_NAME "yacc.c"
64 /* Copy the first part of user declarations. */
65 #line 19 "cldr-plural.y" /* yacc.c:339 */
78 #include "cldr-plural-exp.h"
79 #include "cldr-plural.h"
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);
85 /* Allocation of expressions. */
87 static struct cldr_plural_rule_ty *
88 new_rule (char *name, struct cldr_plural_condition_ty *condition)
90 struct cldr_plural_rule_ty *result =
91 XMALLOC (struct cldr_plural_rule_ty);
93 result->condition = condition;
97 static struct cldr_plural_condition_ty *
98 new_leaf_condition (struct cldr_plural_relation_ty *relation)
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;
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)
112 struct cldr_plural_condition_ty *result =
113 XMALLOC (struct cldr_plural_condition_ty);
115 result->value.conditions[0] = condition0;
116 result->value.conditions[1] = condition1;
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)
125 struct cldr_plural_relation_ty *result =
126 XMALLOC (struct cldr_plural_relation_ty);
127 result->expression = expression;
129 result->ranges = ranges;
133 static struct cldr_plural_expression_ty *
134 new_expression (int operand, int mod)
136 struct cldr_plural_expression_ty *result =
137 XMALLOC (struct cldr_plural_expression_ty);
138 result->operand = operand;
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)
147 if (ranges->nitems == ranges->nitems_max)
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);
154 ranges->items[ranges->nitems++] = range;
158 static struct cldr_plural_range_ty *
159 new_range (struct cldr_plural_operand_ty *start,
160 struct cldr_plural_operand_ty *end)
162 struct cldr_plural_range_ty *result =
163 XMALLOC (struct cldr_plural_range_ty);
164 result->start = start;
169 #line 170 "cldr-plural.c" /* yacc.c:339 */
172 # if defined __cplusplus && 201103L <= __cplusplus
173 # define YY_NULLPTR nullptr
175 # define YY_NULLPTR 0
179 /* Enabling verbose error messages. */
180 #ifdef YYERROR_VERBOSE
181 # undef YYERROR_VERBOSE
182 # define YYERROR_VERBOSE 1
184 # define YYERROR_VERBOSE 0
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
223 #define AT_INTEGER 263
224 #define AT_DECIMAL 264
231 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
235 #line 127 "cldr-plural.y" /* yacc.c:355 */
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;
246 #line 247 "cldr-plural.c" /* yacc.c:355 */
249 typedef union YYSTYPE YYSTYPE;
250 # define YYSTYPE_IS_TRIVIAL 1
251 # define YYSTYPE_IS_DECLARED 1
256 int yyparse (struct cldr_plural_parse_args *arg);
258 #endif /* !YY_YY_CLDR_PLURAL_H_INCLUDED */
260 /* Copy the second part of user declarations. */
262 #line 263 "cldr-plural.c" /* yacc.c:358 */
269 typedef YYTYPE_UINT8 yytype_uint8;
271 typedef unsigned char yytype_uint8;
275 typedef YYTYPE_INT8 yytype_int8;
277 typedef signed char yytype_int8;
281 typedef YYTYPE_UINT16 yytype_uint16;
283 typedef unsigned short int yytype_uint16;
287 typedef YYTYPE_INT16 yytype_int16;
289 typedef short int yytype_int16;
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
301 # define YYSIZE_T unsigned int
305 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
308 # if defined YYENABLE_NLS && YYENABLE_NLS
310 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
311 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
315 # define YY_(Msgid) Msgid
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)
325 # define YY_ATTRIBUTE(Spec) /* empty */
329 #ifndef YY_ATTRIBUTE_PURE
330 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
333 #ifndef YY_ATTRIBUTE_UNUSED
334 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
337 #if !defined _Noreturn \
338 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
339 # if defined _MSC_VER && 1200 <= _MSC_VER
340 # define _Noreturn __declspec (noreturn)
342 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
346 /* Suppress unused-variable warnings by "using" E. */
347 #if ! defined lint || defined __GNUC__
348 # define YYUSE(E) ((void) (E))
350 # define YYUSE(E) /* empty */
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")
362 # define YY_INITIAL_VALUE(Value) Value
364 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
365 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
366 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
368 #ifndef YY_INITIAL_VALUE
369 # define YY_INITIAL_VALUE(Value) /* Nothing. */
373 #if ! defined yyoverflow || YYERROR_VERBOSE
375 /* The parser invokes alloca or malloc; define the necessary symbols. */
377 # ifdef YYSTACK_USE_ALLOCA
378 # if YYSTACK_USE_ALLOCA
380 # define YYSTACK_ALLOC __builtin_alloca
381 # elif defined __BUILTIN_VA_ARG_INCR
382 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
384 # define YYSTACK_ALLOC __alloca
385 # elif defined _MSC_VER
386 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
387 # define alloca _alloca
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
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 */
412 # define YYSTACK_ALLOC YYMALLOC
413 # define YYSTACK_FREE YYFREE
414 # ifndef YYSTACK_ALLOC_MAXIMUM
415 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
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
426 # define YYMALLOC malloc
427 # if ! defined malloc && ! defined EXIT_SUCCESS
428 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
433 # if ! defined free && ! defined EXIT_SUCCESS
434 void free (void *); /* INFRINGES ON USER NAME SPACE */
438 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
441 #if (! defined yyoverflow \
442 && (! defined __cplusplus \
443 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
445 /* A type that is properly aligned for any stack member. */
448 yytype_int16 yyss_alloc;
452 /* The size of the maximum gap between one aligned stack and the next. */
453 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
455 /* The size of an array large to enough to hold all stacks, each with
457 # define YYSTACK_BYTES(N) \
458 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
459 + YYSTACK_GAP_MAXIMUM)
461 # define YYCOPY_NEEDED 1
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
468 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
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); \
481 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
482 /* Copy COUNT objects from SRC to DST. The source and destination do
485 # if defined __GNUC__ && 1 < __GNUC__
486 # define YYCOPY(Dst, Src, Count) \
487 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
489 # define YYCOPY(Dst, Src, Count) \
493 for (yyi = 0; yyi < (Count); yyi++) \
494 (Dst)[yyi] = (Src)[yyi]; \
499 #endif /* !YYCOPY_NEEDED */
501 /* YYFINAL -- State number of the termination state. */
503 /* YYLAST -- Last index in YYTABLE. */
506 /* YYNTOKENS -- Number of terminals. */
508 /* YYNNTS -- Number of nonterminals. */
510 /* YYNRULES -- Number of rules. */
512 /* YYNSTATES -- Number of states. */
515 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
516 by yylex, with out-of-bounds checking. */
518 #define YYMAXUTOK 268
520 #define YYTRANSLATE(YYX) \
521 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
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[] =
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
557 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
558 static const yytype_uint16 yyrline[] =
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,
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[] =
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
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[] =
587 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
588 265, 266, 267, 268, 59, 58, 61, 33, 37, 44,
593 #define YYPACT_NINF -20
595 #define yypact_value_is_default(Yystate) \
596 (!!((Yystate) == (-20)))
598 #define YYTABLE_NINF -1
600 #define yytable_value_is_error(Yytable_value) \
603 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
605 static const yytype_int8 yypact[] =
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,
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[] =
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,
628 /* YYPGOTO[NTERM-NUM]. */
629 static const yytype_int8 yypgoto[] =
631 -20, -20, 21, -20, 14, 17, -20, 18, -19, -20,
632 20, -20, -20, 23, -20, -20, 22
635 /* YYDEFGOTO[NTERM-NUM]. */
636 static const yytype_int8 yydefgoto[] =
638 -1, 3, 4, 13, 14, 15, 16, 40, 41, 42,
639 10, 11, 24, 20, 21, 34, 22
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[] =
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,
655 static const yytype_int8 yycheck[] =
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
665 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
666 symbol of state STATE-NUM. */
667 static const yytype_uint8 yystos[] =
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,
677 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
678 static const yytype_uint8 yyr1[] =
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,
686 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
687 static const yytype_uint8 yyr2[] =
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,
696 #define yyerrok (yyerrstatus = 0)
697 #define yyclearin (yychar = YYEMPTY)
701 #define YYACCEPT goto yyacceptlab
702 #define YYABORT goto yyabortlab
703 #define YYERROR goto yyerrorlab
706 #define YYRECOVERING() (!!yyerrstatus)
708 #define YYBACKUP(Token, Value) \
710 if (yychar == YYEMPTY) \
714 YYPOPSTACK (yylen); \
720 yyerror (arg, YY_("syntax error: cannot back up")); \
725 /* Error token number */
727 #define YYERRCODE 256
731 /* Enable debugging if requested. */
735 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
736 # define YYFPRINTF fprintf
739 # define YYDPRINTF(Args) \
745 /* This macro is provided for backward compatibility. */
746 #ifndef YY_LOCATION_PRINT
747 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
751 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
755 YYFPRINTF (stderr, "%s ", Title); \
756 yy_symbol_print (stderr, \
758 YYFPRINTF (stderr, "\n"); \
763 /*----------------------------------------.
764 | Print this symbol's value on YYOUTPUT. |
765 `----------------------------------------*/
768 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct cldr_plural_parse_args *arg)
770 FILE *yyo = yyoutput;
776 if (yytype < YYNTOKENS)
777 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
783 /*--------------------------------.
784 | Print this symbol on YYOUTPUT. |
785 `--------------------------------*/
788 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct cldr_plural_parse_args *arg)
790 YYFPRINTF (yyoutput, "%s %s (",
791 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
793 yy_symbol_value_print (yyoutput, yytype, yyvaluep, arg);
794 YYFPRINTF (yyoutput, ")");
797 /*------------------------------------------------------------------.
798 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
800 `------------------------------------------------------------------*/
803 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
805 YYFPRINTF (stderr, "Stack now");
806 for (; yybottom <= yytop; yybottom++)
808 int yybot = *yybottom;
809 YYFPRINTF (stderr, " %d", yybot);
811 YYFPRINTF (stderr, "\n");
814 # define YY_STACK_PRINT(Bottom, Top) \
817 yy_stack_print ((Bottom), (Top)); \
821 /*------------------------------------------------.
822 | Report that the YYRULE is going to be reduced. |
823 `------------------------------------------------*/
826 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, struct cldr_plural_parse_args *arg)
828 unsigned long int yylno = yyrline[yyrule];
829 int yynrhs = yyr2[yyrule];
831 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
833 /* The symbols being reduced. */
834 for (yyi = 0; yyi < yynrhs; yyi++)
836 YYFPRINTF (stderr, " $%d = ", yyi + 1);
837 yy_symbol_print (stderr,
838 yystos[yyssp[yyi + 1 - yynrhs]],
839 &(yyvsp[(yyi + 1) - (yynrhs)])
841 YYFPRINTF (stderr, "\n");
845 # define YY_REDUCE_PRINT(Rule) \
848 yy_reduce_print (yyssp, yyvsp, Rule, arg); \
851 /* Nonzero means print parse trace. It is left uninitialized so that
852 multiple parsers can coexist. */
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 */
862 /* YYINITDEPTH -- initial size of the parser's stacks. */
864 # define YYINITDEPTH 200
867 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
868 if the built-in stack extension method is used).
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. */
875 # define YYMAXDEPTH 10000
882 # if defined __GLIBC__ && defined _STRING_H
883 # define yystrlen strlen
885 /* Return the length of YYSTR. */
887 yystrlen (const char *yystr)
890 for (yylen = 0; yystr[yylen]; yylen++)
898 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
899 # define yystpcpy stpcpy
901 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
904 yystpcpy (char *yydest, const char *yysrc)
907 const char *yys = yysrc;
909 while ((*yyd++ = *yys++) != '\0')
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
926 yytnamerr (char *yyres, const char *yystr)
931 char const *yyp = yystr;
938 goto do_not_strip_quotes;
942 goto do_not_strip_quotes;
955 do_not_strip_quotes: ;
959 return yystrlen (yystr);
961 return yystpcpy (yyres, yystr) - yyres;
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
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. */
974 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
975 yytype_int16 *yyssp, int yytoken)
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
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.
1011 if (yytoken != YYEMPTY)
1013 int yyn = yypact[*yyssp];
1014 yyarg[yycount++] = yytname[yytoken];
1015 if (!yypact_value_is_default (yyn))
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;
1026 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1027 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1028 && !yytable_value_is_error (yytable[yyx + yyn]))
1030 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1036 yyarg[yycount++] = yytname[yyx];
1038 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1039 if (! (yysize <= yysize1
1040 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1050 # define YYCASE_(N, S) \
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"));
1064 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1065 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1070 if (*yymsg_alloc < yysize)
1072 *yymsg_alloc = 2 * yysize;
1073 if (! (yysize <= *yymsg_alloc
1074 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1075 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
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. */
1085 while ((*yyp = *yyformat) != '\0')
1086 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1088 yyp += yytnamerr (yyp, yyarg[yyi++]);
1099 #endif /* YYERROR_VERBOSE */
1101 /*-----------------------------------------------.
1102 | Release the memory associated to this symbol. |
1103 `-----------------------------------------------*/
1106 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct cldr_plural_parse_args *arg)
1112 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1114 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
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 */
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 */
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 */
1135 case 13: /* OPERAND */
1136 #line 145 "cldr-plural.y" /* yacc.c:1257 */
1138 #line 1139 "cldr-plural.c" /* yacc.c:1257 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
1187 YY_IGNORE_MAYBE_UNINITIALIZED_END
1198 yyparse (struct cldr_plural_parse_args *arg)
1200 /* The lookahead symbol. */
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);
1210 /* Number of syntax errors so far. */
1214 /* Number of tokens to shift before error messages enabled. */
1217 /* The stacks and their tools:
1218 'yyss': related to states.
1219 'yyvs': related to semantic values.
1221 Refer to the stacks through separate pointers, to allow yyoverflow
1222 to reallocate them elsewhere. */
1224 /* The state stack. */
1225 yytype_int16 yyssa[YYINITDEPTH];
1227 yytype_int16 *yyssp;
1229 /* The semantic value stack. */
1230 YYSTYPE yyvsa[YYINITDEPTH];
1234 YYSIZE_T yystacksize;
1238 /* Lookahead token as an internal (translated) token number. */
1240 /* The variables used to return semantic value and location from the
1245 /* Buffer for error messages, and its allocated size. */
1247 char *yymsg = yymsgbuf;
1248 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1251 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1253 /* The number of symbols on the RHS of the reduced rule.
1254 Keep to zero when no symbol should be popped. */
1257 yyssp = yyss = yyssa;
1258 yyvsp = yyvs = yyvsa;
1259 yystacksize = YYINITDEPTH;
1261 YYDPRINTF ((stderr, "Starting parse\n"));
1266 yychar = YYEMPTY; /* Cause a token to be read. */
1269 /*------------------------------------------------------------.
1270 | yynewstate -- Push a new state, which is found in yystate. |
1271 `------------------------------------------------------------*/
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. */
1280 if (yyss + yystacksize - 1 <= yyssp)
1282 /* Get the current used size of the three stacks, in elements. */
1283 YYSIZE_T yysize = yyssp - yyss + 1;
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
1290 YYSTYPE *yyvs1 = yyvs;
1291 yytype_int16 *yyss1 = yyss;
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),
1305 #else /* no yyoverflow */
1306 # ifndef YYSTACK_RELOCATE
1307 goto yyexhaustedlab;
1309 /* Extend the stack our own way. */
1310 if (YYMAXDEPTH <= yystacksize)
1311 goto yyexhaustedlab;
1313 if (YYMAXDEPTH < yystacksize)
1314 yystacksize = YYMAXDEPTH;
1317 yytype_int16 *yyss1 = yyss;
1318 union yyalloc *yyptr =
1319 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1321 goto yyexhaustedlab;
1322 YYSTACK_RELOCATE (yyss_alloc, yyss);
1323 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1324 # undef YYSTACK_RELOCATE
1326 YYSTACK_FREE (yyss1);
1329 #endif /* no yyoverflow */
1331 yyssp = yyss + yysize - 1;
1332 yyvsp = yyvs + yysize - 1;
1334 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1335 (unsigned long int) yystacksize));
1337 if (yyss + yystacksize - 1 <= yyssp)
1341 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1343 if (yystate == YYFINAL)
1353 /* Do appropriate processing given the current state. Read a
1354 lookahead token if we need one and don't already have one. */
1356 /* First try to decide what to do without reference to lookahead token. */
1357 yyn = yypact[yystate];
1358 if (yypact_value_is_default (yyn))
1361 /* Not known => get a lookahead token if don't already have one. */
1363 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1364 if (yychar == YYEMPTY)
1366 YYDPRINTF ((stderr, "Reading a token: "));
1367 yychar = yylex (&yylval, arg);
1370 if (yychar <= YYEOF)
1372 yychar = yytoken = YYEOF;
1373 YYDPRINTF ((stderr, "Now at end of input.\n"));
1377 yytoken = YYTRANSLATE (yychar);
1378 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1381 /* If the proper action on seeing token YYTOKEN is to reduce or to
1382 detect an error, take that action. */
1384 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1389 if (yytable_value_is_error (yyn))
1395 /* Count tokens shifted since error; after three, turn off error
1400 /* Shift the lookahead token. */
1401 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1403 /* Discard the shifted token. */
1407 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1409 YY_IGNORE_MAYBE_UNINITIALIZED_END
1414 /*-----------------------------------------------------------.
1415 | yydefault -- do the default action for the current state. |
1416 `-----------------------------------------------------------*/
1418 yyn = yydefact[yystate];
1424 /*-----------------------------.
1425 | yyreduce -- Do a reduction. |
1426 `-----------------------------*/
1428 /* yyn is the number of a rule to reduce with. */
1431 /* If YYLEN is nonzero, implement the default value of the action:
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];
1442 YY_REDUCE_PRINT (yyn);
1446 #line 164 "cldr-plural.y" /* yacc.c:1646 */
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)
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);
1457 result->items[result->nitems++] = rule;
1459 #line 1460 "cldr-plural.c" /* yacc.c:1646 */
1463 #line 180 "cldr-plural.y" /* yacc.c:1646 */
1465 (yyval.cval) = (yyvsp[0].cval);
1467 #line 1468 "cldr-plural.c" /* yacc.c:1646 */
1471 #line 184 "cldr-plural.y" /* yacc.c:1646 */
1473 (yyval.cval) = new_branch_condition (CLDR_PLURAL_CONDITION_OR, (yyvsp[-2].cval), (yyvsp[0].cval));
1475 #line 1476 "cldr-plural.c" /* yacc.c:1646 */
1479 #line 190 "cldr-plural.y" /* yacc.c:1646 */
1481 (yyval.cval) = new_leaf_condition ((yyvsp[0].lval));
1483 #line 1484 "cldr-plural.c" /* yacc.c:1646 */
1487 #line 194 "cldr-plural.y" /* yacc.c:1646 */
1489 (yyval.cval) = new_branch_condition (CLDR_PLURAL_CONDITION_AND,
1491 new_leaf_condition ((yyvsp[0].lval)));
1493 #line 1494 "cldr-plural.c" /* yacc.c:1646 */
1497 #line 202 "cldr-plural.y" /* yacc.c:1646 */
1499 (yyval.lval) = new_relation ((yyvsp[-2].eval), CLDR_PLURAL_RELATION_EQUAL, (yyvsp[0].rval));
1501 #line 1502 "cldr-plural.c" /* yacc.c:1646 */
1505 #line 206 "cldr-plural.y" /* yacc.c:1646 */
1507 (yyval.lval) = new_relation ((yyvsp[-2].eval), CLDR_PLURAL_RELATION_NOT_EQUAL, (yyvsp[0].rval));
1509 #line 1510 "cldr-plural.c" /* yacc.c:1646 */
1513 #line 212 "cldr-plural.y" /* yacc.c:1646 */
1515 (yyval.eval) = new_expression ((yyvsp[0].ival), 0);
1517 #line 1518 "cldr-plural.c" /* yacc.c:1646 */
1521 #line 216 "cldr-plural.y" /* yacc.c:1646 */
1523 (yyval.eval) = new_expression ((yyvsp[-2].ival), (yyvsp[0].oval)->value.ival);
1525 #line 1526 "cldr-plural.c" /* yacc.c:1646 */
1529 #line 222 "cldr-plural.y" /* yacc.c:1646 */
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));
1536 #line 1537 "cldr-plural.c" /* yacc.c:1646 */
1540 #line 229 "cldr-plural.y" /* yacc.c:1646 */
1542 (yyval.rval) = add_range ((yyvsp[-2].rval), (yyvsp[0].gval));
1544 #line 1545 "cldr-plural.c" /* yacc.c:1646 */
1548 #line 235 "cldr-plural.y" /* yacc.c:1646 */
1550 (yyval.gval) = (yyvsp[0].gval);
1552 #line 1553 "cldr-plural.c" /* yacc.c:1646 */
1556 #line 239 "cldr-plural.y" /* yacc.c:1646 */
1558 (yyval.gval) = new_range ((yyvsp[0].oval), (yyvsp[0].oval));
1560 #line 1561 "cldr-plural.c" /* yacc.c:1646 */
1564 #line 245 "cldr-plural.y" /* yacc.c:1646 */
1566 (yyval.gval) = new_range ((yyvsp[-2].oval), (yyvsp[0].oval));
1568 #line 1569 "cldr-plural.c" /* yacc.c:1646 */
1572 #line 272 "cldr-plural.y" /* yacc.c:1646 */
1573 { free ((yyvsp[0].oval)); }
1574 #line 1575 "cldr-plural.c" /* yacc.c:1646 */
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 */
1584 #line 276 "cldr-plural.y" /* yacc.c:1646 */
1585 { free ((yyvsp[0].oval)); }
1586 #line 1587 "cldr-plural.c" /* yacc.c:1646 */
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 */
1596 #line 1597 "cldr-plural.c" /* yacc.c:1646 */
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);
1614 YY_STACK_PRINT (yyss, yyssp);
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. */
1624 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1625 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1626 yystate = yytable[yystate];
1628 yystate = yydefgoto[yyn - YYNTOKENS];
1633 /*--------------------------------------.
1634 | yyerrlab -- here on detecting error. |
1635 `--------------------------------------*/
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);
1641 /* If not already recovering from an error, report this error. */
1645 #if ! YYERROR_VERBOSE
1646 yyerror (arg, YY_("syntax error"));
1648 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1651 char const *yymsgp = YY_("syntax error");
1652 int yysyntax_error_status;
1653 yysyntax_error_status = YYSYNTAX_ERROR;
1654 if (yysyntax_error_status == 0)
1656 else if (yysyntax_error_status == 1)
1658 if (yymsg != yymsgbuf)
1659 YYSTACK_FREE (yymsg);
1660 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1664 yymsg_alloc = sizeof yymsgbuf;
1665 yysyntax_error_status = 2;
1669 yysyntax_error_status = YYSYNTAX_ERROR;
1673 yyerror (arg, yymsgp);
1674 if (yysyntax_error_status == 2)
1675 goto yyexhaustedlab;
1677 # undef YYSYNTAX_ERROR
1683 if (yyerrstatus == 3)
1685 /* If just tried and failed to reuse lookahead token after an
1686 error, discard it. */
1688 if (yychar <= YYEOF)
1690 /* Return failure if at end of input. */
1691 if (yychar == YYEOF)
1696 yydestruct ("Error: discarding",
1697 yytoken, &yylval, arg);
1702 /* Else will try to reuse lookahead token after shifting the error
1707 /*---------------------------------------------------.
1708 | yyerrorlab -- error raised explicitly by YYERROR. |
1709 `---------------------------------------------------*/
1712 /* Pacify compilers like GCC when the user code never invokes
1713 YYERROR and the label yyerrorlab therefore never appears in user
1715 if (/*CONSTCOND*/ 0)
1718 /* Do not reclaim the symbols of the rule whose action triggered
1722 YY_STACK_PRINT (yyss, yyssp);
1727 /*-------------------------------------------------------------.
1728 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1729 `-------------------------------------------------------------*/
1731 yyerrstatus = 3; /* Each real token shifted decrements this. */
1735 yyn = yypact[yystate];
1736 if (!yypact_value_is_default (yyn))
1739 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1747 /* Pop the current state because it cannot handle the error token. */
1752 yydestruct ("Error: popping",
1753 yystos[yystate], yyvsp, arg);
1756 YY_STACK_PRINT (yyss, yyssp);
1759 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1761 YY_IGNORE_MAYBE_UNINITIALIZED_END
1764 /* Shift the error token. */
1765 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1771 /*-------------------------------------.
1772 | yyacceptlab -- YYACCEPT comes here. |
1773 `-------------------------------------*/
1778 /*-----------------------------------.
1779 | yyabortlab -- YYABORT comes here. |
1780 `-----------------------------------*/
1785 #if !defined yyoverflow || YYERROR_VERBOSE
1786 /*-------------------------------------------------.
1787 | yyexhaustedlab -- memory exhaustion comes here. |
1788 `-------------------------------------------------*/
1790 yyerror (arg, YY_("memory exhausted"));
1796 if (yychar != YYEMPTY)
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);
1804 /* Do not reclaim the symbols of the rule whose action triggered
1805 this YYABORT or YYACCEPT. */
1807 YY_STACK_PRINT (yyss, yyssp);
1808 while (yyssp != yyss)
1810 yydestruct ("Cleanup: popping",
1811 yystos[*yyssp], yyvsp, arg);
1816 YYSTACK_FREE (yyss);
1819 if (yymsg != yymsgbuf)
1820 YYSTACK_FREE (yymsg);
1824 #line 281 "cldr-plural.y" /* yacc.c:1906 */
1828 yylex (YYSTYPE *lval, struct cldr_plural_parse_args *arg)
1830 const char *exp = arg->cp;
1834 static char *buffer;
1835 static size_t bufmax;
1846 if (exp[0] != ' ' && exp[0] != '\t')
1852 length = u8_mbtouc (&uc, (const uint8_t *) exp, arg->cp_end - exp);
1855 arg->cp = exp + length;
1858 else if (strncmp ("...", exp, 3) == 0)
1863 else if (strncmp ("..", exp, 2) == 0)
1868 else if (strncmp ("other", exp, 5) == 0)
1873 else if (strncmp ("@integer", exp, 8) == 0)
1878 else if (strncmp ("@decimal", exp, 8) == 0)
1887 case '0': case '1': case '2': case '3': case '4':
1888 case '5': case '6': case '7': case '8': case '9':
1890 unsigned long int ival = result - '0';
1892 while (exp[0] >= '0' && exp[0] <= '9')
1895 ival += exp[0] - '0';
1899 lval->oval = XMALLOC (struct cldr_plural_operand_ty);
1900 if (exp[0] == '.' && exp[1] >= '0' && exp[1] <= '9')
1903 int denominator = 10, nfractions = 0;
1905 while (exp[0] >= '0' && exp[0] <= '9')
1907 dval += (exp[0] - '0') / (double) denominator;
1912 lval->oval->type = CLDR_PLURAL_OPERAND_DECIMAL;
1913 lval->oval->value.dval.d = dval;
1914 lval->oval->value.dval.nfractions = nfractions;
1919 lval->oval->type = CLDR_PLURAL_OPERAND_INTEGER;
1920 lval->oval->value.ival = ival;
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':
1932 if (bufpos >= bufmax)
1934 bufmax = 2 * bufmax + 10;
1935 buffer = xrealloc (buffer, bufmax);
1937 buffer[bufpos++] = result;
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':
1955 if (bufpos >= bufmax)
1957 bufmax = 2 * bufmax + 10;
1958 buffer = xrealloc (buffer, bufmax);
1960 buffer[bufpos] = '\0';
1967 case 'n': case 'i': case 'f': case 't': case 'v': case 'w':
1969 lval->ival = buffer[0];
1977 if (strcmp (buffer, "and") == 0)
1982 else if (strcmp (buffer, "or") == 0)
1988 lval->sval = xstrdup (buffer);
2010 yyerror (struct cldr_plural_parse_args *arg, char const *s)
2012 fprintf (stderr, "%s\n", s);