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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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. */
80 #define inline /* nothing: don't inline if the compiler is not GCC */
83 static struct expression
*new_exp
PARAMS ((int nargs
, enum operator op
,
84 struct expression
* const *args
));
85 static inline struct expression
*new_exp_0
PARAMS ((enum operator op
));
86 static inline struct expression
*new_exp_1
PARAMS ((enum operator op
,
87 struct expression
*right
));
88 static struct expression
*new_exp_2
PARAMS ((enum operator op
,
89 struct expression
*left
,
90 struct expression
*right
));
91 static inline struct expression
*new_exp_3
PARAMS ((enum operator op
,
92 struct expression
*bexp
,
93 struct expression
*tbranch
,
94 struct expression
*fbranch
));
95 static int yylex
PARAMS ((YYSTYPE
*lval
, const char **pexp
));
96 static void yyerror
PARAMS ((const char *str
));
98 /* Allocation of expressions. */
100 static struct expression
*
101 new_exp (nargs
, op
, args
)
104 struct expression
* const *args
;
107 struct expression
*newp
;
109 /* If any of the argument could not be malloc'ed, just return NULL. */
110 for (i
= nargs
- 1; i
>= 0; i
--)
114 /* Allocate a new expression. */
115 newp
= (struct expression
*) malloc (sizeof (*newp
));
119 newp
->operation
= op
;
120 for (i
= nargs
- 1; i
>= 0; i
--)
121 newp
->val
.args
[i
] = args
[i
];
126 for (i
= nargs
- 1; i
>= 0; i
--)
127 FREE_EXPRESSION (args
[i
]);
132 static inline struct expression
*
136 return new_exp (0, op
, NULL
);
139 static inline struct expression
*
140 new_exp_1 (op
, right
)
142 struct expression
*right
;
144 struct expression
*args
[1];
147 return new_exp (1, op
, args
);
150 static struct expression
*
151 new_exp_2 (op
, left
, right
)
153 struct expression
*left
;
154 struct expression
*right
;
156 struct expression
*args
[2];
160 return new_exp (2, op
, args
);
163 static inline struct expression
*
164 new_exp_3 (op
, bexp
, tbranch
, fbranch
)
166 struct expression
*bexp
;
167 struct expression
*tbranch
;
168 struct expression
*fbranch
;
170 struct expression
*args
[3];
175 return new_exp (3, op
, args
);
185 #define YYFLAG -32768
188 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
189 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
191 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
192 static const char yytranslate
[] =
194 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
198 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
200 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 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 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
206 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
208 2, 2, 2, 2, 2, 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, 1, 6, 7, 8,
224 static const short yyprhs
[] =
226 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
229 static const short yyrhs
[] =
231 17, 0, 17, 3, 17, 12, 17, 0, 17, 4,
232 17, 0, 17, 5, 17, 0, 17, 6, 17, 0,
233 17, 7, 17, 0, 17, 8, 17, 0, 17, 9,
234 17, 0, 10, 17, 0, 13, 0, 11, 0, 14,
241 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
242 static const short yyrline
[] =
244 0, 179, 187, 191, 195, 199, 203, 207, 211, 215,
250 #if (YYDEBUG) || defined YYERROR_VERBOSE
252 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
253 static const char *const yytname
[] =
255 "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
256 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
261 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
262 static const short yyr1
[] =
264 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
268 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
269 static const short yyr2
[] =
271 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
275 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
276 doesn't specify something else to do. Zero means the default is an
278 static const short yydefact
[] =
280 0, 0, 11, 10, 0, 1, 9, 0, 0, 0,
281 0, 0, 0, 0, 0, 12, 0, 3, 4, 5,
282 6, 7, 8, 0, 2, 0, 0, 0
285 static const short yydefgoto
[] =
290 static const short yypact
[] =
292 -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9,
293 -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16,
294 26, -3,-32768, -9, 34, 21, 53,-32768
297 static const short yypgoto
[] =
306 static const short yytable
[] =
308 6, 1, 2, 7, 3, 4, 14, 16, 17, 18,
309 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
310 14, 26, 24, 12, 13, 14, 15, 8, 9, 10,
311 11, 12, 13, 14, 13, 14, 23, 8, 9, 10,
312 11, 12, 13, 14, 10, 11, 12, 13, 14, 11,
316 static const short yycheck
[] =
318 1, 10, 11, 4, 13, 14, 9, 8, 9, 10,
319 11, 12, 13, 14, 3, 4, 5, 6, 7, 8,
320 9, 0, 23, 7, 8, 9, 15, 3, 4, 5,
321 6, 7, 8, 9, 8, 9, 12, 3, 4, 5,
322 6, 7, 8, 9, 5, 6, 7, 8, 9, 6,
327 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
328 #line 3 "/usr/share/bison/bison.simple"
330 /* Skeleton output parser for bison,
332 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
335 This program is free software; you can redistribute it and/or modify
336 it under the terms of the GNU General Public License as published by
337 the Free Software Foundation; either version 2, or (at your option)
340 This program is distributed in the hope that it will be useful,
341 but WITHOUT ANY WARRANTY; without even the implied warranty of
342 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
343 GNU General Public License for more details.
345 You should have received a copy of the GNU General Public License
346 along with this program; if not, write to the Free Software
347 Foundation, Inc., 59 Temple Place - Suite 330,
348 Boston, MA 02111-1307, USA. */
350 /* As a special exception, when this file is copied by Bison into a
351 Bison output file, you may use that output file without restriction.
352 This special exception was added by the Free Software Foundation
353 in version 1.24 of Bison. */
355 /* This is the parser code that is written into each bison parser when
356 the %semantic_parser declaration is not specified in the grammar.
357 It was written by Richard Stallman by simplifying the hairy parser
358 used when %semantic_parser is specified. */
360 /* All symbols defined below should begin with yy or YY, to avoid
361 infringing on user name space. This should be done even for local
362 variables, as they might otherwise be expanded by user macros.
363 There are some unavoidable exceptions within include files to
364 define necessary library symbols; they are noted "INFRINGES ON
365 USER NAME SPACE" below. */
367 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
369 /* The parser invokes alloca or malloc; define the necessary symbols. */
371 # if YYSTACK_USE_ALLOCA
372 # define YYSTACK_ALLOC alloca
374 # ifndef YYSTACK_USE_ALLOCA
375 # if defined (alloca) || defined (_ALLOCA_H)
376 # define YYSTACK_ALLOC alloca
379 # define YYSTACK_ALLOC __builtin_alloca
385 # ifdef YYSTACK_ALLOC
386 /* Pacify GCC's `empty if-body' warning. */
387 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
389 # if defined (__STDC__) || defined (__cplusplus)
390 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
391 # define YYSIZE_T size_t
393 # define YYSTACK_ALLOC malloc
394 # define YYSTACK_FREE free
396 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
399 #if (! defined (yyoverflow) \
400 && (! defined (__cplusplus) \
401 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
403 /* A type that is properly aligned for any stack member. */
413 /* The size of the maximum gap between one aligned stack and the next. */
414 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
416 /* The size of an array large to enough to hold all stacks, each with
419 # define YYSTACK_BYTES(N) \
420 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
421 + 2 * YYSTACK_GAP_MAX)
423 # define YYSTACK_BYTES(N) \
424 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
428 /* Copy COUNT objects from FROM to TO. The source and destination do
432 # define YYCOPY(To, From, Count) \
433 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
435 # define YYCOPY(To, From, Count) \
438 register YYSIZE_T yyi; \
439 for (yyi = 0; yyi < (Count); yyi++) \
440 (To)[yyi] = (From)[yyi]; \
446 /* Relocate STACK from its old location to the new one. The
447 local variables YYSIZE and YYSTACKSIZE give the old and new number of
448 elements in the stack, and YYPTR gives the new location of the
449 stack. Advance YYPTR to a properly aligned location for the next
451 # define YYSTACK_RELOCATE(Stack) \
454 YYSIZE_T yynewbytes; \
455 YYCOPY (&yyptr->Stack, Stack, yysize); \
456 Stack = &yyptr->Stack; \
457 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
458 yyptr += yynewbytes / sizeof (*yyptr); \
465 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
466 # define YYSIZE_T __SIZE_TYPE__
468 #if ! defined (YYSIZE_T) && defined (size_t)
469 # define YYSIZE_T size_t
471 #if ! defined (YYSIZE_T)
472 # if defined (__STDC__) || defined (__cplusplus)
473 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
474 # define YYSIZE_T size_t
477 #if ! defined (YYSIZE_T)
478 # define YYSIZE_T unsigned int
481 #define yyerrok (yyerrstatus = 0)
482 #define yyclearin (yychar = YYEMPTY)
485 #define YYACCEPT goto yyacceptlab
486 #define YYABORT goto yyabortlab
487 #define YYERROR goto yyerrlab1
488 /* Like YYERROR except do call yyerror. This remains here temporarily
489 to ease the transition to the new meaning of YYERROR, for GCC.
490 Once GCC version 2 has supplanted version 1, this can go. */
491 #define YYFAIL goto yyerrlab
492 #define YYRECOVERING() (!!yyerrstatus)
493 #define YYBACKUP(Token, Value) \
495 if (yychar == YYEMPTY && yylen == 1) \
499 yychar1 = YYTRANSLATE (yychar); \
505 yyerror ("syntax error: cannot back up"); \
511 #define YYERRCODE 256
514 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
517 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
518 first token. By default, to implement support for ranges, extend
519 its range to the last symbol. */
521 #ifndef YYLLOC_DEFAULT
522 # define YYLLOC_DEFAULT(Current, Rhs, N) \
523 Current.last_line = Rhs[N].last_line; \
524 Current.last_column = Rhs[N].last_column;
528 /* YYLEX -- calling `yylex' with the right arguments. */
533 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
535 # define YYLEX yylex (&yylval, &yylloc)
537 # else /* !YYLSP_NEEDED */
539 # define YYLEX yylex (&yylval, YYLEX_PARAM)
541 # define YYLEX yylex (&yylval)
543 # endif /* !YYLSP_NEEDED */
545 # define YYLEX yylex ()
549 /* Enable debugging if requested. */
553 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
554 # define YYFPRINTF fprintf
557 # define YYDPRINTF(Args) \
562 /* Nonzero means print parse trace. It is left uninitialized so that
563 multiple parsers can coexist. */
566 # define YYDPRINTF(Args)
567 #endif /* !YYDEBUG */
569 /* YYINITDEPTH -- initial size of the parser's stacks. */
571 # define YYINITDEPTH 200
574 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
575 if the built-in stack extension method is used).
577 Do not make this value too large; the results are undefined if
578 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
579 evaluated with infinite-precision integer arithmetic. */
586 # define YYMAXDEPTH 10000
589 #ifdef YYERROR_VERBOSE
592 # if defined (__GLIBC__) && defined (_STRING_H)
593 # define yystrlen strlen
595 /* Return the length of YYSTR. */
597 # if defined (__STDC__) || defined (__cplusplus)
598 yystrlen (const char *yystr
)
604 register const char *yys
= yystr
;
606 while (*yys
++ != '\0')
609 return yys
- yystr
- 1;
615 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
616 # define yystpcpy stpcpy
618 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
621 # if defined (__STDC__) || defined (__cplusplus)
622 yystpcpy (char *yydest
, const char *yysrc
)
624 yystpcpy (yydest
, yysrc
)
629 register char *yyd
= yydest
;
630 register const char *yys
= yysrc
;
632 while ((*yyd
++ = *yys
++) != '\0')
641 #line 315 "/usr/share/bison/bison.simple"
644 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
645 into yyparse. The argument should have type void *.
646 It should actually point to an object.
647 Grammar actions can access the variable by casting it
648 to the proper pointer type. */
651 # if defined (__STDC__) || defined (__cplusplus)
652 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
653 # define YYPARSE_PARAM_DECL
655 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
656 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
658 #else /* !YYPARSE_PARAM */
659 # define YYPARSE_PARAM_ARG
660 # define YYPARSE_PARAM_DECL
661 #endif /* !YYPARSE_PARAM */
663 /* Prevent warning if -Wstrict-prototypes. */
665 # ifdef YYPARSE_PARAM
666 int yyparse (void *);
672 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
673 variables are global, or local to YYPARSE. */
675 #define YY_DECL_NON_LSP_VARIABLES \
676 /* The lookahead symbol. */ \
679 /* The semantic value of the lookahead symbol. */ \
682 /* Number of parse errors so far. */ \
686 # define YY_DECL_VARIABLES \
687 YY_DECL_NON_LSP_VARIABLES \
689 /* Location data for the lookahead symbol. */ \
692 # define YY_DECL_VARIABLES \
693 YY_DECL_NON_LSP_VARIABLES
697 /* If nonreentrant, generate the variables here. */
704 yyparse (YYPARSE_PARAM_ARG
)
707 /* If reentrant, generate the variables here. */
712 register int yystate
;
715 /* Number of tokens to shift before error messages enabled. */
717 /* Lookahead token as an internal (translated) token number. */
720 /* Three stacks and their tools:
721 `yyss': related to states,
722 `yyvs': related to semantic values,
723 `yyls': related to locations.
725 Refer to the stacks thru separate pointers, to allow yyoverflow
726 to reallocate them elsewhere. */
728 /* The state stack. */
729 short yyssa
[YYINITDEPTH
];
731 register short *yyssp
;
733 /* The semantic value stack. */
734 YYSTYPE yyvsa
[YYINITDEPTH
];
735 YYSTYPE
*yyvs
= yyvsa
;
736 register YYSTYPE
*yyvsp
;
739 /* The location stack. */
740 YYLTYPE yylsa
[YYINITDEPTH
];
741 YYLTYPE
*yyls
= yylsa
;
746 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
748 # define YYPOPSTACK (yyvsp--, yyssp--)
751 YYSIZE_T yystacksize
= YYINITDEPTH
;
754 /* The variables used to return semantic value and location from the
761 /* When reducing, the number of symbols on the RHS of the reduced
765 YYDPRINTF ((stderr
, "Starting parse\n"));
770 yychar
= YYEMPTY
; /* Cause a token to be read. */
772 /* Initialize stack pointers.
773 Waste one element of value and location stack
774 so that they stay on the same level as the state stack.
775 The wasted elements are never initialized. */
784 /*------------------------------------------------------------.
785 | yynewstate -- Push a new state, which is found in yystate. |
786 `------------------------------------------------------------*/
788 /* In all cases, when you get here, the value and location stacks
789 have just been pushed. so pushing a state here evens the stacks.
796 if (yyssp
>= yyss
+ yystacksize
- 1)
798 /* Get the current used size of the three stacks, in elements. */
799 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
803 /* Give user a chance to reallocate the stack. Use copies of
804 these so that the &'s don't force the real ones into
806 YYSTYPE
*yyvs1
= yyvs
;
809 /* Each stack pointer address is followed by the size of the
810 data in use in that stack, in bytes. */
812 YYLTYPE
*yyls1
= yyls
;
813 /* This used to be a conditional around just the two extra args,
814 but that might be undefined if yyoverflow is a macro. */
815 yyoverflow ("parser stack overflow",
816 &yyss1
, yysize
* sizeof (*yyssp
),
817 &yyvs1
, yysize
* sizeof (*yyvsp
),
818 &yyls1
, yysize
* sizeof (*yylsp
),
822 yyoverflow ("parser stack overflow",
823 &yyss1
, yysize
* sizeof (*yyssp
),
824 &yyvs1
, yysize
* sizeof (*yyvsp
),
830 #else /* no yyoverflow */
831 # ifndef YYSTACK_RELOCATE
834 /* Extend the stack our own way. */
835 if (yystacksize
>= YYMAXDEPTH
)
838 if (yystacksize
> YYMAXDEPTH
)
839 yystacksize
= YYMAXDEPTH
;
843 union yyalloc
*yyptr
=
844 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
847 YYSTACK_RELOCATE (yyss
);
848 YYSTACK_RELOCATE (yyvs
);
850 YYSTACK_RELOCATE (yyls
);
852 # undef YYSTACK_RELOCATE
854 YYSTACK_FREE (yyss1
);
857 #endif /* no yyoverflow */
859 yyssp
= yyss
+ yysize
- 1;
860 yyvsp
= yyvs
+ yysize
- 1;
862 yylsp
= yyls
+ yysize
- 1;
865 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
866 (unsigned long int) yystacksize
));
868 if (yyssp
>= yyss
+ yystacksize
- 1)
872 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
882 /* Do appropriate processing given the current state. */
883 /* Read a lookahead token if we need one and don't already have one. */
886 /* First try to decide what to do without reference to lookahead token. */
888 yyn
= yypact
[yystate
];
892 /* Not known => get a lookahead token if don't already have one. */
894 /* yychar is either YYEMPTY or YYEOF
895 or a valid token in external form. */
897 if (yychar
== YYEMPTY
)
899 YYDPRINTF ((stderr
, "Reading a token: "));
903 /* Convert token to internal form (in yychar1) for indexing tables with */
905 if (yychar
<= 0) /* This means end of input. */
908 yychar
= YYEOF
; /* Don't call YYLEX any more */
910 YYDPRINTF ((stderr
, "Now at end of input.\n"));
914 yychar1
= YYTRANSLATE (yychar
);
917 /* We have to keep this `#if YYDEBUG', since we use variables
918 which are defined only if `YYDEBUG' is set. */
921 YYFPRINTF (stderr
, "Next token is %d (%s",
922 yychar
, yytname
[yychar1
]);
923 /* Give the individual parser a way to print the precise
924 meaning of a token, for further debugging info. */
926 YYPRINT (stderr
, yychar
, yylval
);
928 YYFPRINTF (stderr
, ")\n");
934 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
939 /* yyn is what to do for this token type in this state.
940 Negative => reduce, -yyn is rule number.
941 Positive => shift, yyn is new state.
942 New state is final state => don't bother to shift,
944 0, or most negative number => error. */
959 /* Shift the lookahead token. */
960 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
961 yychar
, yytname
[yychar1
]));
963 /* Discard the token being shifted unless it is eof. */
972 /* Count tokens shifted since error; after three, turn off error
981 /*-----------------------------------------------------------.
982 | yydefault -- do the default action for the current state. |
983 `-----------------------------------------------------------*/
985 yyn
= yydefact
[yystate
];
991 /*-----------------------------.
992 | yyreduce -- Do a reduction. |
993 `-----------------------------*/
995 /* yyn is the number of a rule to reduce with. */
998 /* If YYLEN is nonzero, implement the default value of the action:
1001 Otherwise, the following line sets YYVAL to the semantic value of
1002 the lookahead token. This behavior is undocumented and Bison
1003 users should not rely upon it. Assigning to YYVAL
1004 unconditionally makes the parser a bit smaller, and it avoids a
1005 GCC warning that YYVAL may be used uninitialized. */
1006 yyval
= yyvsp
[1-yylen
];
1009 /* Similarly for the default location. Let the user run additional
1010 commands if for instance locations are ranges. */
1011 yyloc
= yylsp
[1-yylen
];
1012 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1016 /* We have to keep this `#if YYDEBUG', since we use variables which
1017 are defined only if `YYDEBUG' is set. */
1022 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1025 /* Print the symbols being reduced, and their result. */
1026 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] > 0; yyi
++)
1027 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1028 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1035 #line 180 "plural.y"
1037 if (yyvsp
[0].exp
== NULL
)
1039 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
1043 #line 188 "plural.y"
1045 yyval
.exp
= new_exp_3 (qmop
, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1049 #line 192 "plural.y"
1051 yyval
.exp
= new_exp_2 (lor
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1055 #line 196 "plural.y"
1057 yyval
.exp
= new_exp_2 (land
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1061 #line 200 "plural.y"
1063 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1067 #line 204 "plural.y"
1069 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1073 #line 208 "plural.y"
1075 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1079 #line 212 "plural.y"
1081 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1085 #line 216 "plural.y"
1087 yyval
.exp
= new_exp_1 (lnot
, yyvsp
[0].exp
);
1091 #line 220 "plural.y"
1093 yyval
.exp
= new_exp_0 (var
);
1097 #line 224 "plural.y"
1099 if ((yyval
.exp
= new_exp_0 (num
)) != NULL
)
1100 yyval
.exp
->val
.num
= yyvsp
[0].num
;
1104 #line 229 "plural.y"
1106 yyval
.exp
= yyvsp
[-1].exp
;
1111 #line 705 "/usr/share/bison/bison.simple"
1123 short *yyssp1
= yyss
- 1;
1124 YYFPRINTF (stderr
, "state stack now");
1125 while (yyssp1
!= yyssp
)
1126 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1127 YYFPRINTF (stderr
, "\n");
1136 /* Now `shift' the result of the reduction. Determine what state
1137 that goes to, based on the state we popped back to and the rule
1138 number reduced by. */
1142 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1143 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1144 yystate
= yytable
[yystate
];
1146 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1151 /*------------------------------------.
1152 | yyerrlab -- here on detecting error |
1153 `------------------------------------*/
1155 /* If not already recovering from an error, report this error. */
1160 #ifdef YYERROR_VERBOSE
1161 yyn
= yypact
[yystate
];
1163 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1165 YYSIZE_T yysize
= 0;
1170 /* Start YYX at -YYN if negative to avoid negative indexes in
1172 for (yyx
= yyn
< 0 ? -yyn
: 0;
1173 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1174 if (yycheck
[yyx
+ yyn
] == yyx
)
1175 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1176 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1177 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1178 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1181 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1182 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1187 for (yyx
= yyn
< 0 ? -yyn
: 0;
1188 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1190 if (yycheck
[yyx
+ yyn
] == yyx
)
1192 const char *yyq
= ! yycount
? ", expecting " : " or ";
1193 yyp
= yystpcpy (yyp
, yyq
);
1194 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1199 YYSTACK_FREE (yymsg
);
1202 yyerror ("parse error; also virtual memory exhausted");
1205 #endif /* defined (YYERROR_VERBOSE) */
1206 yyerror ("parse error");
1211 /*--------------------------------------------------.
1212 | yyerrlab1 -- error raised explicitly by an action |
1213 `--------------------------------------------------*/
1215 if (yyerrstatus
== 3)
1217 /* If just tried and failed to reuse lookahead token after an
1218 error, discard it. */
1220 /* return failure if at end of input */
1221 if (yychar
== YYEOF
)
1223 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1224 yychar
, yytname
[yychar1
]));
1228 /* Else will try to reuse lookahead token after shifting the error
1231 yyerrstatus
= 3; /* Each real token shifted decrements this */
1236 /*-------------------------------------------------------------------.
1237 | yyerrdefault -- current state does not do anything special for the |
1239 `-------------------------------------------------------------------*/
1242 /* This is wrong; only states that explicitly want error tokens
1243 should shift them. */
1245 /* If its default is to accept any token, ok. Otherwise pop it. */
1246 yyn
= yydefact
[yystate
];
1252 /*---------------------------------------------------------------.
1253 | yyerrpop -- pop the current state because it cannot handle the |
1255 `---------------------------------------------------------------*/
1268 short *yyssp1
= yyss
- 1;
1269 YYFPRINTF (stderr
, "Error: state stack now");
1270 while (yyssp1
!= yyssp
)
1271 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1272 YYFPRINTF (stderr
, "\n");
1280 yyn
= yypact
[yystate
];
1285 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1302 YYDPRINTF ((stderr
, "Shifting error token, "));
1313 /*-------------------------------------.
1314 | yyacceptlab -- YYACCEPT comes here. |
1315 `-------------------------------------*/
1320 /*-----------------------------------.
1321 | yyabortlab -- YYABORT comes here. |
1322 `-----------------------------------*/
1327 /*---------------------------------------------.
1328 | yyoverflowab -- parser overflow comes here. |
1329 `---------------------------------------------*/
1331 yyerror ("parser stack overflow");
1338 YYSTACK_FREE (yyss
);
1342 #line 234 "plural.y"
1347 FREE_EXPRESSION (exp
)
1348 struct expression
*exp
;
1353 /* Handle the recursive case. */
1357 FREE_EXPRESSION (exp
->val
.args
[2]);
1360 FREE_EXPRESSION (exp
->val
.args
[1]);
1363 FREE_EXPRESSION (exp
->val
.args
[0]);
1378 const char *exp
= *pexp
;
1389 if (exp
[0] != ' ' && exp
[0] != '\t')
1398 case '0': case '1': case '2': case '3': case '4':
1399 case '5': case '6': case '7': case '8': case '9':
1401 unsigned long int n
= result
- '0';
1402 while (exp
[0] >= '0' && exp
[0] <= '9')
1428 lval
->op
= not_equal
;
1435 if (exp
[0] == result
)
1445 lval
->op
= less_or_equal
;
1448 lval
->op
= less_than
;
1456 lval
->op
= greater_or_equal
;
1459 lval
->op
= greater_than
;
1493 /* Nothing, just return the character. */
1499 /* Be safe and let the user call this function again. */
1522 /* Do nothing. We don't print error messages here. */