1
/* A Bison parser, made by GNU Bison 1.875. */
3
/* Skeleton parser for Yacc-like parsing with Bison,
4
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA. */
21
/* As a special exception, when this file is copied by Bison into a
22
Bison output file, you may use that output file without restriction.
23
This special exception was added by the Free Software Foundation
24
in version 1.24 of Bison. */
26
/* Written by Richard Stallman by simplifying the original so called
27
``semantic'' parser. */
29
/* All symbols defined below should begin with yy or YY, to avoid
30
infringing on user name space. This should be done even for local
31
variables, as they might otherwise be expanded by user macros.
32
There are some unavoidable exceptions within include files to
33
define necessary library symbols; they are noted "INFRINGES ON
34
USER NAME SPACE" below. */
36
/* Identify Bison output. */
40
#define YYSKELETON_NAME "yacc.c"
45
/* Using locations. */
46
#define YYLSP_NEEDED 0
48
/* If NAME_PREFIX is specified substitute the variables and functions
50
#define yyparse __gettextparse
51
#define yylex __gettextlex
52
#define yyerror __gettexterror
53
#define yylval __gettextlval
54
#define yychar __gettextchar
55
#define yydebug __gettextdebug
56
#define yynerrs __gettextnerrs
62
/* Put the tokens into the symbol table, so that GDB and other debuggers
81
/* Copy the first part of user declarations. */
84
/* Expression parsing for plural form selection.
85
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
86
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
88
This program is free software; you can redistribute it and/or modify it
89
under the terms of the GNU Library General Public License as published
90
by the Free Software Foundation; either version 2, or (at your option)
93
This program is distributed in the hope that it will be useful,
94
but WITHOUT ANY WARRANTY; without even the implied warranty of
95
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
96
Library General Public License for more details.
98
You should have received a copy of the GNU Library General Public
99
License along with this program; if not, write to the Free Software
100
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
103
/* The bison generated parser uses alloca. AIX 3 forces us to put this
104
declaration at the beginning of the file. The declaration in bison's
105
skeleton file comes too late. This must come before <config.h>
106
because <config.h> may include arbitrary system headers. */
107
#if defined _AIX && !defined __GNUC__
117
#include "plural-exp.h"
119
/* The main function generated by the parser is called __gettextparse,
120
but we want it to be called PLURAL_PARSE. */
122
# define __gettextparse PLURAL_PARSE
125
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
126
#define YYPARSE_PARAM arg
129
/* Enabling traces. */
134
/* Enabling verbose error messages. */
135
#ifdef YYERROR_VERBOSE
136
# undef YYERROR_VERBOSE
137
# define YYERROR_VERBOSE 1
139
# define YYERROR_VERBOSE 0
142
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
144
typedef union YYSTYPE {
145
unsigned long int num;
147
struct expression *exp;
149
/* Line 191 of yacc.c. */
151
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
152
# define YYSTYPE_IS_DECLARED 1
153
# define YYSTYPE_IS_TRIVIAL 1
158
/* Copy the second part of user declarations. */
161
/* Prototypes for local functions. */
162
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
163
struct expression * const *args));
164
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
165
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
166
struct expression *right));
167
static struct expression *new_exp_2 PARAMS ((enum operator op,
168
struct expression *left,
169
struct expression *right));
170
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
171
struct expression *bexp,
172
struct expression *tbranch,
173
struct expression *fbranch));
174
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
175
static void yyerror PARAMS ((const char *str));
177
/* Allocation of expressions. */
179
static struct expression *
180
new_exp (nargs, op, args)
183
struct expression * const *args;
186
struct expression *newp;
188
/* If any of the argument could not be malloc'ed, just return NULL. */
189
for (i = nargs - 1; i >= 0; i--)
193
/* Allocate a new expression. */
194
newp = (struct expression *) malloc (sizeof (*newp));
198
newp->operation = op;
199
for (i = nargs - 1; i >= 0; i--)
200
newp->val.args[i] = args[i];
205
for (i = nargs - 1; i >= 0; i--)
206
FREE_EXPRESSION (args[i]);
211
static inline struct expression *
215
return new_exp (0, op, NULL);
218
static inline struct expression *
219
new_exp_1 (op, right)
221
struct expression *right;
223
struct expression *args[1];
226
return new_exp (1, op, args);
229
static struct expression *
230
new_exp_2 (op, left, right)
232
struct expression *left;
233
struct expression *right;
235
struct expression *args[2];
239
return new_exp (2, op, args);
242
static inline struct expression *
243
new_exp_3 (op, bexp, tbranch, fbranch)
245
struct expression *bexp;
246
struct expression *tbranch;
247
struct expression *fbranch;
249
struct expression *args[3];
254
return new_exp (3, op, args);
259
/* Line 214 of yacc.c. */
262
#if ! defined (yyoverflow) || YYERROR_VERBOSE
264
/* The parser invokes alloca or malloc; define the necessary symbols. */
266
# if YYSTACK_USE_ALLOCA
267
# define YYSTACK_ALLOC alloca
269
# ifndef YYSTACK_USE_ALLOCA
270
# if defined (alloca) || defined (_ALLOCA_H)
271
# define YYSTACK_ALLOC alloca
274
# define YYSTACK_ALLOC __builtin_alloca
280
# ifdef YYSTACK_ALLOC
281
/* Pacify GCC's `empty if-body' warning. */
282
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
284
# if defined (__STDC__) || defined (__cplusplus)
285
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
286
# define YYSIZE_T size_t
288
# define YYSTACK_ALLOC malloc
289
# define YYSTACK_FREE free
291
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
294
#if (! defined (yyoverflow) \
295
&& (! defined (__cplusplus) \
296
|| (YYSTYPE_IS_TRIVIAL)))
298
/* A type that is properly aligned for any stack member. */
305
/* The size of the maximum gap between one aligned stack and the next. */
306
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
308
/* The size of an array large to enough to hold all stacks, each with
310
# define YYSTACK_BYTES(N) \
311
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
312
+ YYSTACK_GAP_MAXIMUM)
314
/* Copy COUNT objects from FROM to TO. The source and destination do
318
# define YYCOPY(To, From, Count) \
319
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
321
# define YYCOPY(To, From, Count) \
324
register YYSIZE_T yyi; \
325
for (yyi = 0; yyi < (Count); yyi++) \
326
(To)[yyi] = (From)[yyi]; \
332
/* Relocate STACK from its old location to the new one. The
333
local variables YYSIZE and YYSTACKSIZE give the old and new number of
334
elements in the stack, and YYPTR gives the new location of the
335
stack. Advance YYPTR to a properly aligned location for the next
337
# define YYSTACK_RELOCATE(Stack) \
340
YYSIZE_T yynewbytes; \
341
YYCOPY (&yyptr->Stack, Stack, yysize); \
342
Stack = &yyptr->Stack; \
343
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
344
yyptr += yynewbytes / sizeof (*yyptr); \
350
#if defined (__STDC__) || defined (__cplusplus)
351
typedef signed char yysigned_char;
353
typedef short yysigned_char;
356
/* YYFINAL -- State number of the termination state. */
358
/* YYLAST -- Last index in YYTABLE. */
361
/* YYNTOKENS -- Number of terminals. */
363
/* YYNNTS -- Number of nonterminals. */
365
/* YYNRULES -- Number of rules. */
367
/* YYNRULES -- Number of states. */
370
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
372
#define YYMAXUTOK 262
374
#define YYTRANSLATE(YYX) \
375
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
377
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
378
static const unsigned char yytranslate[] =
380
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383
2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
384
14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
385
2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
386
2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
387
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391
13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392
2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
393
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405
2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
410
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
412
static const unsigned char yyprhs[] =
414
0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
418
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
419
static const yysigned_char yyrhs[] =
421
17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
422
-1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
423
6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
424
-1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
425
11, -1, 14, 18, 15, -1
428
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
429
static const unsigned char yyrline[] =
431
0, 174, 174, 182, 186, 190, 194, 198, 202, 206,
436
#if YYDEBUG || YYERROR_VERBOSE
437
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
438
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
439
static const char *const yytname[] =
441
"$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
442
"ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
443
"$accept", "start", "exp", 0
448
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
450
static const unsigned short yytoknum[] =
452
0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
453
33, 262, 58, 110, 40, 41
457
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
458
static const unsigned char yyr1[] =
460
0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
464
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
465
static const unsigned char yyr2[] =
467
0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
471
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
472
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
473
means the default is an error. */
474
static const unsigned char yydefact[] =
476
0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
477
0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
481
/* YYDEFGOTO[NTERM-NUM]. */
482
static const yysigned_char yydefgoto[] =
487
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
489
#define YYPACT_NINF -10
490
static const yysigned_char yypact[] =
492
-9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
493
-9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
494
45, 18, -2, 14, -10, -9, 36
497
/* YYPGOTO[NTERM-NUM]. */
498
static const yysigned_char yypgoto[] =
503
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
504
positive, shift that token. If negative, reduce the rule which
505
number is the opposite. If zero, do what YYDEFACT says.
506
If YYTABLE_NINF, syntax error. */
507
#define YYTABLE_NINF -1
508
static const unsigned char yytable[] =
510
7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
511
19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
512
14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
513
11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
514
11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
518
static const yysigned_char yycheck[] =
520
1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
521
11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
522
7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
523
4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
524
4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
528
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
529
symbol of state STATE-NUM. */
530
static const unsigned char yystos[] =
532
0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
533
3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
534
18, 18, 18, 18, 18, 12, 18
537
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
538
# define YYSIZE_T __SIZE_TYPE__
540
#if ! defined (YYSIZE_T) && defined (size_t)
541
# define YYSIZE_T size_t
543
#if ! defined (YYSIZE_T)
544
# if defined (__STDC__) || defined (__cplusplus)
545
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
546
# define YYSIZE_T size_t
549
#if ! defined (YYSIZE_T)
550
# define YYSIZE_T unsigned int
553
#define yyerrok (yyerrstatus = 0)
554
#define yyclearin (yychar = YYEMPTY)
558
#define YYACCEPT goto yyacceptlab
559
#define YYABORT goto yyabortlab
560
#define YYERROR goto yyerrlab1
562
/* Like YYERROR except do call yyerror. This remains here temporarily
563
to ease the transition to the new meaning of YYERROR, for GCC.
564
Once GCC version 2 has supplanted version 1, this can go. */
566
#define YYFAIL goto yyerrlab
568
#define YYRECOVERING() (!!yyerrstatus)
570
#define YYBACKUP(Token, Value) \
572
if (yychar == YYEMPTY && yylen == 1) \
576
yytoken = YYTRANSLATE (yychar); \
582
yyerror ("syntax error: cannot back up");\
588
#define YYERRCODE 256
590
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
593
#ifndef YYLLOC_DEFAULT
594
# define YYLLOC_DEFAULT(Current, Rhs, N) \
595
Current.first_line = Rhs[1].first_line; \
596
Current.first_column = Rhs[1].first_column; \
597
Current.last_line = Rhs[N].last_line; \
598
Current.last_column = Rhs[N].last_column;
601
/* YYLEX -- calling `yylex' with the right arguments. */
604
# define YYLEX yylex (&yylval, YYLEX_PARAM)
606
# define YYLEX yylex (&yylval)
609
/* Enable debugging if requested. */
613
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
614
# define YYFPRINTF fprintf
617
# define YYDPRINTF(Args) \
623
# define YYDSYMPRINT(Args) \
629
# define YYDSYMPRINTF(Title, Token, Value, Location) \
633
YYFPRINTF (stderr, "%s ", Title); \
634
yysymprint (stderr, \
636
YYFPRINTF (stderr, "\n"); \
640
/*------------------------------------------------------------------.
641
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
643
`------------------------------------------------------------------*/
645
#if defined (__STDC__) || defined (__cplusplus)
647
yy_stack_print (short *bottom, short *top)
650
yy_stack_print (bottom, top)
655
YYFPRINTF (stderr, "Stack now");
656
for (/* Nothing. */; bottom <= top; ++bottom)
657
YYFPRINTF (stderr, " %d", *bottom);
658
YYFPRINTF (stderr, "\n");
661
# define YY_STACK_PRINT(Bottom, Top) \
664
yy_stack_print ((Bottom), (Top)); \
668
/*------------------------------------------------.
669
| Report that the YYRULE is going to be reduced. |
670
`------------------------------------------------*/
672
#if defined (__STDC__) || defined (__cplusplus)
674
yy_reduce_print (int yyrule)
677
yy_reduce_print (yyrule)
682
unsigned int yylineno = yyrline[yyrule];
683
YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
684
yyrule - 1, yylineno);
685
/* Print the symbols being reduced, and their result. */
686
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
687
YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
688
YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
691
# define YY_REDUCE_PRINT(Rule) \
694
yy_reduce_print (Rule); \
697
/* Nonzero means print parse trace. It is left uninitialized so that
698
multiple parsers can coexist. */
701
# define YYDPRINTF(Args)
702
# define YYDSYMPRINT(Args)
703
# define YYDSYMPRINTF(Title, Token, Value, Location)
704
# define YY_STACK_PRINT(Bottom, Top)
705
# define YY_REDUCE_PRINT(Rule)
706
#endif /* !YYDEBUG */
709
/* YYINITDEPTH -- initial size of the parser's stacks. */
711
# define YYINITDEPTH 200
714
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
715
if the built-in stack extension method is used).
717
Do not make this value too large; the results are undefined if
718
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
719
evaluated with infinite-precision integer arithmetic. */
726
# define YYMAXDEPTH 10000
734
# if defined (__GLIBC__) && defined (_STRING_H)
735
# define yystrlen strlen
737
/* Return the length of YYSTR. */
739
# if defined (__STDC__) || defined (__cplusplus)
740
yystrlen (const char *yystr)
746
register const char *yys = yystr;
748
while (*yys++ != '\0')
751
return yys - yystr - 1;
757
# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
758
# define yystpcpy stpcpy
760
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
763
# if defined (__STDC__) || defined (__cplusplus)
764
yystpcpy (char *yydest, const char *yysrc)
766
yystpcpy (yydest, yysrc)
771
register char *yyd = yydest;
772
register const char *yys = yysrc;
774
while ((*yyd++ = *yys++) != '\0')
782
#endif /* !YYERROR_VERBOSE */
787
/*--------------------------------.
788
| Print this symbol on YYOUTPUT. |
789
`--------------------------------*/
791
#if defined (__STDC__) || defined (__cplusplus)
793
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
796
yysymprint (yyoutput, yytype, yyvaluep)
802
/* Pacify ``unused variable'' warnings. */
805
if (yytype < YYNTOKENS)
807
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
809
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
813
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
820
YYFPRINTF (yyoutput, ")");
823
#endif /* ! YYDEBUG */
824
/*-----------------------------------------------.
825
| Release the memory associated to this symbol. |
826
`-----------------------------------------------*/
828
#if defined (__STDC__) || defined (__cplusplus)
830
yydestruct (int yytype, YYSTYPE *yyvaluep)
833
yydestruct (yytype, yyvaluep)
838
/* Pacify ``unused variable'' warnings. */
850
/* Prevent warnings from -Wmissing-prototypes. */
853
# if defined (__STDC__) || defined (__cplusplus)
854
int yyparse (void *YYPARSE_PARAM);
858
#else /* ! YYPARSE_PARAM */
859
#if defined (__STDC__) || defined (__cplusplus)
864
#endif /* ! YYPARSE_PARAM */
876
# if defined (__STDC__) || defined (__cplusplus)
877
int yyparse (void *YYPARSE_PARAM)
879
int yyparse (YYPARSE_PARAM)
882
#else /* ! YYPARSE_PARAM */
883
#if defined (__STDC__) || defined (__cplusplus)
893
/* The lookahead symbol. */
896
/* The semantic value of the lookahead symbol. */
899
/* Number of syntax errors so far. */
902
register int yystate;
905
/* Number of tokens to shift before error messages enabled. */
907
/* Lookahead token as an internal (translated) token number. */
910
/* Three stacks and their tools:
911
`yyss': related to states,
912
`yyvs': related to semantic values,
913
`yyls': related to locations.
915
Refer to the stacks thru separate pointers, to allow yyoverflow
916
to reallocate them elsewhere. */
918
/* The state stack. */
919
short yyssa[YYINITDEPTH];
921
register short *yyssp;
923
/* The semantic value stack. */
924
YYSTYPE yyvsa[YYINITDEPTH];
925
YYSTYPE *yyvs = yyvsa;
926
register YYSTYPE *yyvsp;
930
#define YYPOPSTACK (yyvsp--, yyssp--)
932
YYSIZE_T yystacksize = YYINITDEPTH;
934
/* The variables used to return semantic value and location from the
939
/* When reducing, the number of symbols on the RHS of the reduced
943
YYDPRINTF ((stderr, "Starting parse\n"));
948
yychar = YYEMPTY; /* Cause a token to be read. */
950
/* Initialize stack pointers.
951
Waste one element of value and location stack
952
so that they stay on the same level as the state stack.
953
The wasted elements are never initialized. */
960
/*------------------------------------------------------------.
961
| yynewstate -- Push a new state, which is found in yystate. |
962
`------------------------------------------------------------*/
964
/* In all cases, when you get here, the value and location stacks
965
have just been pushed. so pushing a state here evens the stacks.
972
if (yyss + yystacksize - 1 <= yyssp)
974
/* Get the current used size of the three stacks, in elements. */
975
YYSIZE_T yysize = yyssp - yyss + 1;
979
/* Give user a chance to reallocate the stack. Use copies of
980
these so that the &'s don't force the real ones into
982
YYSTYPE *yyvs1 = yyvs;
986
/* Each stack pointer address is followed by the size of the
987
data in use in that stack, in bytes. This used to be a
988
conditional around just the two extra args, but that might
989
be undefined if yyoverflow is a macro. */
990
yyoverflow ("parser stack overflow",
991
&yyss1, yysize * sizeof (*yyssp),
992
&yyvs1, yysize * sizeof (*yyvsp),
999
#else /* no yyoverflow */
1000
# ifndef YYSTACK_RELOCATE
1003
/* Extend the stack our own way. */
1004
if (YYMAXDEPTH <= yystacksize)
1007
if (YYMAXDEPTH < yystacksize)
1008
yystacksize = YYMAXDEPTH;
1011
short *yyss1 = yyss;
1012
union yyalloc *yyptr =
1013
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1016
YYSTACK_RELOCATE (yyss);
1017
YYSTACK_RELOCATE (yyvs);
1019
# undef YYSTACK_RELOCATE
1021
YYSTACK_FREE (yyss1);
1024
#endif /* no yyoverflow */
1026
yyssp = yyss + yysize - 1;
1027
yyvsp = yyvs + yysize - 1;
1030
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1031
(unsigned long int) yystacksize));
1033
if (yyss + yystacksize - 1 <= yyssp)
1037
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1046
/* Do appropriate processing given the current state. */
1047
/* Read a lookahead token if we need one and don't already have one. */
1050
/* First try to decide what to do without reference to lookahead token. */
1052
yyn = yypact[yystate];
1053
if (yyn == YYPACT_NINF)
1056
/* Not known => get a lookahead token if don't already have one. */
1058
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1059
if (yychar == YYEMPTY)
1061
YYDPRINTF ((stderr, "Reading a token: "));
1065
if (yychar <= YYEOF)
1067
yychar = yytoken = YYEOF;
1068
YYDPRINTF ((stderr, "Now at end of input.\n"));
1072
yytoken = YYTRANSLATE (yychar);
1073
YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1076
/* If the proper action on seeing token YYTOKEN is to reduce or to
1077
detect an error, take that action. */
1079
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1084
if (yyn == 0 || yyn == YYTABLE_NINF)
1093
/* Shift the lookahead token. */
1094
YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1096
/* Discard the token being shifted unless it is eof. */
1097
if (yychar != YYEOF)
1103
/* Count tokens shifted since error; after three, turn off error
1112
/*-----------------------------------------------------------.
1113
| yydefault -- do the default action for the current state. |
1114
`-----------------------------------------------------------*/
1116
yyn = yydefact[yystate];
1122
/*-----------------------------.
1123
| yyreduce -- Do a reduction. |
1124
`-----------------------------*/
1126
/* yyn is the number of a rule to reduce with. */
1129
/* If YYLEN is nonzero, implement the default value of the action:
1132
Otherwise, the following line sets YYVAL to garbage.
1133
This behavior is undocumented and Bison
1134
users should not rely upon it. Assigning to YYVAL
1135
unconditionally makes the parser a bit smaller, and it avoids a
1136
GCC warning that YYVAL may be used uninitialized. */
1137
yyval = yyvsp[1-yylen];
1140
YY_REDUCE_PRINT (yyn);
1144
#line 175 "plural.y"
1146
if (yyvsp[0].exp == NULL)
1148
((struct parse_args *) arg)->res = yyvsp[0].exp;
1153
#line 183 "plural.y"
1155
yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
1160
#line 187 "plural.y"
1162
yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
1167
#line 191 "plural.y"
1169
yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
1174
#line 195 "plural.y"
1176
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1181
#line 199 "plural.y"
1183
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1188
#line 203 "plural.y"
1190
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1195
#line 207 "plural.y"
1197
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1202
#line 211 "plural.y"
1204
yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
1209
#line 215 "plural.y"
1211
yyval.exp = new_exp_0 (var);
1216
#line 219 "plural.y"
1218
if ((yyval.exp = new_exp_0 (num)) != NULL)
1219
yyval.exp->val.num = yyvsp[0].num;
1224
#line 224 "plural.y"
1226
yyval.exp = yyvsp[-1].exp;
1233
/* Line 991 of yacc.c. */
1234
#line 1234 "plural.c"
1240
YY_STACK_PRINT (yyss, yyssp);
1245
/* Now `shift' the result of the reduction. Determine what state
1246
that goes to, based on the state we popped back to and the rule
1247
number reduced by. */
1251
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1252
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1253
yystate = yytable[yystate];
1255
yystate = yydefgoto[yyn - YYNTOKENS];
1260
/*------------------------------------.
1261
| yyerrlab -- here on detecting error |
1262
`------------------------------------*/
1264
/* If not already recovering from an error, report this error. */
1269
yyn = yypact[yystate];
1271
if (YYPACT_NINF < yyn && yyn < YYLAST)
1273
YYSIZE_T yysize = 0;
1274
int yytype = YYTRANSLATE (yychar);
1279
/* Start YYX at -YYN if negative to avoid negative indexes in
1281
for (yyx = yyn < 0 ? -yyn : 0;
1282
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1283
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1284
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1285
yysize += yystrlen ("syntax error, unexpected ") + 1;
1286
yysize += yystrlen (yytname[yytype]);
1287
yymsg = (char *) YYSTACK_ALLOC (yysize);
1290
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1291
yyp = yystpcpy (yyp, yytname[yytype]);
1296
for (yyx = yyn < 0 ? -yyn : 0;
1297
yyx < (int) (sizeof (yytname) / sizeof (char *));
1299
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1301
const char *yyq = ! yycount ? ", expecting " : " or ";
1302
yyp = yystpcpy (yyp, yyq);
1303
yyp = yystpcpy (yyp, yytname[yyx]);
1308
YYSTACK_FREE (yymsg);
1311
yyerror ("syntax error; also virtual memory exhausted");
1314
#endif /* YYERROR_VERBOSE */
1315
yyerror ("syntax error");
1320
if (yyerrstatus == 3)
1322
/* If just tried and failed to reuse lookahead token after an
1323
error, discard it. */
1325
/* Return failure if at end of input. */
1326
if (yychar == YYEOF)
1328
/* Pop the error token. */
1330
/* Pop the rest of the stack. */
1331
while (yyss < yyssp)
1333
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1334
yydestruct (yystos[*yyssp], yyvsp);
1340
YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1341
yydestruct (yytoken, &yylval);
1346
/* Else will try to reuse lookahead token after shifting the error
1351
/*----------------------------------------------------.
1352
| yyerrlab1 -- error raised explicitly by an action. |
1353
`----------------------------------------------------*/
1356
/* Suppress GCC warning that yyerrlab1 is unused when no action
1358
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1359
__attribute__ ((__unused__))
1366
/*---------------------------------------------------------------.
1367
| yyerrlab2 -- pop states until the error token can be shifted. |
1368
`---------------------------------------------------------------*/
1370
yyerrstatus = 3; /* Each real token shifted decrements this. */
1374
yyn = yypact[yystate];
1375
if (yyn != YYPACT_NINF)
1378
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1386
/* Pop the current state because it cannot handle the error token. */
1390
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1391
yydestruct (yystos[yystate], yyvsp);
1395
YY_STACK_PRINT (yyss, yyssp);
1401
YYDPRINTF ((stderr, "Shifting error token, "));
1410
/*-------------------------------------.
1411
| yyacceptlab -- YYACCEPT comes here. |
1412
`-------------------------------------*/
1417
/*-----------------------------------.
1418
| yyabortlab -- YYABORT comes here. |
1419
`-----------------------------------*/
1425
/*----------------------------------------------.
1426
| yyoverflowlab -- parser overflow comes here. |
1427
`----------------------------------------------*/
1429
yyerror ("parser stack overflow");
1437
YYSTACK_FREE (yyss);
1443
#line 229 "plural.y"
1448
FREE_EXPRESSION (exp)
1449
struct expression *exp;
1454
/* Handle the recursive case. */
1458
FREE_EXPRESSION (exp->val.args[2]);
1461
FREE_EXPRESSION (exp->val.args[1]);
1464
FREE_EXPRESSION (exp->val.args[0]);
1479
const char *exp = *pexp;
1490
if (exp[0] != ' ' && exp[0] != '\t')
1499
case '0': case '1': case '2': case '3': case '4':
1500
case '5': case '6': case '7': case '8': case '9':
1502
unsigned long int n = result - '0';
1503
while (exp[0] >= '0' && exp[0] <= '9')
1529
lval->op = not_equal;
1536
if (exp[0] == result)
1546
lval->op = less_or_equal;
1549
lval->op = less_than;
1557
lval->op = greater_or_equal;
1560
lval->op = greater_than;
1594
/* Nothing, just return the character. */
1600
/* Be safe and let the user call this function again. */
1623
/* Do nothing. We don't print error messages here. */