1 /* A Bison parser, made by GNU Bison 2.3a. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
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 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
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.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
44 /* Identify Bison output. */
48 #define YYBISON_VERSION "2.3a"
51 #define YYSKELETON_NAME "yacc.c"
56 /* Using locations. */
57 #define YYLSP_NEEDED 0
59 /* Substitute the variable and function names. */
60 #define yyparse __gettextparse
61 #define yylex __gettextlex
62 #define yyerror __gettexterror
63 #define yylval __gettextlval
64 #define yychar __gettextchar
65 #define yydebug __gettextdebug
66 #define yynerrs __gettextnerrs
69 /* Copy the first part of user declarations. */
70 /* Line 164 of yacc.c. */
73 /* Expression parsing for plural form selection.
74 Copyright (C) 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc.
75 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
77 This program is free software; you can redistribute it and/or modify it
78 under the terms of the GNU Library General Public License as published
79 by the Free Software Foundation; either version 2, or (at your option)
82 This program is distributed in the hope that it will be useful,
83 but WITHOUT ANY WARRANTY; without even the implied warranty of
84 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85 Library General Public License for more details.
87 You should have received a copy of the GNU Library General Public
88 License along with this program; if not, write to the Free Software
89 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
92 /* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us
93 to put this declaration at the beginning of the file. The declaration in
94 bison's skeleton file comes too late. This must come before <config.h>
95 because <config.h> may include arbitrary system headers.
96 This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */
97 #if defined _AIX && !defined __GNUC__
108 #include "plural-exp.h"
110 /* The main function generated by the parser is called __gettextparse,
111 but we want it to be called PLURAL_PARSE. */
113 # define __gettextparse PLURAL_PARSE
116 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
117 #define YYPARSE_PARAM arg
120 /* Enabling traces. */
125 /* Enabling verbose error messages. */
126 #ifdef YYERROR_VERBOSE
127 # undef YYERROR_VERBOSE
128 # define YYERROR_VERBOSE 1
130 # define YYERROR_VERBOSE 0
133 /* Enabling the token table. */
134 #ifndef YYTOKEN_TABLE
135 # define YYTOKEN_TABLE 0
142 /* Put the tokens into the symbol table, so that GDB and other debuggers
162 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
163 typedef union YYSTYPE
164 {/* Line 191 of yacc.c. */
167 unsigned long int num;
168 enum expression_operator op;
169 struct expression *exp;
171 /* Line 191 of yacc.c. */
174 # define YYSTYPE_IS_TRIVIAL 1
175 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
176 # define YYSTYPE_IS_DECLARED 1
182 /* Copy the second part of user declarations. */
183 /* Line 221 of yacc.c. */
186 /* Prototypes for local functions. */
187 static int yylex (YYSTYPE *lval, const char **pexp);
188 static void yyerror (const char *str);
190 /* Allocation of expressions. */
192 static struct expression *
193 new_exp (int nargs, enum expression_operator op,
194 struct expression * const *args)
197 struct expression *newp;
199 /* If any of the argument could not be malloc'ed, just return NULL. */
200 for (i = nargs - 1; i >= 0; i--)
204 /* Allocate a new expression. */
205 newp = (struct expression *) malloc (sizeof (*newp));
209 newp->operation = op;
210 for (i = nargs - 1; i >= 0; i--)
211 newp->val.args[i] = args[i];
216 for (i = nargs - 1; i >= 0; i--)
217 FREE_EXPRESSION (args[i]);
222 static inline struct expression *
223 new_exp_0 (enum expression_operator op)
225 return new_exp (0, op, NULL);
228 static inline struct expression *
229 new_exp_1 (enum expression_operator op, struct expression *right)
231 struct expression *args[1];
234 return new_exp (1, op, args);
237 static struct expression *
238 new_exp_2 (enum expression_operator op, struct expression *left,
239 struct expression *right)
241 struct expression *args[2];
245 return new_exp (2, op, args);
248 static inline struct expression *
249 new_exp_3 (enum expression_operator op, struct expression *bexp,
250 struct expression *tbranch, struct expression *fbranch)
252 struct expression *args[3];
257 return new_exp (3, op, args);
261 /* Line 221 of yacc.c. */
269 typedef YYTYPE_UINT8 yytype_uint8;
271 typedef unsigned char yytype_uint8;
275 typedef YYTYPE_INT8 yytype_int8;
276 #elif (defined __STDC__ || defined __C99__FUNC__ \
277 || defined __cplusplus || defined _MSC_VER)
278 typedef signed char yytype_int8;
280 typedef short int yytype_int8;
284 typedef YYTYPE_UINT16 yytype_uint16;
286 typedef unsigned short int yytype_uint16;
290 typedef YYTYPE_INT16 yytype_int16;
292 typedef short int yytype_int16;
296 # ifdef __SIZE_TYPE__
297 # define YYSIZE_T __SIZE_TYPE__
298 # elif defined size_t
299 # define YYSIZE_T size_t
300 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
301 || defined __cplusplus || defined _MSC_VER)
302 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
303 # define YYSIZE_T size_t
305 # define YYSIZE_T unsigned int
309 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
314 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
315 # define YY_(msgid) dgettext ("bison-runtime", msgid)
319 # define YY_(msgid) msgid
323 /* Suppress unused-variable warnings by "using" E. */
324 #if ! defined lint || defined __GNUC__
325 # define YYUSE(e) ((void) (e))
327 # define YYUSE(e) /* empty */
330 /* Identity function, used to suppress warnings about constant conditions. */
334 #if (defined __STDC__ || defined __C99__FUNC__ \
335 || defined __cplusplus || defined _MSC_VER)
348 #if ! defined yyoverflow || YYERROR_VERBOSE
350 /* The parser invokes alloca or malloc; define the necessary symbols. */
352 # ifdef YYSTACK_USE_ALLOCA
353 # if YYSTACK_USE_ALLOCA
355 # define YYSTACK_ALLOC __builtin_alloca
356 # elif defined __BUILTIN_VA_ARG_INCR
357 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
359 # define YYSTACK_ALLOC __alloca
360 # elif defined _MSC_VER
361 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
362 # define alloca _alloca
364 # define YYSTACK_ALLOC alloca
365 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
366 || defined __cplusplus || defined _MSC_VER)
367 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
376 # ifdef YYSTACK_ALLOC
377 /* Pacify GCC's `empty if-body' warning. */
378 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
379 # ifndef YYSTACK_ALLOC_MAXIMUM
380 /* The OS might guarantee only one guard page at the bottom of the stack,
381 and a page size can be as small as 4096 bytes. So we cannot safely
382 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
383 to allow for a few compiler-allocated temporary stack slots. */
384 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
387 # define YYSTACK_ALLOC YYMALLOC
388 # define YYSTACK_FREE YYFREE
389 # ifndef YYSTACK_ALLOC_MAXIMUM
390 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
392 # if (defined __cplusplus && ! defined _STDLIB_H \
393 && ! ((defined YYMALLOC || defined malloc) \
394 && (defined YYFREE || defined free)))
395 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
401 # define YYMALLOC malloc
402 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
403 || defined __cplusplus || defined _MSC_VER)
404 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
409 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
410 || defined __cplusplus || defined _MSC_VER)
411 void free (void *); /* INFRINGES ON USER NAME SPACE */
415 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
418 #if (! defined yyoverflow \
419 && (! defined __cplusplus \
420 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
422 /* A type that is properly aligned for any stack member. */
429 /* The size of the maximum gap between one aligned stack and the next. */
430 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
432 /* The size of an array large to enough to hold all stacks, each with
434 # define YYSTACK_BYTES(N) \
435 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
436 + YYSTACK_GAP_MAXIMUM)
438 /* Copy COUNT objects from FROM to TO. The source and destination do
441 # if defined __GNUC__ && 1 < __GNUC__
442 # define YYCOPY(To, From, Count) \
443 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
445 # define YYCOPY(To, From, Count) \
449 for (yyi = 0; yyi < (Count); yyi++) \
450 (To)[yyi] = (From)[yyi]; \
456 /* Relocate STACK from its old location to the new one. The
457 local variables YYSIZE and YYSTACKSIZE give the old and new number of
458 elements in the stack, and YYPTR gives the new location of the
459 stack. Advance YYPTR to a properly aligned location for the next
461 # define YYSTACK_RELOCATE(Stack) \
464 YYSIZE_T yynewbytes; \
465 YYCOPY (&yyptr->Stack, Stack, yysize); \
466 Stack = &yyptr->Stack; \
467 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
468 yyptr += yynewbytes / sizeof (*yyptr); \
474 /* YYFINAL -- State number of the termination state. */
476 /* YYLAST -- Last index in YYTABLE. */
479 /* YYNTOKENS -- Number of terminals. */
481 /* YYNNTS -- Number of nonterminals. */
483 /* YYNRULES -- Number of rules. */
485 /* YYNRULES -- Number of states. */
488 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
490 #define YYMAXUTOK 262
492 #define YYTRANSLATE(YYX) \
493 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
495 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
496 static const yytype_uint8 yytranslate[] =
498 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
502 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
504 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
528 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
530 static const yytype_uint8 yyprhs[] =
532 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
536 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
537 static const yytype_int8 yyrhs[] =
539 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
540 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
541 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
542 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
543 11, -1, 14, 18, 15, -1
546 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
547 static const yytype_uint8 yyrline[] =
549 0, 154, 154, 162, 166, 170, 174, 178, 182, 186,
554 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
555 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
556 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
557 static const char *const yytname[] =
559 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
560 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
561 "$accept", "start", "exp", 0
566 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
568 static const yytype_uint16 yytoknum[] =
570 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
571 33, 262, 58, 110, 40, 41
575 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
576 static const yytype_uint8 yyr1[] =
578 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
582 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
583 static const yytype_uint8 yyr2[] =
585 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
589 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
590 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
591 means the default is an error. */
592 static const yytype_uint8 yydefact[] =
594 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
595 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
599 /* YYDEFGOTO[NTERM-NUM]. */
600 static const yytype_int8 yydefgoto[] =
605 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
607 #define YYPACT_NINF -10
608 static const yytype_int8 yypact[] =
610 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
611 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
612 45, 18, -2, 14, -10, -9, 36
615 /* YYPGOTO[NTERM-NUM]. */
616 static const yytype_int8 yypgoto[] =
621 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
622 positive, shift that token. If negative, reduce the rule which
623 number is the opposite. If zero, do what YYDEFACT says.
624 If YYTABLE_NINF, syntax error. */
625 #define YYTABLE_NINF -1
626 static const yytype_uint8 yytable[] =
628 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
629 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
630 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
631 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
632 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
636 static const yytype_int8 yycheck[] =
638 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
639 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
640 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
641 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
642 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
646 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
647 symbol of state STATE-NUM. */
648 static const yytype_uint8 yystos[] =
650 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
651 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
652 18, 18, 18, 18, 18, 12, 18
655 #define yyerrok (yyerrstatus = 0)
656 #define yyclearin (yychar = YYEMPTY)
660 #define YYACCEPT goto yyacceptlab
661 #define YYABORT goto yyabortlab
662 #define YYERROR goto yyerrorlab
665 /* Like YYERROR except do call yyerror. This remains here temporarily
666 to ease the transition to the new meaning of YYERROR, for GCC.
667 Once GCC version 2 has supplanted version 1, this can go. */
669 #define YYFAIL goto yyerrlab
671 #define YYRECOVERING() (!!yyerrstatus)
673 #define YYBACKUP(Token, Value) \
675 if (yychar == YYEMPTY && yylen == 1) \
679 yytoken = YYTRANSLATE (yychar); \
685 yyerror (YY_("syntax error: cannot back up")); \
692 #define YYERRCODE 256
695 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
696 If N is 0, then set CURRENT to the empty location which ends
697 the previous symbol: RHS[0] (always defined). */
699 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
700 #ifndef YYLLOC_DEFAULT
701 # define YYLLOC_DEFAULT(Current, Rhs, N) \
705 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
706 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
707 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
708 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
712 (Current).first_line = (Current).last_line = \
713 YYRHSLOC (Rhs, 0).last_line; \
714 (Current).first_column = (Current).last_column = \
715 YYRHSLOC (Rhs, 0).last_column; \
721 /* YY_LOCATION_PRINT -- Print the location on the stream.
722 This macro was not mandated originally: define only if we know
723 we won't break user code: when these are the locations we know. */
725 #ifndef YY_LOCATION_PRINT
726 # if YYLTYPE_IS_TRIVIAL
727 # define YY_LOCATION_PRINT(File, Loc) \
728 fprintf (File, "%d.%d-%d.%d", \
729 (Loc).first_line, (Loc).first_column, \
730 (Loc).last_line, (Loc).last_column)
732 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
737 /* YYLEX -- calling `yylex' with the right arguments. */
740 # define YYLEX yylex (&yylval, YYLEX_PARAM)
742 # define YYLEX yylex (&yylval)
745 /* Enable debugging if requested. */
749 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
750 # define YYFPRINTF fprintf
753 # define YYDPRINTF(Args) \
759 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
763 YYFPRINTF (stderr, "%s ", Title); \
764 yy_symbol_print (stderr, \
766 YYFPRINTF (stderr, "\n"); \
771 /*--------------------------------.
772 | Print this symbol on YYOUTPUT. |
773 `--------------------------------*/
776 #if (defined __STDC__ || defined __C99__FUNC__ \
777 || defined __cplusplus || defined _MSC_VER)
779 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
782 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
785 YYSTYPE const * const yyvaluep;
791 if (yytype < YYNTOKENS)
792 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
804 /*--------------------------------.
805 | Print this symbol on YYOUTPUT. |
806 `--------------------------------*/
808 #if (defined __STDC__ || defined __C99__FUNC__ \
809 || defined __cplusplus || defined _MSC_VER)
811 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
814 yy_symbol_print (yyoutput, yytype, yyvaluep)
817 YYSTYPE const * const yyvaluep;
820 if (yytype < YYNTOKENS)
821 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
823 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
825 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
826 YYFPRINTF (yyoutput, ")");
829 /*------------------------------------------------------------------.
830 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
832 `------------------------------------------------------------------*/
834 #if (defined __STDC__ || defined __C99__FUNC__ \
835 || defined __cplusplus || defined _MSC_VER)
837 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
840 yy_stack_print (yybottom, yytop)
841 yytype_int16 *yybottom;
845 YYFPRINTF (stderr, "Stack now");
846 for (; yybottom <= yytop; yybottom++)
848 int yybot = *yybottom;
849 YYFPRINTF (stderr, " %d", yybot);
851 YYFPRINTF (stderr, "\n");
854 # define YY_STACK_PRINT(Bottom, Top) \
857 yy_stack_print ((Bottom), (Top)); \
861 /*------------------------------------------------.
862 | Report that the YYRULE is going to be reduced. |
863 `------------------------------------------------*/
865 #if (defined __STDC__ || defined __C99__FUNC__ \
866 || defined __cplusplus || defined _MSC_VER)
868 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
871 yy_reduce_print (yyvsp, yyrule)
876 int yynrhs = yyr2[yyrule];
878 unsigned long int yylno = yyrline[yyrule];
879 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
881 /* The symbols being reduced. */
882 for (yyi = 0; yyi < yynrhs; yyi++)
884 fprintf (stderr, " $%d = ", yyi + 1);
885 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
886 &(yyvsp[(yyi + 1) - (yynrhs)])
888 fprintf (stderr, "\n");
892 # define YY_REDUCE_PRINT(Rule) \
895 yy_reduce_print (yyvsp, Rule); \
898 /* Nonzero means print parse trace. It is left uninitialized so that
899 multiple parsers can coexist. */
902 # define YYDPRINTF(Args)
903 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
904 # define YY_STACK_PRINT(Bottom, Top)
905 # define YY_REDUCE_PRINT(Rule)
906 #endif /* !YYDEBUG */
909 /* YYINITDEPTH -- initial size of the parser's stacks. */
911 # define YYINITDEPTH 200
914 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
915 if the built-in stack extension method is used).
917 Do not make this value too large; the results are undefined if
918 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
919 evaluated with infinite-precision integer arithmetic. */
922 # define YYMAXDEPTH 10000
930 # if defined __GLIBC__ && defined _STRING_H
931 # define yystrlen strlen
933 /* Return the length of YYSTR. */
934 #if (defined __STDC__ || defined __C99__FUNC__ \
935 || defined __cplusplus || defined _MSC_VER)
937 yystrlen (const char *yystr)
945 for (yylen = 0; yystr[yylen]; yylen++)
953 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
954 # define yystpcpy stpcpy
956 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
958 #if (defined __STDC__ || defined __C99__FUNC__ \
959 || defined __cplusplus || defined _MSC_VER)
961 yystpcpy (char *yydest, const char *yysrc)
964 yystpcpy (yydest, yysrc)
970 const char *yys = yysrc;
972 while ((*yyd++ = *yys++) != '\0')
981 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
982 quotes and backslashes, so that it's suitable for yyerror. The
983 heuristic is that double-quoting is unnecessary unless the string
984 contains an apostrophe, a comma, or backslash (other than
985 backslash-backslash). YYSTR is taken from yytname. If YYRES is
986 null, do not copy; instead, return the length of what the result
989 yytnamerr (char *yyres, const char *yystr)
994 char const *yyp = yystr;
1001 goto do_not_strip_quotes;
1005 goto do_not_strip_quotes;
1018 do_not_strip_quotes: ;
1022 return yystrlen (yystr);
1024 return yystpcpy (yyres, yystr) - yyres;
1028 /* Copy into YYRESULT an error message about the unexpected token
1029 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1030 including the terminating null byte. If YYRESULT is null, do not
1031 copy anything; just return the number of bytes that would be
1032 copied. As a special case, return 0 if an ordinary "syntax error"
1033 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1034 size calculation. */
1036 yysyntax_error (char *yyresult, int yystate, int yychar)
1038 int yyn = yypact[yystate];
1040 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1044 int yytype = YYTRANSLATE (yychar);
1045 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1046 YYSIZE_T yysize = yysize0;
1048 int yysize_overflow = 0;
1049 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1050 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1054 /* This is so xgettext sees the translatable formats that are
1055 constructed on the fly. */
1056 YY_("syntax error, unexpected %s");
1057 YY_("syntax error, unexpected %s, expecting %s");
1058 YY_("syntax error, unexpected %s, expecting %s or %s");
1059 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1060 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1064 static char const yyunexpected[] = "syntax error, unexpected %s";
1065 static char const yyexpecting[] = ", expecting %s";
1066 static char const yyor[] = " or %s";
1067 char yyformat[sizeof yyunexpected
1068 + sizeof yyexpecting - 1
1069 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1070 * (sizeof yyor - 1))];
1071 char const *yyprefix = yyexpecting;
1073 /* Start YYX at -YYN if negative to avoid negative indexes in
1075 int yyxbegin = yyn < 0 ? -yyn : 0;
1077 /* Stay within bounds of both yycheck and yytname. */
1078 int yychecklim = YYLAST - yyn + 1;
1079 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1082 yyarg[0] = yytname[yytype];
1083 yyfmt = yystpcpy (yyformat, yyunexpected);
1085 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1086 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1088 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1092 yyformat[sizeof yyunexpected - 1] = '\0';
1095 yyarg[yycount++] = yytname[yyx];
1096 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1097 yysize_overflow |= (yysize1 < yysize);
1099 yyfmt = yystpcpy (yyfmt, yyprefix);
1103 yyf = YY_(yyformat);
1104 yysize1 = yysize + yystrlen (yyf);
1105 yysize_overflow |= (yysize1 < yysize);
1108 if (yysize_overflow)
1109 return YYSIZE_MAXIMUM;
1113 /* Avoid sprintf, as that infringes on the user's name space.
1114 Don't have undefined behavior even if the translation
1115 produced a string with the wrong number of "%s"s. */
1116 char *yyp = yyresult;
1118 while ((*yyp = *yyf) != '\0')
1120 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1122 yyp += yytnamerr (yyp, yyarg[yyi++]);
1135 #endif /* YYERROR_VERBOSE */
1138 /*-----------------------------------------------.
1139 | Release the memory associated to this symbol. |
1140 `-----------------------------------------------*/
1143 #if (defined __STDC__ || defined __C99__FUNC__ \
1144 || defined __cplusplus || defined _MSC_VER)
1146 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1149 yydestruct (yymsg, yytype, yyvaluep)
1159 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1170 /* Prevent warnings from -Wmissing-prototypes. */
1172 #ifdef YYPARSE_PARAM
1173 #if defined __STDC__ || defined __cplusplus
1174 int yyparse (void *YYPARSE_PARAM);
1178 #else /* ! YYPARSE_PARAM */
1179 #if defined __STDC__ || defined __cplusplus
1184 #endif /* ! YYPARSE_PARAM */
1195 #ifdef YYPARSE_PARAM
1196 #if (defined __STDC__ || defined __C99__FUNC__ \
1197 || defined __cplusplus || defined _MSC_VER)
1199 yyparse (void *YYPARSE_PARAM)
1202 yyparse (YYPARSE_PARAM)
1203 void *YYPARSE_PARAM;
1205 #else /* ! YYPARSE_PARAM */
1206 #if (defined __STDC__ || defined __C99__FUNC__ \
1207 || defined __cplusplus || defined _MSC_VER)
1217 /* The lookahead symbol. */
1220 /* The semantic value of the lookahead symbol. */
1223 /* Number of syntax errors so far. */
1229 /* Number of tokens to shift before error messages enabled. */
1231 /* Lookahead token as an internal (translated) token number. */
1234 /* Buffer for error messages, and its allocated size. */
1236 char *yymsg = yymsgbuf;
1237 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1240 /* Three stacks and their tools:
1241 `yyss': related to states,
1242 `yyvs': related to semantic values,
1243 `yyls': related to locations.
1245 Refer to the stacks thru separate pointers, to allow yyoverflow
1246 to reallocate them elsewhere. */
1248 /* The state stack. */
1249 yytype_int16 yyssa[YYINITDEPTH];
1250 yytype_int16 *yyss = yyssa;
1251 yytype_int16 *yyssp;
1253 /* The semantic value stack. */
1254 YYSTYPE yyvsa[YYINITDEPTH];
1255 YYSTYPE *yyvs = yyvsa;
1260 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1262 YYSIZE_T yystacksize = YYINITDEPTH;
1264 /* The variables used to return semantic value and location from the
1269 /* The number of symbols on the RHS of the reduced rule.
1270 Keep to zero when no symbol should be popped. */
1273 YYDPRINTF ((stderr, "Starting parse\n"));
1278 yychar = YYEMPTY; /* Cause a token to be read. */
1280 /* Initialize stack pointers.
1281 Waste one element of value and location stack
1282 so that they stay on the same level as the state stack.
1283 The wasted elements are never initialized. */
1290 /*------------------------------------------------------------.
1291 | yynewstate -- Push a new state, which is found in yystate. |
1292 `------------------------------------------------------------*/
1294 /* In all cases, when you get here, the value and location stacks
1295 have just been pushed. So pushing a state here evens the stacks. */
1301 if (yyss + yystacksize - 1 <= yyssp)
1303 /* Get the current used size of the three stacks, in elements. */
1304 YYSIZE_T yysize = yyssp - yyss + 1;
1308 /* Give user a chance to reallocate the stack. Use copies of
1309 these so that the &'s don't force the real ones into
1311 YYSTYPE *yyvs1 = yyvs;
1312 yytype_int16 *yyss1 = yyss;
1315 /* Each stack pointer address is followed by the size of the
1316 data in use in that stack, in bytes. This used to be a
1317 conditional around just the two extra args, but that might
1318 be undefined if yyoverflow is a macro. */
1319 yyoverflow (YY_("memory exhausted"),
1320 &yyss1, yysize * sizeof (*yyssp),
1321 &yyvs1, yysize * sizeof (*yyvsp),
1328 #else /* no yyoverflow */
1329 # ifndef YYSTACK_RELOCATE
1330 goto yyexhaustedlab;
1332 /* Extend the stack our own way. */
1333 if (YYMAXDEPTH <= yystacksize)
1334 goto yyexhaustedlab;
1336 if (YYMAXDEPTH < yystacksize)
1337 yystacksize = YYMAXDEPTH;
1340 yytype_int16 *yyss1 = yyss;
1341 union yyalloc *yyptr =
1342 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1344 goto yyexhaustedlab;
1345 YYSTACK_RELOCATE (yyss);
1346 YYSTACK_RELOCATE (yyvs);
1348 # undef YYSTACK_RELOCATE
1350 YYSTACK_FREE (yyss1);
1353 #endif /* no yyoverflow */
1355 yyssp = yyss + yysize - 1;
1356 yyvsp = yyvs + yysize - 1;
1359 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1360 (unsigned long int) yystacksize));
1362 if (yyss + yystacksize - 1 <= yyssp)
1366 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1368 if (yystate == YYFINAL)
1378 /* Do appropriate processing given the current state. Read a
1379 lookahead token if we need one and don't already have one. */
1381 /* First try to decide what to do without reference to lookahead token. */
1382 yyn = yypact[yystate];
1383 if (yyn == YYPACT_NINF)
1386 /* Not known => get a lookahead token if don't already have one. */
1388 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1389 if (yychar == YYEMPTY)
1391 YYDPRINTF ((stderr, "Reading a token: "));
1395 if (yychar <= YYEOF)
1397 yychar = yytoken = YYEOF;
1398 YYDPRINTF ((stderr, "Now at end of input.\n"));
1402 yytoken = YYTRANSLATE (yychar);
1403 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1406 /* If the proper action on seeing token YYTOKEN is to reduce or to
1407 detect an error, take that action. */
1409 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1414 if (yyn == 0 || yyn == YYTABLE_NINF)
1420 /* Count tokens shifted since error; after three, turn off error
1425 /* Shift the lookahead token. */
1426 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1428 /* Discard the shifted token. */
1437 /*-----------------------------------------------------------.
1438 | yydefault -- do the default action for the current state. |
1439 `-----------------------------------------------------------*/
1441 yyn = yydefact[yystate];
1447 /*-----------------------------.
1448 | yyreduce -- Do a reduction. |
1449 `-----------------------------*/
1451 /* yyn is the number of a rule to reduce with. */
1454 /* If YYLEN is nonzero, implement the default value of the action:
1457 Otherwise, the following line sets YYVAL to garbage.
1458 This behavior is undocumented and Bison
1459 users should not rely upon it. Assigning to YYVAL
1460 unconditionally makes the parser a bit smaller, and it avoids a
1461 GCC warning that YYVAL may be used uninitialized. */
1462 yyval = yyvsp[1-yylen];
1465 YY_REDUCE_PRINT (yyn);
1469 /* Line 1269 of yacc.c. */
1470 #line 155 "plural.y"
1472 if ((yyvsp[(1) - (1)].exp) == NULL)
1474 ((struct parse_args *) arg)->res = (yyvsp[(1) - (1)].exp);
1479 /* Line 1269 of yacc.c. */
1480 #line 163 "plural.y"
1482 (yyval.exp) = new_exp_3 (qmop, (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp));
1487 /* Line 1269 of yacc.c. */
1488 #line 167 "plural.y"
1490 (yyval.exp) = new_exp_2 (lor, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1495 /* Line 1269 of yacc.c. */
1496 #line 171 "plural.y"
1498 (yyval.exp) = new_exp_2 (land, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1503 /* Line 1269 of yacc.c. */
1504 #line 175 "plural.y"
1506 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1511 /* Line 1269 of yacc.c. */
1512 #line 179 "plural.y"
1514 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1519 /* Line 1269 of yacc.c. */
1520 #line 183 "plural.y"
1522 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1527 /* Line 1269 of yacc.c. */
1528 #line 187 "plural.y"
1530 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1535 /* Line 1269 of yacc.c. */
1536 #line 191 "plural.y"
1538 (yyval.exp) = new_exp_1 (lnot, (yyvsp[(2) - (2)].exp));
1543 /* Line 1269 of yacc.c. */
1544 #line 195 "plural.y"
1546 (yyval.exp) = new_exp_0 (var);
1551 /* Line 1269 of yacc.c. */
1552 #line 199 "plural.y"
1554 if (((yyval.exp) = new_exp_0 (num)) != NULL)
1555 (yyval.exp)->val.num = (yyvsp[(1) - (1)].num);
1560 /* Line 1269 of yacc.c. */
1561 #line 204 "plural.y"
1563 (yyval.exp) = (yyvsp[(2) - (3)].exp);
1568 /* Line 1269 of yacc.c. */
1569 #line 1572 "plural.c"
1572 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1576 YY_STACK_PRINT (yyss, yyssp);
1581 /* Now `shift' the result of the reduction. Determine what state
1582 that goes to, based on the state we popped back to and the rule
1583 number reduced by. */
1587 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1588 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1589 yystate = yytable[yystate];
1591 yystate = yydefgoto[yyn - YYNTOKENS];
1596 /*------------------------------------.
1597 | yyerrlab -- here on detecting error |
1598 `------------------------------------*/
1600 /* If not already recovering from an error, report this error. */
1604 #if ! YYERROR_VERBOSE
1605 yyerror (YY_("syntax error"));
1608 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1609 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1611 YYSIZE_T yyalloc = 2 * yysize;
1612 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1613 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1614 if (yymsg != yymsgbuf)
1615 YYSTACK_FREE (yymsg);
1616 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1618 yymsg_alloc = yyalloc;
1622 yymsg_alloc = sizeof yymsgbuf;
1626 if (0 < yysize && yysize <= yymsg_alloc)
1628 (void) yysyntax_error (yymsg, yystate, yychar);
1633 yyerror (YY_("syntax error"));
1635 goto yyexhaustedlab;
1643 if (yyerrstatus == 3)
1645 /* If just tried and failed to reuse lookahead token after an
1646 error, discard it. */
1648 if (yychar <= YYEOF)
1650 /* Return failure if at end of input. */
1651 if (yychar == YYEOF)
1656 yydestruct ("Error: discarding",
1662 /* Else will try to reuse lookahead token after shifting the error
1667 /*---------------------------------------------------.
1668 | yyerrorlab -- error raised explicitly by YYERROR. |
1669 `---------------------------------------------------*/
1672 /* Pacify compilers like GCC when the user code never invokes
1673 YYERROR and the label yyerrorlab therefore never appears in user
1675 if (/*CONSTCOND*/ 0)
1678 /* Do not reclaim the symbols of the rule which action triggered
1682 YY_STACK_PRINT (yyss, yyssp);
1687 /*-------------------------------------------------------------.
1688 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1689 `-------------------------------------------------------------*/
1691 yyerrstatus = 3; /* Each real token shifted decrements this. */
1695 yyn = yypact[yystate];
1696 if (yyn != YYPACT_NINF)
1699 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1707 /* Pop the current state because it cannot handle the error token. */
1712 yydestruct ("Error: popping",
1713 yystos[yystate], yyvsp);
1716 YY_STACK_PRINT (yyss, yyssp);
1722 /* Shift the error token. */
1723 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1729 /*-------------------------------------.
1730 | yyacceptlab -- YYACCEPT comes here. |
1731 `-------------------------------------*/
1736 /*-----------------------------------.
1737 | yyabortlab -- YYABORT comes here. |
1738 `-----------------------------------*/
1744 /*-------------------------------------------------.
1745 | yyexhaustedlab -- memory exhaustion comes here. |
1746 `-------------------------------------------------*/
1748 yyerror (YY_("memory exhausted"));
1754 if (yychar != YYEMPTY)
1755 yydestruct ("Cleanup: discarding lookahead",
1757 /* Do not reclaim the symbols of the rule which action triggered
1758 this YYABORT or YYACCEPT. */
1760 YY_STACK_PRINT (yyss, yyssp);
1761 while (yyssp != yyss)
1763 yydestruct ("Cleanup: popping",
1764 yystos[*yyssp], yyvsp);
1769 YYSTACK_FREE (yyss);
1772 if (yymsg != yymsgbuf)
1773 YYSTACK_FREE (yymsg);
1775 /* Make sure YYID is used. */
1776 return YYID (yyresult);
1780 /* Line 1486 of yacc.c. */
1781 #line 209 "plural.y"
1786 FREE_EXPRESSION (struct expression *exp)
1791 /* Handle the recursive case. */
1795 FREE_EXPRESSION (exp->val.args[2]);
1798 FREE_EXPRESSION (exp->val.args[1]);
1801 FREE_EXPRESSION (exp->val.args[0]);
1812 yylex (YYSTYPE *lval, const char **pexp)
1814 const char *exp = *pexp;
1825 if (exp[0] != ' ' && exp[0] != '\t')
1834 case '0': case '1': case '2': case '3': case '4':
1835 case '5': case '6': case '7': case '8': case '9':
1837 unsigned long int n = result - '0';
1838 while (exp[0] >= '0' && exp[0] <= '9')
1864 lval->op = not_equal;
1871 if (exp[0] == result)
1881 lval->op = less_or_equal;
1884 lval->op = less_than;
1892 lval->op = greater_or_equal;
1895 lval->op = greater_than;
1929 /* Nothing, just return the character. */
1935 /* Be safe and let the user call this function again. */
1955 yyerror (const char *str)
1957 /* Do nothing. We don't print error messages here. */