1 /* A Bison parser, made from plural.y
4 #define YYBISON 1 /* Identify Bison output. */
6 #define yyparse __gettextparse
7 #define yylex __gettextlex
8 #define yyerror __gettexterror
9 #define yylval __gettextlval
10 #define yychar __gettextchar
11 #define yydebug __gettextdebug
12 #define yynerrs __gettextnerrs
21 /* Expression parsing for plural form selection.
22 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
23 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
25 This program is free software; you can redistribute it and/or modify it
26 under the terms of the GNU Library General Public License as published
27 by the Free Software Foundation; either version 2, or (at your option)
30 This program is distributed in the hope that it will be useful,
31 but WITHOUT ANY WARRANTY; without even the implied warranty of
32 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 Library General Public License for more details.
35 You should have received a copy of the GNU Library General Public
36 License along with this program; if not, write to the Free Software
37 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
40 /* The bison generated parser uses alloca. AIX 3 forces us to put this
41 declaration at the beginning of the file. The declaration in bison's
42 skeleton file comes too late. This must come before <config.h>
43 because <config.h> may include arbitrary system headers. */
44 #if defined _AIX && !defined __GNUC__
54 #include "plural-exp.h"
56 /* The main function generated by the parser is called __gettextparse,
57 but we want it to be called PLURAL_PARSE. */
59 # define __gettextparse PLURAL_PARSE
62 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
63 #define YYPARSE_PARAM arg
68 unsigned long int num;
70 struct expression *exp;
72 # define YYSTYPE yystype
73 # define YYSTYPE_IS_TRIVIAL 1
77 /* Prototypes for local functions. */
78 static struct expression *new_exp PARAMS ((int nargs, enum operator op,
79 struct expression * const *args));
80 static inline struct expression *new_exp_0 PARAMS ((enum operator op));
81 static inline struct expression *new_exp_1 PARAMS ((enum operator op,
82 struct expression *right));
83 static struct expression *new_exp_2 PARAMS ((enum operator op,
84 struct expression *left,
85 struct expression *right));
86 static inline struct expression *new_exp_3 PARAMS ((enum operator op,
87 struct expression *bexp,
88 struct expression *tbranch,
89 struct expression *fbranch));
90 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
91 static void yyerror PARAMS ((const char *str));
93 /* Allocation of expressions. */
95 static struct expression *
96 new_exp (nargs, op, args)
99 struct expression * const *args;
102 struct expression *newp;
104 /* If any of the argument could not be malloc'ed, just return NULL. */
105 for (i = nargs - 1; i >= 0; i--)
109 /* Allocate a new expression. */
110 newp = (struct expression *) malloc (sizeof (*newp));
114 newp->operation = op;
115 for (i = nargs - 1; i >= 0; i--)
116 newp->val.args[i] = args[i];
121 for (i = nargs - 1; i >= 0; i--)
122 FREE_EXPRESSION (args[i]);
127 static inline struct expression *
131 return new_exp (0, op, NULL);
134 static inline struct expression *
135 new_exp_1 (op, right)
137 struct expression *right;
139 struct expression *args[1];
142 return new_exp (1, op, args);
145 static struct expression *
146 new_exp_2 (op, left, right)
148 struct expression *left;
149 struct expression *right;
151 struct expression *args[2];
155 return new_exp (2, op, args);
158 static inline struct expression *
159 new_exp_3 (op, bexp, tbranch, fbranch)
161 struct expression *bexp;
162 struct expression *tbranch;
163 struct expression *fbranch;
165 struct expression *args[3];
170 return new_exp (3, op, args);
180 #define YYFLAG -32768
183 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
184 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
186 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
187 static const char yytranslate[] =
189 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
192 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
193 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
195 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
200 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
212 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
214 2, 2, 2, 2, 2, 2, 1, 6, 7, 8,
219 static const short yyprhs[] =
221 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
224 static const short yyrhs[] =
226 17, 0, 17, 3, 17, 12, 17, 0, 17, 4,
227 17, 0, 17, 5, 17, 0, 17, 6, 17, 0,
228 17, 7, 17, 0, 17, 8, 17, 0, 17, 9,
229 17, 0, 10, 17, 0, 13, 0, 11, 0, 14,
236 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
237 static const short yyrline[] =
239 0, 174, 182, 186, 190, 194, 198, 202, 206, 210,
245 #if (YYDEBUG) || defined YYERROR_VERBOSE
247 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
248 static const char *const yytname[] =
250 "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
251 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
256 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
257 static const short yyr1[] =
259 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
263 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
264 static const short yyr2[] =
266 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
270 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
271 doesn't specify something else to do. Zero means the default is an
273 static const short yydefact[] =
275 0, 0, 11, 10, 0, 1, 9, 0, 0, 0,
276 0, 0, 0, 0, 0, 12, 0, 3, 4, 5,
277 6, 7, 8, 0, 2, 0, 0, 0
280 static const short yydefgoto[] =
285 static const short yypact[] =
287 -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9,
288 -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16,
289 26, -3,-32768, -9, 34, 21, 53,-32768
292 static const short yypgoto[] =
301 static const short yytable[] =
303 6, 1, 2, 7, 3, 4, 14, 16, 17, 18,
304 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
305 14, 26, 24, 12, 13, 14, 15, 8, 9, 10,
306 11, 12, 13, 14, 13, 14, 23, 8, 9, 10,
307 11, 12, 13, 14, 10, 11, 12, 13, 14, 11,
311 static const short yycheck[] =
313 1, 10, 11, 4, 13, 14, 9, 8, 9, 10,
314 11, 12, 13, 14, 3, 4, 5, 6, 7, 8,
315 9, 0, 23, 7, 8, 9, 15, 3, 4, 5,
316 6, 7, 8, 9, 8, 9, 12, 3, 4, 5,
317 6, 7, 8, 9, 5, 6, 7, 8, 9, 6,
322 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
323 #line 3 "/usr/local/share/bison/bison.simple"
325 /* Skeleton output parser for bison,
327 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
330 This program is free software; you can redistribute it and/or modify
331 it under the terms of the GNU General Public License as published by
332 the Free Software Foundation; either version 2, or (at your option)
335 This program is distributed in the hope that it will be useful,
336 but WITHOUT ANY WARRANTY; without even the implied warranty of
337 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
338 GNU General Public License for more details.
340 You should have received a copy of the GNU General Public License
341 along with this program; if not, write to the Free Software
342 Foundation, Inc., 51 Franklin Street - Fifth Floor,
343 Boston, MA 02110-1301, USA. */
345 /* As a special exception, when this file is copied by Bison into a
346 Bison output file, you may use that output file without restriction.
347 This special exception was added by the Free Software Foundation
348 in version 1.24 of Bison. */
350 /* This is the parser code that is written into each bison parser when
351 the %semantic_parser declaration is not specified in the grammar.
352 It was written by Richard Stallman by simplifying the hairy parser
353 used when %semantic_parser is specified. */
355 /* All symbols defined below should begin with yy or YY, to avoid
356 infringing on user name space. This should be done even for local
357 variables, as they might otherwise be expanded by user macros.
358 There are some unavoidable exceptions within include files to
359 define necessary library symbols; they are noted "INFRINGES ON
360 USER NAME SPACE" below. */
362 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
364 /* The parser invokes alloca or malloc; define the necessary symbols. */
366 # if YYSTACK_USE_ALLOCA
367 # define YYSTACK_ALLOC alloca
369 # ifndef YYSTACK_USE_ALLOCA
370 # if defined (alloca) || defined (_ALLOCA_H)
371 # define YYSTACK_ALLOC alloca
374 # define YYSTACK_ALLOC __builtin_alloca
380 # ifdef YYSTACK_ALLOC
381 /* Pacify GCC's `empty if-body' warning. */
382 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
384 # if defined (__STDC__) || defined (__cplusplus)
385 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
386 # define YYSIZE_T size_t
388 # define YYSTACK_ALLOC malloc
389 # define YYSTACK_FREE free
391 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
394 #if (! defined (yyoverflow) \
395 && (! defined (__cplusplus) \
396 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
398 /* A type that is properly aligned for any stack member. */
408 /* The size of the maximum gap between one aligned stack and the next. */
409 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
411 /* The size of an array large to enough to hold all stacks, each with
414 # define YYSTACK_BYTES(N) \
415 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
416 + 2 * YYSTACK_GAP_MAX)
418 # define YYSTACK_BYTES(N) \
419 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
423 /* Copy COUNT objects from FROM to TO. The source and destination do
427 # define YYCOPY(To, From, Count) \
428 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
430 # define YYCOPY(To, From, Count) \
433 register YYSIZE_T yyi; \
434 for (yyi = 0; yyi < (Count); yyi++) \
435 (To)[yyi] = (From)[yyi]; \
441 /* Relocate STACK from its old location to the new one. The
442 local variables YYSIZE and YYSTACKSIZE give the old and new number of
443 elements in the stack, and YYPTR gives the new location of the
444 stack. Advance YYPTR to a properly aligned location for the next
446 # define YYSTACK_RELOCATE(Stack) \
449 YYSIZE_T yynewbytes; \
450 YYCOPY (&yyptr->Stack, Stack, yysize); \
451 Stack = &yyptr->Stack; \
452 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
453 yyptr += yynewbytes / sizeof (*yyptr); \
460 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
461 # define YYSIZE_T __SIZE_TYPE__
463 #if ! defined (YYSIZE_T) && defined (size_t)
464 # define YYSIZE_T size_t
466 #if ! defined (YYSIZE_T)
467 # if defined (__STDC__) || defined (__cplusplus)
468 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
469 # define YYSIZE_T size_t
472 #if ! defined (YYSIZE_T)
473 # define YYSIZE_T unsigned int
476 #define yyerrok (yyerrstatus = 0)
477 #define yyclearin (yychar = YYEMPTY)
480 #define YYACCEPT goto yyacceptlab
481 #define YYABORT goto yyabortlab
482 #define YYERROR goto yyerrlab1
483 /* Like YYERROR except do call yyerror. This remains here temporarily
484 to ease the transition to the new meaning of YYERROR, for GCC.
485 Once GCC version 2 has supplanted version 1, this can go. */
486 #define YYFAIL goto yyerrlab
487 #define YYRECOVERING() (!!yyerrstatus)
488 #define YYBACKUP(Token, Value) \
490 if (yychar == YYEMPTY && yylen == 1) \
494 yychar1 = YYTRANSLATE (yychar); \
500 yyerror ("syntax error: cannot back up"); \
506 #define YYERRCODE 256
509 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
512 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
513 first token. By default, to implement support for ranges, extend
514 its range to the last symbol. */
516 #ifndef YYLLOC_DEFAULT
517 # define YYLLOC_DEFAULT(Current, Rhs, N) \
518 Current.last_line = Rhs[N].last_line; \
519 Current.last_column = Rhs[N].last_column;
523 /* YYLEX -- calling `yylex' with the right arguments. */
528 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
530 # define YYLEX yylex (&yylval, &yylloc)
532 # else /* !YYLSP_NEEDED */
534 # define YYLEX yylex (&yylval, YYLEX_PARAM)
536 # define YYLEX yylex (&yylval)
538 # endif /* !YYLSP_NEEDED */
540 # define YYLEX yylex ()
544 /* Enable debugging if requested. */
548 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
549 # define YYFPRINTF fprintf
552 # define YYDPRINTF(Args) \
557 /* Nonzero means print parse trace. It is left uninitialized so that
558 multiple parsers can coexist. */
561 # define YYDPRINTF(Args)
562 #endif /* !YYDEBUG */
564 /* YYINITDEPTH -- initial size of the parser's stacks. */
566 # define YYINITDEPTH 200
569 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
570 if the built-in stack extension method is used).
572 Do not make this value too large; the results are undefined if
573 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
574 evaluated with infinite-precision integer arithmetic. */
581 # define YYMAXDEPTH 10000
584 #ifdef YYERROR_VERBOSE
587 # if defined (__GLIBC__) && defined (_STRING_H)
588 # define yystrlen strlen
590 /* Return the length of YYSTR. */
592 # if defined (__STDC__) || defined (__cplusplus)
593 yystrlen (const char *yystr)
599 register const char *yys = yystr;
601 while (*yys++ != '\0')
604 return yys - yystr - 1;
610 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
611 # define yystpcpy stpcpy
613 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
616 # if defined (__STDC__) || defined (__cplusplus)
617 yystpcpy (char *yydest, const char *yysrc)
619 yystpcpy (yydest, yysrc)
624 register char *yyd = yydest;
625 register const char *yys = yysrc;
627 while ((*yyd++ = *yys++) != '\0')
636 #line 315 "/usr/local/share/bison/bison.simple"
639 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
640 into yyparse. The argument should have type void *.
641 It should actually point to an object.
642 Grammar actions can access the variable by casting it
643 to the proper pointer type. */
646 # if defined (__STDC__) || defined (__cplusplus)
647 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
648 # define YYPARSE_PARAM_DECL
650 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
651 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
653 #else /* !YYPARSE_PARAM */
654 # define YYPARSE_PARAM_ARG
655 # define YYPARSE_PARAM_DECL
656 #endif /* !YYPARSE_PARAM */
658 /* Prevent warning if -Wstrict-prototypes. */
660 # ifdef YYPARSE_PARAM
661 int yyparse (void *);
667 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
668 variables are global, or local to YYPARSE. */
670 #define YY_DECL_NON_LSP_VARIABLES \
671 /* The lookahead symbol. */ \
674 /* The semantic value of the lookahead symbol. */ \
677 /* Number of parse errors so far. */ \
681 # define YY_DECL_VARIABLES \
682 YY_DECL_NON_LSP_VARIABLES \
684 /* Location data for the lookahead symbol. */ \
687 # define YY_DECL_VARIABLES \
688 YY_DECL_NON_LSP_VARIABLES
692 /* If nonreentrant, generate the variables here. */
699 yyparse (YYPARSE_PARAM_ARG)
702 /* If reentrant, generate the variables here. */
707 register int yystate;
710 /* Number of tokens to shift before error messages enabled. */
712 /* Lookahead token as an internal (translated) token number. */
715 /* Three stacks and their tools:
716 `yyss': related to states,
717 `yyvs': related to semantic values,
718 `yyls': related to locations.
720 Refer to the stacks thru separate pointers, to allow yyoverflow
721 to reallocate them elsewhere. */
723 /* The state stack. */
724 short yyssa[YYINITDEPTH];
726 register short *yyssp;
728 /* The semantic value stack. */
729 YYSTYPE yyvsa[YYINITDEPTH];
730 YYSTYPE *yyvs = yyvsa;
731 register YYSTYPE *yyvsp;
734 /* The location stack. */
735 YYLTYPE yylsa[YYINITDEPTH];
736 YYLTYPE *yyls = yylsa;
741 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
743 # define YYPOPSTACK (yyvsp--, yyssp--)
746 YYSIZE_T yystacksize = YYINITDEPTH;
749 /* The variables used to return semantic value and location from the
756 /* When reducing, the number of symbols on the RHS of the reduced
760 YYDPRINTF ((stderr, "Starting parse\n"));
765 yychar = YYEMPTY; /* Cause a token to be read. */
767 /* Initialize stack pointers.
768 Waste one element of value and location stack
769 so that they stay on the same level as the state stack.
770 The wasted elements are never initialized. */
779 /*------------------------------------------------------------.
780 | yynewstate -- Push a new state, which is found in yystate. |
781 `------------------------------------------------------------*/
783 /* In all cases, when you get here, the value and location stacks
784 have just been pushed. so pushing a state here evens the stacks.
791 if (yyssp >= yyss + yystacksize - 1)
793 /* Get the current used size of the three stacks, in elements. */
794 YYSIZE_T yysize = yyssp - yyss + 1;
798 /* Give user a chance to reallocate the stack. Use copies of
799 these so that the &'s don't force the real ones into
801 YYSTYPE *yyvs1 = yyvs;
804 /* Each stack pointer address is followed by the size of the
805 data in use in that stack, in bytes. */
807 YYLTYPE *yyls1 = yyls;
808 /* This used to be a conditional around just the two extra args,
809 but that might be undefined if yyoverflow is a macro. */
810 yyoverflow ("parser stack overflow",
811 &yyss1, yysize * sizeof (*yyssp),
812 &yyvs1, yysize * sizeof (*yyvsp),
813 &yyls1, yysize * sizeof (*yylsp),
817 yyoverflow ("parser stack overflow",
818 &yyss1, yysize * sizeof (*yyssp),
819 &yyvs1, yysize * sizeof (*yyvsp),
825 #else /* no yyoverflow */
826 # ifndef YYSTACK_RELOCATE
829 /* Extend the stack our own way. */
830 if (yystacksize >= YYMAXDEPTH)
833 if (yystacksize > YYMAXDEPTH)
834 yystacksize = YYMAXDEPTH;
838 union yyalloc *yyptr =
839 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
842 YYSTACK_RELOCATE (yyss);
843 YYSTACK_RELOCATE (yyvs);
845 YYSTACK_RELOCATE (yyls);
847 # undef YYSTACK_RELOCATE
849 YYSTACK_FREE (yyss1);
852 #endif /* no yyoverflow */
854 yyssp = yyss + yysize - 1;
855 yyvsp = yyvs + yysize - 1;
857 yylsp = yyls + yysize - 1;
860 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
861 (unsigned long int) yystacksize));
863 if (yyssp >= yyss + yystacksize - 1)
867 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
877 /* Do appropriate processing given the current state. */
878 /* Read a lookahead token if we need one and don't already have one. */
881 /* First try to decide what to do without reference to lookahead token. */
883 yyn = yypact[yystate];
887 /* Not known => get a lookahead token if don't already have one. */
889 /* yychar is either YYEMPTY or YYEOF
890 or a valid token in external form. */
892 if (yychar == YYEMPTY)
894 YYDPRINTF ((stderr, "Reading a token: "));
898 /* Convert token to internal form (in yychar1) for indexing tables with */
900 if (yychar <= 0) /* This means end of input. */
903 yychar = YYEOF; /* Don't call YYLEX any more */
905 YYDPRINTF ((stderr, "Now at end of input.\n"));
909 yychar1 = YYTRANSLATE (yychar);
912 /* We have to keep this `#if YYDEBUG', since we use variables
913 which are defined only if `YYDEBUG' is set. */
916 YYFPRINTF (stderr, "Next token is %d (%s",
917 yychar, yytname[yychar1]);
918 /* Give the individual parser a way to print the precise
919 meaning of a token, for further debugging info. */
921 YYPRINT (stderr, yychar, yylval);
923 YYFPRINTF (stderr, ")\n");
929 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
934 /* yyn is what to do for this token type in this state.
935 Negative => reduce, -yyn is rule number.
936 Positive => shift, yyn is new state.
937 New state is final state => don't bother to shift,
939 0, or most negative number => error. */
954 /* Shift the lookahead token. */
955 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
956 yychar, yytname[yychar1]));
958 /* Discard the token being shifted unless it is eof. */
967 /* Count tokens shifted since error; after three, turn off error
976 /*-----------------------------------------------------------.
977 | yydefault -- do the default action for the current state. |
978 `-----------------------------------------------------------*/
980 yyn = yydefact[yystate];
986 /*-----------------------------.
987 | yyreduce -- Do a reduction. |
988 `-----------------------------*/
990 /* yyn is the number of a rule to reduce with. */
993 /* If YYLEN is nonzero, implement the default value of the action:
996 Otherwise, the following line sets YYVAL to the semantic value of
997 the lookahead token. This behavior is undocumented and Bison
998 users should not rely upon it. Assigning to YYVAL
999 unconditionally makes the parser a bit smaller, and it avoids a
1000 GCC warning that YYVAL may be used uninitialized. */
1001 yyval = yyvsp[1-yylen];
1004 /* Similarly for the default location. Let the user run additional
1005 commands if for instance locations are ranges. */
1006 yyloc = yylsp[1-yylen];
1007 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1011 /* We have to keep this `#if YYDEBUG', since we use variables which
1012 are defined only if `YYDEBUG' is set. */
1017 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1020 /* Print the symbols being reduced, and their result. */
1021 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
1022 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1023 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1030 #line 175 "plural.y"
1032 if (yyvsp[0].exp == NULL)
1034 ((struct parse_args *) arg)->res = yyvsp[0].exp;
1038 #line 183 "plural.y"
1040 yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
1044 #line 187 "plural.y"
1046 yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
1050 #line 191 "plural.y"
1052 yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
1056 #line 195 "plural.y"
1058 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1062 #line 199 "plural.y"
1064 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1068 #line 203 "plural.y"
1070 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1074 #line 207 "plural.y"
1076 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1080 #line 211 "plural.y"
1082 yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
1086 #line 215 "plural.y"
1088 yyval.exp = new_exp_0 (var);
1092 #line 219 "plural.y"
1094 if ((yyval.exp = new_exp_0 (num)) != NULL)
1095 yyval.exp->val.num = yyvsp[0].num;
1099 #line 224 "plural.y"
1101 yyval.exp = yyvsp[-1].exp;
1106 #line 705 "/usr/local/share/bison/bison.simple"
1118 short *yyssp1 = yyss - 1;
1119 YYFPRINTF (stderr, "state stack now");
1120 while (yyssp1 != yyssp)
1121 YYFPRINTF (stderr, " %d", *++yyssp1);
1122 YYFPRINTF (stderr, "\n");
1131 /* Now `shift' the result of the reduction. Determine what state
1132 that goes to, based on the state we popped back to and the rule
1133 number reduced by. */
1137 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1138 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1139 yystate = yytable[yystate];
1141 yystate = yydefgoto[yyn - YYNTBASE];
1146 /*------------------------------------.
1147 | yyerrlab -- here on detecting error |
1148 `------------------------------------*/
1150 /* If not already recovering from an error, report this error. */
1155 #ifdef YYERROR_VERBOSE
1156 yyn = yypact[yystate];
1158 if (yyn > YYFLAG && yyn < YYLAST)
1160 YYSIZE_T yysize = 0;
1165 /* Start YYX at -YYN if negative to avoid negative indexes in
1167 for (yyx = yyn < 0 ? -yyn : 0;
1168 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1169 if (yycheck[yyx + yyn] == yyx)
1170 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1171 yysize += yystrlen ("parse error, unexpected ") + 1;
1172 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1173 yymsg = (char *) YYSTACK_ALLOC (yysize);
1176 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1177 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1182 for (yyx = yyn < 0 ? -yyn : 0;
1183 yyx < (int) (sizeof (yytname) / sizeof (char *));
1185 if (yycheck[yyx + yyn] == yyx)
1187 const char *yyq = ! yycount ? ", expecting " : " or ";
1188 yyp = yystpcpy (yyp, yyq);
1189 yyp = yystpcpy (yyp, yytname[yyx]);
1194 YYSTACK_FREE (yymsg);
1197 yyerror ("parse error; also virtual memory exhausted");
1200 #endif /* defined (YYERROR_VERBOSE) */
1201 yyerror ("parse error");
1206 /*--------------------------------------------------.
1207 | yyerrlab1 -- error raised explicitly by an action |
1208 `--------------------------------------------------*/
1210 if (yyerrstatus == 3)
1212 /* If just tried and failed to reuse lookahead token after an
1213 error, discard it. */
1215 /* return failure if at end of input */
1216 if (yychar == YYEOF)
1218 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1219 yychar, yytname[yychar1]));
1223 /* Else will try to reuse lookahead token after shifting the error
1226 yyerrstatus = 3; /* Each real token shifted decrements this */
1231 /*-------------------------------------------------------------------.
1232 | yyerrdefault -- current state does not do anything special for the |
1234 `-------------------------------------------------------------------*/
1237 /* This is wrong; only states that explicitly want error tokens
1238 should shift them. */
1240 /* If its default is to accept any token, ok. Otherwise pop it. */
1241 yyn = yydefact[yystate];
1247 /*---------------------------------------------------------------.
1248 | yyerrpop -- pop the current state because it cannot handle the |
1250 `---------------------------------------------------------------*/
1263 short *yyssp1 = yyss - 1;
1264 YYFPRINTF (stderr, "Error: state stack now");
1265 while (yyssp1 != yyssp)
1266 YYFPRINTF (stderr, " %d", *++yyssp1);
1267 YYFPRINTF (stderr, "\n");
1275 yyn = yypact[yystate];
1280 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1297 YYDPRINTF ((stderr, "Shifting error token, "));
1308 /*-------------------------------------.
1309 | yyacceptlab -- YYACCEPT comes here. |
1310 `-------------------------------------*/
1315 /*-----------------------------------.
1316 | yyabortlab -- YYABORT comes here. |
1317 `-----------------------------------*/
1322 /*---------------------------------------------.
1323 | yyoverflowab -- parser overflow comes here. |
1324 `---------------------------------------------*/
1326 yyerror ("parser stack overflow");
1333 YYSTACK_FREE (yyss);
1337 #line 229 "plural.y"
1342 FREE_EXPRESSION (exp)
1343 struct expression *exp;
1348 /* Handle the recursive case. */
1352 FREE_EXPRESSION (exp->val.args[2]);
1355 FREE_EXPRESSION (exp->val.args[1]);
1358 FREE_EXPRESSION (exp->val.args[0]);
1373 const char *exp = *pexp;
1384 if (exp[0] != ' ' && exp[0] != '\t')
1393 case '0': case '1': case '2': case '3': case '4':
1394 case '5': case '6': case '7': case '8': case '9':
1396 unsigned long int n = result - '0';
1397 while (exp[0] >= '0' && exp[0] <= '9')
1423 lval->op = not_equal;
1430 if (exp[0] == result)
1440 lval->op = less_or_equal;
1443 lval->op = less_than;
1451 lval->op = greater_or_equal;
1454 lval->op = greater_than;
1488 /* Nothing, just return the character. */
1494 /* Be safe and let the user call this function again. */
1517 /* Do nothing. We don't print error messages here. */