1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, 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 YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse __gettextparse
53 #define yylex __gettextlex
54 #define yyerror __gettexterror
55 #define yylval __gettextlval
56 #define yychar __gettextchar
57 #define yydebug __gettextdebug
58 #define yynerrs __gettextnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 /* Copy the first part of user declarations. */
85 #line 1 "../../trunk/intl/plural.y"
87 /* Expression parsing for plural form selection.
88 Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
89 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
91 This program is free software; you can redistribute it and/or modify it
92 under the terms of the GNU Library General Public License as published
93 by the Free Software Foundation; either version 2, or (at your option)
96 This program is distributed in the hope that it will be useful,
97 but WITHOUT ANY WARRANTY; without even the implied warranty of
98 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
99 Library General Public License for more details.
101 You should have received a copy of the GNU Library General Public
102 License along with this program; if not, write to the Free Software
103 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
106 /* The bison generated parser uses alloca. AIX 3 forces us to put this
107 declaration at the beginning of the file. The declaration in bison's
108 skeleton file comes too late. This must come before <config.h>
109 because <config.h> may include arbitrary system headers. */
110 #if defined _AIX && !defined __GNUC__
120 #include "plural-exp.h"
122 /* The main function generated by the parser is called __gettextparse,
123 but we want it to be called PLURAL_PARSE. */
125 # define __gettextparse PLURAL_PARSE
128 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
129 #define YYPARSE_PARAM arg
132 /* Enabling traces. */
137 /* Enabling verbose error messages. */
138 #ifdef YYERROR_VERBOSE
139 # undef YYERROR_VERBOSE
140 # define YYERROR_VERBOSE 1
142 # define YYERROR_VERBOSE 0
145 /* Enabling the token table. */
146 #ifndef YYTOKEN_TABLE
147 # define YYTOKEN_TABLE 0
150 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
151 #line 49 "../../trunk/intl/plural.y"
152 typedef union YYSTYPE {
153 unsigned long int num;
155 struct expression *exp;
157 /* Line 196 of yacc.c. */
158 #line 159 "../../trunk/intl/plural.c"
159 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
160 # define YYSTYPE_IS_DECLARED 1
161 # define YYSTYPE_IS_TRIVIAL 1
166 /* Copy the second part of user declarations. */
167 #line 55 "../../trunk/intl/plural.y"
169 /* Prototypes for local functions. */
170 static int yylex (YYSTYPE *lval, const char **pexp);
171 static void yyerror (const char *str);
173 /* Allocation of expressions. */
175 static struct expression *
176 new_exp (int nargs, enum operator op, struct expression * const *args)
179 struct expression *newp;
181 /* If any of the argument could not be malloc'ed, just return NULL. */
182 for (i = nargs - 1; i >= 0; i--)
186 /* Allocate a new expression. */
187 newp = (struct expression *) malloc (sizeof (*newp));
191 newp->operation = op;
192 for (i = nargs - 1; i >= 0; i--)
193 newp->val.args[i] = args[i];
198 for (i = nargs - 1; i >= 0; i--)
199 FREE_EXPRESSION (args[i]);
204 static inline struct expression *
205 new_exp_0 (enum operator op)
207 return new_exp (0, op, NULL);
210 static inline struct expression *
211 new_exp_1 (enum operator op, struct expression *right)
213 struct expression *args[1];
216 return new_exp (1, op, args);
219 static struct expression *
220 new_exp_2 (enum operator op, struct expression *left, struct expression *right)
222 struct expression *args[2];
226 return new_exp (2, op, args);
229 static inline struct expression *
230 new_exp_3 (enum operator op, struct expression *bexp,
231 struct expression *tbranch, struct expression *fbranch)
233 struct expression *args[3];
238 return new_exp (3, op, args);
243 /* Line 219 of yacc.c. */
244 #line 245 "../../trunk/intl/plural.c"
246 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
247 # define YYSIZE_T __SIZE_TYPE__
249 #if ! defined (YYSIZE_T) && defined (size_t)
250 # define YYSIZE_T size_t
252 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
253 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
254 # define YYSIZE_T size_t
256 #if ! defined (YYSIZE_T)
257 # define YYSIZE_T unsigned int
263 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
264 # define YY_(msgid) dgettext ("bison-runtime", msgid)
268 # define YY_(msgid) msgid
272 #if ! defined (yyoverflow) || YYERROR_VERBOSE
274 /* The parser invokes alloca or malloc; define the necessary symbols. */
276 # ifdef YYSTACK_USE_ALLOCA
277 # if YYSTACK_USE_ALLOCA
279 # define YYSTACK_ALLOC __builtin_alloca
281 # define YYSTACK_ALLOC alloca
282 # if defined (__STDC__) || defined (__cplusplus)
283 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
284 # define YYINCLUDED_STDLIB_H
290 # ifdef YYSTACK_ALLOC
291 /* Pacify GCC's `empty if-body' warning. */
292 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
293 # ifndef YYSTACK_ALLOC_MAXIMUM
294 /* The OS might guarantee only one guard page at the bottom of the stack,
295 and a page size can be as small as 4096 bytes. So we cannot safely
296 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
297 to allow for a few compiler-allocated temporary stack slots. */
298 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
301 # define YYSTACK_ALLOC YYMALLOC
302 # define YYSTACK_FREE YYFREE
303 # ifndef YYSTACK_ALLOC_MAXIMUM
304 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
310 # define YYMALLOC malloc
311 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
312 && (defined (__STDC__) || defined (__cplusplus)))
313 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
318 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
319 && (defined (__STDC__) || defined (__cplusplus)))
320 void free (void *); /* INFRINGES ON USER NAME SPACE */
327 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
330 #if (! defined (yyoverflow) \
331 && (! defined (__cplusplus) \
332 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
334 /* A type that is properly aligned for any stack member. */
341 /* The size of the maximum gap between one aligned stack and the next. */
342 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
344 /* The size of an array large to enough to hold all stacks, each with
346 # define YYSTACK_BYTES(N) \
347 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
348 + YYSTACK_GAP_MAXIMUM)
350 /* Copy COUNT objects from FROM to TO. The source and destination do
353 # if defined (__GNUC__) && 1 < __GNUC__
354 # define YYCOPY(To, From, Count) \
355 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
357 # define YYCOPY(To, From, Count) \
361 for (yyi = 0; yyi < (Count); yyi++) \
362 (To)[yyi] = (From)[yyi]; \
368 /* Relocate STACK from its old location to the new one. The
369 local variables YYSIZE and YYSTACKSIZE give the old and new number of
370 elements in the stack, and YYPTR gives the new location of the
371 stack. Advance YYPTR to a properly aligned location for the next
373 # define YYSTACK_RELOCATE(Stack) \
376 YYSIZE_T yynewbytes; \
377 YYCOPY (&yyptr->Stack, Stack, yysize); \
378 Stack = &yyptr->Stack; \
379 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
380 yyptr += yynewbytes / sizeof (*yyptr); \
386 #if defined (__STDC__) || defined (__cplusplus)
387 typedef signed char yysigned_char;
389 typedef short int yysigned_char;
392 /* YYFINAL -- State number of the termination state. */
394 /* YYLAST -- Last index in YYTABLE. */
397 /* YYNTOKENS -- Number of terminals. */
399 /* YYNNTS -- Number of nonterminals. */
401 /* YYNRULES -- Number of rules. */
403 /* YYNRULES -- Number of states. */
406 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
408 #define YYMAXUTOK 262
410 #define YYTRANSLATE(YYX) \
411 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
413 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
414 static const unsigned char yytranslate[] =
416 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
420 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
422 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
446 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
448 static const unsigned char yyprhs[] =
450 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
454 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
455 static const yysigned_char yyrhs[] =
457 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
458 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
459 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
460 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
461 11, -1, 14, 18, 15, -1
464 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
465 static const unsigned char yyrline[] =
467 0, 150, 150, 158, 162, 166, 170, 174, 178, 182,
472 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
473 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
474 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
475 static const char *const yytname[] =
477 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
478 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
479 "$accept", "start", "exp", 0
484 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
486 static const unsigned short int yytoknum[] =
488 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
489 33, 262, 58, 110, 40, 41
493 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
494 static const unsigned char yyr1[] =
496 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
500 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
501 static const unsigned char yyr2[] =
503 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
507 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
508 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
509 means the default is an error. */
510 static const unsigned char yydefact[] =
512 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
513 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
517 /* YYDEFGOTO[NTERM-NUM]. */
518 static const yysigned_char yydefgoto[] =
523 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
525 #define YYPACT_NINF -10
526 static const yysigned_char yypact[] =
528 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
529 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
530 45, 18, -2, 14, -10, -9, 36
533 /* YYPGOTO[NTERM-NUM]. */
534 static const yysigned_char yypgoto[] =
539 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
540 positive, shift that token. If negative, reduce the rule which
541 number is the opposite. If zero, do what YYDEFACT says.
542 If YYTABLE_NINF, syntax error. */
543 #define YYTABLE_NINF -1
544 static const unsigned char yytable[] =
546 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
547 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
548 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
549 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
550 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
554 static const yysigned_char yycheck[] =
556 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
557 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
558 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
559 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
560 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
564 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
565 symbol of state STATE-NUM. */
566 static const unsigned char yystos[] =
568 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
569 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
570 18, 18, 18, 18, 18, 12, 18
573 #define yyerrok (yyerrstatus = 0)
574 #define yyclearin (yychar = YYEMPTY)
578 #define YYACCEPT goto yyacceptlab
579 #define YYABORT goto yyabortlab
580 #define YYERROR goto yyerrorlab
583 /* Like YYERROR except do call yyerror. This remains here temporarily
584 to ease the transition to the new meaning of YYERROR, for GCC.
585 Once GCC version 2 has supplanted version 1, this can go. */
587 #define YYFAIL goto yyerrlab
589 #define YYRECOVERING() (!!yyerrstatus)
591 #define YYBACKUP(Token, Value) \
593 if (yychar == YYEMPTY && yylen == 1) \
597 yytoken = YYTRANSLATE (yychar); \
603 yyerror (YY_("syntax error: cannot back up")); \
610 #define YYERRCODE 256
613 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
614 If N is 0, then set CURRENT to the empty location which ends
615 the previous symbol: RHS[0] (always defined). */
617 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
618 #ifndef YYLLOC_DEFAULT
619 # define YYLLOC_DEFAULT(Current, Rhs, N) \
623 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
624 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
625 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
626 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
630 (Current).first_line = (Current).last_line = \
631 YYRHSLOC (Rhs, 0).last_line; \
632 (Current).first_column = (Current).last_column = \
633 YYRHSLOC (Rhs, 0).last_column; \
639 /* YY_LOCATION_PRINT -- Print the location on the stream.
640 This macro was not mandated originally: define only if we know
641 we won't break user code: when these are the locations we know. */
643 #ifndef YY_LOCATION_PRINT
644 # if YYLTYPE_IS_TRIVIAL
645 # define YY_LOCATION_PRINT(File, Loc) \
646 fprintf (File, "%d.%d-%d.%d", \
647 (Loc).first_line, (Loc).first_column, \
648 (Loc).last_line, (Loc).last_column)
650 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
655 /* YYLEX -- calling `yylex' with the right arguments. */
658 # define YYLEX yylex (&yylval, YYLEX_PARAM)
660 # define YYLEX yylex (&yylval)
663 /* Enable debugging if requested. */
667 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
668 # define YYFPRINTF fprintf
671 # define YYDPRINTF(Args) \
677 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
681 YYFPRINTF (stderr, "%s ", Title); \
682 yysymprint (stderr, \
684 YYFPRINTF (stderr, "\n"); \
688 /*------------------------------------------------------------------.
689 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
691 `------------------------------------------------------------------*/
693 #if defined (__STDC__) || defined (__cplusplus)
695 yy_stack_print (short int *bottom, short int *top)
698 yy_stack_print (bottom, top)
703 YYFPRINTF (stderr, "Stack now");
704 for (/* Nothing. */; bottom <= top; ++bottom)
705 YYFPRINTF (stderr, " %d", *bottom);
706 YYFPRINTF (stderr, "\n");
709 # define YY_STACK_PRINT(Bottom, Top) \
712 yy_stack_print ((Bottom), (Top)); \
716 /*------------------------------------------------.
717 | Report that the YYRULE is going to be reduced. |
718 `------------------------------------------------*/
720 #if defined (__STDC__) || defined (__cplusplus)
722 yy_reduce_print (int yyrule)
725 yy_reduce_print (yyrule)
730 unsigned long int yylno = yyrline[yyrule];
731 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
733 /* Print the symbols being reduced, and their result. */
734 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
735 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
736 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
739 # define YY_REDUCE_PRINT(Rule) \
742 yy_reduce_print (Rule); \
745 /* Nonzero means print parse trace. It is left uninitialized so that
746 multiple parsers can coexist. */
749 # define YYDPRINTF(Args)
750 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
751 # define YY_STACK_PRINT(Bottom, Top)
752 # define YY_REDUCE_PRINT(Rule)
753 #endif /* !YYDEBUG */
756 /* YYINITDEPTH -- initial size of the parser's stacks. */
758 # define YYINITDEPTH 200
761 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
762 if the built-in stack extension method is used).
764 Do not make this value too large; the results are undefined if
765 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
766 evaluated with infinite-precision integer arithmetic. */
769 # define YYMAXDEPTH 10000
777 # if defined (__GLIBC__) && defined (_STRING_H)
778 # define yystrlen strlen
780 /* Return the length of YYSTR. */
782 # if defined (__STDC__) || defined (__cplusplus)
783 yystrlen (const char *yystr)
789 const char *yys = yystr;
791 while (*yys++ != '\0')
794 return yys - yystr - 1;
800 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
801 # define yystpcpy stpcpy
803 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
806 # if defined (__STDC__) || defined (__cplusplus)
807 yystpcpy (char *yydest, const char *yysrc)
809 yystpcpy (yydest, yysrc)
815 const char *yys = yysrc;
817 while ((*yyd++ = *yys++) != '\0')
826 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
827 quotes and backslashes, so that it's suitable for yyerror. The
828 heuristic is that double-quoting is unnecessary unless the string
829 contains an apostrophe, a comma, or backslash (other than
830 backslash-backslash). YYSTR is taken from yytname. If YYRES is
831 null, do not copy; instead, return the length of what the result
834 yytnamerr (char *yyres, const char *yystr)
839 char const *yyp = yystr;
846 goto do_not_strip_quotes;
850 goto do_not_strip_quotes;
863 do_not_strip_quotes: ;
867 return yystrlen (yystr);
869 return yystpcpy (yyres, yystr) - yyres;
873 #endif /* YYERROR_VERBOSE */
878 /*--------------------------------.
879 | Print this symbol on YYOUTPUT. |
880 `--------------------------------*/
882 #if defined (__STDC__) || defined (__cplusplus)
884 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
887 yysymprint (yyoutput, yytype, yyvaluep)
893 /* Pacify ``unused variable'' warnings. */
896 if (yytype < YYNTOKENS)
897 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
899 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
903 if (yytype < YYNTOKENS)
904 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
911 YYFPRINTF (yyoutput, ")");
914 #endif /* ! YYDEBUG */
915 /*-----------------------------------------------.
916 | Release the memory associated to this symbol. |
917 `-----------------------------------------------*/
919 #if defined (__STDC__) || defined (__cplusplus)
921 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
924 yydestruct (yymsg, yytype, yyvaluep)
930 /* Pacify ``unused variable'' warnings. */
935 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
946 /* Prevent warnings from -Wmissing-prototypes. */
949 # if defined (__STDC__) || defined (__cplusplus)
950 int yyparse (void *YYPARSE_PARAM);
954 #else /* ! YYPARSE_PARAM */
955 #if defined (__STDC__) || defined (__cplusplus)
960 #endif /* ! YYPARSE_PARAM */
972 # if defined (__STDC__) || defined (__cplusplus)
973 int yyparse (void *YYPARSE_PARAM)
975 int yyparse (YYPARSE_PARAM)
978 #else /* ! YYPARSE_PARAM */
979 #if defined (__STDC__) || defined (__cplusplus)
989 /* The look-ahead symbol. */
992 /* The semantic value of the look-ahead symbol. */
995 /* Number of syntax errors so far. */
1001 /* Number of tokens to shift before error messages enabled. */
1003 /* Look-ahead token as an internal (translated) token number. */
1006 /* Three stacks and their tools:
1007 `yyss': related to states,
1008 `yyvs': related to semantic values,
1009 `yyls': related to locations.
1011 Refer to the stacks thru separate pointers, to allow yyoverflow
1012 to reallocate them elsewhere. */
1014 /* The state stack. */
1015 short int yyssa[YYINITDEPTH];
1016 short int *yyss = yyssa;
1019 /* The semantic value stack. */
1020 YYSTYPE yyvsa[YYINITDEPTH];
1021 YYSTYPE *yyvs = yyvsa;
1026 #define YYPOPSTACK (yyvsp--, yyssp--)
1028 YYSIZE_T yystacksize = YYINITDEPTH;
1030 /* The variables used to return semantic value and location from the
1035 /* When reducing, the number of symbols on the RHS of the reduced
1039 YYDPRINTF ((stderr, "Starting parse\n"));
1044 yychar = YYEMPTY; /* Cause a token to be read. */
1046 /* Initialize stack pointers.
1047 Waste one element of value and location stack
1048 so that they stay on the same level as the state stack.
1049 The wasted elements are never initialized. */
1056 /*------------------------------------------------------------.
1057 | yynewstate -- Push a new state, which is found in yystate. |
1058 `------------------------------------------------------------*/
1060 /* In all cases, when you get here, the value and location stacks
1061 have just been pushed. so pushing a state here evens the stacks.
1068 if (yyss + yystacksize - 1 <= yyssp)
1070 /* Get the current used size of the three stacks, in elements. */
1071 YYSIZE_T yysize = yyssp - yyss + 1;
1075 /* Give user a chance to reallocate the stack. Use copies of
1076 these so that the &'s don't force the real ones into
1078 YYSTYPE *yyvs1 = yyvs;
1079 short int *yyss1 = yyss;
1082 /* Each stack pointer address is followed by the size of the
1083 data in use in that stack, in bytes. This used to be a
1084 conditional around just the two extra args, but that might
1085 be undefined if yyoverflow is a macro. */
1086 yyoverflow (YY_("memory exhausted"),
1087 &yyss1, yysize * sizeof (*yyssp),
1088 &yyvs1, yysize * sizeof (*yyvsp),
1095 #else /* no yyoverflow */
1096 # ifndef YYSTACK_RELOCATE
1097 goto yyexhaustedlab;
1099 /* Extend the stack our own way. */
1100 if (YYMAXDEPTH <= yystacksize)
1101 goto yyexhaustedlab;
1103 if (YYMAXDEPTH < yystacksize)
1104 yystacksize = YYMAXDEPTH;
1107 short int *yyss1 = yyss;
1108 union yyalloc *yyptr =
1109 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1111 goto yyexhaustedlab;
1112 YYSTACK_RELOCATE (yyss);
1113 YYSTACK_RELOCATE (yyvs);
1115 # undef YYSTACK_RELOCATE
1117 YYSTACK_FREE (yyss1);
1120 #endif /* no yyoverflow */
1122 yyssp = yyss + yysize - 1;
1123 yyvsp = yyvs + yysize - 1;
1126 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1127 (unsigned long int) yystacksize));
1129 if (yyss + yystacksize - 1 <= yyssp)
1133 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1142 /* Do appropriate processing given the current state. */
1143 /* Read a look-ahead token if we need one and don't already have one. */
1146 /* First try to decide what to do without reference to look-ahead token. */
1148 yyn = yypact[yystate];
1149 if (yyn == YYPACT_NINF)
1152 /* Not known => get a look-ahead token if don't already have one. */
1154 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1155 if (yychar == YYEMPTY)
1157 YYDPRINTF ((stderr, "Reading a token: "));
1161 if (yychar <= YYEOF)
1163 yychar = yytoken = YYEOF;
1164 YYDPRINTF ((stderr, "Now at end of input.\n"));
1168 yytoken = YYTRANSLATE (yychar);
1169 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1172 /* If the proper action on seeing token YYTOKEN is to reduce or to
1173 detect an error, take that action. */
1175 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1180 if (yyn == 0 || yyn == YYTABLE_NINF)
1189 /* Shift the look-ahead token. */
1190 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1192 /* Discard the token being shifted unless it is eof. */
1193 if (yychar != YYEOF)
1199 /* Count tokens shifted since error; after three, turn off error
1208 /*-----------------------------------------------------------.
1209 | yydefault -- do the default action for the current state. |
1210 `-----------------------------------------------------------*/
1212 yyn = yydefact[yystate];
1218 /*-----------------------------.
1219 | yyreduce -- Do a reduction. |
1220 `-----------------------------*/
1222 /* yyn is the number of a rule to reduce with. */
1225 /* If YYLEN is nonzero, implement the default value of the action:
1228 Otherwise, the following line sets YYVAL to garbage.
1229 This behavior is undocumented and Bison
1230 users should not rely upon it. Assigning to YYVAL
1231 unconditionally makes the parser a bit smaller, and it avoids a
1232 GCC warning that YYVAL may be used uninitialized. */
1233 yyval = yyvsp[1-yylen];
1236 YY_REDUCE_PRINT (yyn);
1240 #line 151 "../../trunk/intl/plural.y"
1242 if ((yyvsp[0].exp) == NULL)
1244 ((struct parse_args *) arg)->res = (yyvsp[0].exp);
1249 #line 159 "../../trunk/intl/plural.y"
1251 (yyval.exp) = new_exp_3 (qmop, (yyvsp[-4].exp), (yyvsp[-2].exp), (yyvsp[0].exp));
1256 #line 163 "../../trunk/intl/plural.y"
1258 (yyval.exp) = new_exp_2 (lor, (yyvsp[-2].exp), (yyvsp[0].exp));
1263 #line 167 "../../trunk/intl/plural.y"
1265 (yyval.exp) = new_exp_2 (land, (yyvsp[-2].exp), (yyvsp[0].exp));
1270 #line 171 "../../trunk/intl/plural.y"
1272 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1277 #line 175 "../../trunk/intl/plural.y"
1279 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1284 #line 179 "../../trunk/intl/plural.y"
1286 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1291 #line 183 "../../trunk/intl/plural.y"
1293 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1298 #line 187 "../../trunk/intl/plural.y"
1300 (yyval.exp) = new_exp_1 (lnot, (yyvsp[0].exp));
1305 #line 191 "../../trunk/intl/plural.y"
1307 (yyval.exp) = new_exp_0 (var);
1312 #line 195 "../../trunk/intl/plural.y"
1314 if (((yyval.exp) = new_exp_0 (num)) != NULL)
1315 (yyval.exp)->val.num = (yyvsp[0].num);
1320 #line 200 "../../trunk/intl/plural.y"
1322 (yyval.exp) = (yyvsp[-1].exp);
1330 /* Line 1126 of yacc.c. */
1331 #line 1332 "../../trunk/intl/plural.c"
1337 YY_STACK_PRINT (yyss, yyssp);
1342 /* Now `shift' the result of the reduction. Determine what state
1343 that goes to, based on the state we popped back to and the rule
1344 number reduced by. */
1348 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1349 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1350 yystate = yytable[yystate];
1352 yystate = yydefgoto[yyn - YYNTOKENS];
1357 /*------------------------------------.
1358 | yyerrlab -- here on detecting error |
1359 `------------------------------------*/
1361 /* If not already recovering from an error, report this error. */
1366 yyn = yypact[yystate];
1368 if (YYPACT_NINF < yyn && yyn < YYLAST)
1370 int yytype = YYTRANSLATE (yychar);
1371 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1372 YYSIZE_T yysize = yysize0;
1374 int yysize_overflow = 0;
1376 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
1377 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1381 /* This is so xgettext sees the translatable formats that are
1382 constructed on the fly. */
1383 YY_("syntax error, unexpected %s");
1384 YY_("syntax error, unexpected %s, expecting %s");
1385 YY_("syntax error, unexpected %s, expecting %s or %s");
1386 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1387 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1391 static char const yyunexpected[] = "syntax error, unexpected %s";
1392 static char const yyexpecting[] = ", expecting %s";
1393 static char const yyor[] = " or %s";
1394 char yyformat[sizeof yyunexpected
1395 + sizeof yyexpecting - 1
1396 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1397 * (sizeof yyor - 1))];
1398 char const *yyprefix = yyexpecting;
1400 /* Start YYX at -YYN if negative to avoid negative indexes in
1402 int yyxbegin = yyn < 0 ? -yyn : 0;
1404 /* Stay within bounds of both yycheck and yytname. */
1405 int yychecklim = YYLAST - yyn;
1406 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1409 yyarg[0] = yytname[yytype];
1410 yyfmt = yystpcpy (yyformat, yyunexpected);
1412 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1413 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1415 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1419 yyformat[sizeof yyunexpected - 1] = '\0';
1422 yyarg[yycount++] = yytname[yyx];
1423 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1424 yysize_overflow |= yysize1 < yysize;
1426 yyfmt = yystpcpy (yyfmt, yyprefix);
1430 yyf = YY_(yyformat);
1431 yysize1 = yysize + yystrlen (yyf);
1432 yysize_overflow |= yysize1 < yysize;
1435 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
1436 yymsg = (char *) YYSTACK_ALLOC (yysize);
1439 /* Avoid sprintf, as that infringes on the user's name space.
1440 Don't have undefined behavior even if the translation
1441 produced a string with the wrong number of "%s"s. */
1444 while ((*yyp = *yyf))
1446 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1448 yyp += yytnamerr (yyp, yyarg[yyi++]);
1458 YYSTACK_FREE (yymsg);
1462 yyerror (YY_("syntax error"));
1463 goto yyexhaustedlab;
1467 #endif /* YYERROR_VERBOSE */
1468 yyerror (YY_("syntax error"));
1473 if (yyerrstatus == 3)
1475 /* If just tried and failed to reuse look-ahead token after an
1476 error, discard it. */
1478 if (yychar <= YYEOF)
1480 /* Return failure if at end of input. */
1481 if (yychar == YYEOF)
1486 yydestruct ("Error: discarding", yytoken, &yylval);
1491 /* Else will try to reuse look-ahead token after shifting the error
1496 /*---------------------------------------------------.
1497 | yyerrorlab -- error raised explicitly by YYERROR. |
1498 `---------------------------------------------------*/
1501 /* Pacify compilers like GCC when the user code never invokes
1502 YYERROR and the label yyerrorlab therefore never appears in user
1513 /*-------------------------------------------------------------.
1514 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1515 `-------------------------------------------------------------*/
1517 yyerrstatus = 3; /* Each real token shifted decrements this. */
1521 yyn = yypact[yystate];
1522 if (yyn != YYPACT_NINF)
1525 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1533 /* Pop the current state because it cannot handle the error token. */
1538 yydestruct ("Error: popping", yystos[yystate], yyvsp);
1541 YY_STACK_PRINT (yyss, yyssp);
1550 /* Shift the error token. */
1551 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1557 /*-------------------------------------.
1558 | yyacceptlab -- YYACCEPT comes here. |
1559 `-------------------------------------*/
1564 /*-----------------------------------.
1565 | yyabortlab -- YYABORT comes here. |
1566 `-----------------------------------*/
1572 /*-------------------------------------------------.
1573 | yyexhaustedlab -- memory exhaustion comes here. |
1574 `-------------------------------------------------*/
1576 yyerror (YY_("memory exhausted"));
1582 if (yychar != YYEOF && yychar != YYEMPTY)
1583 yydestruct ("Cleanup: discarding lookahead",
1585 while (yyssp != yyss)
1587 yydestruct ("Cleanup: popping",
1588 yystos[*yyssp], yyvsp);
1593 YYSTACK_FREE (yyss);
1599 #line 205 "../../trunk/intl/plural.y"
1604 FREE_EXPRESSION (struct expression *exp)
1609 /* Handle the recursive case. */
1613 FREE_EXPRESSION (exp->val.args[2]);
1616 FREE_EXPRESSION (exp->val.args[1]);
1619 FREE_EXPRESSION (exp->val.args[0]);
1630 yylex (YYSTYPE *lval, const char **pexp)
1632 const char *exp = *pexp;
1643 if (exp[0] != ' ' && exp[0] != '\t')
1652 case '0': case '1': case '2': case '3': case '4':
1653 case '5': case '6': case '7': case '8': case '9':
1655 unsigned long int n = result - '0';
1656 while (exp[0] >= '0' && exp[0] <= '9')
1682 lval->op = not_equal;
1689 if (exp[0] == result)
1699 lval->op = less_or_equal;
1702 lval->op = less_than;
1710 lval->op = greater_or_equal;
1713 lval->op = greater_than;
1747 /* Nothing, just return the character. */
1753 /* Be safe and let the user call this function again. */
1773 yyerror (const char *str)
1775 /* Do nothing. We don't print error messages here. */