1 /* A Bison parser, made by GNU Bison 1.875. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* If NAME_PREFIX is specified substitute the variables and functions
50 #define yyparse __gettextparse
51 #define yylex __gettextlex
52 #define yyerror __gettexterror
53 #define yylval __gettextlval
54 #define yychar __gettextchar
55 #define yydebug __gettextdebug
56 #define yynerrs __gettextnerrs
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
81 /* Copy the first part of user declarations. */
82 #line 1 "../../intl/plural.y"
84 /* Expression parsing for plural form selection.
85 Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
86 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
88 This program is free software; you can redistribute it and/or modify it
89 under the terms of the GNU Library General Public License as published
90 by the Free Software Foundation; either version 2, or (at your option)
93 This program is distributed in the hope that it will be useful,
94 but WITHOUT ANY WARRANTY; without even the implied warranty of
95 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
96 Library General Public License for more details.
98 You should have received a copy of the GNU Library General Public
99 License along with this program; if not, write to the Free Software
100 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
103 /* The bison generated parser uses alloca. AIX 3 forces us to put this
104 declaration at the beginning of the file. The declaration in bison's
105 skeleton file comes too late. This must come before <config.h>
106 because <config.h> may include arbitrary system headers. */
107 #if defined _AIX && !defined __GNUC__
117 #include "plural-exp.h"
119 /* The main function generated by the parser is called __gettextparse,
120 but we want it to be called PLURAL_PARSE. */
122 # define __gettextparse PLURAL_PARSE
125 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
126 #define YYPARSE_PARAM arg
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 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
143 #line 49 "../../intl/plural.y"
144 typedef union YYSTYPE {
145 unsigned long int num;
147 struct expression *exp;
149 /* Line 191 of yacc.c. */
150 #line 150 "../../intl/plural.c"
151 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
152 # define YYSTYPE_IS_DECLARED 1
153 # define YYSTYPE_IS_TRIVIAL 1
158 /* Copy the second part of user declarations. */
159 #line 55 "../../intl/plural.y"
161 /* Prototypes for local functions. */
162 static int yylex (YYSTYPE *lval, const char **pexp);
163 static void yyerror (const char *str);
165 /* Allocation of expressions. */
167 static struct expression *
168 new_exp (int nargs, enum operator op, struct expression * const *args)
171 struct expression *newp;
173 /* If any of the argument could not be malloc'ed, just return NULL. */
174 for (i = nargs - 1; i >= 0; i--)
178 /* Allocate a new expression. */
179 newp = (struct expression *) malloc (sizeof (*newp));
183 newp->operation = op;
184 for (i = nargs - 1; i >= 0; i--)
185 newp->val.args[i] = args[i];
190 for (i = nargs - 1; i >= 0; i--)
191 FREE_EXPRESSION (args[i]);
196 static inline struct expression *
197 new_exp_0 (enum operator op)
199 return new_exp (0, op, NULL);
202 static inline struct expression *
203 new_exp_1 (enum operator op, struct expression *right)
205 struct expression *args[1];
208 return new_exp (1, op, args);
211 static struct expression *
212 new_exp_2 (enum operator op, struct expression *left, struct expression *right)
214 struct expression *args[2];
218 return new_exp (2, op, args);
221 static inline struct expression *
222 new_exp_3 (enum operator op, struct expression *bexp,
223 struct expression *tbranch, struct expression *fbranch)
225 struct expression *args[3];
230 return new_exp (3, op, args);
235 /* Line 214 of yacc.c. */
236 #line 236 "../../intl/plural.c"
238 #if ! defined (yyoverflow) || YYERROR_VERBOSE
240 /* The parser invokes alloca or malloc; define the necessary symbols. */
242 # if YYSTACK_USE_ALLOCA
243 # define YYSTACK_ALLOC alloca
245 # ifndef YYSTACK_USE_ALLOCA
246 # if defined (alloca) || defined (_ALLOCA_H)
247 # define YYSTACK_ALLOC alloca
250 # define YYSTACK_ALLOC __builtin_alloca
256 # ifdef YYSTACK_ALLOC
257 /* Pacify GCC's `empty if-body' warning. */
258 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
260 # if defined (__STDC__) || defined (__cplusplus)
261 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
262 # define YYSIZE_T size_t
264 # define YYSTACK_ALLOC malloc
265 # define YYSTACK_FREE free
267 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
270 #if (! defined (yyoverflow) \
271 && (! defined (__cplusplus) \
272 || (YYSTYPE_IS_TRIVIAL)))
274 /* A type that is properly aligned for any stack member. */
281 /* The size of the maximum gap between one aligned stack and the next. */
282 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
284 /* The size of an array large to enough to hold all stacks, each with
286 # define YYSTACK_BYTES(N) \
287 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
288 + YYSTACK_GAP_MAXIMUM)
290 /* Copy COUNT objects from FROM to TO. The source and destination do
294 # define YYCOPY(To, From, Count) \
295 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
297 # define YYCOPY(To, From, Count) \
300 register YYSIZE_T yyi; \
301 for (yyi = 0; yyi < (Count); yyi++) \
302 (To)[yyi] = (From)[yyi]; \
308 /* Relocate STACK from its old location to the new one. The
309 local variables YYSIZE and YYSTACKSIZE give the old and new number of
310 elements in the stack, and YYPTR gives the new location of the
311 stack. Advance YYPTR to a properly aligned location for the next
313 # define YYSTACK_RELOCATE(Stack) \
316 YYSIZE_T yynewbytes; \
317 YYCOPY (&yyptr->Stack, Stack, yysize); \
318 Stack = &yyptr->Stack; \
319 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
320 yyptr += yynewbytes / sizeof (*yyptr); \
326 #if defined (__STDC__) || defined (__cplusplus)
327 typedef signed char yysigned_char;
329 typedef short yysigned_char;
332 /* YYFINAL -- State number of the termination state. */
334 /* YYLAST -- Last index in YYTABLE. */
337 /* YYNTOKENS -- Number of terminals. */
339 /* YYNNTS -- Number of nonterminals. */
341 /* YYNRULES -- Number of rules. */
343 /* YYNRULES -- Number of states. */
346 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
348 #define YYMAXUTOK 262
350 #define YYTRANSLATE(YYX) \
351 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
353 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
354 static const unsigned char yytranslate[] =
356 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
357 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
359 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
360 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
361 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
362 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
364 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
365 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
366 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
367 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
368 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
369 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
370 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
371 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
372 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
373 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
375 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
376 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
377 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
386 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
388 static const unsigned char yyprhs[] =
390 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
394 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
395 static const yysigned_char yyrhs[] =
397 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
398 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
399 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
400 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
401 11, -1, 14, 18, 15, -1
404 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
405 static const unsigned char yyrline[] =
407 0, 150, 150, 158, 162, 166, 170, 174, 178, 182,
412 #if YYDEBUG || YYERROR_VERBOSE
413 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
414 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
415 static const char *const yytname[] =
417 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
418 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
419 "$accept", "start", "exp", 0
424 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
426 static const unsigned short yytoknum[] =
428 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
429 33, 262, 58, 110, 40, 41
433 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
434 static const unsigned char yyr1[] =
436 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
440 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
441 static const unsigned char yyr2[] =
443 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
447 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
448 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
449 means the default is an error. */
450 static const unsigned char yydefact[] =
452 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
453 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
457 /* YYDEFGOTO[NTERM-NUM]. */
458 static const yysigned_char yydefgoto[] =
463 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
465 #define YYPACT_NINF -10
466 static const yysigned_char yypact[] =
468 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
469 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
470 45, 18, -2, 14, -10, -9, 36
473 /* YYPGOTO[NTERM-NUM]. */
474 static const yysigned_char yypgoto[] =
479 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
480 positive, shift that token. If negative, reduce the rule which
481 number is the opposite. If zero, do what YYDEFACT says.
482 If YYTABLE_NINF, syntax error. */
483 #define YYTABLE_NINF -1
484 static const unsigned char yytable[] =
486 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
487 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
488 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
489 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
490 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
494 static const yysigned_char yycheck[] =
496 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
497 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
498 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
499 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
500 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
504 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
505 symbol of state STATE-NUM. */
506 static const unsigned char yystos[] =
508 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
509 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
510 18, 18, 18, 18, 18, 12, 18
513 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
514 # define YYSIZE_T __SIZE_TYPE__
516 #if ! defined (YYSIZE_T) && defined (size_t)
517 # define YYSIZE_T size_t
519 #if ! defined (YYSIZE_T)
520 # if defined (__STDC__) || defined (__cplusplus)
521 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
522 # define YYSIZE_T size_t
525 #if ! defined (YYSIZE_T)
526 # define YYSIZE_T unsigned int
529 #define yyerrok (yyerrstatus = 0)
530 #define yyclearin (yychar = YYEMPTY)
534 #define YYACCEPT goto yyacceptlab
535 #define YYABORT goto yyabortlab
536 #define YYERROR goto yyerrlab1
539 /* Like YYERROR except do call yyerror. This remains here temporarily
540 to ease the transition to the new meaning of YYERROR, for GCC.
541 Once GCC version 2 has supplanted version 1, this can go. */
543 #define YYFAIL goto yyerrlab
545 #define YYRECOVERING() (!!yyerrstatus)
547 #define YYBACKUP(Token, Value) \
549 if (yychar == YYEMPTY && yylen == 1) \
553 yytoken = YYTRANSLATE (yychar); \
559 yyerror ("syntax error: cannot back up");\
565 #define YYERRCODE 256
567 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
570 #ifndef YYLLOC_DEFAULT
571 # define YYLLOC_DEFAULT(Current, Rhs, N) \
572 Current.first_line = Rhs[1].first_line; \
573 Current.first_column = Rhs[1].first_column; \
574 Current.last_line = Rhs[N].last_line; \
575 Current.last_column = Rhs[N].last_column;
578 /* YYLEX -- calling `yylex' with the right arguments. */
581 # define YYLEX yylex (&yylval, YYLEX_PARAM)
583 # define YYLEX yylex (&yylval)
586 /* Enable debugging if requested. */
590 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
591 # define YYFPRINTF fprintf
594 # define YYDPRINTF(Args) \
600 # define YYDSYMPRINT(Args) \
606 # define YYDSYMPRINTF(Title, Token, Value, Location) \
610 YYFPRINTF (stderr, "%s ", Title); \
611 yysymprint (stderr, \
613 YYFPRINTF (stderr, "\n"); \
617 /*------------------------------------------------------------------.
618 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
620 `------------------------------------------------------------------*/
622 #if defined (__STDC__) || defined (__cplusplus)
624 yy_stack_print (short *bottom, short *top)
627 yy_stack_print (bottom, top)
632 YYFPRINTF (stderr, "Stack now");
633 for (/* Nothing. */; bottom <= top; ++bottom)
634 YYFPRINTF (stderr, " %d", *bottom);
635 YYFPRINTF (stderr, "\n");
638 # define YY_STACK_PRINT(Bottom, Top) \
641 yy_stack_print ((Bottom), (Top)); \
645 /*------------------------------------------------.
646 | Report that the YYRULE is going to be reduced. |
647 `------------------------------------------------*/
649 #if defined (__STDC__) || defined (__cplusplus)
651 yy_reduce_print (int yyrule)
654 yy_reduce_print (yyrule)
659 unsigned int yylineno = yyrline[yyrule];
660 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
661 yyrule - 1, yylineno);
662 /* Print the symbols being reduced, and their result. */
663 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
664 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
665 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
668 # define YY_REDUCE_PRINT(Rule) \
671 yy_reduce_print (Rule); \
674 /* Nonzero means print parse trace. It is left uninitialized so that
675 multiple parsers can coexist. */
678 # define YYDPRINTF(Args)
679 # define YYDSYMPRINT(Args)
680 # define YYDSYMPRINTF(Title, Token, Value, Location)
681 # define YY_STACK_PRINT(Bottom, Top)
682 # define YY_REDUCE_PRINT(Rule)
683 #endif /* !YYDEBUG */
686 /* YYINITDEPTH -- initial size of the parser's stacks. */
688 # define YYINITDEPTH 200
691 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
692 if the built-in stack extension method is used).
694 Do not make this value too large; the results are undefined if
695 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
696 evaluated with infinite-precision integer arithmetic. */
703 # define YYMAXDEPTH 10000
711 # if defined (__GLIBC__) && defined (_STRING_H)
712 # define yystrlen strlen
714 /* Return the length of YYSTR. */
716 # if defined (__STDC__) || defined (__cplusplus)
717 yystrlen (const char *yystr)
723 register const char *yys = yystr;
725 while (*yys++ != '\0')
728 return yys - yystr - 1;
734 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
735 # define yystpcpy stpcpy
737 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
740 # if defined (__STDC__) || defined (__cplusplus)
741 yystpcpy (char *yydest, const char *yysrc)
743 yystpcpy (yydest, yysrc)
748 register char *yyd = yydest;
749 register const char *yys = yysrc;
751 while ((*yyd++ = *yys++) != '\0')
759 #endif /* !YYERROR_VERBOSE */
764 /*--------------------------------.
765 | Print this symbol on YYOUTPUT. |
766 `--------------------------------*/
768 #if defined (__STDC__) || defined (__cplusplus)
770 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
773 yysymprint (yyoutput, yytype, yyvaluep)
779 /* Pacify ``unused variable'' warnings. */
782 if (yytype < YYNTOKENS)
784 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
786 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
790 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
797 YYFPRINTF (yyoutput, ")");
800 #endif /* ! YYDEBUG */
801 /*-----------------------------------------------.
802 | Release the memory associated to this symbol. |
803 `-----------------------------------------------*/
805 #if defined (__STDC__) || defined (__cplusplus)
807 yydestruct (int yytype, YYSTYPE *yyvaluep)
810 yydestruct (yytype, yyvaluep)
815 /* Pacify ``unused variable'' warnings. */
827 /* Prevent warnings from -Wmissing-prototypes. */
830 # if defined (__STDC__) || defined (__cplusplus)
831 int yyparse (void *YYPARSE_PARAM);
835 #else /* ! YYPARSE_PARAM */
836 #if defined (__STDC__) || defined (__cplusplus)
841 #endif /* ! YYPARSE_PARAM */
853 # if defined (__STDC__) || defined (__cplusplus)
854 int yyparse (void *YYPARSE_PARAM)
856 int yyparse (YYPARSE_PARAM)
859 #else /* ! YYPARSE_PARAM */
860 #if defined (__STDC__) || defined (__cplusplus)
870 /* The lookahead symbol. */
873 /* The semantic value of the lookahead symbol. */
876 /* Number of syntax errors so far. */
879 register int yystate;
882 /* Number of tokens to shift before error messages enabled. */
884 /* Lookahead token as an internal (translated) token number. */
887 /* Three stacks and their tools:
888 `yyss': related to states,
889 `yyvs': related to semantic values,
890 `yyls': related to locations.
892 Refer to the stacks thru separate pointers, to allow yyoverflow
893 to reallocate them elsewhere. */
895 /* The state stack. */
896 short yyssa[YYINITDEPTH];
898 register short *yyssp;
900 /* The semantic value stack. */
901 YYSTYPE yyvsa[YYINITDEPTH];
902 YYSTYPE *yyvs = yyvsa;
903 register YYSTYPE *yyvsp;
907 #define YYPOPSTACK (yyvsp--, yyssp--)
909 YYSIZE_T yystacksize = YYINITDEPTH;
911 /* The variables used to return semantic value and location from the
916 /* When reducing, the number of symbols on the RHS of the reduced
920 YYDPRINTF ((stderr, "Starting parse\n"));
925 yychar = YYEMPTY; /* Cause a token to be read. */
927 /* Initialize stack pointers.
928 Waste one element of value and location stack
929 so that they stay on the same level as the state stack.
930 The wasted elements are never initialized. */
937 /*------------------------------------------------------------.
938 | yynewstate -- Push a new state, which is found in yystate. |
939 `------------------------------------------------------------*/
941 /* In all cases, when you get here, the value and location stacks
942 have just been pushed. so pushing a state here evens the stacks.
949 if (yyss + yystacksize - 1 <= yyssp)
951 /* Get the current used size of the three stacks, in elements. */
952 YYSIZE_T yysize = yyssp - yyss + 1;
956 /* Give user a chance to reallocate the stack. Use copies of
957 these so that the &'s don't force the real ones into
959 YYSTYPE *yyvs1 = yyvs;
963 /* Each stack pointer address is followed by the size of the
964 data in use in that stack, in bytes. This used to be a
965 conditional around just the two extra args, but that might
966 be undefined if yyoverflow is a macro. */
967 yyoverflow ("parser stack overflow",
968 &yyss1, yysize * sizeof (*yyssp),
969 &yyvs1, yysize * sizeof (*yyvsp),
976 #else /* no yyoverflow */
977 # ifndef YYSTACK_RELOCATE
980 /* Extend the stack our own way. */
981 if (YYMAXDEPTH <= yystacksize)
984 if (YYMAXDEPTH < yystacksize)
985 yystacksize = YYMAXDEPTH;
989 union yyalloc *yyptr =
990 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
993 YYSTACK_RELOCATE (yyss);
994 YYSTACK_RELOCATE (yyvs);
996 # undef YYSTACK_RELOCATE
998 YYSTACK_FREE (yyss1);
1001 #endif /* no yyoverflow */
1003 yyssp = yyss + yysize - 1;
1004 yyvsp = yyvs + yysize - 1;
1007 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1008 (unsigned long int) yystacksize));
1010 if (yyss + yystacksize - 1 <= yyssp)
1014 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1023 /* Do appropriate processing given the current state. */
1024 /* Read a lookahead token if we need one and don't already have one. */
1027 /* First try to decide what to do without reference to lookahead token. */
1029 yyn = yypact[yystate];
1030 if (yyn == YYPACT_NINF)
1033 /* Not known => get a lookahead token if don't already have one. */
1035 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1036 if (yychar == YYEMPTY)
1038 YYDPRINTF ((stderr, "Reading a token: "));
1042 if (yychar <= YYEOF)
1044 yychar = yytoken = YYEOF;
1045 YYDPRINTF ((stderr, "Now at end of input.\n"));
1049 yytoken = YYTRANSLATE (yychar);
1050 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1053 /* If the proper action on seeing token YYTOKEN is to reduce or to
1054 detect an error, take that action. */
1056 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1061 if (yyn == 0 || yyn == YYTABLE_NINF)
1070 /* Shift the lookahead token. */
1071 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1073 /* Discard the token being shifted unless it is eof. */
1074 if (yychar != YYEOF)
1080 /* Count tokens shifted since error; after three, turn off error
1089 /*-----------------------------------------------------------.
1090 | yydefault -- do the default action for the current state. |
1091 `-----------------------------------------------------------*/
1093 yyn = yydefact[yystate];
1099 /*-----------------------------.
1100 | yyreduce -- Do a reduction. |
1101 `-----------------------------*/
1103 /* yyn is the number of a rule to reduce with. */
1106 /* If YYLEN is nonzero, implement the default value of the action:
1109 Otherwise, the following line sets YYVAL to garbage.
1110 This behavior is undocumented and Bison
1111 users should not rely upon it. Assigning to YYVAL
1112 unconditionally makes the parser a bit smaller, and it avoids a
1113 GCC warning that YYVAL may be used uninitialized. */
1114 yyval = yyvsp[1-yylen];
1117 YY_REDUCE_PRINT (yyn);
1121 #line 151 "../../intl/plural.y"
1123 if (yyvsp[0].exp == NULL)
1125 ((struct parse_args *) arg)->res = yyvsp[0].exp;
1130 #line 159 "../../intl/plural.y"
1132 yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
1137 #line 163 "../../intl/plural.y"
1139 yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
1144 #line 167 "../../intl/plural.y"
1146 yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
1151 #line 171 "../../intl/plural.y"
1153 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1158 #line 175 "../../intl/plural.y"
1160 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1165 #line 179 "../../intl/plural.y"
1167 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1172 #line 183 "../../intl/plural.y"
1174 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1179 #line 187 "../../intl/plural.y"
1181 yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
1186 #line 191 "../../intl/plural.y"
1188 yyval.exp = new_exp_0 (var);
1193 #line 195 "../../intl/plural.y"
1195 if ((yyval.exp = new_exp_0 (num)) != NULL)
1196 yyval.exp->val.num = yyvsp[0].num;
1201 #line 200 "../../intl/plural.y"
1203 yyval.exp = yyvsp[-1].exp;
1210 /* Line 999 of yacc.c. */
1211 #line 1211 "../../intl/plural.c"
1217 YY_STACK_PRINT (yyss, yyssp);
1222 /* Now `shift' the result of the reduction. Determine what state
1223 that goes to, based on the state we popped back to and the rule
1224 number reduced by. */
1228 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1229 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1230 yystate = yytable[yystate];
1232 yystate = yydefgoto[yyn - YYNTOKENS];
1237 /*------------------------------------.
1238 | yyerrlab -- here on detecting error |
1239 `------------------------------------*/
1241 /* If not already recovering from an error, report this error. */
1246 yyn = yypact[yystate];
1248 if (YYPACT_NINF < yyn && yyn < YYLAST)
1250 YYSIZE_T yysize = 0;
1251 int yytype = YYTRANSLATE (yychar);
1256 /* Start YYX at -YYN if negative to avoid negative indexes in
1258 for (yyx = yyn < 0 ? -yyn : 0;
1259 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1260 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1261 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1262 yysize += yystrlen ("syntax error, unexpected ") + 1;
1263 yysize += yystrlen (yytname[yytype]);
1264 yymsg = (char *) YYSTACK_ALLOC (yysize);
1267 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1268 yyp = yystpcpy (yyp, yytname[yytype]);
1273 for (yyx = yyn < 0 ? -yyn : 0;
1274 yyx < (int) (sizeof (yytname) / sizeof (char *));
1276 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1278 const char *yyq = ! yycount ? ", expecting " : " or ";
1279 yyp = yystpcpy (yyp, yyq);
1280 yyp = yystpcpy (yyp, yytname[yyx]);
1285 YYSTACK_FREE (yymsg);
1288 yyerror ("syntax error; also virtual memory exhausted");
1291 #endif /* YYERROR_VERBOSE */
1292 yyerror ("syntax error");
1297 if (yyerrstatus == 3)
1299 /* If just tried and failed to reuse lookahead token after an
1300 error, discard it. */
1302 /* Return failure if at end of input. */
1303 if (yychar == YYEOF)
1305 /* Pop the error token. */
1307 /* Pop the rest of the stack. */
1308 while (yyss < yyssp)
1310 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1311 yydestruct (yystos[*yyssp], yyvsp);
1317 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1318 yydestruct (yytoken, &yylval);
1323 /* Else will try to reuse lookahead token after shifting the error
1328 /*----------------------------------------------------.
1329 | yyerrlab1 -- error raised explicitly by an action. |
1330 `----------------------------------------------------*/
1332 yyerrstatus = 3; /* Each real token shifted decrements this. */
1336 yyn = yypact[yystate];
1337 if (yyn != YYPACT_NINF)
1340 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1348 /* Pop the current state because it cannot handle the error token. */
1352 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1353 yydestruct (yystos[yystate], yyvsp);
1357 YY_STACK_PRINT (yyss, yyssp);
1363 YYDPRINTF ((stderr, "Shifting error token, "));
1372 /*-------------------------------------.
1373 | yyacceptlab -- YYACCEPT comes here. |
1374 `-------------------------------------*/
1379 /*-----------------------------------.
1380 | yyabortlab -- YYABORT comes here. |
1381 `-----------------------------------*/
1387 /*----------------------------------------------.
1388 | yyoverflowlab -- parser overflow comes here. |
1389 `----------------------------------------------*/
1391 yyerror ("parser stack overflow");
1399 YYSTACK_FREE (yyss);
1405 #line 205 "../../intl/plural.y"
1410 FREE_EXPRESSION (struct expression *exp)
1415 /* Handle the recursive case. */
1419 FREE_EXPRESSION (exp->val.args[2]);
1422 FREE_EXPRESSION (exp->val.args[1]);
1425 FREE_EXPRESSION (exp->val.args[0]);
1436 yylex (YYSTYPE *lval, const char **pexp)
1438 const char *exp = *pexp;
1449 if (exp[0] != ' ' && exp[0] != '\t')
1458 case '0': case '1': case '2': case '3': case '4':
1459 case '5': case '6': case '7': case '8': case '9':
1461 unsigned long int n = result - '0';
1462 while (exp[0] >= '0' && exp[0] <= '9')
1488 lval->op = not_equal;
1495 if (exp[0] == result)
1505 lval->op = less_or_equal;
1508 lval->op = less_than;
1516 lval->op = greater_or_equal;
1519 lval->op = greater_than;
1553 /* Nothing, just return the character. */
1559 /* Be safe and let the user call this function again. */
1579 yyerror (const char *str)
1581 /* Do nothing. We don't print error messages here. */