1 /* A Bison parser, made by GNU Bison 1.875. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* If NAME_PREFIX is specified substitute the variables and functions
50 #define yyparse gettext__parse
51 #define yylex gettext__lex
52 #define yyerror gettext__error
53 #define yylval gettext__lval
54 #define yychar gettext__char
55 #define yydebug gettext__debug
56 #define yynerrs gettext__nerrs
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
81 /* Copy the first part of user declarations. */
84 /* Expression parsing for plural form selection.
85 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
86 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
88 This program is free software; you can redistribute it and/or modify
89 it under the terms of the GNU General Public License as published by
90 the Free Software Foundation; either version 2, or (at your option)
93 This program is distributed in the hope that it will be useful,
94 but WITHOUT ANY WARRANTY; without even the implied warranty of
95 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96 GNU General Public License for more details.
98 You should have received a copy of the GNU General Public License
99 along with this program; if not, write to the Free Software Foundation,
100 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
102 /* The bison generated parser uses alloca. AIX 3 forces us to put this
103 declaration at the beginning of the file. The declaration in bison's
104 skeleton file comes too late. This must come before <config.h>
105 because <config.h> may include arbitrary system headers. */
106 #if defined _AIX && !defined __GNUC__
115 #include "intl/gettext/gettextP.h"
117 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
118 #define YYPARSE_PARAM arg
121 /* Enabling traces. */
126 /* Enabling verbose error messages. */
127 #ifdef YYERROR_VERBOSE
128 # undef YYERROR_VERBOSE
129 # define YYERROR_VERBOSE 1
131 # define YYERROR_VERBOSE 0
134 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
136 typedef union YYSTYPE
{
137 unsigned long int num
;
139 struct expression
*exp
;
141 /* Line 191 of yacc.c. */
143 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
144 # define YYSTYPE_IS_DECLARED 1
145 # define YYSTYPE_IS_TRIVIAL 1
150 /* Copy the second part of user declarations. */
153 /* Prototypes for local functions. */
154 static struct expression
*new_exp(int nargs
, enum operator op
,
155 struct expression
* const *args
);
156 static inline struct expression
*new_exp_0(enum operator op
);
157 static inline struct expression
*new_exp_1(enum operator op
,
158 struct expression
*right
);
159 static struct expression
*new_exp_2(enum operator op
,
160 struct expression
*left
,
161 struct expression
*right
);
162 static inline struct expression
*new_exp_3(enum operator op
,
163 struct expression
*bexp
,
164 struct expression
*tbranch
,
165 struct expression
*fbranch
);
166 static int yylex(YYSTYPE
*lval
, const unsigned char **pexp
);
167 static void yyerror(const unsigned char *str
);
169 /* Allocation of expressions. */
171 static struct expression
*
172 new_exp(int nargs
, enum operator op
, struct expression
* const *args
)
175 struct expression
*newp
;
177 /* If any of the argument could not be malloc'ed, just return NULL. */
178 for (i
= nargs
- 1; i
>= 0; i
--)
182 /* Allocate a new expression. */
183 newp
= (struct expression
*) malloc (sizeof (*newp
));
187 newp
->operation
= op
;
188 for (i
= nargs
- 1; i
>= 0; i
--)
189 newp
->val
.args
[i
] = args
[i
];
194 for (i
= nargs
- 1; i
>= 0; i
--)
195 gettext_free_exp__ (args
[i
]);
200 static inline struct expression
*
201 new_exp_0(enum operator op
)
203 return new_exp (0, op
, NULL
);
206 static inline struct expression
*
207 new_exp_1(enum operator op
, struct expression
*right
)
209 struct expression
*args
[1];
212 return new_exp (1, op
, args
);
215 static struct expression
*
216 new_exp_2(enum operator op
, struct expression
*left
, struct expression
*right
)
218 struct expression
*args
[2];
222 return new_exp (2, op
, args
);
225 static inline struct expression
*
226 new_exp_3(enum operator op
, struct expression
*bexp
, struct expression
*tbranch
,
227 struct expression
*fbranch
)
229 struct expression
*args
[3];
234 return new_exp (3, op
, args
);
239 /* Line 214 of yacc.c. */
242 #if ! defined (yyoverflow) || YYERROR_VERBOSE
244 /* The parser invokes alloca or malloc; define the necessary symbols. */
246 # if YYSTACK_USE_ALLOCA
247 # define YYSTACK_ALLOC alloca
249 # ifndef YYSTACK_USE_ALLOCA
250 # if defined (alloca) || defined (_ALLOCA_H)
251 # define YYSTACK_ALLOC alloca
254 # define YYSTACK_ALLOC __builtin_alloca
260 # ifdef YYSTACK_ALLOC
261 /* Pacify GCC's `empty if-body' warning. */
262 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
264 # if defined (__STDC__) || defined (__cplusplus)
265 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
266 # define YYSIZE_T size_t
268 # define YYSTACK_ALLOC malloc
269 # define YYSTACK_FREE free
271 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
274 #if (! defined (yyoverflow) \
275 && (! defined (__cplusplus) \
276 || (YYSTYPE_IS_TRIVIAL)))
278 /* A type that is properly aligned for any stack member. */
285 /* The size of the maximum gap between one aligned stack and the next. */
286 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
288 /* The size of an array large to enough to hold all stacks, each with
290 # define YYSTACK_BYTES(N) \
291 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
292 + YYSTACK_GAP_MAXIMUM)
294 /* Copy COUNT objects from FROM to TO. The source and destination do
298 # define YYCOPY(To, From, Count) \
299 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
301 # define YYCOPY(To, From, Count) \
304 register YYSIZE_T yyi; \
305 for (yyi = 0; yyi < (Count); yyi++) \
306 (To)[yyi] = (From)[yyi]; \
312 /* Relocate STACK from its old location to the new one. The
313 local variables YYSIZE and YYSTACKSIZE give the old and new number of
314 elements in the stack, and YYPTR gives the new location of the
315 stack. Advance YYPTR to a properly aligned location for the next
317 # define YYSTACK_RELOCATE(Stack) \
320 YYSIZE_T yynewbytes; \
321 YYCOPY (&yyptr->Stack, Stack, yysize); \
322 Stack = &yyptr->Stack; \
323 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
324 yyptr += yynewbytes / sizeof (*yyptr); \
330 #if defined (__STDC__) || defined (__cplusplus)
331 typedef signed char yysigned_char
;
333 typedef short yysigned_char
;
336 /* YYFINAL -- State number of the termination state. */
338 /* YYLAST -- Last index in YYTABLE. */
341 /* YYNTOKENS -- Number of terminals. */
343 /* YYNNTS -- Number of nonterminals. */
345 /* YYNRULES -- Number of rules. */
347 /* YYNRULES -- Number of states. */
350 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
352 #define YYMAXUTOK 262
354 #define YYTRANSLATE(YYX) \
355 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
357 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
358 static const unsigned char yytranslate
[] =
360 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
361 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
363 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
364 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
365 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
366 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
367 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
368 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
369 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
370 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
371 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
372 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
373 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
375 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
376 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
377 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
390 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
392 static const unsigned char yyprhs
[] =
394 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
398 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
399 static const yysigned_char yyrhs
[] =
401 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
402 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
403 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
404 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
405 11, -1, 14, 18, 15, -1
408 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
409 static const unsigned char yyrline
[] =
411 0, 154, 154, 162, 166, 170, 174, 178, 182, 186,
416 #if YYDEBUG || YYERROR_VERBOSE
417 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
418 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
419 static const char *const yytname
[] =
421 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
422 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
423 "$accept", "start", "exp", 0
428 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
430 static const unsigned short yytoknum
[] =
432 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
433 33, 262, 58, 110, 40, 41
437 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
438 static const unsigned char yyr1
[] =
440 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
444 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
445 static const unsigned char yyr2
[] =
447 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
451 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
452 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
453 means the default is an error. */
454 static const unsigned char yydefact
[] =
456 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
457 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
461 /* YYDEFGOTO[NTERM-NUM]. */
462 static const yysigned_char yydefgoto
[] =
467 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
469 #define YYPACT_NINF -10
470 static const yysigned_char yypact
[] =
472 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
473 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
474 45, 18, -2, 14, -10, -9, 36
477 /* YYPGOTO[NTERM-NUM]. */
478 static const yysigned_char yypgoto
[] =
483 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
484 positive, shift that token. If negative, reduce the rule which
485 number is the opposite. If zero, do what YYDEFACT says.
486 If YYTABLE_NINF, syntax error. */
487 #define YYTABLE_NINF -1
488 static const unsigned char yytable
[] =
490 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
491 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
492 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
493 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
494 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
498 static const yysigned_char yycheck
[] =
500 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
501 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
502 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
503 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
504 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
508 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
509 symbol of state STATE-NUM. */
510 static const unsigned char yystos
[] =
512 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
513 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
514 18, 18, 18, 18, 18, 12, 18
517 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
518 # define YYSIZE_T __SIZE_TYPE__
520 #if ! defined (YYSIZE_T) && defined (size_t)
521 # define YYSIZE_T size_t
523 #if ! defined (YYSIZE_T)
524 # if defined (__STDC__) || defined (__cplusplus)
525 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
526 # define YYSIZE_T size_t
529 #if ! defined (YYSIZE_T)
530 # define YYSIZE_T unsigned int
533 #define yyerrok (yyerrstatus = 0)
534 #define yyclearin (yychar = YYEMPTY)
538 #define YYACCEPT goto yyacceptlab
539 #define YYABORT goto yyabortlab
540 #define YYERROR goto yyerrlab1
542 /* Like YYERROR except do call yyerror. This remains here temporarily
543 to ease the transition to the new meaning of YYERROR, for GCC.
544 Once GCC version 2 has supplanted version 1, this can go. */
546 #define YYFAIL goto yyerrlab
548 #define YYRECOVERING() (!!yyerrstatus)
550 #define YYBACKUP(Token, Value) \
552 if (yychar == YYEMPTY && yylen == 1) \
556 yytoken = YYTRANSLATE (yychar); \
562 yyerror ("syntax error: cannot back up");\
568 #define YYERRCODE 256
570 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
573 #ifndef YYLLOC_DEFAULT
574 # define YYLLOC_DEFAULT(Current, Rhs, N) \
575 Current.first_line = Rhs[1].first_line; \
576 Current.first_column = Rhs[1].first_column; \
577 Current.last_line = Rhs[N].last_line; \
578 Current.last_column = Rhs[N].last_column;
581 /* YYLEX -- calling `yylex' with the right arguments. */
584 # define YYLEX yylex (&yylval, YYLEX_PARAM)
586 # define YYLEX yylex (&yylval)
589 /* Enable debugging if requested. */
593 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
594 # define YYFPRINTF fprintf
597 # define YYDPRINTF(Args) \
603 # define YYDSYMPRINT(Args) \
609 # define YYDSYMPRINTF(Title, Token, Value, Location) \
613 YYFPRINTF (stderr, "%s ", Title); \
614 yysymprint (stderr, \
616 YYFPRINTF (stderr, "\n"); \
620 /*------------------------------------------------------------------.
621 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
623 `------------------------------------------------------------------*/
625 #if defined (__STDC__) || defined (__cplusplus)
627 yy_stack_print (short *bottom
, short *top
)
630 yy_stack_print (bottom
, top
)
635 YYFPRINTF (stderr
, "Stack now");
636 for (/* Nothing. */; bottom
<= top
; ++bottom
)
637 YYFPRINTF (stderr
, " %d", *bottom
);
638 YYFPRINTF (stderr
, "\n");
641 # define YY_STACK_PRINT(Bottom, Top) \
644 yy_stack_print ((Bottom), (Top)); \
648 /*------------------------------------------------.
649 | Report that the YYRULE is going to be reduced. |
650 `------------------------------------------------*/
652 #if defined (__STDC__) || defined (__cplusplus)
654 yy_reduce_print (int yyrule
)
657 yy_reduce_print (yyrule
)
662 unsigned int yylineno
= yyrline
[yyrule
];
663 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
664 yyrule
- 1, yylineno
);
665 /* Print the symbols being reduced, and their result. */
666 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
667 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
668 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
671 # define YY_REDUCE_PRINT(Rule) \
674 yy_reduce_print (Rule); \
677 /* Nonzero means print parse trace. It is left uninitialized so that
678 multiple parsers can coexist. */
681 # define YYDPRINTF(Args)
682 # define YYDSYMPRINT(Args)
683 # define YYDSYMPRINTF(Title, Token, Value, Location)
684 # define YY_STACK_PRINT(Bottom, Top)
685 # define YY_REDUCE_PRINT(Rule)
686 #endif /* !YYDEBUG */
689 /* YYINITDEPTH -- initial size of the parser's stacks. */
691 # define YYINITDEPTH 200
694 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
695 if the built-in stack extension method is used).
697 Do not make this value too large; the results are undefined if
698 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
699 evaluated with infinite-precision integer arithmetic. */
706 # define YYMAXDEPTH 10000
714 # if defined (__GLIBC__) && defined (_STRING_H)
715 # define yystrlen strlen
717 /* Return the length of YYSTR. */
719 # if defined (__STDC__) || defined (__cplusplus)
720 yystrlen (const char *yystr
)
726 register const char *yys
= yystr
;
728 while (*yys
++ != '\0')
731 return yys
- yystr
- 1;
737 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
738 # define yystpcpy stpcpy
740 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
743 # if defined (__STDC__) || defined (__cplusplus)
744 yystpcpy (char *yydest
, const char *yysrc
)
746 yystpcpy (yydest
, yysrc
)
751 register char *yyd
= yydest
;
752 register const char *yys
= yysrc
;
754 while ((*yyd
++ = *yys
++) != '\0')
762 #endif /* !YYERROR_VERBOSE */
767 /*--------------------------------.
768 | Print this symbol on YYOUTPUT. |
769 `--------------------------------*/
771 #if defined (__STDC__) || defined (__cplusplus)
773 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
)
776 yysymprint (yyoutput
, yytype
, yyvaluep
)
782 /* Pacify ``unused variable'' warnings. */
785 if (yytype
< YYNTOKENS
)
787 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
789 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
793 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
800 YYFPRINTF (yyoutput
, ")");
803 #endif /* ! YYDEBUG */
804 /*-----------------------------------------------.
805 | Release the memory associated to this symbol. |
806 `-----------------------------------------------*/
808 #if defined (__STDC__) || defined (__cplusplus)
810 yydestruct (int yytype
, YYSTYPE
*yyvaluep
)
813 yydestruct (yytype
, yyvaluep
)
818 /* Pacify ``unused variable'' warnings. */
830 /* Prevent warnings from -Wmissing-prototypes. */
833 # if defined (__STDC__) || defined (__cplusplus)
834 int yyparse (void *YYPARSE_PARAM
);
838 #else /* ! YYPARSE_PARAM */
839 #if defined (__STDC__) || defined (__cplusplus)
844 #endif /* ! YYPARSE_PARAM */
856 # if defined (__STDC__) || defined (__cplusplus)
857 int yyparse (void *YYPARSE_PARAM
)
859 int yyparse (YYPARSE_PARAM
)
862 #else /* ! YYPARSE_PARAM */
863 #if defined (__STDC__) || defined (__cplusplus)
873 /* The lookahead symbol. */
876 /* The semantic value of the lookahead symbol. */
879 /* Number of syntax errors so far. */
882 register int yystate
;
885 /* Number of tokens to shift before error messages enabled. */
887 /* Lookahead token as an internal (translated) token number. */
890 /* Three stacks and their tools:
891 `yyss': related to states,
892 `yyvs': related to semantic values,
893 `yyls': related to locations.
895 Refer to the stacks thru separate pointers, to allow yyoverflow
896 to reallocate them elsewhere. */
898 /* The state stack. */
899 short yyssa
[YYINITDEPTH
];
901 register short *yyssp
;
903 /* The semantic value stack. */
904 YYSTYPE yyvsa
[YYINITDEPTH
];
905 YYSTYPE
*yyvs
= yyvsa
;
906 register YYSTYPE
*yyvsp
;
910 #define YYPOPSTACK (yyvsp--, yyssp--)
912 YYSIZE_T yystacksize
= YYINITDEPTH
;
914 /* The variables used to return semantic value and location from the
919 /* When reducing, the number of symbols on the RHS of the reduced
923 YYDPRINTF ((stderr
, "Starting parse\n"));
928 yychar
= YYEMPTY
; /* Cause a token to be read. */
930 /* Initialize stack pointers.
931 Waste one element of value and location stack
932 so that they stay on the same level as the state stack.
933 The wasted elements are never initialized. */
940 /*------------------------------------------------------------.
941 | yynewstate -- Push a new state, which is found in yystate. |
942 `------------------------------------------------------------*/
944 /* In all cases, when you get here, the value and location stacks
945 have just been pushed. so pushing a state here evens the stacks.
952 if (yyss
+ yystacksize
- 1 <= yyssp
)
954 /* Get the current used size of the three stacks, in elements. */
955 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
959 /* Give user a chance to reallocate the stack. Use copies of
960 these so that the &'s don't force the real ones into
962 YYSTYPE
*yyvs1
= yyvs
;
966 /* Each stack pointer address is followed by the size of the
967 data in use in that stack, in bytes. This used to be a
968 conditional around just the two extra args, but that might
969 be undefined if yyoverflow is a macro. */
970 yyoverflow ("parser stack overflow",
971 &yyss1
, yysize
* sizeof (*yyssp
),
972 &yyvs1
, yysize
* sizeof (*yyvsp
),
979 #else /* no yyoverflow */
980 # ifndef YYSTACK_RELOCATE
983 /* Extend the stack our own way. */
984 if (YYMAXDEPTH
<= yystacksize
)
987 if (YYMAXDEPTH
< yystacksize
)
988 yystacksize
= YYMAXDEPTH
;
992 union yyalloc
*yyptr
=
993 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
996 YYSTACK_RELOCATE (yyss
);
997 YYSTACK_RELOCATE (yyvs
);
999 # undef YYSTACK_RELOCATE
1001 YYSTACK_FREE (yyss1
);
1004 #endif /* no yyoverflow */
1006 yyssp
= yyss
+ yysize
- 1;
1007 yyvsp
= yyvs
+ yysize
- 1;
1010 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1011 (unsigned long int) yystacksize
));
1013 if (yyss
+ yystacksize
- 1 <= yyssp
)
1017 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1026 /* Do appropriate processing given the current state. */
1027 /* Read a lookahead token if we need one and don't already have one. */
1030 /* First try to decide what to do without reference to lookahead token. */
1032 yyn
= yypact
[yystate
];
1033 if (yyn
== YYPACT_NINF
)
1036 /* Not known => get a lookahead token if don't already have one. */
1038 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1039 if (yychar
== YYEMPTY
)
1041 YYDPRINTF ((stderr
, "Reading a token: "));
1045 if (yychar
<= YYEOF
)
1047 yychar
= yytoken
= YYEOF
;
1048 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1052 yytoken
= YYTRANSLATE (yychar
);
1053 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1056 /* If the proper action on seeing token YYTOKEN is to reduce or to
1057 detect an error, take that action. */
1059 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1064 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1073 /* Shift the lookahead token. */
1074 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1076 /* Discard the token being shifted unless it is eof. */
1077 if (yychar
!= YYEOF
)
1083 /* Count tokens shifted since error; after three, turn off error
1092 /*-----------------------------------------------------------.
1093 | yydefault -- do the default action for the current state. |
1094 `-----------------------------------------------------------*/
1096 yyn
= yydefact
[yystate
];
1102 /*-----------------------------.
1103 | yyreduce -- Do a reduction. |
1104 `-----------------------------*/
1106 /* yyn is the number of a rule to reduce with. */
1109 /* If YYLEN is nonzero, implement the default value of the action:
1112 Otherwise, the following line sets YYVAL to garbage.
1113 This behavior is undocumented and Bison
1114 users should not rely upon it. Assigning to YYVAL
1115 unconditionally makes the parser a bit smaller, and it avoids a
1116 GCC warning that YYVAL may be used uninitialized. */
1117 yyval
= yyvsp
[1-yylen
];
1120 YY_REDUCE_PRINT (yyn
);
1124 #line 155 "plural.y"
1126 if (yyvsp
[0].exp
== NULL
)
1128 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
1133 #line 163 "plural.y"
1135 yyval
.exp
= new_exp_3 (qmop
, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1140 #line 167 "plural.y"
1142 yyval
.exp
= new_exp_2 (lor
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1147 #line 171 "plural.y"
1149 yyval
.exp
= new_exp_2 (land
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1154 #line 175 "plural.y"
1156 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1161 #line 179 "plural.y"
1163 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1168 #line 183 "plural.y"
1170 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1175 #line 187 "plural.y"
1177 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1182 #line 191 "plural.y"
1184 yyval
.exp
= new_exp_1 (lnot
, yyvsp
[0].exp
);
1189 #line 195 "plural.y"
1191 yyval
.exp
= new_exp_0 (var
);
1196 #line 199 "plural.y"
1198 if ((yyval
.exp
= new_exp_0 (num
)) != NULL
)
1199 yyval
.exp
->val
.num
= yyvsp
[0].num
;
1204 #line 204 "plural.y"
1206 yyval
.exp
= yyvsp
[-1].exp
;
1213 /* Line 991 of yacc.c. */
1214 #line 1214 "plural.c"
1220 YY_STACK_PRINT (yyss
, yyssp
);
1225 /* Now `shift' the result of the reduction. Determine what state
1226 that goes to, based on the state we popped back to and the rule
1227 number reduced by. */
1231 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1232 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1233 yystate
= yytable
[yystate
];
1235 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1240 /*------------------------------------.
1241 | yyerrlab -- here on detecting error |
1242 `------------------------------------*/
1244 /* If not already recovering from an error, report this error. */
1249 yyn
= yypact
[yystate
];
1251 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1253 YYSIZE_T yysize
= 0;
1254 int yytype
= YYTRANSLATE (yychar
);
1259 /* Start YYX at -YYN if negative to avoid negative indexes in
1261 for (yyx
= yyn
< 0 ? -yyn
: 0;
1262 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1263 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1264 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1265 yysize
+= yystrlen ("syntax error, unexpected ") + 1;
1266 yysize
+= yystrlen (yytname
[yytype
]);
1267 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1270 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
1271 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1276 for (yyx
= yyn
< 0 ? -yyn
: 0;
1277 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1279 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1281 const char *yyq
= ! yycount
? ", expecting " : " or ";
1282 yyp
= yystpcpy (yyp
, yyq
);
1283 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1288 YYSTACK_FREE (yymsg
);
1291 yyerror ("syntax error; also virtual memory exhausted");
1294 #endif /* YYERROR_VERBOSE */
1295 yyerror ("syntax error");
1300 if (yyerrstatus
== 3)
1302 /* If just tried and failed to reuse lookahead token after an
1303 error, discard it. */
1305 /* Return failure if at end of input. */
1306 if (yychar
== YYEOF
)
1308 /* Pop the error token. */
1310 /* Pop the rest of the stack. */
1311 while (yyss
< yyssp
)
1313 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1314 yydestruct (yystos
[*yyssp
], yyvsp
);
1320 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
1321 yydestruct (yytoken
, &yylval
);
1326 /* Else will try to reuse lookahead token after shifting the error
1331 /*----------------------------------------------------.
1332 | yyerrlab1 -- error raised explicitly by an action. |
1333 `----------------------------------------------------*/
1336 /* Suppress GCC warning that yyerrlab1 is unused when no action
1338 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1339 /* but it's harmful in C++ code
1340 * (gcc 3.2.1 complained about erroneous yylerrsp declaration) */
1341 # ifndef __cplusplus
1342 __attribute__ ((__unused__
))
1350 /*---------------------------------------------------------------.
1351 | yyerrlab2 -- pop states until the error token can be shifted. |
1352 `---------------------------------------------------------------*/
1354 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1358 yyn
= yypact
[yystate
];
1359 if (yyn
!= YYPACT_NINF
)
1362 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1370 /* Pop the current state because it cannot handle the error token. */
1374 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1375 yydestruct (yystos
[yystate
], yyvsp
);
1379 YY_STACK_PRINT (yyss
, yyssp
);
1385 YYDPRINTF ((stderr
, "Shifting error token, "));
1394 /*-------------------------------------.
1395 | yyacceptlab -- YYACCEPT comes here. |
1396 `-------------------------------------*/
1401 /*-----------------------------------.
1402 | yyabortlab -- YYABORT comes here. |
1403 `-----------------------------------*/
1409 /*----------------------------------------------.
1410 | yyoverflowlab -- parser overflow comes here. |
1411 `----------------------------------------------*/
1413 yyerror ("parser stack overflow");
1421 YYSTACK_FREE (yyss
);
1427 #line 209 "plural.y"
1431 gettext_free_exp__(struct expression
*exp
)
1436 /* Handle the recursive case. */
1440 gettext_free_exp__ (exp
->val
.args
[2]);
1443 gettext_free_exp__ (exp
->val
.args
[1]);
1446 gettext_free_exp__ (exp
->val
.args
[0]);
1457 yylex(YYSTYPE
*lval
, const unsigned char **pexp
)
1459 const unsigned char *exp
= *pexp
;
1470 if (exp
[0] != ' ' && exp
[0] != '\t')
1479 case '0': case '1': case '2': case '3': case '4':
1480 case '5': case '6': case '7': case '8': case '9':
1482 unsigned long int n
= result
- '0';
1483 while (exp
[0] >= '0' && exp
[0] <= '9')
1509 lval
->op
= not_equal
;
1516 if (exp
[0] == result
)
1526 lval
->op
= less_or_equal
;
1529 lval
->op
= less_than
;
1537 lval
->op
= greater_or_equal
;
1540 lval
->op
= greater_than
;
1574 /* Nothing, just return the character. */
1580 /* Be safe and let the user call this function again. */
1600 yyerror(const unsigned char *str
)
1602 /* Do nothing. We don't print error messages here. */