1
/* A Bison parser, made by GNU Bison 2.3a. */
3
/* Skeleton implementation for Bison's Yacc-like parsers in C
5
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
Free Software Foundation, Inc.
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2, or (at your option)
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
Boston, MA 02110-1301, USA. */
23
/* As a special exception, you may create a larger work that contains
24
part or all of the Bison parser skeleton and distribute that work
25
under terms of your choice, so long as that work isn't itself a
26
parser generator using the skeleton or a modified version thereof
27
as a parser skeleton. Alternatively, if you modify or redistribute
28
the parser skeleton itself, you may (at your option) remove this
29
special exception, which will cause the skeleton and the resulting
30
Bison output files to be licensed under the GNU General Public
31
License without this special exception.
33
This special exception was added by the Free Software Foundation in
34
version 2.2 of Bison. */
36
/* C LALR(1) parser skeleton written by Richard Stallman, by
37
simplifying the original so-called "semantic" parser. */
39
/* All symbols defined below should begin with yy or YY, to avoid
40
infringing on user name space. This should be done even for local
41
variables, as they might otherwise be expanded by user macros.
42
There are some unavoidable exceptions within include files to
43
define necessary library symbols; they are noted "INFRINGES ON
44
USER NAME SPACE" below. */
46
/* Identify Bison output. */
50
#define YYBISON_VERSION "2.3a"
53
#define YYSKELETON_NAME "yacc.c"
58
/* Using locations. */
59
#define YYLSP_NEEDED 0
61
/* Substitute the variable and function names. */
62
#define yyparse __gettextparse
63
#define yylex __gettextlex
64
#define yyerror __gettexterror
65
#define yylval __gettextlval
66
#define yychar __gettextchar
67
#define yydebug __gettextdebug
68
#define yynerrs __gettextnerrs
71
/* Copy the first part of user declarations. */
72
/* Line 164 of yacc.c. */
75
/* Expression parsing for plural form selection.
76
Copyright (C) 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc.
77
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
79
This program is free software; you can redistribute it and/or modify it
80
under the terms of the GNU Library General Public License as published
81
by the Free Software Foundation; either version 2, or (at your option)
84
This program is distributed in the hope that it will be useful,
85
but WITHOUT ANY WARRANTY; without even the implied warranty of
86
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87
Library General Public License for more details.
89
You should have received a copy of the GNU Library General Public
90
License along with this program; if not, write to the Free Software
91
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
94
/* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us
95
to put this declaration at the beginning of the file. The declaration in
96
bison's skeleton file comes too late. This must come before <config.h>
97
because <config.h> may include arbitrary system headers.
98
This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */
99
#if defined _AIX && !defined __GNUC__
110
#include "plural-exp.h"
112
/* The main function generated by the parser is called __gettextparse,
113
but we want it to be called PLURAL_PARSE. */
115
# define __gettextparse PLURAL_PARSE
118
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
119
#define YYPARSE_PARAM arg
122
/* Enabling traces. */
127
/* Enabling verbose error messages. */
128
#ifdef YYERROR_VERBOSE
129
# undef YYERROR_VERBOSE
130
# define YYERROR_VERBOSE 1
132
# define YYERROR_VERBOSE 0
135
/* Enabling the token table. */
136
#ifndef YYTOKEN_TABLE
137
# define YYTOKEN_TABLE 0
144
/* Put the tokens into the symbol table, so that GDB and other debuggers
164
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
165
typedef union YYSTYPE
166
{/* Line 191 of yacc.c. */
169
unsigned long int num;
170
enum expression_operator op;
171
struct expression *exp;
173
/* Line 191 of yacc.c. */
176
# define YYSTYPE_IS_TRIVIAL 1
177
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
178
# define YYSTYPE_IS_DECLARED 1
184
/* Copy the second part of user declarations. */
185
/* Line 221 of yacc.c. */
188
/* Prototypes for local functions. */
189
static int yylex (YYSTYPE *lval, const char **pexp);
190
static void yyerror (const char *str);
192
/* Allocation of expressions. */
194
static struct expression *
195
new_exp (int nargs, enum expression_operator op,
196
struct expression * const *args)
199
struct expression *newp;
201
/* If any of the argument could not be malloc'ed, just return NULL. */
202
for (i = nargs - 1; i >= 0; i--)
206
/* Allocate a new expression. */
207
newp = (struct expression *) malloc (sizeof (*newp));
211
newp->operation = op;
212
for (i = nargs - 1; i >= 0; i--)
213
newp->val.args[i] = args[i];
218
for (i = nargs - 1; i >= 0; i--)
219
FREE_EXPRESSION (args[i]);
224
static inline struct expression *
225
new_exp_0 (enum expression_operator op)
227
return new_exp (0, op, NULL);
230
static inline struct expression *
231
new_exp_1 (enum expression_operator op, struct expression *right)
233
struct expression *args[1];
236
return new_exp (1, op, args);
239
static struct expression *
240
new_exp_2 (enum expression_operator op, struct expression *left,
241
struct expression *right)
243
struct expression *args[2];
247
return new_exp (2, op, args);
250
static inline struct expression *
251
new_exp_3 (enum expression_operator op, struct expression *bexp,
252
struct expression *tbranch, struct expression *fbranch)
254
struct expression *args[3];
259
return new_exp (3, op, args);
263
/* Line 221 of yacc.c. */
271
typedef YYTYPE_UINT8 yytype_uint8;
273
typedef unsigned char yytype_uint8;
277
typedef YYTYPE_INT8 yytype_int8;
278
#elif (defined __STDC__ || defined __C99__FUNC__ \
279
|| defined __cplusplus || defined _MSC_VER)
280
typedef signed char yytype_int8;
282
typedef short int yytype_int8;
286
typedef YYTYPE_UINT16 yytype_uint16;
288
typedef unsigned short int yytype_uint16;
292
typedef YYTYPE_INT16 yytype_int16;
294
typedef short int yytype_int16;
298
# ifdef __SIZE_TYPE__
299
# define YYSIZE_T __SIZE_TYPE__
300
# elif defined size_t
301
# define YYSIZE_T size_t
302
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
303
|| defined __cplusplus || defined _MSC_VER)
304
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
305
# define YYSIZE_T size_t
307
# define YYSIZE_T unsigned int
311
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
316
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
317
# define YY_(msgid) dgettext ("bison-runtime", msgid)
321
# define YY_(msgid) msgid
325
/* Suppress unused-variable warnings by "using" E. */
326
#if ! defined lint || defined __GNUC__
327
# define YYUSE(e) ((void) (e))
329
# define YYUSE(e) /* empty */
332
/* Identity function, used to suppress warnings about constant conditions. */
336
#if (defined __STDC__ || defined __C99__FUNC__ \
337
|| defined __cplusplus || defined _MSC_VER)
350
#if ! defined yyoverflow || YYERROR_VERBOSE
352
/* The parser invokes alloca or malloc; define the necessary symbols. */
354
# ifdef YYSTACK_USE_ALLOCA
355
# if YYSTACK_USE_ALLOCA
357
# define YYSTACK_ALLOC __builtin_alloca
358
# elif defined __BUILTIN_VA_ARG_INCR
359
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
361
# define YYSTACK_ALLOC __alloca
362
# elif defined _MSC_VER
363
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
364
# define alloca _alloca
366
# define YYSTACK_ALLOC alloca
367
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
368
|| defined __cplusplus || defined _MSC_VER)
369
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
378
# ifdef YYSTACK_ALLOC
379
/* Pacify GCC's `empty if-body' warning. */
380
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
381
# ifndef YYSTACK_ALLOC_MAXIMUM
382
/* The OS might guarantee only one guard page at the bottom of the stack,
383
and a page size can be as small as 4096 bytes. So we cannot safely
384
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
385
to allow for a few compiler-allocated temporary stack slots. */
386
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
389
# define YYSTACK_ALLOC YYMALLOC
390
# define YYSTACK_FREE YYFREE
391
# ifndef YYSTACK_ALLOC_MAXIMUM
392
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
394
# if (defined __cplusplus && ! defined _STDLIB_H \
395
&& ! ((defined YYMALLOC || defined malloc) \
396
&& (defined YYFREE || defined free)))
397
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
403
# define YYMALLOC malloc
404
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
405
|| defined __cplusplus || defined _MSC_VER)
406
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
411
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
412
|| defined __cplusplus || defined _MSC_VER)
413
void free (void *); /* INFRINGES ON USER NAME SPACE */
417
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
420
#if (! defined yyoverflow \
421
&& (! defined __cplusplus \
422
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
424
/* A type that is properly aligned for any stack member. */
431
/* The size of the maximum gap between one aligned stack and the next. */
432
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
434
/* The size of an array large to enough to hold all stacks, each with
436
# define YYSTACK_BYTES(N) \
437
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
438
+ YYSTACK_GAP_MAXIMUM)
440
/* Copy COUNT objects from FROM to TO. The source and destination do
443
# if defined __GNUC__ && 1 < __GNUC__
444
# define YYCOPY(To, From, Count) \
445
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
447
# define YYCOPY(To, From, Count) \
451
for (yyi = 0; yyi < (Count); yyi++) \
452
(To)[yyi] = (From)[yyi]; \
458
/* Relocate STACK from its old location to the new one. The
459
local variables YYSIZE and YYSTACKSIZE give the old and new number of
460
elements in the stack, and YYPTR gives the new location of the
461
stack. Advance YYPTR to a properly aligned location for the next
463
# define YYSTACK_RELOCATE(Stack) \
466
YYSIZE_T yynewbytes; \
467
YYCOPY (&yyptr->Stack, Stack, yysize); \
468
Stack = &yyptr->Stack; \
469
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
470
yyptr += yynewbytes / sizeof (*yyptr); \
476
/* YYFINAL -- State number of the termination state. */
478
/* YYLAST -- Last index in YYTABLE. */
481
/* YYNTOKENS -- Number of terminals. */
483
/* YYNNTS -- Number of nonterminals. */
485
/* YYNRULES -- Number of rules. */
487
/* YYNRULES -- Number of states. */
490
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
492
#define YYMAXUTOK 262
494
#define YYTRANSLATE(YYX) \
495
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
497
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
498
static const yytype_uint8 yytranslate[] =
500
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503
2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
504
14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
505
2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
506
2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
507
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511
13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512
2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
513
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525
2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
530
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
532
static const yytype_uint8 yyprhs[] =
534
0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
538
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
539
static const yytype_int8 yyrhs[] =
541
17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
542
-1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
543
6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
544
-1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
545
11, -1, 14, 18, 15, -1
548
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
549
static const yytype_uint8 yyrline[] =
551
0, 154, 154, 162, 166, 170, 174, 178, 182, 186,
556
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
557
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
558
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
559
static const char *const yytname[] =
561
"$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
562
"ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
563
"$accept", "start", "exp", 0
568
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
570
static const yytype_uint16 yytoknum[] =
572
0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
573
33, 262, 58, 110, 40, 41
577
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
578
static const yytype_uint8 yyr1[] =
580
0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
584
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
585
static const yytype_uint8 yyr2[] =
587
0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
591
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
592
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
593
means the default is an error. */
594
static const yytype_uint8 yydefact[] =
596
0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
597
0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
601
/* YYDEFGOTO[NTERM-NUM]. */
602
static const yytype_int8 yydefgoto[] =
607
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
609
#define YYPACT_NINF -10
610
static const yytype_int8 yypact[] =
612
-9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
613
-9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
614
45, 18, -2, 14, -10, -9, 36
617
/* YYPGOTO[NTERM-NUM]. */
618
static const yytype_int8 yypgoto[] =
623
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
624
positive, shift that token. If negative, reduce the rule which
625
number is the opposite. If zero, do what YYDEFACT says.
626
If YYTABLE_NINF, syntax error. */
627
#define YYTABLE_NINF -1
628
static const yytype_uint8 yytable[] =
630
7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
631
19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
632
14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
633
11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
634
11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
638
static const yytype_int8 yycheck[] =
640
1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
641
11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
642
7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
643
4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
644
4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
648
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
649
symbol of state STATE-NUM. */
650
static const yytype_uint8 yystos[] =
652
0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
653
3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
654
18, 18, 18, 18, 18, 12, 18
657
#define yyerrok (yyerrstatus = 0)
658
#define yyclearin (yychar = YYEMPTY)
662
#define YYACCEPT goto yyacceptlab
663
#define YYABORT goto yyabortlab
664
#define YYERROR goto yyerrorlab
667
/* Like YYERROR except do call yyerror. This remains here temporarily
668
to ease the transition to the new meaning of YYERROR, for GCC.
669
Once GCC version 2 has supplanted version 1, this can go. */
671
#define YYFAIL goto yyerrlab
673
#define YYRECOVERING() (!!yyerrstatus)
675
#define YYBACKUP(Token, Value) \
677
if (yychar == YYEMPTY && yylen == 1) \
681
yytoken = YYTRANSLATE (yychar); \
687
yyerror (YY_("syntax error: cannot back up")); \
694
#define YYERRCODE 256
697
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
698
If N is 0, then set CURRENT to the empty location which ends
699
the previous symbol: RHS[0] (always defined). */
701
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
702
#ifndef YYLLOC_DEFAULT
703
# define YYLLOC_DEFAULT(Current, Rhs, N) \
707
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
708
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
709
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
710
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
714
(Current).first_line = (Current).last_line = \
715
YYRHSLOC (Rhs, 0).last_line; \
716
(Current).first_column = (Current).last_column = \
717
YYRHSLOC (Rhs, 0).last_column; \
723
/* YY_LOCATION_PRINT -- Print the location on the stream.
724
This macro was not mandated originally: define only if we know
725
we won't break user code: when these are the locations we know. */
727
#ifndef YY_LOCATION_PRINT
728
# if YYLTYPE_IS_TRIVIAL
729
# define YY_LOCATION_PRINT(File, Loc) \
730
fprintf (File, "%d.%d-%d.%d", \
731
(Loc).first_line, (Loc).first_column, \
732
(Loc).last_line, (Loc).last_column)
734
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
739
/* YYLEX -- calling `yylex' with the right arguments. */
742
# define YYLEX yylex (&yylval, YYLEX_PARAM)
744
# define YYLEX yylex (&yylval)
747
/* Enable debugging if requested. */
751
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
752
# define YYFPRINTF fprintf
755
# define YYDPRINTF(Args) \
761
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
765
YYFPRINTF (stderr, "%s ", Title); \
766
yy_symbol_print (stderr, \
768
YYFPRINTF (stderr, "\n"); \
773
/*--------------------------------.
774
| Print this symbol on YYOUTPUT. |
775
`--------------------------------*/
778
#if (defined __STDC__ || defined __C99__FUNC__ \
779
|| defined __cplusplus || defined _MSC_VER)
781
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
784
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
787
YYSTYPE const * const yyvaluep;
793
if (yytype < YYNTOKENS)
794
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
806
/*--------------------------------.
807
| Print this symbol on YYOUTPUT. |
808
`--------------------------------*/
810
#if (defined __STDC__ || defined __C99__FUNC__ \
811
|| defined __cplusplus || defined _MSC_VER)
813
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
816
yy_symbol_print (yyoutput, yytype, yyvaluep)
819
YYSTYPE const * const yyvaluep;
822
if (yytype < YYNTOKENS)
823
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
825
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
827
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
828
YYFPRINTF (yyoutput, ")");
831
/*------------------------------------------------------------------.
832
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
834
`------------------------------------------------------------------*/
836
#if (defined __STDC__ || defined __C99__FUNC__ \
837
|| defined __cplusplus || defined _MSC_VER)
839
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
842
yy_stack_print (yybottom, yytop)
843
yytype_int16 *yybottom;
847
YYFPRINTF (stderr, "Stack now");
848
for (; yybottom <= yytop; yybottom++)
850
int yybot = *yybottom;
851
YYFPRINTF (stderr, " %d", yybot);
853
YYFPRINTF (stderr, "\n");
856
# define YY_STACK_PRINT(Bottom, Top) \
859
yy_stack_print ((Bottom), (Top)); \
863
/*------------------------------------------------.
864
| Report that the YYRULE is going to be reduced. |
865
`------------------------------------------------*/
867
#if (defined __STDC__ || defined __C99__FUNC__ \
868
|| defined __cplusplus || defined _MSC_VER)
870
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
873
yy_reduce_print (yyvsp, yyrule)
878
int yynrhs = yyr2[yyrule];
880
unsigned long int yylno = yyrline[yyrule];
881
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
883
/* The symbols being reduced. */
884
for (yyi = 0; yyi < yynrhs; yyi++)
886
fprintf (stderr, " $%d = ", yyi + 1);
887
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
888
&(yyvsp[(yyi + 1) - (yynrhs)])
890
fprintf (stderr, "\n");
894
# define YY_REDUCE_PRINT(Rule) \
897
yy_reduce_print (yyvsp, Rule); \
900
/* Nonzero means print parse trace. It is left uninitialized so that
901
multiple parsers can coexist. */
904
# define YYDPRINTF(Args)
905
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
906
# define YY_STACK_PRINT(Bottom, Top)
907
# define YY_REDUCE_PRINT(Rule)
908
#endif /* !YYDEBUG */
911
/* YYINITDEPTH -- initial size of the parser's stacks. */
913
# define YYINITDEPTH 200
916
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
917
if the built-in stack extension method is used).
919
Do not make this value too large; the results are undefined if
920
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
921
evaluated with infinite-precision integer arithmetic. */
924
# define YYMAXDEPTH 10000
932
# if defined __GLIBC__ && defined _STRING_H
933
# define yystrlen strlen
935
/* Return the length of YYSTR. */
936
#if (defined __STDC__ || defined __C99__FUNC__ \
937
|| defined __cplusplus || defined _MSC_VER)
939
yystrlen (const char *yystr)
947
for (yylen = 0; yystr[yylen]; yylen++)
955
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
956
# define yystpcpy stpcpy
958
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
960
#if (defined __STDC__ || defined __C99__FUNC__ \
961
|| defined __cplusplus || defined _MSC_VER)
963
yystpcpy (char *yydest, const char *yysrc)
966
yystpcpy (yydest, yysrc)
972
const char *yys = yysrc;
974
while ((*yyd++ = *yys++) != '\0')
983
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
984
quotes and backslashes, so that it's suitable for yyerror. The
985
heuristic is that double-quoting is unnecessary unless the string
986
contains an apostrophe, a comma, or backslash (other than
987
backslash-backslash). YYSTR is taken from yytname. If YYRES is
988
null, do not copy; instead, return the length of what the result
991
yytnamerr (char *yyres, const char *yystr)
996
char const *yyp = yystr;
1003
goto do_not_strip_quotes;
1007
goto do_not_strip_quotes;
1020
do_not_strip_quotes: ;
1024
return yystrlen (yystr);
1026
return yystpcpy (yyres, yystr) - yyres;
1030
/* Copy into YYRESULT an error message about the unexpected token
1031
YYCHAR while in state YYSTATE. Return the number of bytes copied,
1032
including the terminating null byte. If YYRESULT is null, do not
1033
copy anything; just return the number of bytes that would be
1034
copied. As a special case, return 0 if an ordinary "syntax error"
1035
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1036
size calculation. */
1038
yysyntax_error (char *yyresult, int yystate, int yychar)
1040
int yyn = yypact[yystate];
1042
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1046
int yytype = YYTRANSLATE (yychar);
1047
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1048
YYSIZE_T yysize = yysize0;
1050
int yysize_overflow = 0;
1051
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1052
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1056
/* This is so xgettext sees the translatable formats that are
1057
constructed on the fly. */
1058
YY_("syntax error, unexpected %s");
1059
YY_("syntax error, unexpected %s, expecting %s");
1060
YY_("syntax error, unexpected %s, expecting %s or %s");
1061
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1062
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1066
static char const yyunexpected[] = "syntax error, unexpected %s";
1067
static char const yyexpecting[] = ", expecting %s";
1068
static char const yyor[] = " or %s";
1069
char yyformat[sizeof yyunexpected
1070
+ sizeof yyexpecting - 1
1071
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1072
* (sizeof yyor - 1))];
1073
char const *yyprefix = yyexpecting;
1075
/* Start YYX at -YYN if negative to avoid negative indexes in
1077
int yyxbegin = yyn < 0 ? -yyn : 0;
1079
/* Stay within bounds of both yycheck and yytname. */
1080
int yychecklim = YYLAST - yyn + 1;
1081
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1084
yyarg[0] = yytname[yytype];
1085
yyfmt = yystpcpy (yyformat, yyunexpected);
1087
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1088
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1090
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1094
yyformat[sizeof yyunexpected - 1] = '\0';
1097
yyarg[yycount++] = yytname[yyx];
1098
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1099
yysize_overflow |= (yysize1 < yysize);
1101
yyfmt = yystpcpy (yyfmt, yyprefix);
1105
yyf = YY_(yyformat);
1106
yysize1 = yysize + yystrlen (yyf);
1107
yysize_overflow |= (yysize1 < yysize);
1110
if (yysize_overflow)
1111
return YYSIZE_MAXIMUM;
1115
/* Avoid sprintf, as that infringes on the user's name space.
1116
Don't have undefined behavior even if the translation
1117
produced a string with the wrong number of "%s"s. */
1118
char *yyp = yyresult;
1120
while ((*yyp = *yyf) != '\0')
1122
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1124
yyp += yytnamerr (yyp, yyarg[yyi++]);
1137
#endif /* YYERROR_VERBOSE */
1140
/*-----------------------------------------------.
1141
| Release the memory associated to this symbol. |
1142
`-----------------------------------------------*/
1145
#if (defined __STDC__ || defined __C99__FUNC__ \
1146
|| defined __cplusplus || defined _MSC_VER)
1148
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1151
yydestruct (yymsg, yytype, yyvaluep)
1161
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1172
/* Prevent warnings from -Wmissing-prototypes. */
1174
#ifdef YYPARSE_PARAM
1175
#if defined __STDC__ || defined __cplusplus
1176
int yyparse (void *YYPARSE_PARAM);
1180
#else /* ! YYPARSE_PARAM */
1181
#if defined __STDC__ || defined __cplusplus
1186
#endif /* ! YYPARSE_PARAM */
1197
#ifdef YYPARSE_PARAM
1198
#if (defined __STDC__ || defined __C99__FUNC__ \
1199
|| defined __cplusplus || defined _MSC_VER)
1201
yyparse (void *YYPARSE_PARAM)
1204
yyparse (YYPARSE_PARAM)
1205
void *YYPARSE_PARAM;
1207
#else /* ! YYPARSE_PARAM */
1208
#if (defined __STDC__ || defined __C99__FUNC__ \
1209
|| defined __cplusplus || defined _MSC_VER)
1219
/* The lookahead symbol. */
1222
/* The semantic value of the lookahead symbol. */
1225
/* Number of syntax errors so far. */
1231
/* Number of tokens to shift before error messages enabled. */
1233
/* Lookahead token as an internal (translated) token number. */
1236
/* Buffer for error messages, and its allocated size. */
1238
char *yymsg = yymsgbuf;
1239
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1242
/* Three stacks and their tools:
1243
`yyss': related to states,
1244
`yyvs': related to semantic values,
1245
`yyls': related to locations.
1247
Refer to the stacks thru separate pointers, to allow yyoverflow
1248
to reallocate them elsewhere. */
1250
/* The state stack. */
1251
yytype_int16 yyssa[YYINITDEPTH];
1252
yytype_int16 *yyss = yyssa;
1253
yytype_int16 *yyssp;
1255
/* The semantic value stack. */
1256
YYSTYPE yyvsa[YYINITDEPTH];
1257
YYSTYPE *yyvs = yyvsa;
1262
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1264
YYSIZE_T yystacksize = YYINITDEPTH;
1266
/* The variables used to return semantic value and location from the
1271
/* The number of symbols on the RHS of the reduced rule.
1272
Keep to zero when no symbol should be popped. */
1275
YYDPRINTF ((stderr, "Starting parse\n"));
1280
yychar = YYEMPTY; /* Cause a token to be read. */
1282
/* Initialize stack pointers.
1283
Waste one element of value and location stack
1284
so that they stay on the same level as the state stack.
1285
The wasted elements are never initialized. */
1292
/*------------------------------------------------------------.
1293
| yynewstate -- Push a new state, which is found in yystate. |
1294
`------------------------------------------------------------*/
1296
/* In all cases, when you get here, the value and location stacks
1297
have just been pushed. So pushing a state here evens the stacks. */
1303
if (yyss + yystacksize - 1 <= yyssp)
1305
/* Get the current used size of the three stacks, in elements. */
1306
YYSIZE_T yysize = yyssp - yyss + 1;
1310
/* Give user a chance to reallocate the stack. Use copies of
1311
these so that the &'s don't force the real ones into
1313
YYSTYPE *yyvs1 = yyvs;
1314
yytype_int16 *yyss1 = yyss;
1317
/* Each stack pointer address is followed by the size of the
1318
data in use in that stack, in bytes. This used to be a
1319
conditional around just the two extra args, but that might
1320
be undefined if yyoverflow is a macro. */
1321
yyoverflow (YY_("memory exhausted"),
1322
&yyss1, yysize * sizeof (*yyssp),
1323
&yyvs1, yysize * sizeof (*yyvsp),
1330
#else /* no yyoverflow */
1331
# ifndef YYSTACK_RELOCATE
1332
goto yyexhaustedlab;
1334
/* Extend the stack our own way. */
1335
if (YYMAXDEPTH <= yystacksize)
1336
goto yyexhaustedlab;
1338
if (YYMAXDEPTH < yystacksize)
1339
yystacksize = YYMAXDEPTH;
1342
yytype_int16 *yyss1 = yyss;
1343
union yyalloc *yyptr =
1344
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1346
goto yyexhaustedlab;
1347
YYSTACK_RELOCATE (yyss);
1348
YYSTACK_RELOCATE (yyvs);
1350
# undef YYSTACK_RELOCATE
1352
YYSTACK_FREE (yyss1);
1355
#endif /* no yyoverflow */
1357
yyssp = yyss + yysize - 1;
1358
yyvsp = yyvs + yysize - 1;
1361
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1362
(unsigned long int) yystacksize));
1364
if (yyss + yystacksize - 1 <= yyssp)
1368
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1370
if (yystate == YYFINAL)
1380
/* Do appropriate processing given the current state. Read a
1381
lookahead token if we need one and don't already have one. */
1383
/* First try to decide what to do without reference to lookahead token. */
1384
yyn = yypact[yystate];
1385
if (yyn == YYPACT_NINF)
1388
/* Not known => get a lookahead token if don't already have one. */
1390
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1391
if (yychar == YYEMPTY)
1393
YYDPRINTF ((stderr, "Reading a token: "));
1397
if (yychar <= YYEOF)
1399
yychar = yytoken = YYEOF;
1400
YYDPRINTF ((stderr, "Now at end of input.\n"));
1404
yytoken = YYTRANSLATE (yychar);
1405
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1408
/* If the proper action on seeing token YYTOKEN is to reduce or to
1409
detect an error, take that action. */
1411
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1416
if (yyn == 0 || yyn == YYTABLE_NINF)
1422
/* Count tokens shifted since error; after three, turn off error
1427
/* Shift the lookahead token. */
1428
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1430
/* Discard the shifted token. */
1439
/*-----------------------------------------------------------.
1440
| yydefault -- do the default action for the current state. |
1441
`-----------------------------------------------------------*/
1443
yyn = yydefact[yystate];
1449
/*-----------------------------.
1450
| yyreduce -- Do a reduction. |
1451
`-----------------------------*/
1453
/* yyn is the number of a rule to reduce with. */
1456
/* If YYLEN is nonzero, implement the default value of the action:
1459
Otherwise, the following line sets YYVAL to garbage.
1460
This behavior is undocumented and Bison
1461
users should not rely upon it. Assigning to YYVAL
1462
unconditionally makes the parser a bit smaller, and it avoids a
1463
GCC warning that YYVAL may be used uninitialized. */
1464
yyval = yyvsp[1-yylen];
1467
YY_REDUCE_PRINT (yyn);
1471
/* Line 1269 of yacc.c. */
1472
#line 155 "plural.y"
1474
if ((yyvsp[(1) - (1)].exp) == NULL)
1476
((struct parse_args *) arg)->res = (yyvsp[(1) - (1)].exp);
1481
/* Line 1269 of yacc.c. */
1482
#line 163 "plural.y"
1484
(yyval.exp) = new_exp_3 (qmop, (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp));
1489
/* Line 1269 of yacc.c. */
1490
#line 167 "plural.y"
1492
(yyval.exp) = new_exp_2 (lor, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1497
/* Line 1269 of yacc.c. */
1498
#line 171 "plural.y"
1500
(yyval.exp) = new_exp_2 (land, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1505
/* Line 1269 of yacc.c. */
1506
#line 175 "plural.y"
1508
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1513
/* Line 1269 of yacc.c. */
1514
#line 179 "plural.y"
1516
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1521
/* Line 1269 of yacc.c. */
1522
#line 183 "plural.y"
1524
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1529
/* Line 1269 of yacc.c. */
1530
#line 187 "plural.y"
1532
(yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1537
/* Line 1269 of yacc.c. */
1538
#line 191 "plural.y"
1540
(yyval.exp) = new_exp_1 (lnot, (yyvsp[(2) - (2)].exp));
1545
/* Line 1269 of yacc.c. */
1546
#line 195 "plural.y"
1548
(yyval.exp) = new_exp_0 (var);
1553
/* Line 1269 of yacc.c. */
1554
#line 199 "plural.y"
1556
if (((yyval.exp) = new_exp_0 (num)) != NULL)
1557
(yyval.exp)->val.num = (yyvsp[(1) - (1)].num);
1562
/* Line 1269 of yacc.c. */
1563
#line 204 "plural.y"
1565
(yyval.exp) = (yyvsp[(2) - (3)].exp);
1570
/* Line 1269 of yacc.c. */
1571
#line 1572 "plural.c"
1574
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1578
YY_STACK_PRINT (yyss, yyssp);
1583
/* Now `shift' the result of the reduction. Determine what state
1584
that goes to, based on the state we popped back to and the rule
1585
number reduced by. */
1589
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1590
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1591
yystate = yytable[yystate];
1593
yystate = yydefgoto[yyn - YYNTOKENS];
1598
/*------------------------------------.
1599
| yyerrlab -- here on detecting error |
1600
`------------------------------------*/
1602
/* If not already recovering from an error, report this error. */
1606
#if ! YYERROR_VERBOSE
1607
yyerror (YY_("syntax error"));
1610
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1611
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1613
YYSIZE_T yyalloc = 2 * yysize;
1614
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1615
yyalloc = YYSTACK_ALLOC_MAXIMUM;
1616
if (yymsg != yymsgbuf)
1617
YYSTACK_FREE (yymsg);
1618
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1620
yymsg_alloc = yyalloc;
1624
yymsg_alloc = sizeof yymsgbuf;
1628
if (0 < yysize && yysize <= yymsg_alloc)
1630
(void) yysyntax_error (yymsg, yystate, yychar);
1635
yyerror (YY_("syntax error"));
1637
goto yyexhaustedlab;
1645
if (yyerrstatus == 3)
1647
/* If just tried and failed to reuse lookahead token after an
1648
error, discard it. */
1650
if (yychar <= YYEOF)
1652
/* Return failure if at end of input. */
1653
if (yychar == YYEOF)
1658
yydestruct ("Error: discarding",
1664
/* Else will try to reuse lookahead token after shifting the error
1669
/*---------------------------------------------------.
1670
| yyerrorlab -- error raised explicitly by YYERROR. |
1671
`---------------------------------------------------*/
1674
/* Pacify compilers like GCC when the user code never invokes
1675
YYERROR and the label yyerrorlab therefore never appears in user
1677
if (/*CONSTCOND*/ 0)
1680
/* Do not reclaim the symbols of the rule which action triggered
1684
YY_STACK_PRINT (yyss, yyssp);
1689
/*-------------------------------------------------------------.
1690
| yyerrlab1 -- common code for both syntax error and YYERROR. |
1691
`-------------------------------------------------------------*/
1693
yyerrstatus = 3; /* Each real token shifted decrements this. */
1697
yyn = yypact[yystate];
1698
if (yyn != YYPACT_NINF)
1701
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1709
/* Pop the current state because it cannot handle the error token. */
1714
yydestruct ("Error: popping",
1715
yystos[yystate], yyvsp);
1718
YY_STACK_PRINT (yyss, yyssp);
1724
/* Shift the error token. */
1725
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1731
/*-------------------------------------.
1732
| yyacceptlab -- YYACCEPT comes here. |
1733
`-------------------------------------*/
1738
/*-----------------------------------.
1739
| yyabortlab -- YYABORT comes here. |
1740
`-----------------------------------*/
1746
/*-------------------------------------------------.
1747
| yyexhaustedlab -- memory exhaustion comes here. |
1748
`-------------------------------------------------*/
1750
yyerror (YY_("memory exhausted"));
1756
if (yychar != YYEMPTY)
1757
yydestruct ("Cleanup: discarding lookahead",
1759
/* Do not reclaim the symbols of the rule which action triggered
1760
this YYABORT or YYACCEPT. */
1762
YY_STACK_PRINT (yyss, yyssp);
1763
while (yyssp != yyss)
1765
yydestruct ("Cleanup: popping",
1766
yystos[*yyssp], yyvsp);
1771
YYSTACK_FREE (yyss);
1774
if (yymsg != yymsgbuf)
1775
YYSTACK_FREE (yymsg);
1777
/* Make sure YYID is used. */
1778
return YYID (yyresult);
1782
/* Line 1486 of yacc.c. */
1783
#line 209 "plural.y"
1788
FREE_EXPRESSION (struct expression *exp)
1793
/* Handle the recursive case. */
1797
FREE_EXPRESSION (exp->val.args[2]);
1800
FREE_EXPRESSION (exp->val.args[1]);
1803
FREE_EXPRESSION (exp->val.args[0]);
1814
yylex (YYSTYPE *lval, const char **pexp)
1816
const char *exp = *pexp;
1827
if (exp[0] != ' ' && exp[0] != '\t')
1836
case '0': case '1': case '2': case '3': case '4':
1837
case '5': case '6': case '7': case '8': case '9':
1839
unsigned long int n = result - '0';
1840
while (exp[0] >= '0' && exp[0] <= '9')
1866
lval->op = not_equal;
1873
if (exp[0] == result)
1883
lval->op = less_or_equal;
1886
lval->op = less_than;
1894
lval->op = greater_or_equal;
1897
lval->op = greater_than;
1931
/* Nothing, just return the character. */
1937
/* Be safe and let the user call this function again. */
1957
yyerror (const char *str)
1959
/* Do nothing. We don't print error messages here. */