1 /* A Bison parser, made from plural.y
4 #define YYBISON 1 /* Identify Bison output. */
6 #define yyparse __gettextparse
7 #define yylex __gettextlex
8 #define yyerror __gettexterror
9 #define yylval __gettextlval
10 #define yychar __gettextchar
11 #define yydebug __gettextdebug
12 #define yynerrs __gettextnerrs
21 /* Expression parsing for plural form selection.
22 Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
23 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
25 This program is free software; you can redistribute it and/or modify it
26 under the terms of the GNU Library General Public License as published
27 by the Free Software Foundation; either version 2, or (at your option)
30 This program is distributed in the hope that it will be useful,
31 but WITHOUT ANY WARRANTY; without even the implied warranty of
32 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 Library General Public License for more details.
35 You should have received a copy of the GNU Library General Public
36 License along with this program; if not, write to the Free Software
37 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
40 /* The bison generated parser uses alloca. AIX 3 forces us to put this
41 declaration at the beginning of the file. The declaration in bison's
42 skeleton file comes too late. This must come before <config.h>
43 because <config.h> may include arbitrary system headers. */
44 #if defined _AIX && !defined __GNUC__
54 #include "plural-exp.h"
56 /* The main function generated by the parser is called __gettextparse,
57 but we want it to be called PLURAL_PARSE. */
59 # define __gettextparse PLURAL_PARSE
62 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
63 #define YYPARSE_PARAM arg
68 unsigned long int num
;
70 struct expression
*exp
;
72 # define YYSTYPE yystype
73 # define YYSTYPE_IS_TRIVIAL 1
77 /* Prototypes for local functions. */
78 static int yylex (YYSTYPE
*lval
, const char **pexp
);
79 static void yyerror (const char *str
);
81 /* Allocation of expressions. */
83 static struct expression
*
84 new_exp (int nargs
, enum operator op
, struct expression
* const *args
)
87 struct expression
*newp
;
89 /* If any of the argument could not be malloc'ed, just return NULL. */
90 for (i
= nargs
- 1; i
>= 0; i
--)
94 /* Allocate a new expression. */
95 newp
= (struct expression
*) malloc (sizeof (*newp
));
100 for (i
= nargs
- 1; i
>= 0; i
--)
101 newp
->val
.args
[i
] = args
[i
];
106 for (i
= nargs
- 1; i
>= 0; i
--)
107 FREE_EXPRESSION (args
[i
]);
112 static inline struct expression
*
113 new_exp_0 (enum operator op
)
115 return new_exp (0, op
, NULL
);
118 static inline struct expression
*
119 new_exp_1 (enum operator op
, struct expression
*right
)
121 struct expression
*args
[1];
124 return new_exp (1, op
, args
);
127 static struct expression
*
128 new_exp_2 (enum operator op
, struct expression
*left
, struct expression
*right
)
130 struct expression
*args
[2];
134 return new_exp (2, op
, args
);
137 static inline struct expression
*
138 new_exp_3 (enum operator op
, struct expression
*bexp
,
139 struct expression
*tbranch
, struct expression
*fbranch
)
141 struct expression
*args
[3];
146 return new_exp (3, op
, args
);
156 #define YYFLAG -32768
159 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
160 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
162 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
163 static const char yytranslate
[] =
165 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
166 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
167 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
168 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
169 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
170 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
171 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
172 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
173 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
174 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
176 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
177 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
180 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 2, 2, 2, 2, 1, 6, 7, 8,
195 static const short yyprhs
[] =
197 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
200 static const short yyrhs
[] =
202 17, 0, 17, 3, 17, 12, 17, 0, 17, 4,
203 17, 0, 17, 5, 17, 0, 17, 6, 17, 0,
204 17, 7, 17, 0, 17, 8, 17, 0, 17, 9,
205 17, 0, 10, 17, 0, 13, 0, 11, 0, 14,
212 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
213 static const short yyrline
[] =
215 0, 150, 158, 162, 166, 170, 174, 178, 182, 186,
221 #if (YYDEBUG) || defined YYERROR_VERBOSE
223 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
224 static const char *const yytname
[] =
226 "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
227 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
232 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
233 static const short yyr1
[] =
235 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
239 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
240 static const short yyr2
[] =
242 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
246 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
247 doesn't specify something else to do. Zero means the default is an
249 static const short yydefact
[] =
251 0, 0, 11, 10, 0, 1, 9, 0, 0, 0,
252 0, 0, 0, 0, 0, 12, 0, 3, 4, 5,
253 6, 7, 8, 0, 2, 0, 0, 0
256 static const short yydefgoto
[] =
261 static const short yypact
[] =
263 -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9,
264 -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16,
265 26, -3,-32768, -9, 34, 21, 53,-32768
268 static const short yypgoto
[] =
277 static const short yytable
[] =
279 6, 1, 2, 7, 3, 4, 14, 16, 17, 18,
280 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
281 14, 26, 24, 12, 13, 14, 15, 8, 9, 10,
282 11, 12, 13, 14, 13, 14, 23, 8, 9, 10,
283 11, 12, 13, 14, 10, 11, 12, 13, 14, 11,
287 static const short yycheck
[] =
289 1, 10, 11, 4, 13, 14, 9, 8, 9, 10,
290 11, 12, 13, 14, 3, 4, 5, 6, 7, 8,
291 9, 0, 23, 7, 8, 9, 15, 3, 4, 5,
292 6, 7, 8, 9, 8, 9, 12, 3, 4, 5,
293 6, 7, 8, 9, 5, 6, 7, 8, 9, 6,
298 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
299 #line 3 "/usr/local/share/bison/bison.simple"
301 /* Skeleton output parser for bison,
303 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
306 This program is free software; you can redistribute it and/or modify
307 it under the terms of the GNU General Public License as published by
308 the Free Software Foundation; either version 2, or (at your option)
311 This program is distributed in the hope that it will be useful,
312 but WITHOUT ANY WARRANTY; without even the implied warranty of
313 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
314 GNU General Public License for more details.
316 You should have received a copy of the GNU General Public License
317 along with this program; if not, write to the Free Software
318 Foundation, Inc., 51 Franklin Street, Fifth Floor,
319 Boston, MA 02110-1301, USA. */
321 /* As a special exception, when this file is copied by Bison into a
322 Bison output file, you may use that output file without restriction.
323 This special exception was added by the Free Software Foundation
324 in version 1.24 of Bison. */
326 /* This is the parser code that is written into each bison parser when
327 the %semantic_parser declaration is not specified in the grammar.
328 It was written by Richard Stallman by simplifying the hairy parser
329 used when %semantic_parser is specified. */
331 /* All symbols defined below should begin with yy or YY, to avoid
332 infringing on user name space. This should be done even for local
333 variables, as they might otherwise be expanded by user macros.
334 There are some unavoidable exceptions within include files to
335 define necessary library symbols; they are noted "INFRINGES ON
336 USER NAME SPACE" below. */
338 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
340 /* The parser invokes alloca or malloc; define the necessary symbols. */
342 # if YYSTACK_USE_ALLOCA
343 # define YYSTACK_ALLOC alloca
345 # ifndef YYSTACK_USE_ALLOCA
346 # if defined (alloca) || defined (_ALLOCA_H)
347 # define YYSTACK_ALLOC alloca
350 # define YYSTACK_ALLOC __builtin_alloca
356 # ifdef YYSTACK_ALLOC
357 /* Pacify GCC's `empty if-body' warning. */
358 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
360 # if defined (__STDC__) || defined (__cplusplus)
361 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
362 # define YYSIZE_T size_t
364 # define YYSTACK_ALLOC malloc
365 # define YYSTACK_FREE free
367 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
370 #if (! defined (yyoverflow) \
371 && (! defined (__cplusplus) \
372 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
374 /* A type that is properly aligned for any stack member. */
384 /* The size of the maximum gap between one aligned stack and the next. */
385 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
387 /* The size of an array large to enough to hold all stacks, each with
390 # define YYSTACK_BYTES(N) \
391 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
392 + 2 * YYSTACK_GAP_MAX)
394 # define YYSTACK_BYTES(N) \
395 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
399 /* Copy COUNT objects from FROM to TO. The source and destination do
403 # define YYCOPY(To, From, Count) \
404 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
406 # define YYCOPY(To, From, Count) \
409 register YYSIZE_T yyi; \
410 for (yyi = 0; yyi < (Count); yyi++) \
411 (To)[yyi] = (From)[yyi]; \
417 /* Relocate STACK from its old location to the new one. The
418 local variables YYSIZE and YYSTACKSIZE give the old and new number of
419 elements in the stack, and YYPTR gives the new location of the
420 stack. Advance YYPTR to a properly aligned location for the next
422 # define YYSTACK_RELOCATE(Stack) \
425 YYSIZE_T yynewbytes; \
426 YYCOPY (&yyptr->Stack, Stack, yysize); \
427 Stack = &yyptr->Stack; \
428 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
429 yyptr += yynewbytes / sizeof (*yyptr); \
436 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
437 # define YYSIZE_T __SIZE_TYPE__
439 #if ! defined (YYSIZE_T) && defined (size_t)
440 # define YYSIZE_T size_t
442 #if ! defined (YYSIZE_T)
443 # if defined (__STDC__) || defined (__cplusplus)
444 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
445 # define YYSIZE_T size_t
448 #if ! defined (YYSIZE_T)
449 # define YYSIZE_T unsigned int
452 #define yyerrok (yyerrstatus = 0)
453 #define yyclearin (yychar = YYEMPTY)
456 #define YYACCEPT goto yyacceptlab
457 #define YYABORT goto yyabortlab
458 #define YYERROR goto yyerrlab1
459 /* Like YYERROR except do call yyerror. This remains here temporarily
460 to ease the transition to the new meaning of YYERROR, for GCC.
461 Once GCC version 2 has supplanted version 1, this can go. */
462 #define YYFAIL goto yyerrlab
463 #define YYRECOVERING() (!!yyerrstatus)
464 #define YYBACKUP(Token, Value) \
466 if (yychar == YYEMPTY && yylen == 1) \
470 yychar1 = YYTRANSLATE (yychar); \
476 yyerror ("syntax error: cannot back up"); \
482 #define YYERRCODE 256
485 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
488 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
489 first token. By default, to implement support for ranges, extend
490 its range to the last symbol. */
492 #ifndef YYLLOC_DEFAULT
493 # define YYLLOC_DEFAULT(Current, Rhs, N) \
494 Current.last_line = Rhs[N].last_line; \
495 Current.last_column = Rhs[N].last_column;
499 /* YYLEX -- calling `yylex' with the right arguments. */
504 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
506 # define YYLEX yylex (&yylval, &yylloc)
508 # else /* !YYLSP_NEEDED */
510 # define YYLEX yylex (&yylval, YYLEX_PARAM)
512 # define YYLEX yylex (&yylval)
514 # endif /* !YYLSP_NEEDED */
516 # define YYLEX yylex ()
520 /* Enable debugging if requested. */
524 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
525 # define YYFPRINTF fprintf
528 # define YYDPRINTF(Args) \
533 /* Nonzero means print parse trace. It is left uninitialized so that
534 multiple parsers can coexist. */
537 # define YYDPRINTF(Args)
538 #endif /* !YYDEBUG */
540 /* YYINITDEPTH -- initial size of the parser's stacks. */
542 # define YYINITDEPTH 200
545 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
546 if the built-in stack extension method is used).
548 Do not make this value too large; the results are undefined if
549 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
550 evaluated with infinite-precision integer arithmetic. */
557 # define YYMAXDEPTH 10000
560 #ifdef YYERROR_VERBOSE
563 # if defined (__GLIBC__) && defined (_STRING_H)
564 # define yystrlen strlen
566 /* Return the length of YYSTR. */
568 # if defined (__STDC__) || defined (__cplusplus)
569 yystrlen (const char *yystr
)
575 register const char *yys
= yystr
;
577 while (*yys
++ != '\0')
580 return yys
- yystr
- 1;
586 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
587 # define yystpcpy stpcpy
589 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
592 # if defined (__STDC__) || defined (__cplusplus)
593 yystpcpy (char *yydest
, const char *yysrc
)
595 yystpcpy (yydest
, yysrc
)
600 register char *yyd
= yydest
;
601 register const char *yys
= yysrc
;
603 while ((*yyd
++ = *yys
++) != '\0')
612 #line 315 "/usr/local/share/bison/bison.simple"
615 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
616 into yyparse. The argument should have type void *.
617 It should actually point to an object.
618 Grammar actions can access the variable by casting it
619 to the proper pointer type. */
622 # if defined (__STDC__) || defined (__cplusplus)
623 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
624 # define YYPARSE_PARAM_DECL
626 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
627 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
629 #else /* !YYPARSE_PARAM */
630 # define YYPARSE_PARAM_ARG
631 # define YYPARSE_PARAM_DECL
632 #endif /* !YYPARSE_PARAM */
634 /* Prevent warning if -Wstrict-prototypes. */
636 # ifdef YYPARSE_PARAM
637 int yyparse (void *);
643 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
644 variables are global, or local to YYPARSE. */
646 #define YY_DECL_NON_LSP_VARIABLES \
647 /* The lookahead symbol. */ \
650 /* The semantic value of the lookahead symbol. */ \
653 /* Number of parse errors so far. */ \
657 # define YY_DECL_VARIABLES \
658 YY_DECL_NON_LSP_VARIABLES \
660 /* Location data for the lookahead symbol. */ \
663 # define YY_DECL_VARIABLES \
664 YY_DECL_NON_LSP_VARIABLES
668 /* If nonreentrant, generate the variables here. */
675 yyparse (YYPARSE_PARAM_ARG
)
678 /* If reentrant, generate the variables here. */
683 register int yystate
;
686 /* Number of tokens to shift before error messages enabled. */
688 /* Lookahead token as an internal (translated) token number. */
691 /* Three stacks and their tools:
692 `yyss': related to states,
693 `yyvs': related to semantic values,
694 `yyls': related to locations.
696 Refer to the stacks thru separate pointers, to allow yyoverflow
697 to reallocate them elsewhere. */
699 /* The state stack. */
700 short yyssa
[YYINITDEPTH
];
702 register short *yyssp
;
704 /* The semantic value stack. */
705 YYSTYPE yyvsa
[YYINITDEPTH
];
706 YYSTYPE
*yyvs
= yyvsa
;
707 register YYSTYPE
*yyvsp
;
710 /* The location stack. */
711 YYLTYPE yylsa
[YYINITDEPTH
];
712 YYLTYPE
*yyls
= yylsa
;
717 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
719 # define YYPOPSTACK (yyvsp--, yyssp--)
722 YYSIZE_T yystacksize
= YYINITDEPTH
;
725 /* The variables used to return semantic value and location from the
732 /* When reducing, the number of symbols on the RHS of the reduced
736 YYDPRINTF ((stderr
, "Starting parse\n"));
741 yychar
= YYEMPTY
; /* Cause a token to be read. */
743 /* Initialize stack pointers.
744 Waste one element of value and location stack
745 so that they stay on the same level as the state stack.
746 The wasted elements are never initialized. */
755 /*------------------------------------------------------------.
756 | yynewstate -- Push a new state, which is found in yystate. |
757 `------------------------------------------------------------*/
759 /* In all cases, when you get here, the value and location stacks
760 have just been pushed. so pushing a state here evens the stacks.
767 if (yyssp
>= yyss
+ yystacksize
- 1)
769 /* Get the current used size of the three stacks, in elements. */
770 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
774 /* Give user a chance to reallocate the stack. Use copies of
775 these so that the &'s don't force the real ones into
777 YYSTYPE
*yyvs1
= yyvs
;
780 /* Each stack pointer address is followed by the size of the
781 data in use in that stack, in bytes. */
783 YYLTYPE
*yyls1
= yyls
;
784 /* This used to be a conditional around just the two extra args,
785 but that might be undefined if yyoverflow is a macro. */
786 yyoverflow ("parser stack overflow",
787 &yyss1
, yysize
* sizeof (*yyssp
),
788 &yyvs1
, yysize
* sizeof (*yyvsp
),
789 &yyls1
, yysize
* sizeof (*yylsp
),
793 yyoverflow ("parser stack overflow",
794 &yyss1
, yysize
* sizeof (*yyssp
),
795 &yyvs1
, yysize
* sizeof (*yyvsp
),
801 #else /* no yyoverflow */
802 # ifndef YYSTACK_RELOCATE
805 /* Extend the stack our own way. */
806 if (yystacksize
>= YYMAXDEPTH
)
809 if (yystacksize
> YYMAXDEPTH
)
810 yystacksize
= YYMAXDEPTH
;
814 union yyalloc
*yyptr
=
815 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
818 YYSTACK_RELOCATE (yyss
);
819 YYSTACK_RELOCATE (yyvs
);
821 YYSTACK_RELOCATE (yyls
);
823 # undef YYSTACK_RELOCATE
825 YYSTACK_FREE (yyss1
);
828 #endif /* no yyoverflow */
830 yyssp
= yyss
+ yysize
- 1;
831 yyvsp
= yyvs
+ yysize
- 1;
833 yylsp
= yyls
+ yysize
- 1;
836 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
837 (unsigned long int) yystacksize
));
839 if (yyssp
>= yyss
+ yystacksize
- 1)
843 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
853 /* Do appropriate processing given the current state. */
854 /* Read a lookahead token if we need one and don't already have one. */
857 /* First try to decide what to do without reference to lookahead token. */
859 yyn
= yypact
[yystate
];
863 /* Not known => get a lookahead token if don't already have one. */
865 /* yychar is either YYEMPTY or YYEOF
866 or a valid token in external form. */
868 if (yychar
== YYEMPTY
)
870 YYDPRINTF ((stderr
, "Reading a token: "));
874 /* Convert token to internal form (in yychar1) for indexing tables with */
876 if (yychar
<= 0) /* This means end of input. */
879 yychar
= YYEOF
; /* Don't call YYLEX any more */
881 YYDPRINTF ((stderr
, "Now at end of input.\n"));
885 yychar1
= YYTRANSLATE (yychar
);
888 /* We have to keep this `#if YYDEBUG', since we use variables
889 which are defined only if `YYDEBUG' is set. */
892 YYFPRINTF (stderr
, "Next token is %d (%s",
893 yychar
, yytname
[yychar1
]);
894 /* Give the individual parser a way to print the precise
895 meaning of a token, for further debugging info. */
897 YYPRINT (stderr
, yychar
, yylval
);
899 YYFPRINTF (stderr
, ")\n");
905 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
910 /* yyn is what to do for this token type in this state.
911 Negative => reduce, -yyn is rule number.
912 Positive => shift, yyn is new state.
913 New state is final state => don't bother to shift,
915 0, or most negative number => error. */
930 /* Shift the lookahead token. */
931 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
932 yychar
, yytname
[yychar1
]));
934 /* Discard the token being shifted unless it is eof. */
943 /* Count tokens shifted since error; after three, turn off error
952 /*-----------------------------------------------------------.
953 | yydefault -- do the default action for the current state. |
954 `-----------------------------------------------------------*/
956 yyn
= yydefact
[yystate
];
962 /*-----------------------------.
963 | yyreduce -- Do a reduction. |
964 `-----------------------------*/
966 /* yyn is the number of a rule to reduce with. */
969 /* If YYLEN is nonzero, implement the default value of the action:
972 Otherwise, the following line sets YYVAL to the semantic value of
973 the lookahead token. This behavior is undocumented and Bison
974 users should not rely upon it. Assigning to YYVAL
975 unconditionally makes the parser a bit smaller, and it avoids a
976 GCC warning that YYVAL may be used uninitialized. */
977 yyval
= yyvsp
[1-yylen
];
980 /* Similarly for the default location. Let the user run additional
981 commands if for instance locations are ranges. */
982 yyloc
= yylsp
[1-yylen
];
983 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
987 /* We have to keep this `#if YYDEBUG', since we use variables which
988 are defined only if `YYDEBUG' is set. */
993 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
996 /* Print the symbols being reduced, and their result. */
997 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] > 0; yyi
++)
998 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
999 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1006 #line 151 "plural.y"
1008 if (yyvsp
[0].exp
== NULL
)
1010 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
1014 #line 159 "plural.y"
1016 yyval
.exp
= new_exp_3 (qmop
, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1020 #line 163 "plural.y"
1022 yyval
.exp
= new_exp_2 (lor
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1026 #line 167 "plural.y"
1028 yyval
.exp
= new_exp_2 (land
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1032 #line 171 "plural.y"
1034 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1038 #line 175 "plural.y"
1040 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1044 #line 179 "plural.y"
1046 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1050 #line 183 "plural.y"
1052 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1056 #line 187 "plural.y"
1058 yyval
.exp
= new_exp_1 (lnot
, yyvsp
[0].exp
);
1062 #line 191 "plural.y"
1064 yyval
.exp
= new_exp_0 (var
);
1068 #line 195 "plural.y"
1070 if ((yyval
.exp
= new_exp_0 (num
)) != NULL
)
1071 yyval
.exp
->val
.num
= yyvsp
[0].num
;
1075 #line 200 "plural.y"
1077 yyval
.exp
= yyvsp
[-1].exp
;
1082 #line 705 "/usr/local/share/bison/bison.simple"
1094 short *yyssp1
= yyss
- 1;
1095 YYFPRINTF (stderr
, "state stack now");
1096 while (yyssp1
!= yyssp
)
1097 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1098 YYFPRINTF (stderr
, "\n");
1107 /* Now `shift' the result of the reduction. Determine what state
1108 that goes to, based on the state we popped back to and the rule
1109 number reduced by. */
1113 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1114 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1115 yystate
= yytable
[yystate
];
1117 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1122 /*------------------------------------.
1123 | yyerrlab -- here on detecting error |
1124 `------------------------------------*/
1126 /* If not already recovering from an error, report this error. */
1131 #ifdef YYERROR_VERBOSE
1132 yyn
= yypact
[yystate
];
1134 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1136 YYSIZE_T yysize
= 0;
1141 /* Start YYX at -YYN if negative to avoid negative indexes in
1143 for (yyx
= yyn
< 0 ? -yyn
: 0;
1144 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1145 if (yycheck
[yyx
+ yyn
] == yyx
)
1146 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1147 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1148 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1149 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1152 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1153 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1158 for (yyx
= yyn
< 0 ? -yyn
: 0;
1159 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1161 if (yycheck
[yyx
+ yyn
] == yyx
)
1163 const char *yyq
= ! yycount
? ", expecting " : " or ";
1164 yyp
= yystpcpy (yyp
, yyq
);
1165 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1170 YYSTACK_FREE (yymsg
);
1173 yyerror ("parse error; also virtual memory exhausted");
1176 #endif /* defined (YYERROR_VERBOSE) */
1177 yyerror ("parse error");
1182 /*--------------------------------------------------.
1183 | yyerrlab1 -- error raised explicitly by an action |
1184 `--------------------------------------------------*/
1186 if (yyerrstatus
== 3)
1188 /* If just tried and failed to reuse lookahead token after an
1189 error, discard it. */
1191 /* return failure if at end of input */
1192 if (yychar
== YYEOF
)
1194 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1195 yychar
, yytname
[yychar1
]));
1199 /* Else will try to reuse lookahead token after shifting the error
1202 yyerrstatus
= 3; /* Each real token shifted decrements this */
1207 /*-------------------------------------------------------------------.
1208 | yyerrdefault -- current state does not do anything special for the |
1210 `-------------------------------------------------------------------*/
1213 /* This is wrong; only states that explicitly want error tokens
1214 should shift them. */
1216 /* If its default is to accept any token, ok. Otherwise pop it. */
1217 yyn
= yydefact
[yystate
];
1223 /*---------------------------------------------------------------.
1224 | yyerrpop -- pop the current state because it cannot handle the |
1226 `---------------------------------------------------------------*/
1239 short *yyssp1
= yyss
- 1;
1240 YYFPRINTF (stderr
, "Error: state stack now");
1241 while (yyssp1
!= yyssp
)
1242 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1243 YYFPRINTF (stderr
, "\n");
1251 yyn
= yypact
[yystate
];
1256 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1273 YYDPRINTF ((stderr
, "Shifting error token, "));
1284 /*-------------------------------------.
1285 | yyacceptlab -- YYACCEPT comes here. |
1286 `-------------------------------------*/
1291 /*-----------------------------------.
1292 | yyabortlab -- YYABORT comes here. |
1293 `-----------------------------------*/
1298 /*---------------------------------------------.
1299 | yyoverflowab -- parser overflow comes here. |
1300 `---------------------------------------------*/
1302 yyerror ("parser stack overflow");
1309 YYSTACK_FREE (yyss
);
1313 #line 205 "plural.y"
1318 FREE_EXPRESSION (struct expression
*exp
)
1323 /* Handle the recursive case. */
1327 FREE_EXPRESSION (exp
->val
.args
[2]);
1330 FREE_EXPRESSION (exp
->val
.args
[1]);
1333 FREE_EXPRESSION (exp
->val
.args
[0]);
1344 yylex (YYSTYPE
*lval
, const char **pexp
)
1346 const char *exp
= *pexp
;
1357 if (exp
[0] != ' ' && exp
[0] != '\t')
1366 case '0': case '1': case '2': case '3': case '4':
1367 case '5': case '6': case '7': case '8': case '9':
1369 unsigned long int n
= result
- '0';
1370 while (exp
[0] >= '0' && exp
[0] <= '9')
1396 lval
->op
= not_equal
;
1403 if (exp
[0] == result
)
1413 lval
->op
= less_or_equal
;
1416 lval
->op
= less_than
;
1424 lval
->op
= greater_or_equal
;
1427 lval
->op
= greater_than
;
1461 /* Nothing, just return the character. */
1467 /* Be safe and let the user call this function again. */
1487 yyerror (const char *str
)
1489 /* Do nothing. We don't print error messages here. */