1 /* A Bison parser, made by GNU Bison 2.0. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6 This file is part of GNU Bush.
8 Bush 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 Bush 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 Bush. If not, see <http://www.gnu.org/licenses/>.
22 /* As a special exception, when this file is copied by Bison into a
23 Bison output file, you may use that output file without restriction.
24 This special exception was added by the Free Software Foundation
25 in version 1.24 of Bison. */
27 /* Written by Richard Stallman by simplifying the original so called
28 ``semantic'' parser. */
30 /* All symbols defined below should begin with yy or YY, to avoid
31 infringing on user name space. This should be done even for local
32 variables, as they might otherwise be expanded by user macros.
33 There are some unavoidable exceptions within include files to
34 define necessary library symbols; they are noted "INFRINGES ON
35 USER NAME SPACE" below. */
37 /* Identify Bison output. */
41 #define YYSKELETON_NAME "yacc.c"
46 /* Using locations. */
47 #define YYLSP_NEEDED 0
49 /* Substitute the variable and function names. */
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 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
84 /* plural.y - Expression parsing for plural form selection. */
86 /* Copyright (C) 2000, 2001, 2005-2009 Free Software Foundation, Inc.
87 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
89 This file is part of GNU Bush.
91 Bush is free software: you can redistribute it and/or modify
92 it under the terms of the GNU General Public License as published by
93 the Free Software Foundation, either version 3 of the License, or
94 (at your option) any later version.
96 Bush 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
99 GNU General Public License for more details.
101 You should have received a copy of the GNU General Public License
102 along with Bush. If not, see <http://www.gnu.org/licenses/>.
105 /* The bison generated parser uses alloca. AIX 3 forces us to put this
106 declaration at the beginning of the file. The declaration in bison's
107 skeleton file comes too late. This must come before <config.h>
108 because <config.h> may include arbitrary system headers. */
109 #if defined _AIX && !defined __GNUC__
119 #include "plural-exp.h"
121 /* The main function generated by the parser is called __gettextparse,
122 but we want it to be called PLURAL_PARSE. */
124 # define __gettextparse PLURAL_PARSE
127 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
128 #define YYPARSE_PARAM arg
131 /* Enabling traces. */
136 /* Enabling verbose error messages. */
137 #ifdef YYERROR_VERBOSE
138 # undef YYERROR_VERBOSE
139 # define YYERROR_VERBOSE 1
141 # define YYERROR_VERBOSE 0
144 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
145 #line 51 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
146 typedef union YYSTYPE
{
147 unsigned long int num
;
149 struct expression
*exp
;
151 /* Line 190 of yacc.c. */
152 #line 152 "/usr/src/local/bush/bush-20080814/lib/intl/plural.c"
153 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
154 # define YYSTYPE_IS_DECLARED 1
155 # define YYSTYPE_IS_TRIVIAL 1
160 /* Copy the second part of user declarations. */
161 #line 57 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
163 /* Prototypes for local functions. */
164 static struct expression
*new_exp
PARAMS ((int nargs
, enum operator op
,
165 struct expression
* const *args
));
166 static inline struct expression
*new_exp_0
PARAMS ((enum operator op
));
167 static inline struct expression
*new_exp_1
PARAMS ((enum operator op
,
168 struct expression
*right
));
169 static struct expression
*new_exp_2
PARAMS ((enum operator op
,
170 struct expression
*left
,
171 struct expression
*right
));
172 static inline struct expression
*new_exp_3
PARAMS ((enum operator op
,
173 struct expression
*bexp
,
174 struct expression
*tbranch
,
175 struct expression
*fbranch
));
176 static int yylex
PARAMS ((YYSTYPE
*lval
, const char **pexp
));
177 static void yyerror
PARAMS ((const char *str
));
179 /* Allocation of expressions. */
181 static struct expression
*
182 new_exp (nargs
, op
, args
)
185 struct expression
* const *args
;
188 struct expression
*newp
;
190 /* If any of the argument could not be malloc'ed, just return NULL. */
191 for (i
= nargs
- 1; i
>= 0; i
--)
195 /* Allocate a new expression. */
196 newp
= (struct expression
*) malloc (sizeof (*newp
));
200 newp
->operation
= op
;
201 for (i
= nargs
- 1; i
>= 0; i
--)
202 newp
->val
.args
[i
] = args
[i
];
207 for (i
= nargs
- 1; i
>= 0; i
--)
208 FREE_EXPRESSION (args
[i
]);
213 static inline struct expression
*
217 return new_exp (0, op
, NULL
);
220 static inline struct expression
*
221 new_exp_1 (op
, right
)
223 struct expression
*right
;
225 struct expression
*args
[1];
228 return new_exp (1, op
, args
);
231 static struct expression
*
232 new_exp_2 (op
, left
, right
)
234 struct expression
*left
;
235 struct expression
*right
;
237 struct expression
*args
[2];
241 return new_exp (2, op
, args
);
244 static inline struct expression
*
245 new_exp_3 (op
, bexp
, tbranch
, fbranch
)
247 struct expression
*bexp
;
248 struct expression
*tbranch
;
249 struct expression
*fbranch
;
251 struct expression
*args
[3];
256 return new_exp (3, op
, args
);
261 /* Line 213 of yacc.c. */
262 #line 262 "/usr/src/local/bush/bush-20080814/lib/intl/plural.c"
264 #if ! defined (yyoverflow) || YYERROR_VERBOSE
270 # define YYMALLOC malloc
273 /* The parser invokes alloca or malloc; define the necessary symbols. */
275 # ifdef YYSTACK_USE_ALLOCA
276 # if YYSTACK_USE_ALLOCA
278 # define YYSTACK_ALLOC __builtin_alloca
280 # define YYSTACK_ALLOC alloca
285 # ifdef YYSTACK_ALLOC
286 /* Pacify GCC's `empty if-body' warning. */
287 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
289 # if defined (__STDC__) || defined (__cplusplus)
290 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
291 # define YYSIZE_T size_t
293 # define YYSTACK_ALLOC YYMALLOC
294 # define YYSTACK_FREE YYFREE
296 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
299 #if (! defined (yyoverflow) \
300 && (! defined (__cplusplus) \
301 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
303 /* A type that is properly aligned for any stack member. */
310 /* The size of the maximum gap between one aligned stack and the next. */
311 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
313 /* The size of an array large to enough to hold all stacks, each with
315 # define YYSTACK_BYTES(N) \
316 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
317 + YYSTACK_GAP_MAXIMUM)
319 /* Copy COUNT objects from FROM to TO. The source and destination do
322 # if defined (__GNUC__) && 1 < __GNUC__
323 # define YYCOPY(To, From, Count) \
324 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
326 # define YYCOPY(To, From, Count) \
329 register YYSIZE_T yyi; \
330 for (yyi = 0; yyi < (Count); yyi++) \
331 (To)[yyi] = (From)[yyi]; \
337 /* Relocate STACK from its old location to the new one. The
338 local variables YYSIZE and YYSTACKSIZE give the old and new number of
339 elements in the stack, and YYPTR gives the new location of the
340 stack. Advance YYPTR to a properly aligned location for the next
342 # define YYSTACK_RELOCATE(Stack) \
345 YYSIZE_T yynewbytes; \
346 YYCOPY (&yyptr->Stack, Stack, yysize); \
347 Stack = &yyptr->Stack; \
348 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
349 yyptr += yynewbytes / sizeof (*yyptr); \
355 #if defined (__STDC__) || defined (__cplusplus)
356 typedef signed char yysigned_char
;
358 typedef short int yysigned_char
;
361 /* YYFINAL -- State number of the termination state. */
363 /* YYLAST -- Last index in YYTABLE. */
366 /* YYNTOKENS -- Number of terminals. */
368 /* YYNNTS -- Number of nonterminals. */
370 /* YYNRULES -- Number of rules. */
372 /* YYNRULES -- Number of states. */
375 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
377 #define YYMAXUTOK 262
379 #define YYTRANSLATE(YYX) \
380 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
382 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
383 static const unsigned char yytranslate
[] =
385 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
389 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
391 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
415 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
417 static const unsigned char yyprhs
[] =
419 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
423 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
424 static const yysigned_char yyrhs
[] =
426 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
427 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
428 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
429 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
430 11, -1, 14, 18, 15, -1
433 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
434 static const unsigned char yyrline
[] =
436 0, 176, 176, 184, 188, 192, 196, 200, 204, 208,
441 #if YYDEBUG || YYERROR_VERBOSE
442 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
443 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
444 static const char *const yytname
[] =
446 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
447 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
448 "$accept", "start", "exp", 0
453 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
455 static const unsigned short int yytoknum
[] =
457 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
458 33, 262, 58, 110, 40, 41
462 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
463 static const unsigned char yyr1
[] =
465 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
469 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
470 static const unsigned char yyr2
[] =
472 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
476 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
477 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
478 means the default is an error. */
479 static const unsigned char yydefact
[] =
481 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
482 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
486 /* YYDEFGOTO[NTERM-NUM]. */
487 static const yysigned_char yydefgoto
[] =
492 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
494 #define YYPACT_NINF -10
495 static const yysigned_char yypact
[] =
497 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
498 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
499 45, 18, -2, 14, -10, -9, 36
502 /* YYPGOTO[NTERM-NUM]. */
503 static const yysigned_char yypgoto
[] =
508 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
509 positive, shift that token. If negative, reduce the rule which
510 number is the opposite. If zero, do what YYDEFACT says.
511 If YYTABLE_NINF, syntax error. */
512 #define YYTABLE_NINF -1
513 static const unsigned char yytable
[] =
515 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
516 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
517 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
518 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
519 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
523 static const yysigned_char yycheck
[] =
525 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
526 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
527 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
528 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
529 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
533 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
534 symbol of state STATE-NUM. */
535 static const unsigned char yystos
[] =
537 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
538 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
539 18, 18, 18, 18, 18, 12, 18
542 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
543 # define YYSIZE_T __SIZE_TYPE__
545 #if ! defined (YYSIZE_T) && defined (size_t)
546 # define YYSIZE_T size_t
548 #if ! defined (YYSIZE_T)
549 # if defined (__STDC__) || defined (__cplusplus)
550 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
551 # define YYSIZE_T size_t
554 #if ! defined (YYSIZE_T)
555 # define YYSIZE_T unsigned int
558 #define yyerrok (yyerrstatus = 0)
559 #define yyclearin (yychar = YYEMPTY)
563 #define YYACCEPT goto yyacceptlab
564 #define YYABORT goto yyabortlab
565 #define YYERROR goto yyerrorlab
568 /* Like YYERROR except do call yyerror. This remains here temporarily
569 to ease the transition to the new meaning of YYERROR, for GCC.
570 Once GCC version 2 has supplanted version 1, this can go. */
572 #define YYFAIL goto yyerrlab
574 #define YYRECOVERING() (!!yyerrstatus)
576 #define YYBACKUP(Token, Value) \
578 if (yychar == YYEMPTY && yylen == 1) \
582 yytoken = YYTRANSLATE (yychar); \
588 yyerror ("syntax error: cannot back up");\
595 #define YYERRCODE 256
598 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
599 If N is 0, then set CURRENT to the empty location which ends
600 the previous symbol: RHS[0] (always defined). */
602 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
603 #ifndef YYLLOC_DEFAULT
604 # define YYLLOC_DEFAULT(Current, Rhs, N) \
608 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
609 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
610 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
611 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
615 (Current).first_line = (Current).last_line = \
616 YYRHSLOC (Rhs, 0).last_line; \
617 (Current).first_column = (Current).last_column = \
618 YYRHSLOC (Rhs, 0).last_column; \
624 /* YY_LOCATION_PRINT -- Print the location on the stream.
625 This macro was not mandated originally: define only if we know
626 we won't break user code: when these are the locations we know. */
628 #ifndef YY_LOCATION_PRINT
629 # if YYLTYPE_IS_TRIVIAL
630 # define YY_LOCATION_PRINT(File, Loc) \
631 fprintf (File, "%d.%d-%d.%d", \
632 (Loc).first_line, (Loc).first_column, \
633 (Loc).last_line, (Loc).last_column)
635 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
640 /* YYLEX -- calling `yylex' with the right arguments. */
643 # define YYLEX yylex (&yylval, YYLEX_PARAM)
645 # define YYLEX yylex (&yylval)
648 /* Enable debugging if requested. */
652 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
653 # define YYFPRINTF fprintf
656 # define YYDPRINTF(Args) \
662 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
666 YYFPRINTF (stderr, "%s ", Title); \
667 yysymprint (stderr, \
669 YYFPRINTF (stderr, "\n"); \
673 /*------------------------------------------------------------------.
674 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
676 `------------------------------------------------------------------*/
678 #if defined (__STDC__) || defined (__cplusplus)
680 yy_stack_print (short int *bottom
, short int *top
)
683 yy_stack_print (bottom
, top
)
688 YYFPRINTF (stderr
, "Stack now");
689 for (/* Nothing. */; bottom
<= top
; ++bottom
)
690 YYFPRINTF (stderr
, " %d", *bottom
);
691 YYFPRINTF (stderr
, "\n");
694 # define YY_STACK_PRINT(Bottom, Top) \
697 yy_stack_print ((Bottom), (Top)); \
701 /*------------------------------------------------.
702 | Report that the YYRULE is going to be reduced. |
703 `------------------------------------------------*/
705 #if defined (__STDC__) || defined (__cplusplus)
707 yy_reduce_print (int yyrule
)
710 yy_reduce_print (yyrule
)
715 unsigned int yylno
= yyrline
[yyrule
];
716 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
718 /* Print the symbols being reduced, and their result. */
719 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
720 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
721 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
724 # define YY_REDUCE_PRINT(Rule) \
727 yy_reduce_print (Rule); \
730 /* Nonzero means print parse trace. It is left uninitialized so that
731 multiple parsers can coexist. */
734 # define YYDPRINTF(Args)
735 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
736 # define YY_STACK_PRINT(Bottom, Top)
737 # define YY_REDUCE_PRINT(Rule)
738 #endif /* !YYDEBUG */
741 /* YYINITDEPTH -- initial size of the parser's stacks. */
743 # define YYINITDEPTH 200
746 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
747 if the built-in stack extension method is used).
749 Do not make this value too large; the results are undefined if
750 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
751 evaluated with infinite-precision integer arithmetic. */
754 # define YYMAXDEPTH 10000
762 # if defined (__GLIBC__) && defined (_STRING_H)
763 # define yystrlen strlen
765 /* Return the length of YYSTR. */
767 # if defined (__STDC__) || defined (__cplusplus)
768 yystrlen (const char *yystr
)
774 register const char *yys
= yystr
;
776 while (*yys
++ != '\0')
779 return yys
- yystr
- 1;
785 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
786 # define yystpcpy stpcpy
788 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
791 # if defined (__STDC__) || defined (__cplusplus)
792 yystpcpy (char *yydest
, const char *yysrc
)
794 yystpcpy (yydest
, yysrc
)
799 register char *yyd
= yydest
;
800 register const char *yys
= yysrc
;
802 while ((*yyd
++ = *yys
++) != '\0')
810 #endif /* !YYERROR_VERBOSE */
815 /*--------------------------------.
816 | Print this symbol on YYOUTPUT. |
817 `--------------------------------*/
819 #if defined (__STDC__) || defined (__cplusplus)
821 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
)
824 yysymprint (yyoutput
, yytype
, yyvaluep
)
830 /* Pacify ``unused variable'' warnings. */
833 if (yytype
< YYNTOKENS
)
834 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
836 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
840 if (yytype
< YYNTOKENS
)
841 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
848 YYFPRINTF (yyoutput
, ")");
851 #endif /* ! YYDEBUG */
852 /*-----------------------------------------------.
853 | Release the memory associated to this symbol. |
854 `-----------------------------------------------*/
856 #if defined (__STDC__) || defined (__cplusplus)
858 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
861 yydestruct (yymsg
, yytype
, yyvaluep
)
867 /* Pacify ``unused variable'' warnings. */
872 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
883 /* Prevent warnings from -Wmissing-prototypes. */
886 # if defined (__STDC__) || defined (__cplusplus)
887 int yyparse (void *YYPARSE_PARAM
);
891 #else /* ! YYPARSE_PARAM */
892 #if defined (__STDC__) || defined (__cplusplus)
897 #endif /* ! YYPARSE_PARAM */
909 # if defined (__STDC__) || defined (__cplusplus)
910 int yyparse (void *YYPARSE_PARAM
)
912 int yyparse (YYPARSE_PARAM
)
915 #else /* ! YYPARSE_PARAM */
916 #if defined (__STDC__) || defined (__cplusplus)
926 /* The look-ahead symbol. */
929 /* The semantic value of the look-ahead symbol. */
932 /* Number of syntax errors so far. */
935 register int yystate
;
938 /* Number of tokens to shift before error messages enabled. */
940 /* Look-ahead token as an internal (translated) token number. */
943 /* Three stacks and their tools:
944 `yyss': related to states,
945 `yyvs': related to semantic values,
946 `yyls': related to locations.
948 Refer to the stacks thru separate pointers, to allow yyoverflow
949 to reallocate them elsewhere. */
951 /* The state stack. */
952 short int yyssa
[YYINITDEPTH
];
953 short int *yyss
= yyssa
;
954 register short int *yyssp
;
956 /* The semantic value stack. */
957 YYSTYPE yyvsa
[YYINITDEPTH
];
958 YYSTYPE
*yyvs
= yyvsa
;
959 register YYSTYPE
*yyvsp
;
963 #define YYPOPSTACK (yyvsp--, yyssp--)
965 YYSIZE_T yystacksize
= YYINITDEPTH
;
967 /* The variables used to return semantic value and location from the
972 /* When reducing, the number of symbols on the RHS of the reduced
976 YYDPRINTF ((stderr
, "Starting parse\n"));
981 yychar
= YYEMPTY
; /* Cause a token to be read. */
983 /* Initialize stack pointers.
984 Waste one element of value and location stack
985 so that they stay on the same level as the state stack.
986 The wasted elements are never initialized. */
996 /*------------------------------------------------------------.
997 | yynewstate -- Push a new state, which is found in yystate. |
998 `------------------------------------------------------------*/
1000 /* In all cases, when you get here, the value and location stacks
1001 have just been pushed. so pushing a state here evens the stacks.
1008 if (yyss
+ yystacksize
- 1 <= yyssp
)
1010 /* Get the current used size of the three stacks, in elements. */
1011 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1015 /* Give user a chance to reallocate the stack. Use copies of
1016 these so that the &'s don't force the real ones into
1018 YYSTYPE
*yyvs1
= yyvs
;
1019 short int *yyss1
= yyss
;
1022 /* Each stack pointer address is followed by the size of the
1023 data in use in that stack, in bytes. This used to be a
1024 conditional around just the two extra args, but that might
1025 be undefined if yyoverflow is a macro. */
1026 yyoverflow ("parser stack overflow",
1027 &yyss1
, yysize
* sizeof (*yyssp
),
1028 &yyvs1
, yysize
* sizeof (*yyvsp
),
1035 #else /* no yyoverflow */
1036 # ifndef YYSTACK_RELOCATE
1039 /* Extend the stack our own way. */
1040 if (YYMAXDEPTH
<= yystacksize
)
1043 if (YYMAXDEPTH
< yystacksize
)
1044 yystacksize
= YYMAXDEPTH
;
1047 short int *yyss1
= yyss
;
1048 union yyalloc
*yyptr
=
1049 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1052 YYSTACK_RELOCATE (yyss
);
1053 YYSTACK_RELOCATE (yyvs
);
1055 # undef YYSTACK_RELOCATE
1057 YYSTACK_FREE (yyss1
);
1060 #endif /* no yyoverflow */
1062 yyssp
= yyss
+ yysize
- 1;
1063 yyvsp
= yyvs
+ yysize
- 1;
1066 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1067 (unsigned long int) yystacksize
));
1069 if (yyss
+ yystacksize
- 1 <= yyssp
)
1073 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1082 /* Do appropriate processing given the current state. */
1083 /* Read a look-ahead token if we need one and don't already have one. */
1086 /* First try to decide what to do without reference to look-ahead token. */
1088 yyn
= yypact
[yystate
];
1089 if (yyn
== YYPACT_NINF
)
1092 /* Not known => get a look-ahead token if don't already have one. */
1094 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1095 if (yychar
== YYEMPTY
)
1097 YYDPRINTF ((stderr
, "Reading a token: "));
1101 if (yychar
<= YYEOF
)
1103 yychar
= yytoken
= YYEOF
;
1104 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1108 yytoken
= YYTRANSLATE (yychar
);
1109 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1112 /* If the proper action on seeing token YYTOKEN is to reduce or to
1113 detect an error, take that action. */
1115 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1120 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1129 /* Shift the look-ahead token. */
1130 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1132 /* Discard the token being shifted unless it is eof. */
1133 if (yychar
!= YYEOF
)
1139 /* Count tokens shifted since error; after three, turn off error
1148 /*-----------------------------------------------------------.
1149 | yydefault -- do the default action for the current state. |
1150 `-----------------------------------------------------------*/
1152 yyn
= yydefact
[yystate
];
1158 /*-----------------------------.
1159 | yyreduce -- Do a reduction. |
1160 `-----------------------------*/
1162 /* yyn is the number of a rule to reduce with. */
1165 /* If YYLEN is nonzero, implement the default value of the action:
1168 Otherwise, the following line sets YYVAL to garbage.
1169 This behavior is undocumented and Bison
1170 users should not rely upon it. Assigning to YYVAL
1171 unconditionally makes the parser a bit smaller, and it avoids a
1172 GCC warning that YYVAL may be used uninitialized. */
1173 yyval
= yyvsp
[1-yylen
];
1176 YY_REDUCE_PRINT (yyn
);
1180 #line 177 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1182 if ((yyvsp
[0].exp
) == NULL
)
1184 ((struct parse_args
*) arg
)->res
= (yyvsp
[0].exp
);
1189 #line 185 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1191 (yyval
.exp
) = new_exp_3 (qmop
, (yyvsp
[-4].exp
), (yyvsp
[-2].exp
), (yyvsp
[0].exp
));
1196 #line 189 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1198 (yyval
.exp
) = new_exp_2 (lor
, (yyvsp
[-2].exp
), (yyvsp
[0].exp
));
1203 #line 193 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1205 (yyval
.exp
) = new_exp_2 (land
, (yyvsp
[-2].exp
), (yyvsp
[0].exp
));
1210 #line 197 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1212 (yyval
.exp
) = new_exp_2 ((yyvsp
[-1].op
), (yyvsp
[-2].exp
), (yyvsp
[0].exp
));
1217 #line 201 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1219 (yyval
.exp
) = new_exp_2 ((yyvsp
[-1].op
), (yyvsp
[-2].exp
), (yyvsp
[0].exp
));
1224 #line 205 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1226 (yyval
.exp
) = new_exp_2 ((yyvsp
[-1].op
), (yyvsp
[-2].exp
), (yyvsp
[0].exp
));
1231 #line 209 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1233 (yyval
.exp
) = new_exp_2 ((yyvsp
[-1].op
), (yyvsp
[-2].exp
), (yyvsp
[0].exp
));
1238 #line 213 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1240 (yyval
.exp
) = new_exp_1 (lnot
, (yyvsp
[0].exp
));
1245 #line 217 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1247 (yyval
.exp
) = new_exp_0 (var
);
1252 #line 221 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1254 if (((yyval
.exp
) = new_exp_0 (num
)) != NULL
)
1255 (yyval
.exp
)->val
.num
= (yyvsp
[0].num
);
1260 #line 226 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1262 (yyval
.exp
) = (yyvsp
[-1].exp
);
1269 /* Line 1037 of yacc.c. */
1270 #line 1270 "/usr/src/local/bush/bush-20080814/lib/intl/plural.c"
1276 YY_STACK_PRINT (yyss
, yyssp
);
1281 /* Now `shift' the result of the reduction. Determine what state
1282 that goes to, based on the state we popped back to and the rule
1283 number reduced by. */
1287 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1288 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1289 yystate
= yytable
[yystate
];
1291 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1296 /*------------------------------------.
1297 | yyerrlab -- here on detecting error |
1298 `------------------------------------*/
1300 /* If not already recovering from an error, report this error. */
1305 yyn
= yypact
[yystate
];
1307 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1309 YYSIZE_T yysize
= 0;
1310 int yytype
= YYTRANSLATE (yychar
);
1311 const char* yyprefix
;
1315 /* Start YYX at -YYN if negative to avoid negative indexes in
1317 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1319 /* Stay within bounds of both yycheck and yytname. */
1320 int yychecklim
= YYLAST
- yyn
;
1321 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1324 yyprefix
= ", expecting ";
1325 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1326 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1328 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
1336 yysize
+= (sizeof ("syntax error, unexpected ")
1337 + yystrlen (yytname
[yytype
]));
1338 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1341 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
1342 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1346 yyprefix
= ", expecting ";
1347 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1348 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1350 yyp
= yystpcpy (yyp
, yyprefix
);
1351 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1356 YYSTACK_FREE (yymsg
);
1359 yyerror ("syntax error; also virtual memory exhausted");
1362 #endif /* YYERROR_VERBOSE */
1363 yyerror ("syntax error");
1368 if (yyerrstatus
== 3)
1370 /* If just tried and failed to reuse look-ahead token after an
1371 error, discard it. */
1373 if (yychar
<= YYEOF
)
1375 /* If at end of input, pop the error token,
1376 then the rest of the stack, then return failure. */
1377 if (yychar
== YYEOF
)
1384 yydestruct ("Error: popping",
1385 yystos
[*yyssp
], yyvsp
);
1390 yydestruct ("Error: discarding", yytoken
, &yylval
);
1395 /* Else will try to reuse look-ahead token after shifting the error
1400 /*---------------------------------------------------.
1401 | yyerrorlab -- error raised explicitly by YYERROR. |
1402 `---------------------------------------------------*/
1406 /* Pacify GCC when the user code never invokes YYERROR and the label
1407 yyerrorlab therefore never appears in user code. */
1418 /*-------------------------------------------------------------.
1419 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1420 `-------------------------------------------------------------*/
1422 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1426 yyn
= yypact
[yystate
];
1427 if (yyn
!= YYPACT_NINF
)
1430 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1438 /* Pop the current state because it cannot handle the error token. */
1443 yydestruct ("Error: popping", yystos
[yystate
], yyvsp
);
1446 YY_STACK_PRINT (yyss
, yyssp
);
1455 /* Shift the error token. */
1456 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1462 /*-------------------------------------.
1463 | yyacceptlab -- YYACCEPT comes here. |
1464 `-------------------------------------*/
1469 /*-----------------------------------.
1470 | yyabortlab -- YYABORT comes here. |
1471 `-----------------------------------*/
1473 yydestruct ("Error: discarding lookahead",
1480 /*----------------------------------------------.
1481 | yyoverflowlab -- parser overflow comes here. |
1482 `----------------------------------------------*/
1484 yyerror ("parser stack overflow");
1492 YYSTACK_FREE (yyss
);
1498 #line 231 "/usr/src/local/bush/bush-20080814/lib/intl/plural.y"
1503 FREE_EXPRESSION (exp
)
1504 struct expression
*exp
;
1509 /* Handle the recursive case. */
1513 FREE_EXPRESSION (exp
->val
.args
[2]);
1516 FREE_EXPRESSION (exp
->val
.args
[1]);
1519 FREE_EXPRESSION (exp
->val
.args
[0]);
1534 const char *exp
= *pexp
;
1545 if (exp
[0] != ' ' && exp
[0] != '\t')
1554 case '0': case '1': case '2': case '3': case '4':
1555 case '5': case '6': case '7': case '8': case '9':
1557 unsigned long int n
= result
- '0';
1558 while (exp
[0] >= '0' && exp
[0] <= '9')
1584 lval
->op
= not_equal
;
1591 if (exp
[0] == result
)
1601 lval
->op
= less_or_equal
;
1604 lval
->op
= less_than
;
1612 lval
->op
= greater_or_equal
;
1615 lval
->op
= greater_than
;
1649 /* Nothing, just return the character. */
1655 /* Be safe and let the user call this function again. */
1678 /* Do nothing. We don't print error messages here. */