2 /* A Bison parser, made from plural.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse __gettextparse
8 #define yylex __gettextlex
9 #define yyerror __gettexterror
10 #define yylval __gettextlval
11 #define yychar __gettextchar
12 #define yydebug __gettextdebug
13 #define yynerrs __gettextnerrs
22 /* Expression parsing for plural form selection.
23 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
24 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
26 This program is free software; you can redistribute it and/or modify it
27 under the terms of the GNU Library General Public License as published
28 by the Free Software Foundation; either version 2, or (at your option)
31 This program 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 Library General Public License for more details.
36 You should have received a copy of the GNU Library General Public
37 License along with this program; if not, write to the Free Software
38 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
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__
56 /* Names for the libintl functions are a problem. They must not clash
57 with existing names and they should follow ANSI C. But this source
58 code is also used in GNU C Library where the names have a __
59 prefix. So we have to make a difference here. */
61 # define FREE_EXPRESSION __gettext_free_exp
63 # define FREE_EXPRESSION gettext_free_exp__
64 # define __gettextparse gettextparse__
67 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
68 #define YYPARSE_PARAM arg
72 unsigned long int num;
74 struct expression *exp;
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);
185 #define YYFLAG -32768
188 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
190 static const char yytranslate[] = { 0,
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, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 10, 2, 2, 2, 2, 5, 2, 14,
195 15, 2, 2, 2, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 12, 2, 2,
197 2, 2, 3, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 13,
202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
203 2, 2, 2, 4, 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, 2, 2, 2, 2,
216 2, 2, 2, 2, 2, 1, 6, 7, 8, 9,
221 static const short yyprhs[] = { 0,
222 0, 2, 8, 12, 16, 20, 24, 28, 32, 35,
226 static const short yyrhs[] = { 17,
227 0, 17, 3, 17, 12, 17, 0, 17, 4, 17,
228 0, 17, 5, 17, 0, 17, 6, 17, 0, 17,
229 7, 17, 0, 17, 8, 17, 0, 17, 9, 17,
230 0, 10, 17, 0, 13, 0, 11, 0, 14, 17,
237 static const short yyrline[] = { 0,
238 178, 186, 190, 194, 198, 202, 206, 210, 214, 218,
244 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
246 static const char * const yytname[] = { "$","error","$undefined.","'?'","'|'",
247 "'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'",
252 static const short yyr1[] = { 0,
253 16, 17, 17, 17, 17, 17, 17, 17, 17, 17,
257 static const short yyr2[] = { 0,
258 1, 5, 3, 3, 3, 3, 3, 3, 2, 1,
262 static const short yydefact[] = { 0,
263 0, 11, 10, 0, 1, 9, 0, 0, 0, 0,
264 0, 0, 0, 0, 12, 0, 3, 4, 5, 6,
268 static const short yydefgoto[] = { 25,
272 static const short yypact[] = { -9,
273 -9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9,
274 -9, -9, -9, -9,-32768, 24, 39, 43, 16, 26,
275 -3,-32768, -9, 34, 21, 53,-32768
278 static const short yypgoto[] = {-32768,
286 static const short yytable[] = { 6,
287 1, 2, 7, 3, 4, 14, 16, 17, 18, 19,
288 20, 21, 22, 8, 9, 10, 11, 12, 13, 14,
289 26, 24, 12, 13, 14, 15, 8, 9, 10, 11,
290 12, 13, 14, 13, 14, 23, 8, 9, 10, 11,
291 12, 13, 14, 10, 11, 12, 13, 14, 11, 12,
295 static const short yycheck[] = { 1,
296 10, 11, 4, 13, 14, 9, 8, 9, 10, 11,
297 12, 13, 14, 3, 4, 5, 6, 7, 8, 9,
298 0, 23, 7, 8, 9, 15, 3, 4, 5, 6,
299 7, 8, 9, 8, 9, 12, 3, 4, 5, 6,
300 7, 8, 9, 5, 6, 7, 8, 9, 6, 7,
305 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
306 #line 3 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
307 /* This file comes from bison-1.28. */
309 /* Skeleton output parser for bison,
310 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
312 This program is free software; you can redistribute it and/or modify
313 it under the terms of the GNU General Public License as published by
314 the Free Software Foundation; either version 2, or (at your option)
317 This program is distributed in the hope that it will be useful,
318 but WITHOUT ANY WARRANTY; without even the implied warranty of
319 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
320 GNU General Public License for more details.
322 You should have received a copy of the GNU General Public License
323 along with this program; if not, write to the Free Software
324 Foundation, Inc., 51 Franklin Street, Fifth Floor,
325 Boston, MA 02110-1301, USA. */
327 /* As a special exception, when this file is copied by Bison into a
328 Bison output file, you may use that output file without restriction.
329 This special exception was added by the Free Software Foundation
330 in version 1.24 of Bison. */
332 /* This is the parser code that is written into each bison parser
333 when the %semantic_parser declaration is not specified in the grammar.
334 It was written by Richard Stallman by simplifying the hairy parser
335 used when %semantic_parser is specified. */
337 #ifndef YYSTACK_USE_ALLOCA
339 #define YYSTACK_USE_ALLOCA
340 #else /* alloca not defined */
342 #define YYSTACK_USE_ALLOCA
343 #define alloca __builtin_alloca
344 #else /* not GNU C. */
345 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
346 #define YYSTACK_USE_ALLOCA
348 #else /* not sparc */
349 /* We think this test detects Watcom and Microsoft C. */
350 /* This used to test MSDOS, but that is a bad idea
351 since that symbol is in the user namespace. */
352 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
353 #if 0 /* No need for malloc.h, which pollutes the namespace;
354 instead, just don't use alloca. */
357 #else /* not MSDOS, or __TURBOC__ */
359 /* I don't know what this was needed for, but it pollutes the namespace.
360 So I turned it off. rms, 2 May 1997. */
361 /* #include <malloc.h> */
363 #define YYSTACK_USE_ALLOCA
364 #else /* not MSDOS, or __TURBOC__, or _AIX */
366 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
367 and on HPUX 10. Eventually we can turn this on. */
368 #define YYSTACK_USE_ALLOCA
369 #define alloca __builtin_alloca
372 #endif /* not _AIX */
373 #endif /* not MSDOS, or __TURBOC__ */
374 #endif /* not sparc */
375 #endif /* not GNU C */
376 #endif /* alloca not defined */
377 #endif /* YYSTACK_USE_ALLOCA not defined */
379 #ifdef YYSTACK_USE_ALLOCA
380 #define YYSTACK_ALLOC alloca
382 #define YYSTACK_ALLOC malloc
385 /* Note: there must be only one dollar sign in this file.
386 It is replaced by the list of actions, each action
387 as one case of the switch. */
389 #define yyerrok (yyerrstatus = 0)
390 #define yyclearin (yychar = YYEMPTY)
393 #define YYACCEPT goto yyacceptlab
394 #define YYABORT goto yyabortlab
395 #define YYERROR goto yyerrlab1
396 /* Like YYERROR except do call yyerror.
397 This remains here temporarily to ease the
398 transition to the new meaning of YYERROR, for GCC.
399 Once GCC version 2 has supplanted version 1, this can go. */
400 #define YYFAIL goto yyerrlab
401 #define YYRECOVERING() (!!yyerrstatus)
402 #define YYBACKUP(token, value) \
404 if (yychar == YYEMPTY && yylen == 1) \
405 { yychar = (token), yylval = (value); \
406 yychar1 = YYTRANSLATE (yychar); \
411 { yyerror ("syntax error: cannot back up"); YYERROR; } \
415 #define YYERRCODE 256
418 #define YYLEX yylex()
424 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
426 #define YYLEX yylex(&yylval, &yylloc)
428 #else /* not YYLSP_NEEDED */
430 #define YYLEX yylex(&yylval, YYLEX_PARAM)
432 #define YYLEX yylex(&yylval)
434 #endif /* not YYLSP_NEEDED */
437 /* If nonreentrant, generate the variables here */
441 int yychar; /* the lookahead symbol */
442 YYSTYPE yylval; /* the semantic value of the */
443 /* lookahead symbol */
446 YYLTYPE yylloc; /* location data for the lookahead */
450 int yynerrs; /* number of parse errors so far */
451 #endif /* not YYPURE */
454 int yydebug; /* nonzero means print parse trace */
455 /* Since this is uninitialized, it does not stop multiple parsers
459 /* YYINITDEPTH indicates the initial size of the parser's stacks */
462 #define YYINITDEPTH 200
465 /* YYMAXDEPTH is the maximum size the stacks can grow to
466 (effective only if the built-in stack extension method is used). */
473 #define YYMAXDEPTH 10000
476 /* Define __yy_memcpy. Note that the size argument
477 should be passed with type unsigned int, because that is what the non-GCC
478 definitions require. With GCC, __builtin_memcpy takes an arg
479 of type size_t, but it can handle unsigned int. */
481 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
482 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
483 #else /* not GNU C or C++ */
486 /* This is the most reliable way to avoid incompatibilities
487 in available built-in functions on various systems. */
489 __yy_memcpy (to, from, count)
494 register char *f = from;
495 register char *t = to;
496 register int i = count;
502 #else /* __cplusplus */
504 /* This is the most reliable way to avoid incompatibilities
505 in available built-in functions on various systems. */
507 __yy_memcpy (char *to, char *from, unsigned int count)
509 register char *t = to;
510 register char *f = from;
511 register int i = count;
520 #line 217 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
522 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
523 into yyparse. The argument should have type void *.
524 It should actually point to an object.
525 Grammar actions can access the variable by casting it
526 to the proper pointer type. */
530 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
531 #define YYPARSE_PARAM_DECL
532 #else /* not __cplusplus */
533 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
534 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
535 #endif /* not __cplusplus */
536 #else /* not YYPARSE_PARAM */
537 #define YYPARSE_PARAM_ARG
538 #define YYPARSE_PARAM_DECL
539 #endif /* not YYPARSE_PARAM */
541 /* Prevent warning if -Wstrict-prototypes. */
544 int yyparse (void *);
551 yyparse(YYPARSE_PARAM_ARG)
554 register int yystate;
556 register short *yyssp;
557 register YYSTYPE *yyvsp;
558 int yyerrstatus; /* number of tokens to shift before error messages enabled */
559 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
561 short yyssa[YYINITDEPTH]; /* the state stack */
562 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
564 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
565 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
568 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
569 YYLTYPE *yyls = yylsa;
572 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
574 #define YYPOPSTACK (yyvsp--, yyssp--)
577 int yystacksize = YYINITDEPTH;
578 int yyfree_stacks = 0;
589 YYSTYPE yyval; /* the variable used to return */
590 /* semantic values from the action */
597 fprintf(stderr, "Starting parse\n");
603 yychar = YYEMPTY; /* Cause a token to be read. */
605 /* Initialize stack pointers.
606 Waste one element of value and location stack
607 so that they stay on the same level as the state stack.
608 The wasted elements are never initialized. */
616 /* Push a new state, which is found in yystate . */
617 /* In all cases, when you get here, the value and location stacks
618 have just been pushed. so pushing a state here evens the stacks. */
623 if (yyssp >= yyss + yystacksize - 1)
625 /* Give user a chance to reallocate the stack */
626 /* Use copies of these so that the &'s don't force the real ones into memory. */
627 YYSTYPE *yyvs1 = yyvs;
630 YYLTYPE *yyls1 = yyls;
633 /* Get the current used size of the three stacks, in elements. */
634 int size = yyssp - yyss + 1;
637 /* Each stack pointer address is followed by the size of
638 the data in use in that stack, in bytes. */
640 /* This used to be a conditional around just the two extra args,
641 but that might be undefined if yyoverflow is a macro. */
642 yyoverflow("parser stack overflow",
643 &yyss1, size * sizeof (*yyssp),
644 &yyvs1, size * sizeof (*yyvsp),
645 &yyls1, size * sizeof (*yylsp),
648 yyoverflow("parser stack overflow",
649 &yyss1, size * sizeof (*yyssp),
650 &yyvs1, size * sizeof (*yyvsp),
654 yyss = yyss1; yyvs = yyvs1;
658 #else /* no yyoverflow */
659 /* Extend the stack our own way. */
660 if (yystacksize >= YYMAXDEPTH)
662 yyerror("parser stack overflow");
674 if (yystacksize > YYMAXDEPTH)
675 yystacksize = YYMAXDEPTH;
676 #ifndef YYSTACK_USE_ALLOCA
679 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
680 __yy_memcpy ((char *)yyss, (char *)yyss1,
681 size * (unsigned int) sizeof (*yyssp));
682 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
683 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
684 size * (unsigned int) sizeof (*yyvsp));
686 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
687 __yy_memcpy ((char *)yyls, (char *)yyls1,
688 size * (unsigned int) sizeof (*yylsp));
690 #endif /* no yyoverflow */
692 yyssp = yyss + size - 1;
693 yyvsp = yyvs + size - 1;
695 yylsp = yyls + size - 1;
700 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
703 if (yyssp >= yyss + yystacksize - 1)
709 fprintf(stderr, "Entering state %d\n", yystate);
715 /* Do appropriate processing given the current state. */
716 /* Read a lookahead token if we need one and don't already have one. */
719 /* First try to decide what to do without reference to lookahead token. */
721 yyn = yypact[yystate];
725 /* Not known => get a lookahead token if don't already have one. */
727 /* yychar is either YYEMPTY or YYEOF
728 or a valid token in external form. */
730 if (yychar == YYEMPTY)
734 fprintf(stderr, "Reading a token: ");
739 /* Convert token to internal form (in yychar1) for indexing tables with */
741 if (yychar <= 0) /* This means end of input. */
744 yychar = YYEOF; /* Don't call YYLEX any more */
748 fprintf(stderr, "Now at end of input.\n");
753 yychar1 = YYTRANSLATE(yychar);
758 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
759 /* Give the individual parser a way to print the precise meaning
760 of a token, for further debugging info. */
762 YYPRINT (stderr, yychar, yylval);
764 fprintf (stderr, ")\n");
770 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
775 /* yyn is what to do for this token type in this state.
776 Negative => reduce, -yyn is rule number.
777 Positive => shift, yyn is new state.
778 New state is final state => don't bother to shift,
780 0, or most negative number => error. */
795 /* Shift the lookahead token. */
799 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
802 /* Discard the token being shifted unless it is eof. */
811 /* count tokens shifted since error; after three, turn off error status. */
812 if (yyerrstatus) yyerrstatus--;
817 /* Do the default action for the current state. */
820 yyn = yydefact[yystate];
824 /* Do a reduction. yyn is the number of a rule to reduce with. */
828 yyval = yyvsp[1-yylen]; /* implement default value of the action */
835 fprintf (stderr, "Reducing via rule %d (line %d), ",
838 /* Print the symbols being reduced, and their result. */
839 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
840 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
841 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
851 if (yyvsp[0].exp == NULL)
853 ((struct parse_args *) arg)->res = yyvsp[0].exp;
859 yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
865 yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
871 yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
877 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
883 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
889 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
895 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
901 yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
907 yyval.exp = new_exp_0 (var);
913 if ((yyval.exp = new_exp_0 (num)) != NULL)
914 yyval.exp->val.num = yyvsp[0].num;
920 yyval.exp = yyvsp[-1].exp;
924 /* the action file gets copied in in place of this dollarsign */
925 #line 543 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
936 short *ssp1 = yyss - 1;
937 fprintf (stderr, "state stack now");
938 while (ssp1 != yyssp)
939 fprintf (stderr, " %d", *++ssp1);
940 fprintf (stderr, "\n");
950 yylsp->first_line = yylloc.first_line;
951 yylsp->first_column = yylloc.first_column;
952 yylsp->last_line = (yylsp-1)->last_line;
953 yylsp->last_column = (yylsp-1)->last_column;
958 yylsp->last_line = (yylsp+yylen-1)->last_line;
959 yylsp->last_column = (yylsp+yylen-1)->last_column;
963 /* Now "shift" the result of the reduction.
964 Determine what state that goes to,
965 based on the state we popped back to
966 and the rule number reduced by. */
970 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
971 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
972 yystate = yytable[yystate];
974 yystate = yydefgoto[yyn - YYNTBASE];
978 yyerrlab: /* here on detecting error */
981 /* If not already recovering from an error, report this error. */
985 #ifdef YYERROR_VERBOSE
986 yyn = yypact[yystate];
988 if (yyn > YYFLAG && yyn < YYLAST)
995 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
996 for (x = (yyn < 0 ? -yyn : 0);
997 x < (sizeof(yytname) / sizeof(char *)); x++)
998 if (yycheck[x + yyn] == x)
999 size += strlen(yytname[x]) + 15, count++;
1000 msg = (char *) malloc(size + 15);
1003 strcpy(msg, "parse error");
1008 for (x = (yyn < 0 ? -yyn : 0);
1009 x < (sizeof(yytname) / sizeof(char *)); x++)
1010 if (yycheck[x + yyn] == x)
1012 strcat(msg, count == 0 ? ", expecting `" : " or `");
1013 strcat(msg, yytname[x]);
1022 yyerror ("parse error; also virtual memory exceeded");
1025 #endif /* YYERROR_VERBOSE */
1026 yyerror("parse error");
1030 yyerrlab1: /* here on error raised explicitly by an action */
1032 if (yyerrstatus == 3)
1034 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1036 /* return failure if at end of input */
1037 if (yychar == YYEOF)
1042 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1048 /* Else will try to reuse lookahead token
1049 after shifting the error token. */
1051 yyerrstatus = 3; /* Each real token shifted decrements this */
1055 yyerrdefault: /* current state does not do anything special for the error token. */
1058 /* This is wrong; only states that explicitly want error tokens
1059 should shift them. */
1060 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1061 if (yyn) goto yydefault;
1064 yyerrpop: /* pop the current state because it cannot handle the error token */
1066 if (yyssp == yyss) YYABORT;
1076 short *ssp1 = yyss - 1;
1077 fprintf (stderr, "Error: state stack now");
1078 while (ssp1 != yyssp)
1079 fprintf (stderr, " %d", *++ssp1);
1080 fprintf (stderr, "\n");
1086 yyn = yypact[yystate];
1091 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1110 fprintf(stderr, "Shifting error token, ");
1122 /* YYACCEPT comes here. */
1134 /* YYABORT comes here. */
1145 #line 233 "plural.y"
1150 FREE_EXPRESSION (exp)
1151 struct expression *exp;
1156 /* Handle the recursive case. */
1160 FREE_EXPRESSION (exp->val.args[2]);
1163 FREE_EXPRESSION (exp->val.args[1]);
1166 FREE_EXPRESSION (exp->val.args[0]);
1181 const char *exp = *pexp;
1192 if (exp[0] != ' ' && exp[0] != '\t')
1201 case '0': case '1': case '2': case '3': case '4':
1202 case '5': case '6': case '7': case '8': case '9':
1204 unsigned long int n = result - '0';
1205 while (exp[0] >= '0' && exp[0] <= '9')
1231 lval->op = not_equal;
1238 if (exp[0] == result)
1248 lval->op = less_or_equal;
1251 lval->op = less_than;
1259 lval->op = greater_or_equal;
1262 lval->op = greater_than;
1296 /* Nothing, just return the character. */
1302 /* Be safe and let the user call this function again. */
1325 /* Do nothing. We don't print error messages here. */