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
27
it under the terms of the GNU General Public License as published by
28
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
34
GNU General Public License for more details.
36
You should have received a copy of the GNU General Public License
37
along with this program; if not, write to the Free Software Foundation,
38
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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__
55
/* Names for the libintl functions are a problem. They must not clash
56
with existing names and they should follow ANSI C. But this source
57
code is also used in GNU C Library where the names have a __
58
prefix. So we have to make a difference here. */
60
# define FREE_EXPRESSION __gettext_free_exp
62
# define FREE_EXPRESSION gettext_free_exp__
63
# define __gettextparse gettextparse__
66
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
67
#define YYPARSE_PARAM arg
71
unsigned long int num;
73
struct expression *exp;
77
/* Prototypes for local functions. */
78
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
79
struct expression * const *args));
80
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
81
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
82
struct expression *right));
83
static struct expression *new_exp_2 PARAMS ((enum operator op,
84
struct expression *left,
85
struct expression *right));
86
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
87
struct expression *bexp,
88
struct expression *tbranch,
89
struct expression *fbranch));
90
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
91
static void yyerror PARAMS ((const char *str));
93
/* Allocation of expressions. */
95
static struct expression *
96
new_exp (nargs, op, args)
99
struct expression * const *args;
102
struct expression *newp;
104
/* If any of the argument could not be malloc'ed, just return NULL. */
105
for (i = nargs - 1; i >= 0; i--)
109
/* Allocate a new expression. */
110
newp = (struct expression *) malloc (sizeof (*newp));
114
newp->operation = op;
115
for (i = nargs - 1; i >= 0; i--)
116
newp->val.args[i] = args[i];
121
for (i = nargs - 1; i >= 0; i--)
122
FREE_EXPRESSION (args[i]);
127
static inline struct expression *
131
return new_exp (0, op, NULL);
134
static inline struct expression *
135
new_exp_1 (op, right)
137
struct expression *right;
139
struct expression *args[1];
142
return new_exp (1, op, args);
145
static struct expression *
146
new_exp_2 (op, left, right)
148
struct expression *left;
149
struct expression *right;
151
struct expression *args[2];
155
return new_exp (2, op, args);
158
static inline struct expression *
159
new_exp_3 (op, bexp, tbranch, fbranch)
161
struct expression *bexp;
162
struct expression *tbranch;
163
struct expression *fbranch;
165
struct expression *args[3];
170
return new_exp (3, op, args);
184
#define YYFLAG -32768
187
#define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
189
static const char yytranslate[] = { 0,
190
2, 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, 10, 2, 2, 2, 2, 5, 2, 14,
194
15, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195
2, 2, 2, 2, 2, 2, 2, 12, 2, 2,
196
2, 2, 3, 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, 2, 2, 2, 2, 2, 2, 2,
200
2, 2, 2, 2, 2, 2, 2, 2, 2, 13,
201
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202
2, 2, 2, 4, 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
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, 1, 6, 7, 8, 9,
220
static const short yyprhs[] = { 0,
221
0, 2, 8, 12, 16, 20, 24, 28, 32, 35,
225
static const short yyrhs[] = { 17,
226
0, 17, 3, 17, 12, 17, 0, 17, 4, 17,
227
0, 17, 5, 17, 0, 17, 6, 17, 0, 17,
228
7, 17, 0, 17, 8, 17, 0, 17, 9, 17,
229
0, 10, 17, 0, 13, 0, 11, 0, 14, 17,
236
static const short yyrline[] = { 0,
237
177, 185, 189, 193, 197, 201, 205, 209, 213, 217,
243
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
245
static const char * const yytname[] = { "$","error","$undefined.","'?'","'|'",
246
"'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'",
251
static const short yyr1[] = { 0,
252
16, 17, 17, 17, 17, 17, 17, 17, 17, 17,
256
static const short yyr2[] = { 0,
257
1, 5, 3, 3, 3, 3, 3, 3, 2, 1,
261
static const short yydefact[] = { 0,
262
0, 11, 10, 0, 1, 9, 0, 0, 0, 0,
263
0, 0, 0, 0, 12, 0, 3, 4, 5, 6,
267
static const short yydefgoto[] = { 25,
271
static const short yypact[] = { -9,
272
-9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9,
273
-9, -9, -9, -9,-32768, 24, 39, 43, 16, 26,
274
-3,-32768, -9, 34, 21, 53,-32768
277
static const short yypgoto[] = {-32768,
285
static const short yytable[] = { 6,
286
1, 2, 7, 3, 4, 14, 16, 17, 18, 19,
287
20, 21, 22, 8, 9, 10, 11, 12, 13, 14,
288
26, 24, 12, 13, 14, 15, 8, 9, 10, 11,
289
12, 13, 14, 13, 14, 23, 8, 9, 10, 11,
290
12, 13, 14, 10, 11, 12, 13, 14, 11, 12,
294
static const short yycheck[] = { 1,
295
10, 11, 4, 13, 14, 9, 8, 9, 10, 11,
296
12, 13, 14, 3, 4, 5, 6, 7, 8, 9,
297
0, 23, 7, 8, 9, 15, 3, 4, 5, 6,
298
7, 8, 9, 8, 9, 12, 3, 4, 5, 6,
299
7, 8, 9, 5, 6, 7, 8, 9, 6, 7,
304
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
305
#line 3 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
306
/* This file comes from bison-1.28. */
308
/* Skeleton output parser for bison,
309
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
311
This program is free software; you can redistribute it and/or modify
312
it under the terms of the GNU General Public License as published by
313
the Free Software Foundation; either version 2, or (at your option)
316
This program is distributed in the hope that it will be useful,
317
but WITHOUT ANY WARRANTY; without even the implied warranty of
318
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
319
GNU General Public License for more details.
321
You should have received a copy of the GNU General Public License
322
along with this program; if not, write to the Free Software
323
Foundation, Inc., 59 Temple Place - Suite 330,
324
Boston, MA 02111-1307, USA. */
326
/* As a special exception, when this file is copied by Bison into a
327
Bison output file, you may use that output file without restriction.
328
This special exception was added by the Free Software Foundation
329
in version 1.24 of Bison. */
331
/* This is the parser code that is written into each bison parser
332
when the %semantic_parser declaration is not specified in the grammar.
333
It was written by Richard Stallman by simplifying the hairy parser
334
used when %semantic_parser is specified. */
336
#ifndef YYSTACK_USE_ALLOCA
338
#define YYSTACK_USE_ALLOCA
339
#else /* alloca not defined */
341
#define YYSTACK_USE_ALLOCA
342
#define alloca __builtin_alloca
343
#else /* not GNU C. */
344
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
345
#define YYSTACK_USE_ALLOCA
347
#else /* not sparc */
348
/* We think this test detects Watcom and Microsoft C. */
349
/* This used to test MSDOS, but that is a bad idea
350
since that symbol is in the user namespace. */
351
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
352
#if 0 /* No need for malloc.h, which pollutes the namespace;
353
instead, just don't use alloca. */
356
#else /* not MSDOS, or __TURBOC__ */
358
/* I don't know what this was needed for, but it pollutes the namespace.
359
So I turned it off. rms, 2 May 1997. */
360
/* #include <malloc.h> */
362
#define YYSTACK_USE_ALLOCA
363
#else /* not MSDOS, or __TURBOC__, or _AIX */
365
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
366
and on HPUX 10. Eventually we can turn this on. */
367
#define YYSTACK_USE_ALLOCA
368
#define alloca __builtin_alloca
371
#endif /* not _AIX */
372
#endif /* not MSDOS, or __TURBOC__ */
373
#endif /* not sparc */
374
#endif /* not GNU C */
375
#endif /* alloca not defined */
376
#endif /* YYSTACK_USE_ALLOCA not defined */
378
#ifdef YYSTACK_USE_ALLOCA
379
#define YYSTACK_ALLOC alloca
381
#define YYSTACK_ALLOC malloc
384
/* Note: there must be only one dollar sign in this file.
385
It is replaced by the list of actions, each action
386
as one case of the switch. */
388
#define yyerrok (yyerrstatus = 0)
389
#define yyclearin (yychar = YYEMPTY)
392
#define YYACCEPT goto yyacceptlab
393
#define YYABORT goto yyabortlab
394
#define YYERROR goto yyerrlab1
395
/* Like YYERROR except do call yyerror.
396
This remains here temporarily to ease the
397
transition to the new meaning of YYERROR, for GCC.
398
Once GCC version 2 has supplanted version 1, this can go. */
399
#define YYFAIL goto yyerrlab
400
#define YYRECOVERING() (!!yyerrstatus)
401
#define YYBACKUP(token, value) \
403
if (yychar == YYEMPTY && yylen == 1) \
404
{ yychar = (token), yylval = (value); \
405
yychar1 = YYTRANSLATE (yychar); \
410
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
414
#define YYERRCODE 256
417
#define YYLEX yylex()
423
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
425
#define YYLEX yylex(&yylval, &yylloc)
427
#else /* not YYLSP_NEEDED */
429
#define YYLEX yylex(&yylval, YYLEX_PARAM)
431
#define YYLEX yylex(&yylval)
433
#endif /* not YYLSP_NEEDED */
436
/* If nonreentrant, generate the variables here */
440
int yychar; /* the lookahead symbol */
441
YYSTYPE yylval; /* the semantic value of the */
442
/* lookahead symbol */
445
YYLTYPE yylloc; /* location data for the lookahead */
449
int yynerrs; /* number of parse errors so far */
450
#endif /* not YYPURE */
453
int yydebug; /* nonzero means print parse trace */
454
/* Since this is uninitialized, it does not stop multiple parsers
458
/* YYINITDEPTH indicates the initial size of the parser's stacks */
461
#define YYINITDEPTH 200
464
/* YYMAXDEPTH is the maximum size the stacks can grow to
465
(effective only if the built-in stack extension method is used). */
472
#define YYMAXDEPTH 10000
475
/* Define __yy_memcpy. Note that the size argument
476
should be passed with type unsigned int, because that is what the non-GCC
477
definitions require. With GCC, __builtin_memcpy takes an arg
478
of type size_t, but it can handle unsigned int. */
480
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
481
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
482
#else /* not GNU C or C++ */
485
/* This is the most reliable way to avoid incompatibilities
486
in available built-in functions on various systems. */
488
__yy_memcpy (to, from, count)
493
register char *f = from;
494
register char *t = to;
495
register int i = count;
501
#else /* __cplusplus */
503
/* This is the most reliable way to avoid incompatibilities
504
in available built-in functions on various systems. */
506
__yy_memcpy (char *to, char *from, unsigned int count)
508
register char *t = to;
509
register char *f = from;
510
register int i = count;
519
#line 217 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
521
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
522
into yyparse. The argument should have type void *.
523
It should actually point to an object.
524
Grammar actions can access the variable by casting it
525
to the proper pointer type. */
529
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
530
#define YYPARSE_PARAM_DECL
531
#else /* not __cplusplus */
532
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
533
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
534
#endif /* not __cplusplus */
535
#else /* not YYPARSE_PARAM */
536
#define YYPARSE_PARAM_ARG
537
#define YYPARSE_PARAM_DECL
538
#endif /* not YYPARSE_PARAM */
540
/* Prevent warning if -Wstrict-prototypes. */
543
int yyparse (void *);
550
yyparse(YYPARSE_PARAM_ARG)
553
register int yystate;
555
register short *yyssp;
556
register YYSTYPE *yyvsp;
557
int yyerrstatus; /* number of tokens to shift before error messages enabled */
558
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
560
short yyssa[YYINITDEPTH]; /* the state stack */
561
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
563
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
564
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
567
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
568
YYLTYPE *yyls = yylsa;
571
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
573
#define YYPOPSTACK (yyvsp--, yyssp--)
576
int yystacksize = YYINITDEPTH;
577
int yyfree_stacks = 0;
588
YYSTYPE yyval; /* the variable used to return */
589
/* semantic values from the action */
596
fprintf(stderr, "Starting parse\n");
602
yychar = YYEMPTY; /* Cause a token to be read. */
604
/* Initialize stack pointers.
605
Waste one element of value and location stack
606
so that they stay on the same level as the state stack.
607
The wasted elements are never initialized. */
615
/* Push a new state, which is found in yystate . */
616
/* In all cases, when you get here, the value and location stacks
617
have just been pushed. so pushing a state here evens the stacks. */
622
if (yyssp >= yyss + yystacksize - 1)
624
/* Give user a chance to reallocate the stack */
625
/* Use copies of these so that the &'s don't force the real ones into memory. */
626
YYSTYPE *yyvs1 = yyvs;
629
YYLTYPE *yyls1 = yyls;
632
/* Get the current used size of the three stacks, in elements. */
633
int size = yyssp - yyss + 1;
636
/* Each stack pointer address is followed by the size of
637
the data in use in that stack, in bytes. */
639
/* This used to be a conditional around just the two extra args,
640
but that might be undefined if yyoverflow is a macro. */
641
yyoverflow("parser stack overflow",
642
&yyss1, size * sizeof (*yyssp),
643
&yyvs1, size * sizeof (*yyvsp),
644
&yyls1, size * sizeof (*yylsp),
647
yyoverflow("parser stack overflow",
648
&yyss1, size * sizeof (*yyssp),
649
&yyvs1, size * sizeof (*yyvsp),
653
yyss = yyss1; yyvs = yyvs1;
657
#else /* no yyoverflow */
658
/* Extend the stack our own way. */
659
if (yystacksize >= YYMAXDEPTH)
661
yyerror("parser stack overflow");
673
if (yystacksize > YYMAXDEPTH)
674
yystacksize = YYMAXDEPTH;
675
#ifndef YYSTACK_USE_ALLOCA
678
yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
679
__yy_memcpy ((char *)yyss, (char *)yyss1,
680
size * (unsigned int) sizeof (*yyssp));
681
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
682
__yy_memcpy ((char *)yyvs, (char *)yyvs1,
683
size * (unsigned int) sizeof (*yyvsp));
685
yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
686
__yy_memcpy ((char *)yyls, (char *)yyls1,
687
size * (unsigned int) sizeof (*yylsp));
689
#endif /* no yyoverflow */
691
yyssp = yyss + size - 1;
692
yyvsp = yyvs + size - 1;
694
yylsp = yyls + size - 1;
699
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
702
if (yyssp >= yyss + yystacksize - 1)
708
fprintf(stderr, "Entering state %d\n", yystate);
714
/* Do appropriate processing given the current state. */
715
/* Read a lookahead token if we need one and don't already have one. */
718
/* First try to decide what to do without reference to lookahead token. */
720
yyn = yypact[yystate];
724
/* Not known => get a lookahead token if don't already have one. */
726
/* yychar is either YYEMPTY or YYEOF
727
or a valid token in external form. */
729
if (yychar == YYEMPTY)
733
fprintf(stderr, "Reading a token: ");
738
/* Convert token to internal form (in yychar1) for indexing tables with */
740
if (yychar <= 0) /* This means end of input. */
743
yychar = YYEOF; /* Don't call YYLEX any more */
747
fprintf(stderr, "Now at end of input.\n");
752
yychar1 = YYTRANSLATE(yychar);
757
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
758
/* Give the individual parser a way to print the precise meaning
759
of a token, for further debugging info. */
761
YYPRINT (stderr, yychar, yylval);
763
fprintf (stderr, ")\n");
769
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
774
/* yyn is what to do for this token type in this state.
775
Negative => reduce, -yyn is rule number.
776
Positive => shift, yyn is new state.
777
New state is final state => don't bother to shift,
779
0, or most negative number => error. */
794
/* Shift the lookahead token. */
798
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
801
/* Discard the token being shifted unless it is eof. */
810
/* count tokens shifted since error; after three, turn off error status. */
811
if (yyerrstatus) yyerrstatus--;
816
/* Do the default action for the current state. */
819
yyn = yydefact[yystate];
823
/* Do a reduction. yyn is the number of a rule to reduce with. */
827
yyval = yyvsp[1-yylen]; /* implement default value of the action */
834
fprintf (stderr, "Reducing via rule %d (line %d), ",
837
/* Print the symbols being reduced, and their result. */
838
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
839
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
840
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
850
if (yyvsp[0].exp == NULL)
852
((struct parse_args *) arg)->res = yyvsp[0].exp;
858
yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
864
yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
870
yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
876
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
882
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
888
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
894
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
900
yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
906
yyval.exp = new_exp_0 (var);
912
if ((yyval.exp = new_exp_0 (num)) != NULL)
913
yyval.exp->val.num = yyvsp[0].num;
919
yyval.exp = yyvsp[-1].exp;
923
/* the action file gets copied in in place of this dollarsign */
924
#line 543 "/home/haible/gnu/arch/linuxlibc6/share/bison.simple"
935
short *ssp1 = yyss - 1;
936
fprintf (stderr, "state stack now");
937
while (ssp1 != yyssp)
938
fprintf (stderr, " %d", *++ssp1);
939
fprintf (stderr, "\n");
949
yylsp->first_line = yylloc.first_line;
950
yylsp->first_column = yylloc.first_column;
951
yylsp->last_line = (yylsp-1)->last_line;
952
yylsp->last_column = (yylsp-1)->last_column;
957
yylsp->last_line = (yylsp+yylen-1)->last_line;
958
yylsp->last_column = (yylsp+yylen-1)->last_column;
962
/* Now "shift" the result of the reduction.
963
Determine what state that goes to,
964
based on the state we popped back to
965
and the rule number reduced by. */
969
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
970
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
971
yystate = yytable[yystate];
973
yystate = yydefgoto[yyn - YYNTBASE];
977
yyerrlab: /* here on detecting error */
980
/* If not already recovering from an error, report this error. */
984
#ifdef YYERROR_VERBOSE
985
yyn = yypact[yystate];
987
if (yyn > YYFLAG && yyn < YYLAST)
994
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
995
for (x = (yyn < 0 ? -yyn : 0);
996
x < (sizeof(yytname) / sizeof(char *)); x++)
997
if (yycheck[x + yyn] == x)
998
size += strlen(yytname[x]) + 15, count++;
999
msg = (char *) malloc(size + 15);
1002
strcpy(msg, "parse error");
1007
for (x = (yyn < 0 ? -yyn : 0);
1008
x < (sizeof(yytname) / sizeof(char *)); x++)
1009
if (yycheck[x + yyn] == x)
1011
strcat(msg, count == 0 ? ", expecting `" : " or `");
1012
strcat(msg, yytname[x]);
1021
yyerror ("parse error; also virtual memory exceeded");
1024
#endif /* YYERROR_VERBOSE */
1025
yyerror("parse error");
1029
yyerrlab1: /* here on error raised explicitly by an action */
1031
if (yyerrstatus == 3)
1033
/* if just tried and failed to reuse lookahead token after an error, discard it. */
1035
/* return failure if at end of input */
1036
if (yychar == YYEOF)
1041
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1047
/* Else will try to reuse lookahead token
1048
after shifting the error token. */
1050
yyerrstatus = 3; /* Each real token shifted decrements this */
1054
yyerrdefault: /* current state does not do anything special for the error token. */
1057
/* This is wrong; only states that explicitly want error tokens
1058
should shift them. */
1059
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1060
if (yyn) goto yydefault;
1063
yyerrpop: /* pop the current state because it cannot handle the error token */
1065
if (yyssp == yyss) YYABORT;
1075
short *ssp1 = yyss - 1;
1076
fprintf (stderr, "Error: state stack now");
1077
while (ssp1 != yyssp)
1078
fprintf (stderr, " %d", *++ssp1);
1079
fprintf (stderr, "\n");
1085
yyn = yypact[yystate];
1090
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1109
fprintf(stderr, "Shifting error token, ");
1121
/* YYACCEPT comes here. */
1133
/* YYABORT comes here. */
1144
#line 232 "plural.y"
1149
FREE_EXPRESSION (exp)
1150
struct expression *exp;
1155
/* Handle the recursive case. */
1159
FREE_EXPRESSION (exp->val.args[2]);
1162
FREE_EXPRESSION (exp->val.args[1]);
1165
FREE_EXPRESSION (exp->val.args[0]);
1180
const char *exp = *pexp;
1191
if (exp[0] != ' ' && exp[0] != '\t')
1200
case '0': case '1': case '2': case '3': case '4':
1201
case '5': case '6': case '7': case '8': case '9':
1203
unsigned long int n = result - '0';
1204
while (exp[0] >= '0' && exp[0] <= '9')
1230
lval->op = not_equal;
1237
if (exp[0] == result)
1247
lval->op = less_or_equal;
1250
lval->op = less_than;
1258
lval->op = greater_or_equal;
1261
lval->op = greater_than;
1295
/* Nothing, just return the character. */
1301
/* Be safe and let the user call this function again. */
1324
/* Do nothing. We don't print error messages here. */