1/* A Bison parser, made by GNU Bison 3.8.2. */
2
3/* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
20
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34/* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
40
41/* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
47
48/* Identify Bison output, and Bison version. */
49#define YYBISON 30802
50
51/* Bison version string. */
52#define YYBISON_VERSION "3.8.2"
53
54/* Skeleton name. */
55#define YYSKELETON_NAME "yacc.c"
56
57/* Pure parsers. */
58#define YYPURE 2
59
60/* Push parsers. */
61#define YYPUSH 0
62
63/* Pull parsers. */
64#define YYPULL 1
65
66
67/* Substitute the variable and function names. */
68#define yyparse __gettextparse
69#define yylex __gettextlex
70#define yyerror __gettexterror
71#define yydebug __gettextdebug
72#define yynerrs __gettextnerrs
73
74/* First part of user prologue. */
75#line 1 "plural.y"
76
77/* Expression parsing for plural form selection.
78 Copyright (C) 2000-2020 Free Software Foundation, Inc.
79 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
80
81 This program is free software: you can redistribute it and/or modify
82 it under the terms of the GNU Lesser General Public License as published by
83 the Free Software Foundation; either version 2.1 of the License, or
84 (at your option) any later version.
85
86 This program is distributed in the hope that it will be useful,
87 but WITHOUT ANY WARRANTY; without even the implied warranty of
88 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89 GNU Lesser General Public License for more details.
90
91 You should have received a copy of the GNU Lesser General Public License
92 along with this program. If not, see <https://www.gnu.org/licenses/>. */
93
94/* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us
95 to put this declaration at the beginning of the file. The declaration in
96 bison's skeleton file comes too late. This must come before <config.h>
97 because <config.h> may include arbitrary system headers.
98 This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */
99#if defined _AIX && !defined __GNUC__
100 #pragma alloca
101#endif
102
103#ifdef HAVE_CONFIG_H
104# include <config.h>
105#endif
106
107#include <stddef.h>
108#include <stdlib.h>
109#include <string.h>
110#include "plural-exp.h"
111
112/* The main function generated by the parser is called __gettextparse,
113 but we want it to be called PLURAL_PARSE. */
114#ifndef _LIBC
115# define __gettextparse PLURAL_PARSE
116#endif
117
118
119#line 120 "/home/admin/code/glibc/build/intl/plural.c"
120
121# ifndef YY_CAST
122# ifdef __cplusplus
123# define YY_CAST(Type, Val) static_cast<Type> (Val)
124# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
125# else
126# define YY_CAST(Type, Val) ((Type) (Val))
127# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
128# endif
129# endif
130# ifndef YY_NULLPTR
131# if defined __cplusplus
132# if 201103L <= __cplusplus
133# define YY_NULLPTR nullptr
134# else
135# define YY_NULLPTR 0
136# endif
137# else
138# define YY_NULLPTR ((void*)0)
139# endif
140# endif
141
142
143/* Debug traces. */
144#ifndef YYDEBUG
145# define YYDEBUG 0
146#endif
147#if YYDEBUG
148extern int __gettextdebug;
149#endif
150
151/* Token kinds. */
152#ifndef YYTOKENTYPE
153# define YYTOKENTYPE
154 enum yytokentype
155 {
156 YYEMPTY = -2,
157 YYEOF = 0, /* "end of file" */
158 YYerror = 256, /* error */
159 YYUNDEF = 257, /* "invalid token" */
160 EQUOP2 = 258, /* EQUOP2 */
161 CMPOP2 = 259, /* CMPOP2 */
162 ADDOP2 = 260, /* ADDOP2 */
163 MULOP2 = 261, /* MULOP2 */
164 NUMBER = 262 /* NUMBER */
165 };
166 typedef enum yytokentype yytoken_kind_t;
167#endif
168/* Token kinds. */
169#define YYEMPTY -2
170#define YYEOF 0
171#define YYerror 256
172#define YYUNDEF 257
173#define EQUOP2 258
174#define CMPOP2 259
175#define ADDOP2 260
176#define MULOP2 261
177#define NUMBER 262
178
179/* Value type. */
180#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
181union YYSTYPE
182{
183#line 49 "plural.y"
184
185 unsigned long int num;
186 enum expression_operator op;
187 struct expression *exp;
188
189#line 190 "/home/admin/code/glibc/build/intl/plural.c"
190
191};
192typedef union YYSTYPE YYSTYPE;
193# define YYSTYPE_IS_TRIVIAL 1
194# define YYSTYPE_IS_DECLARED 1
195#endif
196
197
198
199
200int __gettextparse (struct parse_args *arg);
201
202
203
204/* Symbol kind. */
205enum yysymbol_kind_t
206{
207 YYSYMBOL_YYEMPTY = -2,
208 YYSYMBOL_YYEOF = 0, /* "end of file" */
209 YYSYMBOL_YYerror = 1, /* error */
210 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
211 YYSYMBOL_3_ = 3, /* '?' */
212 YYSYMBOL_4_ = 4, /* '|' */
213 YYSYMBOL_5_ = 5, /* '&' */
214 YYSYMBOL_6_ = 6, /* '!' */
215 YYSYMBOL_EQUOP2 = 7, /* EQUOP2 */
216 YYSYMBOL_CMPOP2 = 8, /* CMPOP2 */
217 YYSYMBOL_ADDOP2 = 9, /* ADDOP2 */
218 YYSYMBOL_MULOP2 = 10, /* MULOP2 */
219 YYSYMBOL_NUMBER = 11, /* NUMBER */
220 YYSYMBOL_12_ = 12, /* ':' */
221 YYSYMBOL_13_n_ = 13, /* 'n' */
222 YYSYMBOL_14_ = 14, /* '(' */
223 YYSYMBOL_15_ = 15, /* ')' */
224 YYSYMBOL_YYACCEPT = 16, /* $accept */
225 YYSYMBOL_start = 17, /* start */
226 YYSYMBOL_exp = 18 /* exp */
227};
228typedef enum yysymbol_kind_t yysymbol_kind_t;
229
230
231/* Second part of user prologue. */
232#line 55 "plural.y"
233
234/* Prototypes for local functions. */
235static int yylex (YYSTYPE *lval, struct parse_args *arg);
236static void yyerror (struct parse_args *arg, const char *str);
237
238/* Allocation of expressions. */
239
240static struct expression *
241new_exp (int nargs, enum expression_operator op,
242 struct expression * const *args)
243{
244 int i;
245 struct expression *newp;
246
247 /* If any of the argument could not be malloc'ed, just return NULL. */
248 for (i = nargs - 1; i >= 0; i--)
249 if (args[i] == NULL)
250 goto fail;
251
252 /* Allocate a new expression. */
253 newp = (struct expression *) malloc (sizeof (*newp));
254 if (newp != NULL)
255 {
256 newp->nargs = nargs;
257 newp->operation = op;
258 for (i = nargs - 1; i >= 0; i--)
259 newp->val.args[i] = args[i];
260 return newp;
261 }
262
263 fail:
264 for (i = nargs - 1; i >= 0; i--)
265 FREE_EXPRESSION (args[i]);
266
267 return NULL;
268}
269
270static inline struct expression *
271new_exp_0 (enum expression_operator op)
272{
273 return new_exp (0, op, NULL);
274}
275
276static inline struct expression *
277new_exp_1 (enum expression_operator op, struct expression *right)
278{
279 struct expression *args[1];
280
281 args[0] = right;
282 return new_exp (1, op, args);
283}
284
285static struct expression *
286new_exp_2 (enum expression_operator op, struct expression *left,
287 struct expression *right)
288{
289 struct expression *args[2];
290
291 args[0] = left;
292 args[1] = right;
293 return new_exp (2, op, args);
294}
295
296static inline struct expression *
297new_exp_3 (enum expression_operator op, struct expression *bexp,
298 struct expression *tbranch, struct expression *fbranch)
299{
300 struct expression *args[3];
301
302 args[0] = bexp;
303 args[1] = tbranch;
304 args[2] = fbranch;
305 return new_exp (3, op, args);
306}
307
308
309#line 310 "/home/admin/code/glibc/build/intl/plural.c"
310
311
312#ifdef short
313# undef short
314#endif
315
316/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
317 <limits.h> and (if available) <stdint.h> are included
318 so that the code can choose integer types of a good width. */
319
320#ifndef __PTRDIFF_MAX__
321# include <limits.h> /* INFRINGES ON USER NAME SPACE */
322# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
323# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
324# define YY_STDINT_H
325# endif
326#endif
327
328/* Narrow types that promote to a signed type and that can represent a
329 signed or unsigned integer of at least N bits. In tables they can
330 save space and decrease cache pressure. Promoting to a signed type
331 helps avoid bugs in integer arithmetic. */
332
333#ifdef __INT_LEAST8_MAX__
334typedef __INT_LEAST8_TYPE__ yytype_int8;
335#elif defined YY_STDINT_H
336typedef int_least8_t yytype_int8;
337#else
338typedef signed char yytype_int8;
339#endif
340
341#ifdef __INT_LEAST16_MAX__
342typedef __INT_LEAST16_TYPE__ yytype_int16;
343#elif defined YY_STDINT_H
344typedef int_least16_t yytype_int16;
345#else
346typedef short yytype_int16;
347#endif
348
349/* Work around bug in HP-UX 11.23, which defines these macros
350 incorrectly for preprocessor constants. This workaround can likely
351 be removed in 2023, as HPE has promised support for HP-UX 11.23
352 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
353 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
354#ifdef __hpux
355# undef UINT_LEAST8_MAX
356# undef UINT_LEAST16_MAX
357# define UINT_LEAST8_MAX 255
358# define UINT_LEAST16_MAX 65535
359#endif
360
361#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
362typedef __UINT_LEAST8_TYPE__ yytype_uint8;
363#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
364 && UINT_LEAST8_MAX <= INT_MAX)
365typedef uint_least8_t yytype_uint8;
366#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
367typedef unsigned char yytype_uint8;
368#else
369typedef short yytype_uint8;
370#endif
371
372#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
373typedef __UINT_LEAST16_TYPE__ yytype_uint16;
374#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
375 && UINT_LEAST16_MAX <= INT_MAX)
376typedef uint_least16_t yytype_uint16;
377#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
378typedef unsigned short yytype_uint16;
379#else
380typedef int yytype_uint16;
381#endif
382
383#ifndef YYPTRDIFF_T
384# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
385# define YYPTRDIFF_T __PTRDIFF_TYPE__
386# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
387# elif defined PTRDIFF_MAX
388# ifndef ptrdiff_t
389# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
390# endif
391# define YYPTRDIFF_T ptrdiff_t
392# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
393# else
394# define YYPTRDIFF_T long
395# define YYPTRDIFF_MAXIMUM LONG_MAX
396# endif
397#endif
398
399#ifndef YYSIZE_T
400# ifdef __SIZE_TYPE__
401# define YYSIZE_T __SIZE_TYPE__
402# elif defined size_t
403# define YYSIZE_T size_t
404# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
405# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
406# define YYSIZE_T size_t
407# else
408# define YYSIZE_T unsigned
409# endif
410#endif
411
412#define YYSIZE_MAXIMUM \
413 YY_CAST (YYPTRDIFF_T, \
414 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
415 ? YYPTRDIFF_MAXIMUM \
416 : YY_CAST (YYSIZE_T, -1)))
417
418#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
419
420
421/* Stored state numbers (used for stacks). */
422typedef yytype_int8 yy_state_t;
423
424/* State numbers in computations. */
425typedef int yy_state_fast_t;
426
427#ifndef YY_
428# if defined YYENABLE_NLS && YYENABLE_NLS
429# if ENABLE_NLS
430# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
431# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
432# endif
433# endif
434# ifndef YY_
435# define YY_(Msgid) Msgid
436# endif
437#endif
438
439
440#ifndef YY_ATTRIBUTE_PURE
441# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
442# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
443# else
444# define YY_ATTRIBUTE_PURE
445# endif
446#endif
447
448#ifndef YY_ATTRIBUTE_UNUSED
449# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
450# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
451# else
452# define YY_ATTRIBUTE_UNUSED
453# endif
454#endif
455
456/* Suppress unused-variable warnings by "using" E. */
457#if ! defined lint || defined __GNUC__
458# define YY_USE(E) ((void) (E))
459#else
460# define YY_USE(E) /* empty */
461#endif
462
463/* Suppress an incorrect diagnostic about yylval being uninitialized. */
464#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
465# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
466# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
467 _Pragma ("GCC diagnostic push") \
468 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
469# else
470# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
471 _Pragma ("GCC diagnostic push") \
472 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
473 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
474# endif
475# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
476 _Pragma ("GCC diagnostic pop")
477#else
478# define YY_INITIAL_VALUE(Value) Value
479#endif
480#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
481# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
482# define YY_IGNORE_MAYBE_UNINITIALIZED_END
483#endif
484#ifndef YY_INITIAL_VALUE
485# define YY_INITIAL_VALUE(Value) /* Nothing. */
486#endif
487
488#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
489# define YY_IGNORE_USELESS_CAST_BEGIN \
490 _Pragma ("GCC diagnostic push") \
491 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
492# define YY_IGNORE_USELESS_CAST_END \
493 _Pragma ("GCC diagnostic pop")
494#endif
495#ifndef YY_IGNORE_USELESS_CAST_BEGIN
496# define YY_IGNORE_USELESS_CAST_BEGIN
497# define YY_IGNORE_USELESS_CAST_END
498#endif
499
500
501#define YY_ASSERT(E) ((void) (0 && (E)))
502
503#if !defined yyoverflow
504
505/* The parser invokes alloca or malloc; define the necessary symbols. */
506
507# ifdef YYSTACK_USE_ALLOCA
508# if YYSTACK_USE_ALLOCA
509# ifdef __GNUC__
510# define YYSTACK_ALLOC __builtin_alloca
511# elif defined __BUILTIN_VA_ARG_INCR
512# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
513# elif defined _AIX
514# define YYSTACK_ALLOC __alloca
515# elif defined _MSC_VER
516# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
517# define alloca _alloca
518# else
519# define YYSTACK_ALLOC alloca
520# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
521# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
522 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
523# ifndef EXIT_SUCCESS
524# define EXIT_SUCCESS 0
525# endif
526# endif
527# endif
528# endif
529# endif
530
531# ifdef YYSTACK_ALLOC
532 /* Pacify GCC's 'empty if-body' warning. */
533# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
534# ifndef YYSTACK_ALLOC_MAXIMUM
535 /* The OS might guarantee only one guard page at the bottom of the stack,
536 and a page size can be as small as 4096 bytes. So we cannot safely
537 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
538 to allow for a few compiler-allocated temporary stack slots. */
539# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
540# endif
541# else
542# define YYSTACK_ALLOC YYMALLOC
543# define YYSTACK_FREE YYFREE
544# ifndef YYSTACK_ALLOC_MAXIMUM
545# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
546# endif
547# if (defined __cplusplus && ! defined EXIT_SUCCESS \
548 && ! ((defined YYMALLOC || defined malloc) \
549 && (defined YYFREE || defined free)))
550# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
551# ifndef EXIT_SUCCESS
552# define EXIT_SUCCESS 0
553# endif
554# endif
555# ifndef YYMALLOC
556# define YYMALLOC malloc
557# if ! defined malloc && ! defined EXIT_SUCCESS
558void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
559# endif
560# endif
561# ifndef YYFREE
562# define YYFREE free
563# if ! defined free && ! defined EXIT_SUCCESS
564void free (void *); /* INFRINGES ON USER NAME SPACE */
565# endif
566# endif
567# endif
568#endif /* !defined yyoverflow */
569
570#if (! defined yyoverflow \
571 && (! defined __cplusplus \
572 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
573
574/* A type that is properly aligned for any stack member. */
575union yyalloc
576{
577 yy_state_t yyss_alloc;
578 YYSTYPE yyvs_alloc;
579};
580
581/* The size of the maximum gap between one aligned stack and the next. */
582# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
583
584/* The size of an array large to enough to hold all stacks, each with
585 N elements. */
586# define YYSTACK_BYTES(N) \
587 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
588 + YYSTACK_GAP_MAXIMUM)
589
590# define YYCOPY_NEEDED 1
591
592/* Relocate STACK from its old location to the new one. The
593 local variables YYSIZE and YYSTACKSIZE give the old and new number of
594 elements in the stack, and YYPTR gives the new location of the
595 stack. Advance YYPTR to a properly aligned location for the next
596 stack. */
597# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
598 do \
599 { \
600 YYPTRDIFF_T yynewbytes; \
601 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
602 Stack = &yyptr->Stack_alloc; \
603 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
604 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
605 } \
606 while (0)
607
608#endif
609
610#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
611/* Copy COUNT objects from SRC to DST. The source and destination do
612 not overlap. */
613# ifndef YYCOPY
614# if defined __GNUC__ && 1 < __GNUC__
615# define YYCOPY(Dst, Src, Count) \
616 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
617# else
618# define YYCOPY(Dst, Src, Count) \
619 do \
620 { \
621 YYPTRDIFF_T yyi; \
622 for (yyi = 0; yyi < (Count); yyi++) \
623 (Dst)[yyi] = (Src)[yyi]; \
624 } \
625 while (0)
626# endif
627# endif
628#endif /* !YYCOPY_NEEDED */
629
630/* YYFINAL -- State number of the termination state. */
631#define YYFINAL 9
632/* YYLAST -- Last index in YYTABLE. */
633#define YYLAST 56
634
635/* YYNTOKENS -- Number of terminals. */
636#define YYNTOKENS 16
637/* YYNNTS -- Number of nonterminals. */
638#define YYNNTS 3
639/* YYNRULES -- Number of rules. */
640#define YYNRULES 13
641/* YYNSTATES -- Number of states. */
642#define YYNSTATES 27
643
644/* YYMAXUTOK -- Last valid token kind. */
645#define YYMAXUTOK 262
646
647
648/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
649 as returned by yylex, with out-of-bounds checking. */
650#define YYTRANSLATE(YYX) \
651 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
652 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
653 : YYSYMBOL_YYUNDEF)
654
655/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
656 as returned by yylex. */
657static const yytype_int8 yytranslate[] =
658{
659 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
662 2, 2, 2, 6, 2, 2, 2, 2, 5, 2,
663 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
664 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
665 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
666 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
667 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
668 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
669 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
670 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
671 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
672 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
674 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
675 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
676 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
677 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
678 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
684 2, 2, 2, 2, 2, 2, 1, 2, 7, 8,
685 9, 10, 11
686};
687
688#if YYDEBUG
689/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
690static const yytype_uint8 yyrline[] =
691{
692 0, 152, 152, 160, 164, 168, 172, 176, 180, 184,
693 188, 192, 196, 201
694};
695#endif
696
697/** Accessing symbol of state STATE. */
698#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
699
700#if YYDEBUG || 0
701/* The user-facing name of the symbol whose (internal) number is
702 YYSYMBOL. No bounds checking. */
703static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
704
705/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
706 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
707static const char *const yytname[] =
708{
709 "\"end of file\"", "error", "\"invalid token\"", "'?'", "'|'", "'&'",
710 "'!'", "EQUOP2", "CMPOP2", "ADDOP2", "MULOP2", "NUMBER", "':'", "'n'",
711 "'('", "')'", "$accept", "start", "exp", YY_NULLPTR
712};
713
714static const char *
715yysymbol_name (yysymbol_kind_t yysymbol)
716{
717 return yytname[yysymbol];
718}
719#endif
720
721#define YYPACT_NINF (-4)
722
723#define yypact_value_is_default(Yyn) \
724 ((Yyn) == YYPACT_NINF)
725
726#define YYTABLE_NINF (-1)
727
728#define yytable_value_is_error(Yyn) \
729 0
730
731/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
732 STATE-NUM. */
733static const yytype_int8 yypact[] =
734{
735 27, 27, -4, -4, 27, 1, 39, -4, 13, -4,
736 27, 27, 27, 27, 27, 27, 27, -4, 22, -3,
737 43, 46, 26, -2, -4, 27, 39
738};
739
740/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
741 Performed when YYTABLE does not specify something else to do. Zero
742 means the default is an error. */
743static const yytype_int8 yydefact[] =
744{
745 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
746 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
747 5, 6, 7, 8, 9, 0, 3
748};
749
750/* YYPGOTO[NTERM-NUM]. */
751static const yytype_int8 yypgoto[] =
752{
753 -4, -4, -1
754};
755
756/* YYDEFGOTO[NTERM-NUM]. */
757static const yytype_int8 yydefgoto[] =
758{
759 0, 5, 6
760};
761
762/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
763 positive, shift that token. If negative, reduce the rule whose
764 number is the opposite. If YYTABLE_NINF, syntax error. */
765static const yytype_int8 yytable[] =
766{
767 7, 9, 12, 8, 13, 14, 15, 16, 16, 18,
768 19, 20, 21, 22, 23, 24, 10, 11, 12, 0,
769 13, 14, 15, 16, 26, 10, 11, 12, 17, 13,
770 14, 15, 16, 1, 25, 15, 16, 0, 2, 0,
771 3, 4, 10, 11, 12, 0, 13, 14, 15, 16,
772 13, 14, 15, 16, 14, 15, 16
773};
774
775static const yytype_int8 yycheck[] =
776{
777 1, 0, 5, 4, 7, 8, 9, 10, 10, 10,
778 11, 12, 13, 14, 15, 16, 3, 4, 5, -1,
779 7, 8, 9, 10, 25, 3, 4, 5, 15, 7,
780 8, 9, 10, 6, 12, 9, 10, -1, 11, -1,
781 13, 14, 3, 4, 5, -1, 7, 8, 9, 10,
782 7, 8, 9, 10, 8, 9, 10
783};
784
785/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
786 state STATE-NUM. */
787static const yytype_int8 yystos[] =
788{
789 0, 6, 11, 13, 14, 17, 18, 18, 18, 0,
790 3, 4, 5, 7, 8, 9, 10, 15, 18, 18,
791 18, 18, 18, 18, 18, 12, 18
792};
793
794/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
795static const yytype_int8 yyr1[] =
796{
797 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
798 18, 18, 18, 18
799};
800
801/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
802static const yytype_int8 yyr2[] =
803{
804 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
805 2, 1, 1, 3
806};
807
808
809enum { YYENOMEM = -2 };
810
811#define yyerrok (yyerrstatus = 0)
812#define yyclearin (yychar = YYEMPTY)
813
814#define YYACCEPT goto yyacceptlab
815#define YYABORT goto yyabortlab
816#define YYERROR goto yyerrorlab
817#define YYNOMEM goto yyexhaustedlab
818
819
820#define YYRECOVERING() (!!yyerrstatus)
821
822#define YYBACKUP(Token, Value) \
823 do \
824 if (yychar == YYEMPTY) \
825 { \
826 yychar = (Token); \
827 yylval = (Value); \
828 YYPOPSTACK (yylen); \
829 yystate = *yyssp; \
830 goto yybackup; \
831 } \
832 else \
833 { \
834 yyerror (arg, YY_("syntax error: cannot back up")); \
835 YYERROR; \
836 } \
837 while (0)
838
839/* Backward compatibility with an undocumented macro.
840 Use YYerror or YYUNDEF. */
841#define YYERRCODE YYUNDEF
842
843
844/* Enable debugging if requested. */
845#if YYDEBUG
846
847# ifndef YYFPRINTF
848# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
849# define YYFPRINTF fprintf
850# endif
851
852# define YYDPRINTF(Args) \
853do { \
854 if (yydebug) \
855 YYFPRINTF Args; \
856} while (0)
857
858
859
860
861# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
862do { \
863 if (yydebug) \
864 { \
865 YYFPRINTF (stderr, "%s ", Title); \
866 yy_symbol_print (stderr, \
867 Kind, Value, arg); \
868 YYFPRINTF (stderr, "\n"); \
869 } \
870} while (0)
871
872
873/*-----------------------------------.
874| Print this symbol's value on YYO. |
875`-----------------------------------*/
876
877static void
878yy_symbol_value_print (FILE *yyo,
879 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, struct parse_args *arg)
880{
881 FILE *yyoutput = yyo;
882 YY_USE (yyoutput);
883 YY_USE (arg);
884 if (!yyvaluep)
885 return;
886 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
887 YY_USE (yykind);
888 YY_IGNORE_MAYBE_UNINITIALIZED_END
889}
890
891
892/*---------------------------.
893| Print this symbol on YYO. |
894`---------------------------*/
895
896static void
897yy_symbol_print (FILE *yyo,
898 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, struct parse_args *arg)
899{
900 YYFPRINTF (yyo, "%s %s (",
901 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
902
903 yy_symbol_value_print (yyo, yykind, yyvaluep, arg);
904 YYFPRINTF (yyo, ")");
905}
906
907/*------------------------------------------------------------------.
908| yy_stack_print -- Print the state stack from its BOTTOM up to its |
909| TOP (included). |
910`------------------------------------------------------------------*/
911
912static void
913yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
914{
915 YYFPRINTF (stderr, "Stack now");
916 for (; yybottom <= yytop; yybottom++)
917 {
918 int yybot = *yybottom;
919 YYFPRINTF (stderr, " %d", yybot);
920 }
921 YYFPRINTF (stderr, "\n");
922}
923
924# define YY_STACK_PRINT(Bottom, Top) \
925do { \
926 if (yydebug) \
927 yy_stack_print ((Bottom), (Top)); \
928} while (0)
929
930
931/*------------------------------------------------.
932| Report that the YYRULE is going to be reduced. |
933`------------------------------------------------*/
934
935static void
936yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
937 int yyrule, struct parse_args *arg)
938{
939 int yylno = yyrline[yyrule];
940 int yynrhs = yyr2[yyrule];
941 int yyi;
942 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
943 yyrule - 1, yylno);
944 /* The symbols being reduced. */
945 for (yyi = 0; yyi < yynrhs; yyi++)
946 {
947 YYFPRINTF (stderr, " $%d = ", yyi + 1);
948 yy_symbol_print (stderr,
949 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
950 &yyvsp[(yyi + 1) - (yynrhs)], arg);
951 YYFPRINTF (stderr, "\n");
952 }
953}
954
955# define YY_REDUCE_PRINT(Rule) \
956do { \
957 if (yydebug) \
958 yy_reduce_print (yyssp, yyvsp, Rule, arg); \
959} while (0)
960
961/* Nonzero means print parse trace. It is left uninitialized so that
962 multiple parsers can coexist. */
963int yydebug;
964#else /* !YYDEBUG */
965# define YYDPRINTF(Args) ((void) 0)
966# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
967# define YY_STACK_PRINT(Bottom, Top)
968# define YY_REDUCE_PRINT(Rule)
969#endif /* !YYDEBUG */
970
971
972/* YYINITDEPTH -- initial size of the parser's stacks. */
973#ifndef YYINITDEPTH
974# define YYINITDEPTH 200
975#endif
976
977/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
978 if the built-in stack extension method is used).
979
980 Do not make this value too large; the results are undefined if
981 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
982 evaluated with infinite-precision integer arithmetic. */
983
984#ifndef YYMAXDEPTH
985# define YYMAXDEPTH 10000
986#endif
987
988
989
990
991
992
993/*-----------------------------------------------.
994| Release the memory associated to this symbol. |
995`-----------------------------------------------*/
996
997static void
998yydestruct (const char *yymsg,
999 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, struct parse_args *arg)
1000{
1001 YY_USE (yyvaluep);
1002 YY_USE (arg);
1003 if (!yymsg)
1004 yymsg = "Deleting";
1005 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1006
1007 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1008 YY_USE (yykind);
1009 YY_IGNORE_MAYBE_UNINITIALIZED_END
1010}
1011
1012
1013
1014
1015
1016
1017/*----------.
1018| yyparse. |
1019`----------*/
1020
1021int
1022yyparse (struct parse_args *arg)
1023{
1024/* Lookahead token kind. */
1025int yychar;
1026
1027
1028/* The semantic value of the lookahead symbol. */
1029/* Default value used for initialization, for pacifying older GCCs
1030 or non-GCC compilers. */
1031YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1032YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1033
1034 /* Number of syntax errors so far. */
1035 int yynerrs = 0;
1036
1037 yy_state_fast_t yystate = 0;
1038 /* Number of tokens to shift before error messages enabled. */
1039 int yyerrstatus = 0;
1040
1041 /* Refer to the stacks through separate pointers, to allow yyoverflow
1042 to reallocate them elsewhere. */
1043
1044 /* Their size. */
1045 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1046
1047 /* The state stack: array, bottom, top. */
1048 yy_state_t yyssa[YYINITDEPTH];
1049 yy_state_t *yyss = yyssa;
1050 yy_state_t *yyssp = yyss;
1051
1052 /* The semantic value stack: array, bottom, top. */
1053 YYSTYPE yyvsa[YYINITDEPTH];
1054 YYSTYPE *yyvs = yyvsa;
1055 YYSTYPE *yyvsp = yyvs;
1056
1057 int yyn;
1058 /* The return value of yyparse. */
1059 int yyresult;
1060 /* Lookahead symbol kind. */
1061 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1062 /* The variables used to return semantic value and location from the
1063 action routines. */
1064 YYSTYPE yyval;
1065
1066
1067
1068#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1069
1070 /* The number of symbols on the RHS of the reduced rule.
1071 Keep to zero when no symbol should be popped. */
1072 int yylen = 0;
1073
1074 YYDPRINTF ((stderr, "Starting parse\n"));
1075
1076 yychar = YYEMPTY; /* Cause a token to be read. */
1077
1078 goto yysetstate;
1079
1080
1081/*------------------------------------------------------------.
1082| yynewstate -- push a new state, which is found in yystate. |
1083`------------------------------------------------------------*/
1084yynewstate:
1085 /* In all cases, when you get here, the value and location stacks
1086 have just been pushed. So pushing a state here evens the stacks. */
1087 yyssp++;
1088
1089
1090/*--------------------------------------------------------------------.
1091| yysetstate -- set current state (the top of the stack) to yystate. |
1092`--------------------------------------------------------------------*/
1093yysetstate:
1094 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1095 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1096 YY_IGNORE_USELESS_CAST_BEGIN
1097 *yyssp = YY_CAST (yy_state_t, yystate);
1098 YY_IGNORE_USELESS_CAST_END
1099 YY_STACK_PRINT (yyss, yyssp);
1100
1101 if (yyss + yystacksize - 1 <= yyssp)
1102#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1103 YYNOMEM;
1104#else
1105 {
1106 /* Get the current used size of the three stacks, in elements. */
1107 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1108
1109# if defined yyoverflow
1110 {
1111 /* Give user a chance to reallocate the stack. Use copies of
1112 these so that the &'s don't force the real ones into
1113 memory. */
1114 yy_state_t *yyss1 = yyss;
1115 YYSTYPE *yyvs1 = yyvs;
1116
1117 /* Each stack pointer address is followed by the size of the
1118 data in use in that stack, in bytes. This used to be a
1119 conditional around just the two extra args, but that might
1120 be undefined if yyoverflow is a macro. */
1121 yyoverflow (YY_("memory exhausted"),
1122 &yyss1, yysize * YYSIZEOF (*yyssp),
1123 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1124 &yystacksize);
1125 yyss = yyss1;
1126 yyvs = yyvs1;
1127 }
1128# else /* defined YYSTACK_RELOCATE */
1129 /* Extend the stack our own way. */
1130 if (YYMAXDEPTH <= yystacksize)
1131 YYNOMEM;
1132 yystacksize *= 2;
1133 if (YYMAXDEPTH < yystacksize)
1134 yystacksize = YYMAXDEPTH;
1135
1136 {
1137 yy_state_t *yyss1 = yyss;
1138 union yyalloc *yyptr =
1139 YY_CAST (union yyalloc *,
1140 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1141 if (! yyptr)
1142 YYNOMEM;
1143 YYSTACK_RELOCATE (yyss_alloc, yyss);
1144 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1145# undef YYSTACK_RELOCATE
1146 if (yyss1 != yyssa)
1147 YYSTACK_FREE (yyss1);
1148 }
1149# endif
1150
1151 yyssp = yyss + yysize - 1;
1152 yyvsp = yyvs + yysize - 1;
1153
1154 YY_IGNORE_USELESS_CAST_BEGIN
1155 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1156 YY_CAST (long, yystacksize)));
1157 YY_IGNORE_USELESS_CAST_END
1158
1159 if (yyss + yystacksize - 1 <= yyssp)
1160 YYABORT;
1161 }
1162#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1163
1164
1165 if (yystate == YYFINAL)
1166 YYACCEPT;
1167
1168 goto yybackup;
1169
1170
1171/*-----------.
1172| yybackup. |
1173`-----------*/
1174yybackup:
1175 /* Do appropriate processing given the current state. Read a
1176 lookahead token if we need one and don't already have one. */
1177
1178 /* First try to decide what to do without reference to lookahead token. */
1179 yyn = yypact[yystate];
1180 if (yypact_value_is_default (yyn))
1181 goto yydefault;
1182
1183 /* Not known => get a lookahead token if don't already have one. */
1184
1185 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1186 if (yychar == YYEMPTY)
1187 {
1188 YYDPRINTF ((stderr, "Reading a token\n"));
1189 yychar = yylex (&yylval, arg);
1190 }
1191
1192 if (yychar <= YYEOF)
1193 {
1194 yychar = YYEOF;
1195 yytoken = YYSYMBOL_YYEOF;
1196 YYDPRINTF ((stderr, "Now at end of input.\n"));
1197 }
1198 else if (yychar == YYerror)
1199 {
1200 /* The scanner already issued an error message, process directly
1201 to error recovery. But do not keep the error token as
1202 lookahead, it is too special and may lead us to an endless
1203 loop in error recovery. */
1204 yychar = YYUNDEF;
1205 yytoken = YYSYMBOL_YYerror;
1206 goto yyerrlab1;
1207 }
1208 else
1209 {
1210 yytoken = YYTRANSLATE (yychar);
1211 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1212 }
1213
1214 /* If the proper action on seeing token YYTOKEN is to reduce or to
1215 detect an error, take that action. */
1216 yyn += yytoken;
1217 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1218 goto yydefault;
1219 yyn = yytable[yyn];
1220 if (yyn <= 0)
1221 {
1222 if (yytable_value_is_error (yyn))
1223 goto yyerrlab;
1224 yyn = -yyn;
1225 goto yyreduce;
1226 }
1227
1228 /* Count tokens shifted since error; after three, turn off error
1229 status. */
1230 if (yyerrstatus)
1231 yyerrstatus--;
1232
1233 /* Shift the lookahead token. */
1234 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1235 yystate = yyn;
1236 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1237 *++yyvsp = yylval;
1238 YY_IGNORE_MAYBE_UNINITIALIZED_END
1239
1240 /* Discard the shifted token. */
1241 yychar = YYEMPTY;
1242 goto yynewstate;
1243
1244
1245/*-----------------------------------------------------------.
1246| yydefault -- do the default action for the current state. |
1247`-----------------------------------------------------------*/
1248yydefault:
1249 yyn = yydefact[yystate];
1250 if (yyn == 0)
1251 goto yyerrlab;
1252 goto yyreduce;
1253
1254
1255/*-----------------------------.
1256| yyreduce -- do a reduction. |
1257`-----------------------------*/
1258yyreduce:
1259 /* yyn is the number of a rule to reduce with. */
1260 yylen = yyr2[yyn];
1261
1262 /* If YYLEN is nonzero, implement the default value of the action:
1263 '$$ = $1'.
1264
1265 Otherwise, the following line sets YYVAL to garbage.
1266 This behavior is undocumented and Bison
1267 users should not rely upon it. Assigning to YYVAL
1268 unconditionally makes the parser a bit smaller, and it avoids a
1269 GCC warning that YYVAL may be used uninitialized. */
1270 yyval = yyvsp[1-yylen];
1271
1272
1273 YY_REDUCE_PRINT (yyn);
1274 switch (yyn)
1275 {
1276 case 2: /* start: exp */
1277#line 153 "plural.y"
1278 {
1279 if ((yyvsp[0].exp) == NULL)
1280 YYABORT;
1281 arg->res = (yyvsp[0].exp);
1282 }
1283#line 1284 "/home/admin/code/glibc/build/intl/plural.c"
1284 break;
1285
1286 case 3: /* exp: exp '?' exp ':' exp */
1287#line 161 "plural.y"
1288 {
1289 (yyval.exp) = new_exp_3 (qmop, (yyvsp[-4].exp), (yyvsp[-2].exp), (yyvsp[0].exp));
1290 }
1291#line 1292 "/home/admin/code/glibc/build/intl/plural.c"
1292 break;
1293
1294 case 4: /* exp: exp '|' exp */
1295#line 165 "plural.y"
1296 {
1297 (yyval.exp) = new_exp_2 (lor, (yyvsp[-2].exp), (yyvsp[0].exp));
1298 }
1299#line 1300 "/home/admin/code/glibc/build/intl/plural.c"
1300 break;
1301
1302 case 5: /* exp: exp '&' exp */
1303#line 169 "plural.y"
1304 {
1305 (yyval.exp) = new_exp_2 (land, (yyvsp[-2].exp), (yyvsp[0].exp));
1306 }
1307#line 1308 "/home/admin/code/glibc/build/intl/plural.c"
1308 break;
1309
1310 case 6: /* exp: exp EQUOP2 exp */
1311#line 173 "plural.y"
1312 {
1313 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1314 }
1315#line 1316 "/home/admin/code/glibc/build/intl/plural.c"
1316 break;
1317
1318 case 7: /* exp: exp CMPOP2 exp */
1319#line 177 "plural.y"
1320 {
1321 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1322 }
1323#line 1324 "/home/admin/code/glibc/build/intl/plural.c"
1324 break;
1325
1326 case 8: /* exp: exp ADDOP2 exp */
1327#line 181 "plural.y"
1328 {
1329 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1330 }
1331#line 1332 "/home/admin/code/glibc/build/intl/plural.c"
1332 break;
1333
1334 case 9: /* exp: exp MULOP2 exp */
1335#line 185 "plural.y"
1336 {
1337 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1338 }
1339#line 1340 "/home/admin/code/glibc/build/intl/plural.c"
1340 break;
1341
1342 case 10: /* exp: '!' exp */
1343#line 189 "plural.y"
1344 {
1345 (yyval.exp) = new_exp_1 (lnot, (yyvsp[0].exp));
1346 }
1347#line 1348 "/home/admin/code/glibc/build/intl/plural.c"
1348 break;
1349
1350 case 11: /* exp: 'n' */
1351#line 193 "plural.y"
1352 {
1353 (yyval.exp) = new_exp_0 (var);
1354 }
1355#line 1356 "/home/admin/code/glibc/build/intl/plural.c"
1356 break;
1357
1358 case 12: /* exp: NUMBER */
1359#line 197 "plural.y"
1360 {
1361 if (((yyval.exp) = new_exp_0 (num)) != NULL)
1362 (yyval.exp)->val.num = (yyvsp[0].num);
1363 }
1364#line 1365 "/home/admin/code/glibc/build/intl/plural.c"
1365 break;
1366
1367 case 13: /* exp: '(' exp ')' */
1368#line 202 "plural.y"
1369 {
1370 (yyval.exp) = (yyvsp[-1].exp);
1371 }
1372#line 1373 "/home/admin/code/glibc/build/intl/plural.c"
1373 break;
1374
1375
1376#line 1377 "/home/admin/code/glibc/build/intl/plural.c"
1377
1378 default: break;
1379 }
1380 /* User semantic actions sometimes alter yychar, and that requires
1381 that yytoken be updated with the new translation. We take the
1382 approach of translating immediately before every use of yytoken.
1383 One alternative is translating here after every semantic action,
1384 but that translation would be missed if the semantic action invokes
1385 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1386 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1387 incorrect destructor might then be invoked immediately. In the
1388 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1389 to an incorrect destructor call or verbose syntax error message
1390 before the lookahead is translated. */
1391 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1392
1393 YYPOPSTACK (yylen);
1394 yylen = 0;
1395
1396 *++yyvsp = yyval;
1397
1398 /* Now 'shift' the result of the reduction. Determine what state
1399 that goes to, based on the state we popped back to and the rule
1400 number reduced by. */
1401 {
1402 const int yylhs = yyr1[yyn] - YYNTOKENS;
1403 const int yyi = yypgoto[yylhs] + *yyssp;
1404 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1405 ? yytable[yyi]
1406 : yydefgoto[yylhs]);
1407 }
1408
1409 goto yynewstate;
1410
1411
1412/*--------------------------------------.
1413| yyerrlab -- here on detecting error. |
1414`--------------------------------------*/
1415yyerrlab:
1416 /* Make sure we have latest lookahead translation. See comments at
1417 user semantic actions for why this is necessary. */
1418 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1419 /* If not already recovering from an error, report this error. */
1420 if (!yyerrstatus)
1421 {
1422 ++yynerrs;
1423 yyerror (arg, YY_("syntax error"));
1424 }
1425
1426 if (yyerrstatus == 3)
1427 {
1428 /* If just tried and failed to reuse lookahead token after an
1429 error, discard it. */
1430
1431 if (yychar <= YYEOF)
1432 {
1433 /* Return failure if at end of input. */
1434 if (yychar == YYEOF)
1435 YYABORT;
1436 }
1437 else
1438 {
1439 yydestruct ("Error: discarding",
1440 yytoken, &yylval, arg);
1441 yychar = YYEMPTY;
1442 }
1443 }
1444
1445 /* Else will try to reuse lookahead token after shifting the error
1446 token. */
1447 goto yyerrlab1;
1448
1449
1450/*---------------------------------------------------.
1451| yyerrorlab -- error raised explicitly by YYERROR. |
1452`---------------------------------------------------*/
1453yyerrorlab:
1454 /* Pacify compilers when the user code never invokes YYERROR and the
1455 label yyerrorlab therefore never appears in user code. */
1456 if (0)
1457 YYERROR;
1458 ++yynerrs;
1459
1460 /* Do not reclaim the symbols of the rule whose action triggered
1461 this YYERROR. */
1462 YYPOPSTACK (yylen);
1463 yylen = 0;
1464 YY_STACK_PRINT (yyss, yyssp);
1465 yystate = *yyssp;
1466 goto yyerrlab1;
1467
1468
1469/*-------------------------------------------------------------.
1470| yyerrlab1 -- common code for both syntax error and YYERROR. |
1471`-------------------------------------------------------------*/
1472yyerrlab1:
1473 yyerrstatus = 3; /* Each real token shifted decrements this. */
1474
1475 /* Pop stack until we find a state that shifts the error token. */
1476 for (;;)
1477 {
1478 yyn = yypact[yystate];
1479 if (!yypact_value_is_default (yyn))
1480 {
1481 yyn += YYSYMBOL_YYerror;
1482 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1483 {
1484 yyn = yytable[yyn];
1485 if (0 < yyn)
1486 break;
1487 }
1488 }
1489
1490 /* Pop the current state because it cannot handle the error token. */
1491 if (yyssp == yyss)
1492 YYABORT;
1493
1494
1495 yydestruct ("Error: popping",
1496 YY_ACCESSING_SYMBOL (yystate), yyvsp, arg);
1497 YYPOPSTACK (1);
1498 yystate = *yyssp;
1499 YY_STACK_PRINT (yyss, yyssp);
1500 }
1501
1502 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1503 *++yyvsp = yylval;
1504 YY_IGNORE_MAYBE_UNINITIALIZED_END
1505
1506
1507 /* Shift the error token. */
1508 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1509
1510 yystate = yyn;
1511 goto yynewstate;
1512
1513
1514/*-------------------------------------.
1515| yyacceptlab -- YYACCEPT comes here. |
1516`-------------------------------------*/
1517yyacceptlab:
1518 yyresult = 0;
1519 goto yyreturnlab;
1520
1521
1522/*-----------------------------------.
1523| yyabortlab -- YYABORT comes here. |
1524`-----------------------------------*/
1525yyabortlab:
1526 yyresult = 1;
1527 goto yyreturnlab;
1528
1529
1530/*-----------------------------------------------------------.
1531| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1532`-----------------------------------------------------------*/
1533yyexhaustedlab:
1534 yyerror (arg, YY_("memory exhausted"));
1535 yyresult = 2;
1536 goto yyreturnlab;
1537
1538
1539/*----------------------------------------------------------.
1540| yyreturnlab -- parsing is finished, clean up and return. |
1541`----------------------------------------------------------*/
1542yyreturnlab:
1543 if (yychar != YYEMPTY)
1544 {
1545 /* Make sure we have latest lookahead translation. See comments at
1546 user semantic actions for why this is necessary. */
1547 yytoken = YYTRANSLATE (yychar);
1548 yydestruct ("Cleanup: discarding lookahead",
1549 yytoken, &yylval, arg);
1550 }
1551 /* Do not reclaim the symbols of the rule whose action triggered
1552 this YYABORT or YYACCEPT. */
1553 YYPOPSTACK (yylen);
1554 YY_STACK_PRINT (yyss, yyssp);
1555 while (yyssp != yyss)
1556 {
1557 yydestruct ("Cleanup: popping",
1558 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, arg);
1559 YYPOPSTACK (1);
1560 }
1561#ifndef yyoverflow
1562 if (yyss != yyssa)
1563 YYSTACK_FREE (yyss);
1564#endif
1565
1566 return yyresult;
1567}
1568
1569#line 207 "plural.y"
1570
1571
1572void
1573FREE_EXPRESSION (struct expression *exp)
1574{
1575 if (exp == NULL)
1576 return;
1577
1578 /* Handle the recursive case. */
1579 switch (exp->nargs)
1580 {
1581 case 3:
1582 FREE_EXPRESSION (exp->val.args[2]);
1583 /* FALLTHROUGH */
1584 case 2:
1585 FREE_EXPRESSION (exp->val.args[1]);
1586 /* FALLTHROUGH */
1587 case 1:
1588 FREE_EXPRESSION (exp->val.args[0]);
1589 /* FALLTHROUGH */
1590 default:
1591 break;
1592 }
1593
1594 free (exp);
1595}
1596
1597
1598static int
1599yylex (YYSTYPE *lval, struct parse_args *arg)
1600{
1601 const char *exp = arg->cp;
1602 int result;
1603
1604 while (1)
1605 {
1606 if (exp[0] == '\0')
1607 {
1608 arg->cp = exp;
1609 return YYEOF;
1610 }
1611
1612 if (exp[0] != ' ' && exp[0] != '\t')
1613 break;
1614
1615 ++exp;
1616 }
1617
1618 result = *exp++;
1619 switch (result)
1620 {
1621 case '0': case '1': case '2': case '3': case '4':
1622 case '5': case '6': case '7': case '8': case '9':
1623 {
1624 unsigned long int n = result - '0';
1625 while (exp[0] >= '0' && exp[0] <= '9')
1626 {
1627 n *= 10;
1628 n += exp[0] - '0';
1629 ++exp;
1630 }
1631 lval->num = n;
1632 result = NUMBER;
1633 }
1634 break;
1635
1636 case '=':
1637 if (exp[0] == '=')
1638 {
1639 ++exp;
1640 lval->op = equal;
1641 result = EQUOP2;
1642 }
1643 else
1644 result = YYERRCODE;
1645 break;
1646
1647 case '!':
1648 if (exp[0] == '=')
1649 {
1650 ++exp;
1651 lval->op = not_equal;
1652 result = EQUOP2;
1653 }
1654 break;
1655
1656 case '&':
1657 case '|':
1658 if (exp[0] == result)
1659 ++exp;
1660 else
1661 result = YYERRCODE;
1662 break;
1663
1664 case '<':
1665 if (exp[0] == '=')
1666 {
1667 ++exp;
1668 lval->op = less_or_equal;
1669 }
1670 else
1671 lval->op = less_than;
1672 result = CMPOP2;
1673 break;
1674
1675 case '>':
1676 if (exp[0] == '=')
1677 {
1678 ++exp;
1679 lval->op = greater_or_equal;
1680 }
1681 else
1682 lval->op = greater_than;
1683 result = CMPOP2;
1684 break;
1685
1686 case '*':
1687 lval->op = mult;
1688 result = MULOP2;
1689 break;
1690
1691 case '/':
1692 lval->op = divide;
1693 result = MULOP2;
1694 break;
1695
1696 case '%':
1697 lval->op = module;
1698 result = MULOP2;
1699 break;
1700
1701 case '+':
1702 lval->op = plus;
1703 result = ADDOP2;
1704 break;
1705
1706 case '-':
1707 lval->op = minus;
1708 result = ADDOP2;
1709 break;
1710
1711 case 'n':
1712 case '?':
1713 case ':':
1714 case '(':
1715 case ')':
1716 /* Nothing, just return the character. */
1717 break;
1718
1719 case ';':
1720 case '\n':
1721 case '\0':
1722 /* Be safe and let the user call this function again. */
1723 --exp;
1724 result = YYEOF;
1725 break;
1726
1727 default:
1728 result = YYERRCODE;
1729#if YYDEBUG != 0
1730 --exp;
1731#endif
1732 break;
1733 }
1734
1735 arg->cp = exp;
1736
1737 return result;
1738}
1739
1740
1741static void
1742yyerror (struct parse_args *arg, const char *str)
1743{
1744 /* Do nothing. We don't print error messages here. */
1745}
1746