f9a8faa783883269f35e7c6becfdf93da07bdaba
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-2020 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
63 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
64 #define YYPARSE_PARAM arg
70 unsigned long int num
;
72 struct expression
*exp
;
74 # define YYSTYPE yystype
75 # define YYSTYPE_IS_TRIVIAL 1
79 /* Prototypes for local functions. */
80 static struct expression
*new_exp
PARAMS ((int nargs
, enum operator op
,
81 struct expression
* const *args
));
82 static inline struct expression
*new_exp_0
PARAMS ((enum operator op
));
83 static inline struct expression
*new_exp_1
PARAMS ((enum operator op
,
84 struct expression
*right
));
85 static struct expression
*new_exp_2
PARAMS ((enum operator op
,
86 struct expression
*left
,
87 struct expression
*right
));
88 static inline struct expression
*new_exp_3
PARAMS ((enum operator op
,
89 struct expression
*bexp
,
90 struct expression
*tbranch
,
91 struct expression
*fbranch
));
93 static int yylex
PARAMS ((YYSTYPE
*lval
, struct parse_args
*arg
));
94 static void yyerror
PARAMS ((struct parse_args
*arg
, const char *str
));
96 static int yylex
PARAMS ((YYSTYPE
*lval
, const char **pexp
));
97 static void yyerror
PARAMS ((const char *str
));
100 /* Allocation of expressions. */
102 static struct expression
*
103 new_exp (nargs
, op
, args
)
106 struct expression
* const *args
;
109 struct expression
*newp
;
111 /* If any of the argument could not be malloc'ed, just return NULL. */
112 for (i
= nargs
- 1; i
>= 0; i
--)
116 /* Allocate a new expression. */
117 newp
= (struct expression
*) malloc (sizeof (*newp
));
121 newp
->operation
= op
;
122 for (i
= nargs
- 1; i
>= 0; i
--)
123 newp
->val
.args
[i
] = args
[i
];
128 for (i
= nargs
- 1; i
>= 0; i
--)
129 FREE_EXPRESSION (args
[i
]);
134 static inline struct expression
*
138 return new_exp (0, op
, NULL
);
141 static inline struct expression
*
142 new_exp_1 (op
, right
)
144 struct expression
*right
;
146 struct expression
*args
[1];
149 return new_exp (1, op
, args
);
152 static struct expression
*
153 new_exp_2 (op
, left
, right
)
155 struct expression
*left
;
156 struct expression
*right
;
158 struct expression
*args
[2];
162 return new_exp (2, op
, args
);
165 static inline struct expression
*
166 new_exp_3 (op
, bexp
, tbranch
, fbranch
)
168 struct expression
*bexp
;
169 struct expression
*tbranch
;
170 struct expression
*fbranch
;
172 struct expression
*args
[3];
177 return new_exp (3, op
, args
);
187 #define YYFLAG -32768
190 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
191 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
193 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
194 static const char yytranslate
[] =
196 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
200 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
202 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
207 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
208 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
212 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
215 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
216 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
217 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
218 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
219 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
220 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
221 2, 2, 2, 2, 2, 2, 1, 6, 7, 8,
226 static const short yyprhs
[] =
228 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
231 static const short yyrhs
[] =
233 17, 0, 17, 3, 17, 12, 17, 0, 17, 4,
234 17, 0, 17, 5, 17, 0, 17, 6, 17, 0,
235 17, 7, 17, 0, 17, 8, 17, 0, 17, 9,
236 17, 0, 10, 17, 0, 13, 0, 11, 0, 14,
243 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
244 static const short yyrline
[] =
246 0, 184, 192, 196, 200, 204, 208, 212, 216, 220,
252 #if (YYDEBUG) || defined YYERROR_VERBOSE
254 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
255 static const char *const yytname
[] =
257 "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
258 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
263 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
264 static const short yyr1
[] =
266 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
270 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
271 static const short yyr2
[] =
273 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
277 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
278 doesn't specify something else to do. Zero means the default is an
280 static const short yydefact
[] =
282 0, 0, 11, 10, 0, 1, 9, 0, 0, 0,
283 0, 0, 0, 0, 0, 12, 0, 3, 4, 5,
284 6, 7, 8, 0, 2, 0, 0, 0
287 static const short yydefgoto
[] =
292 static const short yypact
[] =
294 -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9,
295 -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16,
296 26, -3,-32768, -9, 34, 21, 53,-32768
299 static const short yypgoto
[] =
308 static const short yytable
[] =
310 6, 1, 2, 7, 3, 4, 14, 16, 17, 18,
311 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
312 14, 26, 24, 12, 13, 14, 15, 8, 9, 10,
313 11, 12, 13, 14, 13, 14, 23, 8, 9, 10,
314 11, 12, 13, 14, 10, 11, 12, 13, 14, 11,
318 static const short yycheck
[] =
320 1, 10, 11, 4, 13, 14, 9, 8, 9, 10,
321 11, 12, 13, 14, 3, 4, 5, 6, 7, 8,
322 9, 0, 23, 7, 8, 9, 15, 3, 4, 5,
323 6, 7, 8, 9, 8, 9, 12, 3, 4, 5,
324 6, 7, 8, 9, 5, 6, 7, 8, 9, 6,
329 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
330 #line 3 "/usr/local/share/bison/bison.simple"
332 /* Skeleton output parser for bison,
334 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
337 This program is free software; you can redistribute it and/or modify
338 it under the terms of the GNU General Public License as published by
339 the Free Software Foundation; either version 2, or (at your option)
342 This program is distributed in the hope that it will be useful,
343 but WITHOUT ANY WARRANTY; without even the implied warranty of
344 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
345 GNU General Public License for more details.
347 You should have received a copy of the GNU General Public License
348 along with this program; if not, write to the Free Software
349 Foundation, Inc., 59 Temple Place - Suite 330,
350 Boston, MA 02111-1307, USA. */
352 /* As a special exception, when this file is copied by Bison into a
353 Bison output file, you may use that output file without restriction.
354 This special exception was added by the Free Software Foundation
355 in version 1.24 of Bison. */
357 /* This is the parser code that is written into each bison parser when
358 the %semantic_parser declaration is not specified in the grammar.
359 It was written by Richard Stallman by simplifying the hairy parser
360 used when %semantic_parser is specified. */
362 /* All symbols defined below should begin with yy or YY, to avoid
363 infringing on user name space. This should be done even for local
364 variables, as they might otherwise be expanded by user macros.
365 There are some unavoidable exceptions within include files to
366 define necessary library symbols; they are noted "INFRINGES ON
367 USER NAME SPACE" below. */
369 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
371 /* The parser invokes alloca or malloc; define the necessary symbols. */
373 # if YYSTACK_USE_ALLOCA
374 # define YYSTACK_ALLOC alloca
376 # ifndef YYSTACK_USE_ALLOCA
377 # if defined (alloca) || defined (_ALLOCA_H)
378 # define YYSTACK_ALLOC alloca
381 # define YYSTACK_ALLOC __builtin_alloca
387 # ifdef YYSTACK_ALLOC
388 /* Pacify GCC's `empty if-body' warning. */
389 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
391 # if defined (__STDC__) || defined (__cplusplus)
392 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
393 # define YYSIZE_T size_t
395 # define YYSTACK_ALLOC malloc
396 # define YYSTACK_FREE free
398 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
401 #if (! defined (yyoverflow) \
402 && (! defined (__cplusplus) \
403 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
405 /* A type that is properly aligned for any stack member. */
415 /* The size of the maximum gap between one aligned stack and the next. */
416 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
418 /* The size of an array large to enough to hold all stacks, each with
421 # define YYSTACK_BYTES(N) \
422 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
423 + 2 * YYSTACK_GAP_MAX)
425 # define YYSTACK_BYTES(N) \
426 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
430 /* Copy COUNT objects from FROM to TO. The source and destination do
434 # define YYCOPY(To, From, Count) \
435 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
437 # define YYCOPY(To, From, Count) \
440 register YYSIZE_T yyi; \
441 for (yyi = 0; yyi < (Count); yyi++) \
442 (To)[yyi] = (From)[yyi]; \
448 /* Relocate STACK from its old location to the new one. The
449 local variables YYSIZE and YYSTACKSIZE give the old and new number of
450 elements in the stack, and YYPTR gives the new location of the
451 stack. Advance YYPTR to a properly aligned location for the next
453 # define YYSTACK_RELOCATE(Stack) \
456 YYSIZE_T yynewbytes; \
457 YYCOPY (&yyptr->Stack, Stack, yysize); \
458 Stack = &yyptr->Stack; \
459 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
460 yyptr += yynewbytes / sizeof (*yyptr); \
467 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
468 # define YYSIZE_T __SIZE_TYPE__
470 #if ! defined (YYSIZE_T) && defined (size_t)
471 # define YYSIZE_T size_t
473 #if ! defined (YYSIZE_T)
474 # if defined (__STDC__) || defined (__cplusplus)
475 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
476 # define YYSIZE_T size_t
479 #if ! defined (YYSIZE_T)
480 # define YYSIZE_T unsigned int
483 #define yyerrok (yyerrstatus = 0)
484 #define yyclearin (yychar = YYEMPTY)
487 #define YYACCEPT goto yyacceptlab
488 #define YYABORT goto yyabortlab
489 #define YYERROR goto yyerrlab1
490 /* Like YYERROR except do call yyerror. This remains here temporarily
491 to ease the transition to the new meaning of YYERROR, for GCC.
492 Once GCC version 2 has supplanted version 1, this can go. */
493 #define YYFAIL goto yyerrlab
494 #define YYRECOVERING() (!!yyerrstatus)
495 #define YYBACKUP(Token, Value) \
497 if (yychar == YYEMPTY && yylen == 1) \
501 yychar1 = YYTRANSLATE (yychar); \
507 yyerror ("syntax error: cannot back up"); \
513 #define YYERRCODE 256
516 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
519 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
520 first token. By default, to implement support for ranges, extend
521 its range to the last symbol. */
523 #ifndef YYLLOC_DEFAULT
524 # define YYLLOC_DEFAULT(Current, Rhs, N) \
525 Current.last_line = Rhs[N].last_line; \
526 Current.last_column = Rhs[N].last_column;
530 /* YYLEX -- calling `yylex' with the right arguments. */
535 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
537 # define YYLEX yylex (&yylval, &yylloc)
539 # else /* !YYLSP_NEEDED */
541 # define YYLEX yylex (&yylval, YYLEX_PARAM)
543 # define YYLEX yylex (&yylval)
545 # endif /* !YYLSP_NEEDED */
547 # define YYLEX yylex ()
551 /* Enable debugging if requested. */
555 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
556 # define YYFPRINTF fprintf
559 # define YYDPRINTF(Args) \
564 /* Nonzero means print parse trace. It is left uninitialized so that
565 multiple parsers can coexist. */
568 # define YYDPRINTF(Args)
569 #endif /* !YYDEBUG */
571 /* YYINITDEPTH -- initial size of the parser's stacks. */
573 # define YYINITDEPTH 200
576 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
577 if the built-in stack extension method is used).
579 Do not make this value too large; the results are undefined if
580 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
581 evaluated with infinite-precision integer arithmetic. */
588 # define YYMAXDEPTH 10000
591 #ifdef YYERROR_VERBOSE
594 # if defined (__GLIBC__) && defined (_STRING_H)
595 # define yystrlen strlen
597 /* Return the length of YYSTR. */
599 # if defined (__STDC__) || defined (__cplusplus)
600 yystrlen (const char *yystr
)
606 register const char *yys
= yystr
;
608 while (*yys
++ != '\0')
611 return yys
- yystr
- 1;
617 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
618 # define yystpcpy stpcpy
620 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
623 # if defined (__STDC__) || defined (__cplusplus)
624 yystpcpy (char *yydest
, const char *yysrc
)
626 yystpcpy (yydest
, yysrc
)
631 register char *yyd
= yydest
;
632 register const char *yys
= yysrc
;
634 while ((*yyd
++ = *yys
++) != '\0')
643 #line 315 "/usr/local/share/bison/bison.simple"
646 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
647 into yyparse. The argument should have type void *.
648 It should actually point to an object.
649 Grammar actions can access the variable by casting it
650 to the proper pointer type. */
653 # if defined (__STDC__) || defined (__cplusplus)
654 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
655 # define YYPARSE_PARAM_DECL
657 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
658 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
660 #else /* !YYPARSE_PARAM */
661 # define YYPARSE_PARAM_ARG
662 # define YYPARSE_PARAM_DECL
663 #endif /* !YYPARSE_PARAM */
665 /* Prevent warning if -Wstrict-prototypes. */
667 # ifdef YYPARSE_PARAM
668 int yyparse (void *);
674 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
675 variables are global, or local to YYPARSE. */
677 #define YY_DECL_NON_LSP_VARIABLES \
678 /* The lookahead symbol. */ \
681 /* The semantic value of the lookahead symbol. */ \
684 /* Number of parse errors so far. */ \
688 # define YY_DECL_VARIABLES \
689 YY_DECL_NON_LSP_VARIABLES \
691 /* Location data for the lookahead symbol. */ \
694 # define YY_DECL_VARIABLES \
695 YY_DECL_NON_LSP_VARIABLES
699 /* If nonreentrant, generate the variables here. */
706 yyparse (YYPARSE_PARAM_ARG
)
709 /* If reentrant, generate the variables here. */
714 register int yystate
;
717 /* Number of tokens to shift before error messages enabled. */
719 /* Lookahead token as an internal (translated) token number. */
722 /* Three stacks and their tools:
723 `yyss': related to states,
724 `yyvs': related to semantic values,
725 `yyls': related to locations.
727 Refer to the stacks thru separate pointers, to allow yyoverflow
728 to reallocate them elsewhere. */
730 /* The state stack. */
731 short yyssa
[YYINITDEPTH
];
733 register short *yyssp
;
735 /* The semantic value stack. */
736 YYSTYPE yyvsa
[YYINITDEPTH
];
737 YYSTYPE
*yyvs
= yyvsa
;
738 register YYSTYPE
*yyvsp
;
741 /* The location stack. */
742 YYLTYPE yylsa
[YYINITDEPTH
];
743 YYLTYPE
*yyls
= yylsa
;
748 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
750 # define YYPOPSTACK (yyvsp--, yyssp--)
753 YYSIZE_T yystacksize
= YYINITDEPTH
;
756 /* The variables used to return semantic value and location from the
763 /* When reducing, the number of symbols on the RHS of the reduced
767 YYDPRINTF ((stderr
, "Starting parse\n"));
772 yychar
= YYEMPTY
; /* Cause a token to be read. */
774 /* Initialize stack pointers.
775 Waste one element of value and location stack
776 so that they stay on the same level as the state stack.
777 The wasted elements are never initialized. */
786 /*------------------------------------------------------------.
787 | yynewstate -- Push a new state, which is found in yystate. |
788 `------------------------------------------------------------*/
790 /* In all cases, when you get here, the value and location stacks
791 have just been pushed. so pushing a state here evens the stacks.
798 if (yyssp
>= yyss
+ yystacksize
- 1)
800 /* Get the current used size of the three stacks, in elements. */
801 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
805 /* Give user a chance to reallocate the stack. Use copies of
806 these so that the &'s don't force the real ones into
808 YYSTYPE
*yyvs1
= yyvs
;
811 /* Each stack pointer address is followed by the size of the
812 data in use in that stack, in bytes. */
814 YYLTYPE
*yyls1
= yyls
;
815 /* This used to be a conditional around just the two extra args,
816 but that might be undefined if yyoverflow is a macro. */
817 yyoverflow ("parser stack overflow",
818 &yyss1
, yysize
* sizeof (*yyssp
),
819 &yyvs1
, yysize
* sizeof (*yyvsp
),
820 &yyls1
, yysize
* sizeof (*yylsp
),
824 yyoverflow ("parser stack overflow",
825 &yyss1
, yysize
* sizeof (*yyssp
),
826 &yyvs1
, yysize
* sizeof (*yyvsp
),
832 #else /* no yyoverflow */
833 # ifndef YYSTACK_RELOCATE
836 /* Extend the stack our own way. */
837 if (yystacksize
>= YYMAXDEPTH
)
840 if (yystacksize
> YYMAXDEPTH
)
841 yystacksize
= YYMAXDEPTH
;
845 union yyalloc
*yyptr
=
846 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
849 YYSTACK_RELOCATE (yyss
);
850 YYSTACK_RELOCATE (yyvs
);
852 YYSTACK_RELOCATE (yyls
);
854 # undef YYSTACK_RELOCATE
856 YYSTACK_FREE (yyss1
);
859 #endif /* no yyoverflow */
861 yyssp
= yyss
+ yysize
- 1;
862 yyvsp
= yyvs
+ yysize
- 1;
864 yylsp
= yyls
+ yysize
- 1;
867 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
868 (unsigned long int) yystacksize
));
870 if (yyssp
>= yyss
+ yystacksize
- 1)
874 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
884 /* Do appropriate processing given the current state. */
885 /* Read a lookahead token if we need one and don't already have one. */
888 /* First try to decide what to do without reference to lookahead token. */
890 yyn
= yypact
[yystate
];
894 /* Not known => get a lookahead token if don't already have one. */
896 /* yychar is either YYEMPTY or YYEOF
897 or a valid token in external form. */
899 if (yychar
== YYEMPTY
)
901 YYDPRINTF ((stderr
, "Reading a token: "));
905 /* Convert token to internal form (in yychar1) for indexing tables with */
907 if (yychar
<= 0) /* This means end of input. */
910 yychar
= YYEOF
; /* Don't call YYLEX any more */
912 YYDPRINTF ((stderr
, "Now at end of input.\n"));
916 yychar1
= YYTRANSLATE (yychar
);
919 /* We have to keep this `#if YYDEBUG', since we use variables
920 which are defined only if `YYDEBUG' is set. */
923 YYFPRINTF (stderr
, "Next token is %d (%s",
924 yychar
, yytname
[yychar1
]);
925 /* Give the individual parser a way to print the precise
926 meaning of a token, for further debugging info. */
928 YYPRINT (stderr
, yychar
, yylval
);
930 YYFPRINTF (stderr
, ")\n");
936 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
941 /* yyn is what to do for this token type in this state.
942 Negative => reduce, -yyn is rule number.
943 Positive => shift, yyn is new state.
944 New state is final state => don't bother to shift,
946 0, or most negative number => error. */
961 /* Shift the lookahead token. */
962 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
963 yychar
, yytname
[yychar1
]));
965 /* Discard the token being shifted unless it is eof. */
974 /* Count tokens shifted since error; after three, turn off error
983 /*-----------------------------------------------------------.
984 | yydefault -- do the default action for the current state. |
985 `-----------------------------------------------------------*/
987 yyn
= yydefact
[yystate
];
993 /*-----------------------------.
994 | yyreduce -- Do a reduction. |
995 `-----------------------------*/
997 /* yyn is the number of a rule to reduce with. */
1000 /* If YYLEN is nonzero, implement the default value of the action:
1003 Otherwise, the following line sets YYVAL to the semantic value of
1004 the lookahead token. This behavior is undocumented and Bison
1005 users should not rely upon it. Assigning to YYVAL
1006 unconditionally makes the parser a bit smaller, and it avoids a
1007 GCC warning that YYVAL may be used uninitialized. */
1008 yyval
= yyvsp
[1-yylen
];
1011 /* Similarly for the default location. Let the user run additional
1012 commands if for instance locations are ranges. */
1013 yyloc
= yylsp
[1-yylen
];
1014 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1018 /* We have to keep this `#if YYDEBUG', since we use variables which
1019 are defined only if `YYDEBUG' is set. */
1024 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1027 /* Print the symbols being reduced, and their result. */
1028 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] > 0; yyi
++)
1029 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1030 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1037 #line 185 "plural.y"
1039 if (yyvsp
[0].exp
== NULL
)
1041 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
1045 #line 193 "plural.y"
1047 yyval
.exp
= new_exp_3 (qmop
, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1051 #line 197 "plural.y"
1053 yyval
.exp
= new_exp_2 (lor
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1057 #line 201 "plural.y"
1059 yyval
.exp
= new_exp_2 (land
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1063 #line 205 "plural.y"
1065 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1069 #line 209 "plural.y"
1071 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1075 #line 213 "plural.y"
1077 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1081 #line 217 "plural.y"
1083 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1087 #line 221 "plural.y"
1089 yyval
.exp
= new_exp_1 (lnot
, yyvsp
[0].exp
);
1093 #line 225 "plural.y"
1095 yyval
.exp
= new_exp_0 (var
);
1099 #line 229 "plural.y"
1101 if ((yyval
.exp
= new_exp_0 (num
)) != NULL
)
1102 yyval
.exp
->val
.num
= yyvsp
[0].num
;
1106 #line 234 "plural.y"
1108 yyval
.exp
= yyvsp
[-1].exp
;
1113 #line 705 "/usr/local/share/bison/bison.simple"
1125 short *yyssp1
= yyss
- 1;
1126 YYFPRINTF (stderr
, "state stack now");
1127 while (yyssp1
!= yyssp
)
1128 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1129 YYFPRINTF (stderr
, "\n");
1138 /* Now `shift' the result of the reduction. Determine what state
1139 that goes to, based on the state we popped back to and the rule
1140 number reduced by. */
1144 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1145 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1146 yystate
= yytable
[yystate
];
1148 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1153 /*------------------------------------.
1154 | yyerrlab -- here on detecting error |
1155 `------------------------------------*/
1157 /* If not already recovering from an error, report this error. */
1162 #ifdef YYERROR_VERBOSE
1163 yyn
= yypact
[yystate
];
1165 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1167 YYSIZE_T yysize
= 0;
1172 /* Start YYX at -YYN if negative to avoid negative indexes in
1174 for (yyx
= yyn
< 0 ? -yyn
: 0;
1175 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1176 if (yycheck
[yyx
+ yyn
] == yyx
)
1177 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1178 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1179 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1180 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1183 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1184 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1189 for (yyx
= yyn
< 0 ? -yyn
: 0;
1190 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1192 if (yycheck
[yyx
+ yyn
] == yyx
)
1194 const char *yyq
= ! yycount
? ", expecting " : " or ";
1195 yyp
= yystpcpy (yyp
, yyq
);
1196 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1201 YYSTACK_FREE (yymsg
);
1204 yyerror ("parse error; also virtual memory exhausted");
1207 #endif /* defined (YYERROR_VERBOSE) */
1208 yyerror ("parse error");
1213 /*--------------------------------------------------.
1214 | yyerrlab1 -- error raised explicitly by an action |
1215 `--------------------------------------------------*/
1217 if (yyerrstatus
== 3)
1219 /* If just tried and failed to reuse lookahead token after an
1220 error, discard it. */
1222 /* return failure if at end of input */
1223 if (yychar
== YYEOF
)
1225 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1226 yychar
, yytname
[yychar1
]));
1230 /* Else will try to reuse lookahead token after shifting the error
1233 yyerrstatus
= 3; /* Each real token shifted decrements this */
1238 /*-------------------------------------------------------------------.
1239 | yyerrdefault -- current state does not do anything special for the |
1241 `-------------------------------------------------------------------*/
1244 /* This is wrong; only states that explicitly want error tokens
1245 should shift them. */
1247 /* If its default is to accept any token, ok. Otherwise pop it. */
1248 yyn
= yydefact
[yystate
];
1254 /*---------------------------------------------------------------.
1255 | yyerrpop -- pop the current state because it cannot handle the |
1257 `---------------------------------------------------------------*/
1270 short *yyssp1
= yyss
- 1;
1271 YYFPRINTF (stderr
, "Error: state stack now");
1272 while (yyssp1
!= yyssp
)
1273 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1274 YYFPRINTF (stderr
, "\n");
1282 yyn
= yypact
[yystate
];
1287 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1304 YYDPRINTF ((stderr
, "Shifting error token, "));
1315 /*-------------------------------------.
1316 | yyacceptlab -- YYACCEPT comes here. |
1317 `-------------------------------------*/
1322 /*-----------------------------------.
1323 | yyabortlab -- YYABORT comes here. |
1324 `-----------------------------------*/
1329 /*---------------------------------------------.
1330 | yyoverflowab -- parser overflow comes here. |
1331 `---------------------------------------------*/
1333 yyerror ("parser stack overflow");
1340 YYSTACK_FREE (yyss
);
1344 #line 239 "plural.y"
1349 FREE_EXPRESSION (exp
)
1350 struct expression
*exp
;
1355 /* Handle the recursive case. */
1359 FREE_EXPRESSION (exp
->val
.args
[2]);
1362 FREE_EXPRESSION (exp
->val
.args
[1]);
1365 FREE_EXPRESSION (exp
->val
.args
[0]);
1379 struct parse_args
*arg
;
1381 const char **pexp
= &arg
->cp
;
1389 const char *exp
= *pexp
;
1400 if (exp
[0] != ' ' && exp
[0] != '\t')
1409 case '0': case '1': case '2': case '3': case '4':
1410 case '5': case '6': case '7': case '8': case '9':
1412 unsigned long int n
= result
- '0';
1413 while (exp
[0] >= '0' && exp
[0] <= '9')
1439 lval
->op
= not_equal
;
1446 if (exp
[0] == result
)
1456 lval
->op
= less_or_equal
;
1459 lval
->op
= less_than
;
1467 lval
->op
= greater_or_equal
;
1470 lval
->op
= greater_than
;
1504 /* Nothing, just return the character. */
1510 /* Be safe and let the user call this function again. */
1532 struct parse_args
*arg
;
1539 /* Do nothing. We don't print error messages here. */