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 This file is part of the GNU C Library.
24 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
26 The GNU C Library is free software; you can redistribute it and/or
27 modify it under the terms of the GNU Lesser General Public
28 License as published by the Free Software Foundation; either
29 version 2.1 of the License, or (at your option) any later version.
31 The GNU C Library is distributed in the hope that it will be useful,
32 but WITHOUT ANY WARRANTY; without even the implied warranty of
33 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34 Lesser General Public License for more details.
36 You should have received a copy of the GNU Lesser General Public
37 License along with the GNU C Library; if not, write to the Free
38 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
41 /* The bison generated parser uses alloca. AIX 3 forces us to put this
42 declaration at the beginning of the file. The declaration in bison's
43 skeleton file comes too late. This must come before <config.h>
44 because <config.h> may include arbitrary system headers. */
45 #if defined _AIX && !defined __GNUC__
55 #include "plural-exp.h"
57 /* The main function generated by the parser is called __gettextparse,
58 but we want it to be called PLURAL_PARSE. */
60 # define __gettextparse PLURAL_PARSE
63 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
64 #define YYPARSE_PARAM arg
69 unsigned long int num
;
71 struct expression
*exp
;
73 # define YYSTYPE yystype
74 # define YYSTYPE_IS_TRIVIAL 1
78 /* Prototypes for local functions. */
79 static struct expression
*new_exp
PARAMS ((int nargs
, enum operator op
,
80 struct expression
* const *args
));
81 static inline struct expression
*new_exp_0
PARAMS ((enum operator op
));
82 static inline struct expression
*new_exp_1
PARAMS ((enum operator op
,
83 struct expression
*right
));
84 static struct expression
*new_exp_2
PARAMS ((enum operator op
,
85 struct expression
*left
,
86 struct expression
*right
));
87 static inline struct expression
*new_exp_3
PARAMS ((enum operator op
,
88 struct expression
*bexp
,
89 struct expression
*tbranch
,
90 struct expression
*fbranch
));
91 static int yylex
PARAMS ((YYSTYPE
*lval
, const char **pexp
));
92 static void yyerror
PARAMS ((const char *str
));
94 /* Allocation of expressions. */
96 static struct expression
*
97 new_exp (nargs
, op
, args
)
100 struct expression
* const *args
;
103 struct expression
*newp
;
105 /* If any of the argument could not be malloc'ed, just return NULL. */
106 for (i
= nargs
- 1; i
>= 0; i
--)
110 /* Allocate a new expression. */
111 newp
= (struct expression
*) malloc (sizeof (*newp
));
115 newp
->operation
= op
;
116 for (i
= nargs
- 1; i
>= 0; i
--)
117 newp
->val
.args
[i
] = args
[i
];
122 for (i
= nargs
- 1; i
>= 0; i
--)
123 FREE_EXPRESSION (args
[i
]);
128 static inline struct expression
*
132 return new_exp (0, op
, NULL
);
135 static inline struct expression
*
136 new_exp_1 (op
, right
)
138 struct expression
*right
;
140 struct expression
*args
[1];
143 return new_exp (1, op
, args
);
146 static struct expression
*
147 new_exp_2 (op
, left
, right
)
149 struct expression
*left
;
150 struct expression
*right
;
152 struct expression
*args
[2];
156 return new_exp (2, op
, args
);
159 static inline struct expression
*
160 new_exp_3 (op
, bexp
, tbranch
, fbranch
)
162 struct expression
*bexp
;
163 struct expression
*tbranch
;
164 struct expression
*fbranch
;
166 struct expression
*args
[3];
171 return new_exp (3, op
, args
);
181 #define YYFLAG -32768
184 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
185 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
187 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
188 static const char yytranslate
[] =
190 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
193 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
194 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
196 2, 2, 2, 3, 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, 2, 2, 2, 2, 2, 2, 2,
200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
201 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 4, 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 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, 1, 6, 7, 8,
220 static const short yyprhs
[] =
222 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
225 static const short yyrhs
[] =
227 17, 0, 17, 3, 17, 12, 17, 0, 17, 4,
228 17, 0, 17, 5, 17, 0, 17, 6, 17, 0,
229 17, 7, 17, 0, 17, 8, 17, 0, 17, 9,
230 17, 0, 10, 17, 0, 13, 0, 11, 0, 14,
237 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
238 static const short yyrline
[] =
240 0, 174, 182, 186, 190, 194, 198, 202, 206, 210,
246 #if (YYDEBUG) || defined YYERROR_VERBOSE
248 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
249 static const char *const yytname
[] =
251 "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
252 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
257 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
258 static const short yyr1
[] =
260 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
264 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
265 static const short yyr2
[] =
267 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
271 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
272 doesn't specify something else to do. Zero means the default is an
274 static const short yydefact
[] =
276 0, 0, 11, 10, 0, 1, 9, 0, 0, 0,
277 0, 0, 0, 0, 0, 12, 0, 3, 4, 5,
278 6, 7, 8, 0, 2, 0, 0, 0
281 static const short yydefgoto
[] =
286 static const short yypact
[] =
288 -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9,
289 -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16,
290 26, -3,-32768, -9, 34, 21, 53,-32768
293 static const short yypgoto
[] =
302 static const short yytable
[] =
304 6, 1, 2, 7, 3, 4, 14, 16, 17, 18,
305 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
306 14, 26, 24, 12, 13, 14, 15, 8, 9, 10,
307 11, 12, 13, 14, 13, 14, 23, 8, 9, 10,
308 11, 12, 13, 14, 10, 11, 12, 13, 14, 11,
312 static const short yycheck
[] =
314 1, 10, 11, 4, 13, 14, 9, 8, 9, 10,
315 11, 12, 13, 14, 3, 4, 5, 6, 7, 8,
316 9, 0, 23, 7, 8, 9, 15, 3, 4, 5,
317 6, 7, 8, 9, 8, 9, 12, 3, 4, 5,
318 6, 7, 8, 9, 5, 6, 7, 8, 9, 6,
323 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
324 #line 3 "/castro/street/H-alpha-linux/share/bison/bison.simple"
326 /* Skeleton output parser for bison,
328 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
331 This program is free software; you can redistribute it and/or modify
332 it under the terms of the GNU General Public License as published by
333 the Free Software Foundation; either version 2, or (at your option)
336 This program is distributed in the hope that it will be useful,
337 but WITHOUT ANY WARRANTY; without even the implied warranty of
338 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
339 GNU General Public License for more details.
341 You should have received a copy of the GNU General Public License
342 along with this program; if not, write to the Free Software
343 Foundation, Inc., 59 Temple Place - Suite 330,
344 Boston, MA 02111-1307, USA. */
346 /* As a special exception, when this file is copied by Bison into a
347 Bison output file, you may use that output file without restriction.
348 This special exception was added by the Free Software Foundation
349 in version 1.24 of Bison. */
351 /* This is the parser code that is written into each bison parser when
352 the %semantic_parser declaration is not specified in the grammar.
353 It was written by Richard Stallman by simplifying the hairy parser
354 used when %semantic_parser is specified. */
356 /* All symbols defined below should begin with yy or YY, to avoid
357 infringing on user name space. This should be done even for local
358 variables, as they might otherwise be expanded by user macros.
359 There are some unavoidable exceptions within include files to
360 define necessary library symbols; they are noted "INFRINGES ON
361 USER NAME SPACE" below. */
363 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
365 /* The parser invokes alloca or malloc; define the necessary symbols. */
367 # if YYSTACK_USE_ALLOCA
368 # define YYSTACK_ALLOC alloca
370 # ifndef YYSTACK_USE_ALLOCA
371 # if defined (alloca) || defined (_ALLOCA_H)
372 # define YYSTACK_ALLOC alloca
375 # define YYSTACK_ALLOC __builtin_alloca
381 # ifdef YYSTACK_ALLOC
382 /* Pacify GCC's `empty if-body' warning. */
383 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
385 # if defined (__STDC__) || defined (__cplusplus)
386 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
387 # define YYSIZE_T size_t
389 # define YYSTACK_ALLOC malloc
390 # define YYSTACK_FREE free
392 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
395 #if (! defined (yyoverflow) \
396 && (! defined (__cplusplus) \
397 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
399 /* A type that is properly aligned for any stack member. */
409 /* The size of the maximum gap between one aligned stack and the next. */
410 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
412 /* The size of an array large to enough to hold all stacks, each with
415 # define YYSTACK_BYTES(N) \
416 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
417 + 2 * YYSTACK_GAP_MAX)
419 # define YYSTACK_BYTES(N) \
420 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
424 /* Copy COUNT objects from FROM to TO. The source and destination do
428 # define YYCOPY(To, From, Count) \
429 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
431 # define YYCOPY(To, From, Count) \
434 register YYSIZE_T yyi; \
435 for (yyi = 0; yyi < (Count); yyi++) \
436 (To)[yyi] = (From)[yyi]; \
442 /* Relocate STACK from its old location to the new one. The
443 local variables YYSIZE and YYSTACKSIZE give the old and new number of
444 elements in the stack, and YYPTR gives the new location of the
445 stack. Advance YYPTR to a properly aligned location for the next
447 # define YYSTACK_RELOCATE(Stack) \
450 YYSIZE_T yynewbytes; \
451 YYCOPY (&yyptr->Stack, Stack, yysize); \
452 Stack = &yyptr->Stack; \
453 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
454 yyptr += yynewbytes / sizeof (*yyptr); \
461 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
462 # define YYSIZE_T __SIZE_TYPE__
464 #if ! defined (YYSIZE_T) && defined (size_t)
465 # define YYSIZE_T size_t
467 #if ! defined (YYSIZE_T)
468 # if defined (__STDC__) || defined (__cplusplus)
469 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
470 # define YYSIZE_T size_t
473 #if ! defined (YYSIZE_T)
474 # define YYSIZE_T unsigned int
477 #define yyerrok (yyerrstatus = 0)
478 #define yyclearin (yychar = YYEMPTY)
481 #define YYACCEPT goto yyacceptlab
482 #define YYABORT goto yyabortlab
483 #define YYERROR goto yyerrlab1
484 /* Like YYERROR except do call yyerror. This remains here temporarily
485 to ease the transition to the new meaning of YYERROR, for GCC.
486 Once GCC version 2 has supplanted version 1, this can go. */
487 #define YYFAIL goto yyerrlab
488 #define YYRECOVERING() (!!yyerrstatus)
489 #define YYBACKUP(Token, Value) \
491 if (yychar == YYEMPTY && yylen == 1) \
495 yychar1 = YYTRANSLATE (yychar); \
501 yyerror ("syntax error: cannot back up"); \
507 #define YYERRCODE 256
510 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
513 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
514 first token. By default, to implement support for ranges, extend
515 its range to the last symbol. */
517 #ifndef YYLLOC_DEFAULT
518 # define YYLLOC_DEFAULT(Current, Rhs, N) \
519 Current.last_line = Rhs[N].last_line; \
520 Current.last_column = Rhs[N].last_column;
524 /* YYLEX -- calling `yylex' with the right arguments. */
529 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
531 # define YYLEX yylex (&yylval, &yylloc)
533 # else /* !YYLSP_NEEDED */
535 # define YYLEX yylex (&yylval, YYLEX_PARAM)
537 # define YYLEX yylex (&yylval)
539 # endif /* !YYLSP_NEEDED */
541 # define YYLEX yylex ()
545 /* Enable debugging if requested. */
549 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
550 # define YYFPRINTF fprintf
553 # define YYDPRINTF(Args) \
558 /* Nonzero means print parse trace. It is left uninitialized so that
559 multiple parsers can coexist. */
562 # define YYDPRINTF(Args)
563 #endif /* !YYDEBUG */
565 /* YYINITDEPTH -- initial size of the parser's stacks. */
567 # define YYINITDEPTH 200
570 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
571 if the built-in stack extension method is used).
573 Do not make this value too large; the results are undefined if
574 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
575 evaluated with infinite-precision integer arithmetic. */
582 # define YYMAXDEPTH 10000
585 #ifdef YYERROR_VERBOSE
588 # if defined (__GLIBC__) && defined (_STRING_H)
589 # define yystrlen strlen
591 /* Return the length of YYSTR. */
593 # if defined (__STDC__) || defined (__cplusplus)
594 yystrlen (const char *yystr
)
600 register const char *yys
= yystr
;
602 while (*yys
++ != '\0')
605 return yys
- yystr
- 1;
611 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
612 # define yystpcpy stpcpy
614 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
617 # if defined (__STDC__) || defined (__cplusplus)
618 yystpcpy (char *yydest
, const char *yysrc
)
620 yystpcpy (yydest
, yysrc
)
625 register char *yyd
= yydest
;
626 register const char *yys
= yysrc
;
628 while ((*yyd
++ = *yys
++) != '\0')
637 #line 315 "/castro/street/H-alpha-linux/share/bison/bison.simple"
640 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
641 into yyparse. The argument should have type void *.
642 It should actually point to an object.
643 Grammar actions can access the variable by casting it
644 to the proper pointer type. */
647 # if defined (__STDC__) || defined (__cplusplus)
648 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
649 # define YYPARSE_PARAM_DECL
651 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
652 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
654 #else /* !YYPARSE_PARAM */
655 # define YYPARSE_PARAM_ARG
656 # define YYPARSE_PARAM_DECL
657 #endif /* !YYPARSE_PARAM */
659 /* Prevent warning if -Wstrict-prototypes. */
661 # ifdef YYPARSE_PARAM
662 int yyparse (void *);
668 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
669 variables are global, or local to YYPARSE. */
671 #define YY_DECL_NON_LSP_VARIABLES \
672 /* The lookahead symbol. */ \
675 /* The semantic value of the lookahead symbol. */ \
678 /* Number of parse errors so far. */ \
682 # define YY_DECL_VARIABLES \
683 YY_DECL_NON_LSP_VARIABLES \
685 /* Location data for the lookahead symbol. */ \
688 # define YY_DECL_VARIABLES \
689 YY_DECL_NON_LSP_VARIABLES
693 /* If nonreentrant, generate the variables here. */
700 yyparse (YYPARSE_PARAM_ARG
)
703 /* If reentrant, generate the variables here. */
708 register int yystate
;
711 /* Number of tokens to shift before error messages enabled. */
713 /* Lookahead token as an internal (translated) token number. */
716 /* Three stacks and their tools:
717 `yyss': related to states,
718 `yyvs': related to semantic values,
719 `yyls': related to locations.
721 Refer to the stacks thru separate pointers, to allow yyoverflow
722 to reallocate them elsewhere. */
724 /* The state stack. */
725 short yyssa
[YYINITDEPTH
];
727 register short *yyssp
;
729 /* The semantic value stack. */
730 YYSTYPE yyvsa
[YYINITDEPTH
];
731 YYSTYPE
*yyvs
= yyvsa
;
732 register YYSTYPE
*yyvsp
;
735 /* The location stack. */
736 YYLTYPE yylsa
[YYINITDEPTH
];
737 YYLTYPE
*yyls
= yylsa
;
742 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
744 # define YYPOPSTACK (yyvsp--, yyssp--)
747 YYSIZE_T yystacksize
= YYINITDEPTH
;
750 /* The variables used to return semantic value and location from the
757 /* When reducing, the number of symbols on the RHS of the reduced
761 YYDPRINTF ((stderr
, "Starting parse\n"));
766 yychar
= YYEMPTY
; /* Cause a token to be read. */
768 /* Initialize stack pointers.
769 Waste one element of value and location stack
770 so that they stay on the same level as the state stack.
771 The wasted elements are never initialized. */
780 /*------------------------------------------------------------.
781 | yynewstate -- Push a new state, which is found in yystate. |
782 `------------------------------------------------------------*/
784 /* In all cases, when you get here, the value and location stacks
785 have just been pushed. so pushing a state here evens the stacks.
792 if (yyssp
>= yyss
+ yystacksize
- 1)
794 /* Get the current used size of the three stacks, in elements. */
795 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
799 /* Give user a chance to reallocate the stack. Use copies of
800 these so that the &'s don't force the real ones into
802 YYSTYPE
*yyvs1
= yyvs
;
805 /* Each stack pointer address is followed by the size of the
806 data in use in that stack, in bytes. */
808 YYLTYPE
*yyls1
= yyls
;
809 /* This used to be a conditional around just the two extra args,
810 but that might be undefined if yyoverflow is a macro. */
811 yyoverflow ("parser stack overflow",
812 &yyss1
, yysize
* sizeof (*yyssp
),
813 &yyvs1
, yysize
* sizeof (*yyvsp
),
814 &yyls1
, yysize
* sizeof (*yylsp
),
818 yyoverflow ("parser stack overflow",
819 &yyss1
, yysize
* sizeof (*yyssp
),
820 &yyvs1
, yysize
* sizeof (*yyvsp
),
826 #else /* no yyoverflow */
827 # ifndef YYSTACK_RELOCATE
830 /* Extend the stack our own way. */
831 if (yystacksize
>= YYMAXDEPTH
)
834 if (yystacksize
> YYMAXDEPTH
)
835 yystacksize
= YYMAXDEPTH
;
839 union yyalloc
*yyptr
=
840 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
843 YYSTACK_RELOCATE (yyss
);
844 YYSTACK_RELOCATE (yyvs
);
846 YYSTACK_RELOCATE (yyls
);
848 # undef YYSTACK_RELOCATE
850 YYSTACK_FREE (yyss1
);
853 #endif /* no yyoverflow */
855 yyssp
= yyss
+ yysize
- 1;
856 yyvsp
= yyvs
+ yysize
- 1;
858 yylsp
= yyls
+ yysize
- 1;
861 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
862 (unsigned long int) yystacksize
));
864 if (yyssp
>= yyss
+ yystacksize
- 1)
868 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
878 /* Do appropriate processing given the current state. */
879 /* Read a lookahead token if we need one and don't already have one. */
882 /* First try to decide what to do without reference to lookahead token. */
884 yyn
= yypact
[yystate
];
888 /* Not known => get a lookahead token if don't already have one. */
890 /* yychar is either YYEMPTY or YYEOF
891 or a valid token in external form. */
893 if (yychar
== YYEMPTY
)
895 YYDPRINTF ((stderr
, "Reading a token: "));
899 /* Convert token to internal form (in yychar1) for indexing tables with */
901 if (yychar
<= 0) /* This means end of input. */
904 yychar
= YYEOF
; /* Don't call YYLEX any more */
906 YYDPRINTF ((stderr
, "Now at end of input.\n"));
910 yychar1
= YYTRANSLATE (yychar
);
913 /* We have to keep this `#if YYDEBUG', since we use variables
914 which are defined only if `YYDEBUG' is set. */
917 YYFPRINTF (stderr
, "Next token is %d (%s",
918 yychar
, yytname
[yychar1
]);
919 /* Give the individual parser a way to print the precise
920 meaning of a token, for further debugging info. */
922 YYPRINT (stderr
, yychar
, yylval
);
924 YYFPRINTF (stderr
, ")\n");
930 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
935 /* yyn is what to do for this token type in this state.
936 Negative => reduce, -yyn is rule number.
937 Positive => shift, yyn is new state.
938 New state is final state => don't bother to shift,
940 0, or most negative number => error. */
955 /* Shift the lookahead token. */
956 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
957 yychar
, yytname
[yychar1
]));
959 /* Discard the token being shifted unless it is eof. */
968 /* Count tokens shifted since error; after three, turn off error
977 /*-----------------------------------------------------------.
978 | yydefault -- do the default action for the current state. |
979 `-----------------------------------------------------------*/
981 yyn
= yydefact
[yystate
];
987 /*-----------------------------.
988 | yyreduce -- Do a reduction. |
989 `-----------------------------*/
991 /* yyn is the number of a rule to reduce with. */
994 /* If YYLEN is nonzero, implement the default value of the action:
997 Otherwise, the following line sets YYVAL to the semantic value of
998 the lookahead token. This behavior is undocumented and Bison
999 users should not rely upon it. Assigning to YYVAL
1000 unconditionally makes the parser a bit smaller, and it avoids a
1001 GCC warning that YYVAL may be used uninitialized. */
1002 yyval
= yyvsp
[1-yylen
];
1005 /* Similarly for the default location. Let the user run additional
1006 commands if for instance locations are ranges. */
1007 yyloc
= yylsp
[1-yylen
];
1008 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1012 /* We have to keep this `#if YYDEBUG', since we use variables which
1013 are defined only if `YYDEBUG' is set. */
1018 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1021 /* Print the symbols being reduced, and their result. */
1022 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] > 0; yyi
++)
1023 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1024 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1031 #line 175 "plural.y"
1033 if (yyvsp
[0].exp
== NULL
)
1035 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
1039 #line 183 "plural.y"
1041 yyval
.exp
= new_exp_3 (qmop
, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1045 #line 187 "plural.y"
1047 yyval
.exp
= new_exp_2 (lor
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1051 #line 191 "plural.y"
1053 yyval
.exp
= new_exp_2 (land
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1057 #line 195 "plural.y"
1059 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1063 #line 199 "plural.y"
1065 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1069 #line 203 "plural.y"
1071 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1075 #line 207 "plural.y"
1077 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
1081 #line 211 "plural.y"
1083 yyval
.exp
= new_exp_1 (lnot
, yyvsp
[0].exp
);
1087 #line 215 "plural.y"
1089 yyval
.exp
= new_exp_0 (var
);
1093 #line 219 "plural.y"
1095 if ((yyval
.exp
= new_exp_0 (num
)) != NULL
)
1096 yyval
.exp
->val
.num
= yyvsp
[0].num
;
1100 #line 224 "plural.y"
1102 yyval
.exp
= yyvsp
[-1].exp
;
1107 #line 705 "/castro/street/H-alpha-linux/share/bison/bison.simple"
1119 short *yyssp1
= yyss
- 1;
1120 YYFPRINTF (stderr
, "state stack now");
1121 while (yyssp1
!= yyssp
)
1122 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1123 YYFPRINTF (stderr
, "\n");
1132 /* Now `shift' the result of the reduction. Determine what state
1133 that goes to, based on the state we popped back to and the rule
1134 number reduced by. */
1138 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1139 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1140 yystate
= yytable
[yystate
];
1142 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1147 /*------------------------------------.
1148 | yyerrlab -- here on detecting error |
1149 `------------------------------------*/
1151 /* If not already recovering from an error, report this error. */
1156 #ifdef YYERROR_VERBOSE
1157 yyn
= yypact
[yystate
];
1159 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1161 YYSIZE_T yysize
= 0;
1166 /* Start YYX at -YYN if negative to avoid negative indexes in
1168 for (yyx
= yyn
< 0 ? -yyn
: 0;
1169 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1170 if (yycheck
[yyx
+ yyn
] == yyx
)
1171 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1172 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1173 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1174 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1177 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1178 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1183 for (yyx
= yyn
< 0 ? -yyn
: 0;
1184 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1186 if (yycheck
[yyx
+ yyn
] == yyx
)
1188 const char *yyq
= ! yycount
? ", expecting " : " or ";
1189 yyp
= yystpcpy (yyp
, yyq
);
1190 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1195 YYSTACK_FREE (yymsg
);
1198 yyerror ("parse error; also virtual memory exhausted");
1201 #endif /* defined (YYERROR_VERBOSE) */
1202 yyerror ("parse error");
1207 /*--------------------------------------------------.
1208 | yyerrlab1 -- error raised explicitly by an action |
1209 `--------------------------------------------------*/
1211 if (yyerrstatus
== 3)
1213 /* If just tried and failed to reuse lookahead token after an
1214 error, discard it. */
1216 /* return failure if at end of input */
1217 if (yychar
== YYEOF
)
1219 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1220 yychar
, yytname
[yychar1
]));
1224 /* Else will try to reuse lookahead token after shifting the error
1227 yyerrstatus
= 3; /* Each real token shifted decrements this */
1232 /*-------------------------------------------------------------------.
1233 | yyerrdefault -- current state does not do anything special for the |
1235 `-------------------------------------------------------------------*/
1238 /* This is wrong; only states that explicitly want error tokens
1239 should shift them. */
1241 /* If its default is to accept any token, ok. Otherwise pop it. */
1242 yyn
= yydefact
[yystate
];
1248 /*---------------------------------------------------------------.
1249 | yyerrpop -- pop the current state because it cannot handle the |
1251 `---------------------------------------------------------------*/
1264 short *yyssp1
= yyss
- 1;
1265 YYFPRINTF (stderr
, "Error: state stack now");
1266 while (yyssp1
!= yyssp
)
1267 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1268 YYFPRINTF (stderr
, "\n");
1276 yyn
= yypact
[yystate
];
1281 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1298 YYDPRINTF ((stderr
, "Shifting error token, "));
1309 /*-------------------------------------.
1310 | yyacceptlab -- YYACCEPT comes here. |
1311 `-------------------------------------*/
1316 /*-----------------------------------.
1317 | yyabortlab -- YYABORT comes here. |
1318 `-----------------------------------*/
1323 /*---------------------------------------------.
1324 | yyoverflowab -- parser overflow comes here. |
1325 `---------------------------------------------*/
1327 yyerror ("parser stack overflow");
1334 YYSTACK_FREE (yyss
);
1338 #line 229 "plural.y"
1343 FREE_EXPRESSION (exp
)
1344 struct expression
*exp
;
1349 /* Handle the recursive case. */
1353 FREE_EXPRESSION (exp
->val
.args
[2]);
1356 FREE_EXPRESSION (exp
->val
.args
[1]);
1359 FREE_EXPRESSION (exp
->val
.args
[0]);
1374 const char *exp
= *pexp
;
1385 if (exp
[0] != ' ' && exp
[0] != '\t')
1394 case '0': case '1': case '2': case '3': case '4':
1395 case '5': case '6': case '7': case '8': case '9':
1397 unsigned long int n
= result
- '0';
1398 while (exp
[0] >= '0' && exp
[0] <= '9')
1424 lval
->op
= not_equal
;
1431 if (exp
[0] == result
)
1441 lval
->op
= less_or_equal
;
1444 lval
->op
= less_than
;
1452 lval
->op
= greater_or_equal
;
1455 lval
->op
= greater_than
;
1489 /* Nothing, just return the character. */
1495 /* Be safe and let the user call this function again. */
1518 /* Do nothing. We don't print error messages here. */