1 /* A Bison parser, made by GNU Bison 2.4.3. */
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 2009, 2010 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 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.
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.
18 You should have received a copy of the GNU 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.4.3"
51 #define YYSKELETON_NAME "yacc.c"
62 /* Using locations. */
63 #define YYLSP_NEEDED 0
65 /* Substitute the variable and function names. */
66 #define yyparse __gettextparse
67 #define yylex __gettextlex
68 #define yyerror __gettexterror
69 #define yylval __gettextlval
70 #define yychar __gettextchar
71 #define yydebug __gettextdebug
72 #define yynerrs __gettextnerrs
75 /* Copy the first part of user declarations. */
77 /* Line 189 of yacc.c */
80 /* Expression parsing for plural form selection.
81 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
82 This file is part of the GNU C Library.
83 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
85 The GNU C Library is free software; you can redistribute it and/or
86 modify it under the terms of the GNU Lesser General Public
87 License as published by the Free Software Foundation; either
88 version 2.1 of the License, or (at your option) any later version.
90 The GNU C Library is distributed in the hope that it will be useful,
91 but WITHOUT ANY WARRANTY; without even the implied warranty of
92 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93 Lesser General Public License for more details.
95 You should have received a copy of the GNU Lesser General Public
96 License along with the GNU C Library; if not, write to the Free
97 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
100 /* The bison generated parser uses alloca. AIX 3 forces us to put this
101 declaration at the beginning of the file. The declaration in bison's
102 skeleton file comes too late. This must come before <config.h>
103 because <config.h> may include arbitrary system headers. */
104 #if defined _AIX && !defined __GNUC__
114 #include "plural-exp.h"
116 /* The main function generated by the parser is called __gettextparse,
117 but we want it to be called PLURAL_PARSE. */
119 # define __gettextparse PLURAL_PARSE
122 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
123 #define YYPARSE_PARAM arg
126 /* Line 189 of yacc.c */
129 /* Enabling traces. */
134 /* Enabling verbose error messages. */
135 #ifdef YYERROR_VERBOSE
136 # undef YYERROR_VERBOSE
137 # define YYERROR_VERBOSE 1
139 # define YYERROR_VERBOSE 0
142 /* Enabling the token table. */
143 #ifndef YYTOKEN_TABLE
144 # define YYTOKEN_TABLE 0
151 /* Put the tokens into the symbol table, so that GDB and other debuggers
164 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
165 typedef union YYSTYPE
168 /* Line 214 of yacc.c */
171 unsigned long int num;
173 struct expression *exp;
177 /* Line 214 of yacc.c */
180 # define YYSTYPE_IS_TRIVIAL 1
181 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
182 # define YYSTYPE_IS_DECLARED 1
186 /* Copy the second part of user declarations. */
188 /* Line 264 of yacc.c */
191 /* Prototypes for local functions. */
192 static struct expression *new_exp PARAMS ((int nargs, enum operator op,
193 struct expression * const *args));
194 static inline struct expression *new_exp_0 PARAMS ((enum operator op));
195 static inline struct expression *new_exp_1 PARAMS ((enum operator op,
196 struct expression *right));
197 static struct expression *new_exp_2 PARAMS ((enum operator op,
198 struct expression *left,
199 struct expression *right));
200 static inline struct expression *new_exp_3 PARAMS ((enum operator op,
201 struct expression *bexp,
202 struct expression *tbranch,
203 struct expression *fbranch));
204 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
205 static void yyerror PARAMS ((const char *str));
207 /* Allocation of expressions. */
209 static struct expression *
210 new_exp (nargs, op, args)
213 struct expression * const *args;
216 struct expression *newp;
218 /* If any of the argument could not be malloc'ed, just return NULL. */
219 for (i = nargs - 1; i >= 0; i--)
223 /* Allocate a new expression. */
224 newp = (struct expression *) malloc (sizeof (*newp));
228 newp->operation = op;
229 for (i = nargs - 1; i >= 0; i--)
230 newp->val.args[i] = args[i];
235 for (i = nargs - 1; i >= 0; i--)
236 FREE_EXPRESSION (args[i]);
241 static inline struct expression *
245 return new_exp (0, op, NULL);
248 static inline struct expression *
249 new_exp_1 (op, right)
251 struct expression *right;
253 struct expression *args[1];
256 return new_exp (1, op, args);
259 static struct expression *
260 new_exp_2 (op, left, right)
262 struct expression *left;
263 struct expression *right;
265 struct expression *args[2];
269 return new_exp (2, op, args);
272 static inline struct expression *
273 new_exp_3 (op, bexp, tbranch, fbranch)
275 struct expression *bexp;
276 struct expression *tbranch;
277 struct expression *fbranch;
279 struct expression *args[3];
284 return new_exp (3, op, args);
289 /* Line 264 of yacc.c */
297 typedef YYTYPE_UINT8 yytype_uint8;
299 typedef unsigned char yytype_uint8;
303 typedef YYTYPE_INT8 yytype_int8;
304 #elif (defined __STDC__ || defined __C99__FUNC__ \
305 || defined __cplusplus || defined _MSC_VER)
306 typedef signed char yytype_int8;
308 typedef short int yytype_int8;
312 typedef YYTYPE_UINT16 yytype_uint16;
314 typedef unsigned short int yytype_uint16;
318 typedef YYTYPE_INT16 yytype_int16;
320 typedef short int yytype_int16;
324 # ifdef __SIZE_TYPE__
325 # define YYSIZE_T __SIZE_TYPE__
326 # elif defined size_t
327 # define YYSIZE_T size_t
328 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
329 || defined __cplusplus || defined _MSC_VER)
330 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
331 # define YYSIZE_T size_t
333 # define YYSIZE_T unsigned int
337 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
340 # if defined YYENABLE_NLS && YYENABLE_NLS
342 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
343 # define YY_(msgid) dgettext ("bison-runtime", msgid)
347 # define YY_(msgid) msgid
351 /* Suppress unused-variable warnings by "using" E. */
352 #if ! defined lint || defined __GNUC__
353 # define YYUSE(e) ((void) (e))
355 # define YYUSE(e) /* empty */
358 /* Identity function, used to suppress warnings about constant conditions. */
362 #if (defined __STDC__ || defined __C99__FUNC__ \
363 || defined __cplusplus || defined _MSC_VER)
376 #if ! defined yyoverflow || YYERROR_VERBOSE
378 /* The parser invokes alloca or malloc; define the necessary symbols. */
380 # ifdef YYSTACK_USE_ALLOCA
381 # if YYSTACK_USE_ALLOCA
383 # define YYSTACK_ALLOC __builtin_alloca
384 # elif defined __BUILTIN_VA_ARG_INCR
385 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
387 # define YYSTACK_ALLOC __alloca
388 # elif defined _MSC_VER
389 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
390 # define alloca _alloca
392 # define YYSTACK_ALLOC alloca
393 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
394 || defined __cplusplus || defined _MSC_VER)
395 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
404 # ifdef YYSTACK_ALLOC
405 /* Pacify GCC's `empty if-body' warning. */
406 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
407 # ifndef YYSTACK_ALLOC_MAXIMUM
408 /* The OS might guarantee only one guard page at the bottom of the stack,
409 and a page size can be as small as 4096 bytes. So we cannot safely
410 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
411 to allow for a few compiler-allocated temporary stack slots. */
412 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
415 # define YYSTACK_ALLOC YYMALLOC
416 # define YYSTACK_FREE YYFREE
417 # ifndef YYSTACK_ALLOC_MAXIMUM
418 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
420 # if (defined __cplusplus && ! defined _STDLIB_H \
421 && ! ((defined YYMALLOC || defined malloc) \
422 && (defined YYFREE || defined free)))
423 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
429 # define YYMALLOC malloc
430 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
431 || defined __cplusplus || defined _MSC_VER)
432 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
437 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
438 || defined __cplusplus || defined _MSC_VER)
439 void free (void *); /* INFRINGES ON USER NAME SPACE */
443 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
446 #if (! defined yyoverflow \
447 && (! defined __cplusplus \
448 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
450 /* A type that is properly aligned for any stack member. */
453 yytype_int16 yyss_alloc;
457 /* The size of the maximum gap between one aligned stack and the next. */
458 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
460 /* The size of an array large to enough to hold all stacks, each with
462 # define YYSTACK_BYTES(N) \
463 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
464 + YYSTACK_GAP_MAXIMUM)
466 /* Copy COUNT objects from FROM to TO. The source and destination do
469 # if defined __GNUC__ && 1 < __GNUC__
470 # define YYCOPY(To, From, Count) \
471 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
473 # define YYCOPY(To, From, Count) \
477 for (yyi = 0; yyi < (Count); yyi++) \
478 (To)[yyi] = (From)[yyi]; \
484 /* Relocate STACK from its old location to the new one. The
485 local variables YYSIZE and YYSTACKSIZE give the old and new number of
486 elements in the stack, and YYPTR gives the new location of the
487 stack. Advance YYPTR to a properly aligned location for the next
489 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
492 YYSIZE_T yynewbytes; \
493 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
494 Stack = &yyptr->Stack_alloc; \
495 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
496 yyptr += yynewbytes / sizeof (*yyptr); \
502 /* YYFINAL -- State number of the termination state. */
504 /* YYLAST -- Last index in YYTABLE. */
507 /* YYNTOKENS -- Number of terminals. */
509 /* YYNNTS -- Number of nonterminals. */
511 /* YYNRULES -- Number of rules. */
513 /* YYNRULES -- Number of states. */
516 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
518 #define YYMAXUTOK 262
520 #define YYTRANSLATE(YYX) \
521 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
523 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
524 static const yytype_uint8 yytranslate[] =
526 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
530 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
532 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
533 2, 2, 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 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 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, 1, 2, 6, 7,
556 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
558 static const yytype_uint8 yyprhs[] =
560 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
564 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
565 static const yytype_int8 yyrhs[] =
567 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
568 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
569 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
570 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
571 11, -1, 14, 18, 15, -1
574 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
575 static const yytype_uint8 yyrline[] =
577 0, 175, 175, 183, 187, 191, 195, 199, 203, 207,
582 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
583 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
584 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
585 static const char *const yytname[] =
587 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
588 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
589 "$accept", "start", "exp", 0
594 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
596 static const yytype_uint16 yytoknum[] =
598 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
599 33, 262, 58, 110, 40, 41
603 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
604 static const yytype_uint8 yyr1[] =
606 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
610 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
611 static const yytype_uint8 yyr2[] =
613 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
617 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
618 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
619 means the default is an error. */
620 static const yytype_uint8 yydefact[] =
622 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
623 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
627 /* YYDEFGOTO[NTERM-NUM]. */
628 static const yytype_int8 yydefgoto[] =
633 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
635 #define YYPACT_NINF -10
636 static const yytype_int8 yypact[] =
638 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
639 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
640 45, 18, -2, 14, -10, -9, 36
643 /* YYPGOTO[NTERM-NUM]. */
644 static const yytype_int8 yypgoto[] =
649 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
650 positive, shift that token. If negative, reduce the rule which
651 number is the opposite. If zero, do what YYDEFACT says.
652 If YYTABLE_NINF, syntax error. */
653 #define YYTABLE_NINF -1
654 static const yytype_uint8 yytable[] =
656 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
657 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
658 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
659 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
660 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
664 static const yytype_int8 yycheck[] =
666 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
667 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
668 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
669 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
670 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
674 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
675 symbol of state STATE-NUM. */
676 static const yytype_uint8 yystos[] =
678 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
679 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
680 18, 18, 18, 18, 18, 12, 18
683 #define yyerrok (yyerrstatus = 0)
684 #define yyclearin (yychar = YYEMPTY)
688 #define YYACCEPT goto yyacceptlab
689 #define YYABORT goto yyabortlab
690 #define YYERROR goto yyerrorlab
693 /* Like YYERROR except do call yyerror. This remains here temporarily
694 to ease the transition to the new meaning of YYERROR, for GCC.
695 Once GCC version 2 has supplanted version 1, this can go. However,
696 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
697 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
700 #define YYFAIL goto yyerrlab
702 /* This is here to suppress warnings from the GCC cpp's
703 -Wunused-macros. Normally we don't worry about that warning, but
704 some users do, and we want to make it easy for users to remove
705 YYFAIL uses, which will produce warnings from Bison 2.5. */
708 #define YYRECOVERING() (!!yyerrstatus)
710 #define YYBACKUP(Token, Value) \
712 if (yychar == YYEMPTY && yylen == 1) \
716 yytoken = YYTRANSLATE (yychar); \
722 yyerror (YY_("syntax error: cannot back up")); \
729 #define YYERRCODE 256
732 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
733 If N is 0, then set CURRENT to the empty location which ends
734 the previous symbol: RHS[0] (always defined). */
736 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
737 #ifndef YYLLOC_DEFAULT
738 # define YYLLOC_DEFAULT(Current, Rhs, N) \
742 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
743 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
744 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
745 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
749 (Current).first_line = (Current).last_line = \
750 YYRHSLOC (Rhs, 0).last_line; \
751 (Current).first_column = (Current).last_column = \
752 YYRHSLOC (Rhs, 0).last_column; \
758 /* YY_LOCATION_PRINT -- Print the location on the stream.
759 This macro was not mandated originally: define only if we know
760 we won't break user code: when these are the locations we know. */
762 #ifndef YY_LOCATION_PRINT
763 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
764 # define YY_LOCATION_PRINT(File, Loc) \
765 fprintf (File, "%d.%d-%d.%d", \
766 (Loc).first_line, (Loc).first_column, \
767 (Loc).last_line, (Loc).last_column)
769 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
774 /* YYLEX -- calling `yylex' with the right arguments. */
777 # define YYLEX yylex (&yylval, YYLEX_PARAM)
779 # define YYLEX yylex (&yylval)
782 /* Enable debugging if requested. */
786 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
787 # define YYFPRINTF fprintf
790 # define YYDPRINTF(Args) \
796 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
800 YYFPRINTF (stderr, "%s ", Title); \
801 yy_symbol_print (stderr, \
803 YYFPRINTF (stderr, "\n"); \
808 /*--------------------------------.
809 | Print this symbol on YYOUTPUT. |
810 `--------------------------------*/
813 #if (defined __STDC__ || defined __C99__FUNC__ \
814 || defined __cplusplus || defined _MSC_VER)
816 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
819 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
822 YYSTYPE const * const yyvaluep;
828 if (yytype < YYNTOKENS)
829 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
841 /*--------------------------------.
842 | Print this symbol on YYOUTPUT. |
843 `--------------------------------*/
845 #if (defined __STDC__ || defined __C99__FUNC__ \
846 || defined __cplusplus || defined _MSC_VER)
848 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
851 yy_symbol_print (yyoutput, yytype, yyvaluep)
854 YYSTYPE const * const yyvaluep;
857 if (yytype < YYNTOKENS)
858 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
860 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
862 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
863 YYFPRINTF (yyoutput, ")");
866 /*------------------------------------------------------------------.
867 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
869 `------------------------------------------------------------------*/
871 #if (defined __STDC__ || defined __C99__FUNC__ \
872 || defined __cplusplus || defined _MSC_VER)
874 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
877 yy_stack_print (yybottom, yytop)
878 yytype_int16 *yybottom;
882 YYFPRINTF (stderr, "Stack now");
883 for (; yybottom <= yytop; yybottom++)
885 int yybot = *yybottom;
886 YYFPRINTF (stderr, " %d", yybot);
888 YYFPRINTF (stderr, "\n");
891 # define YY_STACK_PRINT(Bottom, Top) \
894 yy_stack_print ((Bottom), (Top)); \
898 /*------------------------------------------------.
899 | Report that the YYRULE is going to be reduced. |
900 `------------------------------------------------*/
902 #if (defined __STDC__ || defined __C99__FUNC__ \
903 || defined __cplusplus || defined _MSC_VER)
905 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
908 yy_reduce_print (yyvsp, yyrule)
913 int yynrhs = yyr2[yyrule];
915 unsigned long int yylno = yyrline[yyrule];
916 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
918 /* The symbols being reduced. */
919 for (yyi = 0; yyi < yynrhs; yyi++)
921 YYFPRINTF (stderr, " $%d = ", yyi + 1);
922 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
923 &(yyvsp[(yyi + 1) - (yynrhs)])
925 YYFPRINTF (stderr, "\n");
929 # define YY_REDUCE_PRINT(Rule) \
932 yy_reduce_print (yyvsp, Rule); \
935 /* Nonzero means print parse trace. It is left uninitialized so that
936 multiple parsers can coexist. */
939 # define YYDPRINTF(Args)
940 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
941 # define YY_STACK_PRINT(Bottom, Top)
942 # define YY_REDUCE_PRINT(Rule)
943 #endif /* !YYDEBUG */
946 /* YYINITDEPTH -- initial size of the parser's stacks. */
948 # define YYINITDEPTH 200
951 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
952 if the built-in stack extension method is used).
954 Do not make this value too large; the results are undefined if
955 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
956 evaluated with infinite-precision integer arithmetic. */
959 # define YYMAXDEPTH 10000
967 # if defined __GLIBC__ && defined _STRING_H
968 # define yystrlen strlen
970 /* Return the length of YYSTR. */
971 #if (defined __STDC__ || defined __C99__FUNC__ \
972 || defined __cplusplus || defined _MSC_VER)
974 yystrlen (const char *yystr)
982 for (yylen = 0; yystr[yylen]; yylen++)
990 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
991 # define yystpcpy stpcpy
993 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
995 #if (defined __STDC__ || defined __C99__FUNC__ \
996 || defined __cplusplus || defined _MSC_VER)
998 yystpcpy (char *yydest, const char *yysrc)
1001 yystpcpy (yydest, yysrc)
1007 const char *yys = yysrc;
1009 while ((*yyd++ = *yys++) != '\0')
1018 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1019 quotes and backslashes, so that it's suitable for yyerror. The
1020 heuristic is that double-quoting is unnecessary unless the string
1021 contains an apostrophe, a comma, or backslash (other than
1022 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1023 null, do not copy; instead, return the length of what the result
1026 yytnamerr (char *yyres, const char *yystr)
1031 char const *yyp = yystr;
1038 goto do_not_strip_quotes;
1042 goto do_not_strip_quotes;
1055 do_not_strip_quotes: ;
1059 return yystrlen (yystr);
1061 return yystpcpy (yyres, yystr) - yyres;
1065 /* Copy into YYRESULT an error message about the unexpected token
1066 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1067 including the terminating null byte. If YYRESULT is null, do not
1068 copy anything; just return the number of bytes that would be
1069 copied. As a special case, return 0 if an ordinary "syntax error"
1070 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1071 size calculation. */
1073 yysyntax_error (char *yyresult, int yystate, int yychar)
1075 int yyn = yypact[yystate];
1077 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1081 int yytype = YYTRANSLATE (yychar);
1082 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1083 YYSIZE_T yysize = yysize0;
1085 int yysize_overflow = 0;
1086 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1087 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1091 /* This is so xgettext sees the translatable formats that are
1092 constructed on the fly. */
1093 YY_("syntax error, unexpected %s");
1094 YY_("syntax error, unexpected %s, expecting %s");
1095 YY_("syntax error, unexpected %s, expecting %s or %s");
1096 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1097 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1101 static char const yyunexpected[] = "syntax error, unexpected %s";
1102 static char const yyexpecting[] = ", expecting %s";
1103 static char const yyor[] = " or %s";
1104 char yyformat[sizeof yyunexpected
1105 + sizeof yyexpecting - 1
1106 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1107 * (sizeof yyor - 1))];
1108 char const *yyprefix = yyexpecting;
1110 /* Start YYX at -YYN if negative to avoid negative indexes in
1112 int yyxbegin = yyn < 0 ? -yyn : 0;
1114 /* Stay within bounds of both yycheck and yytname. */
1115 int yychecklim = YYLAST - yyn + 1;
1116 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1119 yyarg[0] = yytname[yytype];
1120 yyfmt = yystpcpy (yyformat, yyunexpected);
1122 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1123 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1125 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1129 yyformat[sizeof yyunexpected - 1] = '\0';
1132 yyarg[yycount++] = yytname[yyx];
1133 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1134 yysize_overflow |= (yysize1 < yysize);
1136 yyfmt = yystpcpy (yyfmt, yyprefix);
1140 yyf = YY_(yyformat);
1141 yysize1 = yysize + yystrlen (yyf);
1142 yysize_overflow |= (yysize1 < yysize);
1145 if (yysize_overflow)
1146 return YYSIZE_MAXIMUM;
1150 /* Avoid sprintf, as that infringes on the user's name space.
1151 Don't have undefined behavior even if the translation
1152 produced a string with the wrong number of "%s"s. */
1153 char *yyp = yyresult;
1155 while ((*yyp = *yyf) != '\0')
1157 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1159 yyp += yytnamerr (yyp, yyarg[yyi++]);
1172 #endif /* YYERROR_VERBOSE */
1175 /*-----------------------------------------------.
1176 | Release the memory associated to this symbol. |
1177 `-----------------------------------------------*/
1180 #if (defined __STDC__ || defined __C99__FUNC__ \
1181 || defined __cplusplus || defined _MSC_VER)
1183 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1186 yydestruct (yymsg, yytype, yyvaluep)
1196 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1206 /* Prevent warnings from -Wmissing-prototypes. */
1207 #ifdef YYPARSE_PARAM
1208 #if defined __STDC__ || defined __cplusplus
1209 int yyparse (void *YYPARSE_PARAM);
1213 #else /* ! YYPARSE_PARAM */
1214 #if defined __STDC__ || defined __cplusplus
1219 #endif /* ! YYPARSE_PARAM */
1225 /*-------------------------.
1226 | yyparse or yypush_parse. |
1227 `-------------------------*/
1229 #ifdef YYPARSE_PARAM
1230 #if (defined __STDC__ || defined __C99__FUNC__ \
1231 || defined __cplusplus || defined _MSC_VER)
1233 yyparse (void *YYPARSE_PARAM)
1236 yyparse (YYPARSE_PARAM)
1237 void *YYPARSE_PARAM;
1239 #else /* ! YYPARSE_PARAM */
1240 #if (defined __STDC__ || defined __C99__FUNC__ \
1241 || defined __cplusplus || defined _MSC_VER)
1251 /* The lookahead symbol. */
1254 /* The semantic value of the lookahead symbol. */
1257 /* Number of syntax errors so far. */
1261 /* Number of tokens to shift before error messages enabled. */
1264 /* The stacks and their tools:
1265 `yyss': related to states.
1266 `yyvs': related to semantic values.
1268 Refer to the stacks thru separate pointers, to allow yyoverflow
1269 to reallocate them elsewhere. */
1271 /* The state stack. */
1272 yytype_int16 yyssa[YYINITDEPTH];
1274 yytype_int16 *yyssp;
1276 /* The semantic value stack. */
1277 YYSTYPE yyvsa[YYINITDEPTH];
1281 YYSIZE_T yystacksize;
1285 /* Lookahead token as an internal (translated) token number. */
1287 /* The variables used to return semantic value and location from the
1292 /* Buffer for error messages, and its allocated size. */
1294 char *yymsg = yymsgbuf;
1295 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1298 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1300 /* The number of symbols on the RHS of the reduced rule.
1301 Keep to zero when no symbol should be popped. */
1307 yystacksize = YYINITDEPTH;
1309 YYDPRINTF ((stderr, "Starting parse\n"));
1314 yychar = YYEMPTY; /* Cause a token to be read. */
1316 /* Initialize stack pointers.
1317 Waste one element of value and location stack
1318 so that they stay on the same level as the state stack.
1319 The wasted elements are never initialized. */
1325 /*------------------------------------------------------------.
1326 | yynewstate -- Push a new state, which is found in yystate. |
1327 `------------------------------------------------------------*/
1329 /* In all cases, when you get here, the value and location stacks
1330 have just been pushed. So pushing a state here evens the stacks. */
1336 if (yyss + yystacksize - 1 <= yyssp)
1338 /* Get the current used size of the three stacks, in elements. */
1339 YYSIZE_T yysize = yyssp - yyss + 1;
1343 /* Give user a chance to reallocate the stack. Use copies of
1344 these so that the &'s don't force the real ones into
1346 YYSTYPE *yyvs1 = yyvs;
1347 yytype_int16 *yyss1 = yyss;
1349 /* Each stack pointer address is followed by the size of the
1350 data in use in that stack, in bytes. This used to be a
1351 conditional around just the two extra args, but that might
1352 be undefined if yyoverflow is a macro. */
1353 yyoverflow (YY_("memory exhausted"),
1354 &yyss1, yysize * sizeof (*yyssp),
1355 &yyvs1, yysize * sizeof (*yyvsp),
1361 #else /* no yyoverflow */
1362 # ifndef YYSTACK_RELOCATE
1363 goto yyexhaustedlab;
1365 /* Extend the stack our own way. */
1366 if (YYMAXDEPTH <= yystacksize)
1367 goto yyexhaustedlab;
1369 if (YYMAXDEPTH < yystacksize)
1370 yystacksize = YYMAXDEPTH;
1373 yytype_int16 *yyss1 = yyss;
1374 union yyalloc *yyptr =
1375 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1377 goto yyexhaustedlab;
1378 YYSTACK_RELOCATE (yyss_alloc, yyss);
1379 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1380 # undef YYSTACK_RELOCATE
1382 YYSTACK_FREE (yyss1);
1385 #endif /* no yyoverflow */
1387 yyssp = yyss + yysize - 1;
1388 yyvsp = yyvs + yysize - 1;
1390 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1391 (unsigned long int) yystacksize));
1393 if (yyss + yystacksize - 1 <= yyssp)
1397 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1399 if (yystate == YYFINAL)
1409 /* Do appropriate processing given the current state. Read a
1410 lookahead token if we need one and don't already have one. */
1412 /* First try to decide what to do without reference to lookahead token. */
1413 yyn = yypact[yystate];
1414 if (yyn == YYPACT_NINF)
1417 /* Not known => get a lookahead token if don't already have one. */
1419 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1420 if (yychar == YYEMPTY)
1422 YYDPRINTF ((stderr, "Reading a token: "));
1426 if (yychar <= YYEOF)
1428 yychar = yytoken = YYEOF;
1429 YYDPRINTF ((stderr, "Now at end of input.\n"));
1433 yytoken = YYTRANSLATE (yychar);
1434 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1437 /* If the proper action on seeing token YYTOKEN is to reduce or to
1438 detect an error, take that action. */
1440 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1445 if (yyn == 0 || yyn == YYTABLE_NINF)
1451 /* Count tokens shifted since error; after three, turn off error
1456 /* Shift the lookahead token. */
1457 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1459 /* Discard the shifted token. */
1468 /*-----------------------------------------------------------.
1469 | yydefault -- do the default action for the current state. |
1470 `-----------------------------------------------------------*/
1472 yyn = yydefact[yystate];
1478 /*-----------------------------.
1479 | yyreduce -- Do a reduction. |
1480 `-----------------------------*/
1482 /* yyn is the number of a rule to reduce with. */
1485 /* If YYLEN is nonzero, implement the default value of the action:
1488 Otherwise, the following line sets YYVAL to garbage.
1489 This behavior is undocumented and Bison
1490 users should not rely upon it. Assigning to YYVAL
1491 unconditionally makes the parser a bit smaller, and it avoids a
1492 GCC warning that YYVAL may be used uninitialized. */
1493 yyval = yyvsp[1-yylen];
1496 YY_REDUCE_PRINT (yyn);
1501 /* Line 1464 of yacc.c */
1502 #line 176 "plural.y"
1504 if ((yyvsp[(1) - (1)].exp) == NULL)
1506 ((struct parse_args *) arg)->res = (yyvsp[(1) - (1)].exp);
1512 /* Line 1464 of yacc.c */
1513 #line 184 "plural.y"
1515 (yyval.exp) = new_exp_3 (qmop, (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp));
1521 /* Line 1464 of yacc.c */
1522 #line 188 "plural.y"
1524 (yyval.exp) = new_exp_2 (lor, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1530 /* Line 1464 of yacc.c */
1531 #line 192 "plural.y"
1533 (yyval.exp) = new_exp_2 (land, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1539 /* Line 1464 of yacc.c */
1540 #line 196 "plural.y"
1542 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1548 /* Line 1464 of yacc.c */
1549 #line 200 "plural.y"
1551 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1557 /* Line 1464 of yacc.c */
1558 #line 204 "plural.y"
1560 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1566 /* Line 1464 of yacc.c */
1567 #line 208 "plural.y"
1569 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1575 /* Line 1464 of yacc.c */
1576 #line 212 "plural.y"
1578 (yyval.exp) = new_exp_1 (lnot, (yyvsp[(2) - (2)].exp));
1584 /* Line 1464 of yacc.c */
1585 #line 216 "plural.y"
1587 (yyval.exp) = new_exp_0 (var);
1593 /* Line 1464 of yacc.c */
1594 #line 220 "plural.y"
1596 if (((yyval.exp) = new_exp_0 (num)) != NULL)
1597 (yyval.exp)->val.num = (yyvsp[(1) - (1)].num);
1603 /* Line 1464 of yacc.c */
1604 #line 225 "plural.y"
1606 (yyval.exp) = (yyvsp[(2) - (3)].exp);
1612 /* Line 1464 of yacc.c */
1613 #line 1614 "plural.c"
1616 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1620 YY_STACK_PRINT (yyss, yyssp);
1624 /* Now `shift' the result of the reduction. Determine what state
1625 that goes to, based on the state we popped back to and the rule
1626 number reduced by. */
1630 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1631 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1632 yystate = yytable[yystate];
1634 yystate = yydefgoto[yyn - YYNTOKENS];
1639 /*------------------------------------.
1640 | yyerrlab -- here on detecting error |
1641 `------------------------------------*/
1643 /* If not already recovering from an error, report this error. */
1647 #if ! YYERROR_VERBOSE
1648 yyerror (YY_("syntax error"));
1651 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1652 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1654 YYSIZE_T yyalloc = 2 * yysize;
1655 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1656 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1657 if (yymsg != yymsgbuf)
1658 YYSTACK_FREE (yymsg);
1659 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1661 yymsg_alloc = yyalloc;
1665 yymsg_alloc = sizeof yymsgbuf;
1669 if (0 < yysize && yysize <= yymsg_alloc)
1671 (void) yysyntax_error (yymsg, yystate, yychar);
1676 yyerror (YY_("syntax error"));
1678 goto yyexhaustedlab;
1686 if (yyerrstatus == 3)
1688 /* If just tried and failed to reuse lookahead token after an
1689 error, discard it. */
1691 if (yychar <= YYEOF)
1693 /* Return failure if at end of input. */
1694 if (yychar == YYEOF)
1699 yydestruct ("Error: discarding",
1705 /* Else will try to reuse lookahead token after shifting the error
1710 /*---------------------------------------------------.
1711 | yyerrorlab -- error raised explicitly by YYERROR. |
1712 `---------------------------------------------------*/
1715 /* Pacify compilers like GCC when the user code never invokes
1716 YYERROR and the label yyerrorlab therefore never appears in user
1718 if (/*CONSTCOND*/ 0)
1721 /* Do not reclaim the symbols of the rule which action triggered
1725 YY_STACK_PRINT (yyss, yyssp);
1730 /*-------------------------------------------------------------.
1731 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1732 `-------------------------------------------------------------*/
1734 yyerrstatus = 3; /* Each real token shifted decrements this. */
1738 yyn = yypact[yystate];
1739 if (yyn != YYPACT_NINF)
1742 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1750 /* Pop the current state because it cannot handle the error token. */
1755 yydestruct ("Error: popping",
1756 yystos[yystate], yyvsp);
1759 YY_STACK_PRINT (yyss, yyssp);
1765 /* Shift the error token. */
1766 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1772 /*-------------------------------------.
1773 | yyacceptlab -- YYACCEPT comes here. |
1774 `-------------------------------------*/
1779 /*-----------------------------------.
1780 | yyabortlab -- YYABORT comes here. |
1781 `-----------------------------------*/
1786 #if !defined(yyoverflow) || YYERROR_VERBOSE
1787 /*-------------------------------------------------.
1788 | yyexhaustedlab -- memory exhaustion comes here. |
1789 `-------------------------------------------------*/
1791 yyerror (YY_("memory exhausted"));
1797 if (yychar != YYEMPTY)
1798 yydestruct ("Cleanup: discarding lookahead",
1800 /* Do not reclaim the symbols of the rule which action triggered
1801 this YYABORT or YYACCEPT. */
1803 YY_STACK_PRINT (yyss, yyssp);
1804 while (yyssp != yyss)
1806 yydestruct ("Cleanup: popping",
1807 yystos[*yyssp], yyvsp);
1812 YYSTACK_FREE (yyss);
1815 if (yymsg != yymsgbuf)
1816 YYSTACK_FREE (yymsg);
1818 /* Make sure YYID is used. */
1819 return YYID (yyresult);
1824 /* Line 1684 of yacc.c */
1825 #line 230 "plural.y"
1830 FREE_EXPRESSION (exp)
1831 struct expression *exp;
1836 /* Handle the recursive case. */
1840 FREE_EXPRESSION (exp->val.args[2]);
1843 FREE_EXPRESSION (exp->val.args[1]);
1846 FREE_EXPRESSION (exp->val.args[0]);
1861 const char *exp = *pexp;
1872 if (exp[0] != ' ' && exp[0] != '\t')
1881 case '0': case '1': case '2': case '3': case '4':
1882 case '5': case '6': case '7': case '8': case '9':
1884 unsigned long int n = result - '0';
1885 while (exp[0] >= '0' && exp[0] <= '9')
1911 lval->op = not_equal;
1918 if (exp[0] == result)
1928 lval->op = less_or_equal;
1931 lval->op = less_than;
1939 lval->op = greater_or_equal;
1942 lval->op = greater_than;
1976 /* Nothing, just return the character. */
1982 /* Be safe and let the user call this function again. */
2005 /* Do nothing. We don't print error messages here. */