1 /* A Bison parser, made by GNU Bison 2.3a.  */
2 
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6    Free Software Foundation, Inc.
7 
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)
11    any later version.
12 
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.
17 
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.  */
22 
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.
32 
33    This special exception was added by the Free Software Foundation in
34    version 2.2 of Bison.  */
35 
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37    simplifying the original so-called "semantic" parser.  */
38 
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.  */
45 
46 /* Identify Bison output.  */
47 #define YYBISON 1
48 
49 /* Bison version.  */
50 #define YYBISON_VERSION "2.3a"
51 
52 /* Skeleton name.  */
53 #define YYSKELETON_NAME "yacc.c"
54 
55 /* Pure parsers.  */
56 #define YYPURE 1
57 
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60 
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
69 
70 
71 /* Copy the first part of user declarations.  */
72 /* Line 164 of yacc.c.  */
73 #line 1 "plural.y"
74 
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.
78 
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)
82    any later version.
83 
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.
88 
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,
92    USA.  */
93 
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__
100  #pragma alloca
101 #endif
102 
103 #ifdef HAVE_CONFIG_H
104 # include <config.h>
105 #endif
106 
107 #include <stddef.h>
108 #include <stdlib.h>
109 #include <string.h>
110 #include "plural-exp.h"
111 
112 /* The main function generated by the parser is called __gettextparse,
113    but we want it to be called PLURAL_PARSE.  */
114 #ifndef _LIBC
115 # define __gettextparse PLURAL_PARSE
116 #endif
117 
118 #define YYLEX_PARAM	&((struct parse_args *) arg)->cp
119 #define YYPARSE_PARAM	arg
120 
121 
122 /* Enabling traces.  */
123 #ifndef YYDEBUG
124 # define YYDEBUG 0
125 #endif
126 
127 /* Enabling verbose error messages.  */
128 #ifdef YYERROR_VERBOSE
129 # undef YYERROR_VERBOSE
130 # define YYERROR_VERBOSE 1
131 #else
132 # define YYERROR_VERBOSE 0
133 #endif
134 
135 /* Enabling the token table.  */
136 #ifndef YYTOKEN_TABLE
137 # define YYTOKEN_TABLE 0
138 #endif
139 
140 
141 /* Tokens.  */
142 #ifndef YYTOKENTYPE
143 # define YYTOKENTYPE
144    /* Put the tokens into the symbol table, so that GDB and other debuggers
145       know about them.  */
146    enum yytokentype {
147      EQUOP2 = 258,
148      CMPOP2 = 259,
149      ADDOP2 = 260,
150      MULOP2 = 261,
151      NUMBER = 262
152    };
153 #endif
154 /* Tokens.  */
155 #define EQUOP2 258
156 #define CMPOP2 259
157 #define ADDOP2 260
158 #define MULOP2 261
159 #define NUMBER 262
160 
161 
162 
163 
164 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
165 typedef union YYSTYPE
166 {/* Line 191 of yacc.c.  */
167 #line 51 "plural.y"
168 
169   unsigned long int num;
170   enum expression_operator op;
171   struct expression *exp;
172 }
173 /* Line 191 of yacc.c.  */
174 #line 175 "plural.c"
175 	YYSTYPE;
176 # define YYSTYPE_IS_TRIVIAL 1
177 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
178 # define YYSTYPE_IS_DECLARED 1
179 #endif
180 
181 
182 
183 
184 /* Copy the second part of user declarations.  */
185 /* Line 221 of yacc.c.  */
186 #line 57 "plural.y"
187 
188 /* Prototypes for local functions.  */
189 static int yylex (YYSTYPE *lval, const char **pexp);
190 static void yyerror (const char *str);
191 
192 /* Allocation of expressions.  */
193 
194 static struct expression *
new_exp(int nargs,enum expression_operator op,struct expression * const * args)195 new_exp (int nargs, enum expression_operator op,
196 	 struct expression * const *args)
197 {
198   int i;
199   struct expression *newp;
200 
201   /* If any of the argument could not be malloc'ed, just return NULL.  */
202   for (i = nargs - 1; i >= 0; i--)
203     if (args[i] == NULL)
204       goto fail;
205 
206   /* Allocate a new expression.  */
207   newp = (struct expression *) malloc (sizeof (*newp));
208   if (newp != NULL)
209     {
210       newp->nargs = nargs;
211       newp->operation = op;
212       for (i = nargs - 1; i >= 0; i--)
213 	newp->val.args[i] = args[i];
214       return newp;
215     }
216 
217  fail:
218   for (i = nargs - 1; i >= 0; i--)
219     FREE_EXPRESSION (args[i]);
220 
221   return NULL;
222 }
223 
224 static inline struct expression *
new_exp_0(enum expression_operator op)225 new_exp_0 (enum expression_operator op)
226 {
227   return new_exp (0, op, NULL);
228 }
229 
230 static inline struct expression *
new_exp_1(enum expression_operator op,struct expression * right)231 new_exp_1 (enum expression_operator op, struct expression *right)
232 {
233   struct expression *args[1];
234 
235   args[0] = right;
236   return new_exp (1, op, args);
237 }
238 
239 static struct expression *
new_exp_2(enum expression_operator op,struct expression * left,struct expression * right)240 new_exp_2 (enum expression_operator op, struct expression *left,
241 	   struct expression *right)
242 {
243   struct expression *args[2];
244 
245   args[0] = left;
246   args[1] = right;
247   return new_exp (2, op, args);
248 }
249 
250 static inline struct expression *
new_exp_3(enum expression_operator op,struct expression * bexp,struct expression * tbranch,struct expression * fbranch)251 new_exp_3 (enum expression_operator op, struct expression *bexp,
252 	   struct expression *tbranch, struct expression *fbranch)
253 {
254   struct expression *args[3];
255 
256   args[0] = bexp;
257   args[1] = tbranch;
258   args[2] = fbranch;
259   return new_exp (3, op, args);
260 }
261 
262 
263 /* Line 221 of yacc.c.  */
264 #line 265 "plural.c"
265 
266 #ifdef short
267 # undef short
268 #endif
269 
270 #ifdef YYTYPE_UINT8
271 typedef YYTYPE_UINT8 yytype_uint8;
272 #else
273 typedef unsigned char yytype_uint8;
274 #endif
275 
276 #ifdef YYTYPE_INT8
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;
281 #else
282 typedef short int yytype_int8;
283 #endif
284 
285 #ifdef YYTYPE_UINT16
286 typedef YYTYPE_UINT16 yytype_uint16;
287 #else
288 typedef unsigned short int yytype_uint16;
289 #endif
290 
291 #ifdef YYTYPE_INT16
292 typedef YYTYPE_INT16 yytype_int16;
293 #else
294 typedef short int yytype_int16;
295 #endif
296 
297 #ifndef YYSIZE_T
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
306 # else
307 #  define YYSIZE_T unsigned int
308 # endif
309 #endif
310 
311 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
312 
313 #ifndef YY_
314 # if YYENABLE_NLS
315 #  if ENABLE_NLS
316 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
317 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
318 #  endif
319 # endif
320 # ifndef YY_
321 #  define YY_(msgid) msgid
322 # endif
323 #endif
324 
325 /* Suppress unused-variable warnings by "using" E.  */
326 #if ! defined lint || defined __GNUC__
327 # define YYUSE(e) ((void) (e))
328 #else
329 # define YYUSE(e) /* empty */
330 #endif
331 
332 /* Identity function, used to suppress warnings about constant conditions.  */
333 #ifndef lint
334 # define YYID(n) (n)
335 #else
336 #if (defined __STDC__ || defined __C99__FUNC__ \
337      || defined __cplusplus || defined _MSC_VER)
338 static int
YYID(int yyi)339 YYID (int yyi)
340 #else
341 static int
342 YYID (yyi)
343     int yyi;
344 #endif
345 {
346   return yyi;
347 }
348 #endif
349 
350 #if ! defined yyoverflow || YYERROR_VERBOSE
351 
352 /* The parser invokes alloca or malloc; define the necessary symbols.  */
353 
354 # ifdef YYSTACK_USE_ALLOCA
355 #  if YYSTACK_USE_ALLOCA
356 #   ifdef __GNUC__
357 #    define YYSTACK_ALLOC __builtin_alloca
358 #   elif defined __BUILTIN_VA_ARG_INCR
359 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
360 #   elif defined _AIX
361 #    define YYSTACK_ALLOC __alloca
362 #   elif defined _MSC_VER
363 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
364 #    define alloca _alloca
365 #   else
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 */
370 #     ifndef _STDLIB_H
371 #      define _STDLIB_H 1
372 #     endif
373 #    endif
374 #   endif
375 #  endif
376 # endif
377 
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 */
387 #  endif
388 # else
389 #  define YYSTACK_ALLOC YYMALLOC
390 #  define YYSTACK_FREE YYFREE
391 #  ifndef YYSTACK_ALLOC_MAXIMUM
392 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
393 #  endif
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 */
398 #   ifndef _STDLIB_H
399 #    define _STDLIB_H 1
400 #   endif
401 #  endif
402 #  ifndef YYMALLOC
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 */
407 #   endif
408 #  endif
409 #  ifndef YYFREE
410 #   define YYFREE free
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 */
414 #   endif
415 #  endif
416 # endif
417 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
418 
419 
420 #if (! defined yyoverflow \
421      && (! defined __cplusplus \
422 	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
423 
424 /* A type that is properly aligned for any stack member.  */
425 union yyalloc
426 {
427   yytype_int16 yyss;
428   YYSTYPE yyvs;
429   };
430 
431 /* The size of the maximum gap between one aligned stack and the next.  */
432 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
433 
434 /* The size of an array large to enough to hold all stacks, each with
435    N elements.  */
436 # define YYSTACK_BYTES(N) \
437      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
438       + YYSTACK_GAP_MAXIMUM)
439 
440 /* Copy COUNT objects from FROM to TO.  The source and destination do
441    not overlap.  */
442 # ifndef YYCOPY
443 #  if defined __GNUC__ && 1 < __GNUC__
444 #   define YYCOPY(To, From, Count) \
445       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
446 #  else
447 #   define YYCOPY(To, From, Count)		\
448       do					\
449 	{					\
450 	  YYSIZE_T yyi;				\
451 	  for (yyi = 0; yyi < (Count); yyi++)	\
452 	    (To)[yyi] = (From)[yyi];		\
453 	}					\
454       while (YYID (0))
455 #  endif
456 # endif
457 
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
462    stack.  */
463 # define YYSTACK_RELOCATE(Stack)					\
464     do									\
465       {									\
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);				\
471       }									\
472     while (YYID (0))
473 
474 #endif
475 
476 /* YYFINAL -- State number of the termination state.  */
477 #define YYFINAL  9
478 /* YYLAST -- Last index in YYTABLE.  */
479 #define YYLAST   54
480 
481 /* YYNTOKENS -- Number of terminals.  */
482 #define YYNTOKENS  16
483 /* YYNNTS -- Number of nonterminals.  */
484 #define YYNNTS  3
485 /* YYNRULES -- Number of rules.  */
486 #define YYNRULES  13
487 /* YYNRULES -- Number of states.  */
488 #define YYNSTATES  27
489 
490 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
491 #define YYUNDEFTOK  2
492 #define YYMAXUTOK   262
493 
494 #define YYTRANSLATE(YYX)						\
495   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
496 
497 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
498 static const yytype_uint8 yytranslate[] =
499 {
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,
526        8,     9,    11
527 };
528 
529 #if YYDEBUG
530 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
531    YYRHS.  */
532 static const yytype_uint8 yyprhs[] =
533 {
534        0,     0,     3,     5,    11,    15,    19,    23,    27,    31,
535       35,    38,    40,    42
536 };
537 
538 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
539 static const yytype_int8 yyrhs[] =
540 {
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
546 };
547 
548 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
549 static const yytype_uint8 yyrline[] =
550 {
551        0,   154,   154,   162,   166,   170,   174,   178,   182,   186,
552      190,   194,   198,   203
553 };
554 #endif
555 
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[] =
560 {
561   "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
562   "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
563   "$accept", "start", "exp", 0
564 };
565 #endif
566 
567 # ifdef YYPRINT
568 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
569    token YYLEX-NUM.  */
570 static const yytype_uint16 yytoknum[] =
571 {
572        0,   256,   257,    63,   124,    38,   258,   259,   260,   261,
573       33,   262,    58,   110,    40,    41
574 };
575 # endif
576 
577 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
578 static const yytype_uint8 yyr1[] =
579 {
580        0,    16,    17,    18,    18,    18,    18,    18,    18,    18,
581       18,    18,    18,    18
582 };
583 
584 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
585 static const yytype_uint8 yyr2[] =
586 {
587        0,     2,     1,     5,     3,     3,     3,     3,     3,     3,
588        2,     1,     1,     3
589 };
590 
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[] =
595 {
596        0,     0,    12,    11,     0,     0,     2,    10,     0,     1,
597        0,     0,     0,     0,     0,     0,     0,    13,     0,     4,
598        5,     6,     7,     8,     9,     0,     3
599 };
600 
601 /* YYDEFGOTO[NTERM-NUM].  */
602 static const yytype_int8 yydefgoto[] =
603 {
604       -1,     5,     6
605 };
606 
607 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
608    STATE-NUM.  */
609 #define YYPACT_NINF -10
610 static const yytype_int8 yypact[] =
611 {
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
615 };
616 
617 /* YYPGOTO[NTERM-NUM].  */
618 static const yytype_int8 yypgoto[] =
619 {
620      -10,   -10,    -1
621 };
622 
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[] =
629 {
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,
635       16,    13,    14,    15,    16
636 };
637 
638 static const yytype_int8 yycheck[] =
639 {
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,
645        9,     6,     7,     8,     9
646 };
647 
648 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
649    symbol of state STATE-NUM.  */
650 static const yytype_uint8 yystos[] =
651 {
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
655 };
656 
657 #define yyerrok		(yyerrstatus = 0)
658 #define yyclearin	(yychar = YYEMPTY)
659 #define YYEMPTY		(-2)
660 #define YYEOF		0
661 
662 #define YYACCEPT	goto yyacceptlab
663 #define YYABORT		goto yyabortlab
664 #define YYERROR		goto yyerrorlab
665 
666 
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.  */
670 
671 #define YYFAIL		goto yyerrlab
672 
673 #define YYRECOVERING()  (!!yyerrstatus)
674 
675 #define YYBACKUP(Token, Value)					\
676 do								\
677   if (yychar == YYEMPTY && yylen == 1)				\
678     {								\
679       yychar = (Token);						\
680       yylval = (Value);						\
681       yytoken = YYTRANSLATE (yychar);				\
682       YYPOPSTACK (1);						\
683       goto yybackup;						\
684     }								\
685   else								\
686     {								\
687       yyerror (YY_("syntax error: cannot back up")); \
688       YYERROR;							\
689     }								\
690 while (YYID (0))
691 
692 
693 #define YYTERROR	1
694 #define YYERRCODE	256
695 
696 
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).  */
700 
701 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
702 #ifndef YYLLOC_DEFAULT
703 # define YYLLOC_DEFAULT(Current, Rhs, N)				\
704     do									\
705       if (YYID (N))                                                    \
706 	{								\
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;	\
711 	}								\
712       else								\
713 	{								\
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;				\
718 	}								\
719     while (YYID (0))
720 #endif
721 
722 
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.  */
726 
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)
733 # else
734 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
735 # endif
736 #endif
737 
738 
739 /* YYLEX -- calling `yylex' with the right arguments.  */
740 
741 #ifdef YYLEX_PARAM
742 # define YYLEX yylex (&yylval, YYLEX_PARAM)
743 #else
744 # define YYLEX yylex (&yylval)
745 #endif
746 
747 /* Enable debugging if requested.  */
748 #if YYDEBUG
749 
750 # ifndef YYFPRINTF
751 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
752 #  define YYFPRINTF fprintf
753 # endif
754 
755 # define YYDPRINTF(Args)			\
756 do {						\
757   if (yydebug)					\
758     YYFPRINTF Args;				\
759 } while (YYID (0))
760 
761 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
762 do {									  \
763   if (yydebug)								  \
764     {									  \
765       YYFPRINTF (stderr, "%s ", Title);					  \
766       yy_symbol_print (stderr,						  \
767 		  Type, Value); \
768       YYFPRINTF (stderr, "\n");						  \
769     }									  \
770 } while (YYID (0))
771 
772 
773 /*--------------------------------.
774 | Print this symbol on YYOUTPUT.  |
775 `--------------------------------*/
776 
777 /*ARGSUSED*/
778 #if (defined __STDC__ || defined __C99__FUNC__ \
779      || defined __cplusplus || defined _MSC_VER)
780 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)781 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
782 #else
783 static void
784 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
785     FILE *yyoutput;
786     int yytype;
787     YYSTYPE const * const yyvaluep;
788 #endif
789 {
790   if (!yyvaluep)
791     return;
792 # ifdef YYPRINT
793   if (yytype < YYNTOKENS)
794     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
795 # else
796   YYUSE (yyoutput);
797 # endif
798   switch (yytype)
799     {
800       default:
801 	break;
802     }
803 }
804 
805 
806 /*--------------------------------.
807 | Print this symbol on YYOUTPUT.  |
808 `--------------------------------*/
809 
810 #if (defined __STDC__ || defined __C99__FUNC__ \
811      || defined __cplusplus || defined _MSC_VER)
812 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)813 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
814 #else
815 static void
816 yy_symbol_print (yyoutput, yytype, yyvaluep)
817     FILE *yyoutput;
818     int yytype;
819     YYSTYPE const * const yyvaluep;
820 #endif
821 {
822   if (yytype < YYNTOKENS)
823     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
824   else
825     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
826 
827   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
828   YYFPRINTF (yyoutput, ")");
829 }
830 
831 /*------------------------------------------------------------------.
832 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
833 | TOP (included).                                                   |
834 `------------------------------------------------------------------*/
835 
836 #if (defined __STDC__ || defined __C99__FUNC__ \
837      || defined __cplusplus || defined _MSC_VER)
838 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)839 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
840 #else
841 static void
842 yy_stack_print (yybottom, yytop)
843     yytype_int16 *yybottom;
844     yytype_int16 *yytop;
845 #endif
846 {
847   YYFPRINTF (stderr, "Stack now");
848   for (; yybottom <= yytop; yybottom++)
849     {
850       int yybot = *yybottom;
851       YYFPRINTF (stderr, " %d", yybot);
852     }
853   YYFPRINTF (stderr, "\n");
854 }
855 
856 # define YY_STACK_PRINT(Bottom, Top)				\
857 do {								\
858   if (yydebug)							\
859     yy_stack_print ((Bottom), (Top));				\
860 } while (YYID (0))
861 
862 
863 /*------------------------------------------------.
864 | Report that the YYRULE is going to be reduced.  |
865 `------------------------------------------------*/
866 
867 #if (defined __STDC__ || defined __C99__FUNC__ \
868      || defined __cplusplus || defined _MSC_VER)
869 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)870 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
871 #else
872 static void
873 yy_reduce_print (yyvsp, yyrule)
874     YYSTYPE *yyvsp;
875     int yyrule;
876 #endif
877 {
878   int yynrhs = yyr2[yyrule];
879   int yyi;
880   unsigned long int yylno = yyrline[yyrule];
881   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
882 	     yyrule - 1, yylno);
883   /* The symbols being reduced.  */
884   for (yyi = 0; yyi < yynrhs; yyi++)
885     {
886       fprintf (stderr, "   $%d = ", yyi + 1);
887       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
888 		       &(yyvsp[(yyi + 1) - (yynrhs)])
889 		       		       );
890       fprintf (stderr, "\n");
891     }
892 }
893 
894 # define YY_REDUCE_PRINT(Rule)		\
895 do {					\
896   if (yydebug)				\
897     yy_reduce_print (yyvsp, Rule); \
898 } while (YYID (0))
899 
900 /* Nonzero means print parse trace.  It is left uninitialized so that
901    multiple parsers can coexist.  */
902 int yydebug;
903 #else /* !YYDEBUG */
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 */
909 
910 
911 /* YYINITDEPTH -- initial size of the parser's stacks.  */
912 #ifndef	YYINITDEPTH
913 # define YYINITDEPTH 200
914 #endif
915 
916 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
917    if the built-in stack extension method is used).
918 
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.  */
922 
923 #ifndef YYMAXDEPTH
924 # define YYMAXDEPTH 10000
925 #endif
926 
927 
928 
929 #if YYERROR_VERBOSE
930 
931 # ifndef yystrlen
932 #  if defined __GLIBC__ && defined _STRING_H
933 #   define yystrlen strlen
934 #  else
935 /* Return the length of YYSTR.  */
936 #if (defined __STDC__ || defined __C99__FUNC__ \
937      || defined __cplusplus || defined _MSC_VER)
938 static YYSIZE_T
yystrlen(const char * yystr)939 yystrlen (const char *yystr)
940 #else
941 static YYSIZE_T
942 yystrlen (yystr)
943     const char *yystr;
944 #endif
945 {
946   YYSIZE_T yylen;
947   for (yylen = 0; yystr[yylen]; yylen++)
948     continue;
949   return yylen;
950 }
951 #  endif
952 # endif
953 
954 # ifndef yystpcpy
955 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
956 #   define yystpcpy stpcpy
957 #  else
958 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
959    YYDEST.  */
960 #if (defined __STDC__ || defined __C99__FUNC__ \
961      || defined __cplusplus || defined _MSC_VER)
962 static char *
yystpcpy(char * yydest,const char * yysrc)963 yystpcpy (char *yydest, const char *yysrc)
964 #else
965 static char *
966 yystpcpy (yydest, yysrc)
967     char *yydest;
968     const char *yysrc;
969 #endif
970 {
971   char *yyd = yydest;
972   const char *yys = yysrc;
973 
974   while ((*yyd++ = *yys++) != '\0')
975     continue;
976 
977   return yyd - 1;
978 }
979 #  endif
980 # endif
981 
982 # ifndef yytnamerr
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
989    would have been.  */
990 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)991 yytnamerr (char *yyres, const char *yystr)
992 {
993   if (*yystr == '"')
994     {
995       YYSIZE_T yyn = 0;
996       char const *yyp = yystr;
997 
998       for (;;)
999 	switch (*++yyp)
1000 	  {
1001 	  case '\'':
1002 	  case ',':
1003 	    goto do_not_strip_quotes;
1004 
1005 	  case '\\':
1006 	    if (*++yyp != '\\')
1007 	      goto do_not_strip_quotes;
1008 	    /* Fall through.  */
1009 	  default:
1010 	    if (yyres)
1011 	      yyres[yyn] = *yyp;
1012 	    yyn++;
1013 	    break;
1014 
1015 	  case '"':
1016 	    if (yyres)
1017 	      yyres[yyn] = '\0';
1018 	    return yyn;
1019 	  }
1020     do_not_strip_quotes: ;
1021     }
1022 
1023   if (! yyres)
1024     return yystrlen (yystr);
1025 
1026   return yystpcpy (yyres, yystr) - yyres;
1027 }
1028 # endif
1029 
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.  */
1037 static YYSIZE_T
yysyntax_error(char * yyresult,int yystate,int yychar)1038 yysyntax_error (char *yyresult, int yystate, int yychar)
1039 {
1040   int yyn = yypact[yystate];
1041 
1042   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1043     return 0;
1044   else
1045     {
1046       int yytype = YYTRANSLATE (yychar);
1047       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1048       YYSIZE_T yysize = yysize0;
1049       YYSIZE_T yysize1;
1050       int yysize_overflow = 0;
1051       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1052       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1053       int yyx;
1054 
1055 # if 0
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");
1063 # endif
1064       char *yyfmt;
1065       char const *yyf;
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;
1074 
1075       /* Start YYX at -YYN if negative to avoid negative indexes in
1076 	 YYCHECK.  */
1077       int yyxbegin = yyn < 0 ? -yyn : 0;
1078 
1079       /* Stay within bounds of both yycheck and yytname.  */
1080       int yychecklim = YYLAST - yyn + 1;
1081       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1082       int yycount = 1;
1083 
1084       yyarg[0] = yytname[yytype];
1085       yyfmt = yystpcpy (yyformat, yyunexpected);
1086 
1087       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1088 	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1089 	  {
1090 	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1091 	      {
1092 		yycount = 1;
1093 		yysize = yysize0;
1094 		yyformat[sizeof yyunexpected - 1] = '\0';
1095 		break;
1096 	      }
1097 	    yyarg[yycount++] = yytname[yyx];
1098 	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1099 	    yysize_overflow |= (yysize1 < yysize);
1100 	    yysize = yysize1;
1101 	    yyfmt = yystpcpy (yyfmt, yyprefix);
1102 	    yyprefix = yyor;
1103 	  }
1104 
1105       yyf = YY_(yyformat);
1106       yysize1 = yysize + yystrlen (yyf);
1107       yysize_overflow |= (yysize1 < yysize);
1108       yysize = yysize1;
1109 
1110       if (yysize_overflow)
1111 	return YYSIZE_MAXIMUM;
1112 
1113       if (yyresult)
1114 	{
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;
1119 	  int yyi = 0;
1120 	  while ((*yyp = *yyf) != '\0')
1121 	    {
1122 	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1123 		{
1124 		  yyp += yytnamerr (yyp, yyarg[yyi++]);
1125 		  yyf += 2;
1126 		}
1127 	      else
1128 		{
1129 		  yyp++;
1130 		  yyf++;
1131 		}
1132 	    }
1133 	}
1134       return yysize;
1135     }
1136 }
1137 #endif /* YYERROR_VERBOSE */
1138 
1139 
1140 /*-----------------------------------------------.
1141 | Release the memory associated to this symbol.  |
1142 `-----------------------------------------------*/
1143 
1144 /*ARGSUSED*/
1145 #if (defined __STDC__ || defined __C99__FUNC__ \
1146      || defined __cplusplus || defined _MSC_VER)
1147 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1148 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1149 #else
1150 static void
1151 yydestruct (yymsg, yytype, yyvaluep)
1152     const char *yymsg;
1153     int yytype;
1154     YYSTYPE *yyvaluep;
1155 #endif
1156 {
1157   YYUSE (yyvaluep);
1158 
1159   if (!yymsg)
1160     yymsg = "Deleting";
1161   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1162 
1163   switch (yytype)
1164     {
1165 
1166       default:
1167 	break;
1168     }
1169 }
1170 
1171 
1172 /* Prevent warnings from -Wmissing-prototypes.  */
1173 
1174 #ifdef YYPARSE_PARAM
1175 #if defined __STDC__ || defined __cplusplus
1176 int yyparse (void *YYPARSE_PARAM);
1177 #else
1178 int yyparse ();
1179 #endif
1180 #else /* ! YYPARSE_PARAM */
1181 #if defined __STDC__ || defined __cplusplus
1182 int yyparse (void);
1183 #else
1184 int yyparse ();
1185 #endif
1186 #endif /* ! YYPARSE_PARAM */
1187 
1188 
1189 
1190 
1191 
1192 
1193 /*----------.
1194 | yyparse.  |
1195 `----------*/
1196 
1197 #ifdef YYPARSE_PARAM
1198 #if (defined __STDC__ || defined __C99__FUNC__ \
1199      || defined __cplusplus || defined _MSC_VER)
1200 int
yyparse(void * YYPARSE_PARAM)1201 yyparse (void *YYPARSE_PARAM)
1202 #else
1203 int
1204 yyparse (YYPARSE_PARAM)
1205     void *YYPARSE_PARAM;
1206 #endif
1207 #else /* ! YYPARSE_PARAM */
1208 #if (defined __STDC__ || defined __C99__FUNC__ \
1209      || defined __cplusplus || defined _MSC_VER)
1210 int
1211 yyparse (void)
1212 #else
1213 int
1214 yyparse ()
1215 
1216 #endif
1217 #endif
1218 {
1219   /* The lookahead symbol.  */
1220 int yychar;
1221 
1222 /* The semantic value of the lookahead symbol.  */
1223 YYSTYPE yylval;
1224 
1225 /* Number of syntax errors so far.  */
1226 int yynerrs;
1227 
1228   int yystate;
1229   int yyn;
1230   int yyresult;
1231   /* Number of tokens to shift before error messages enabled.  */
1232   int yyerrstatus;
1233   /* Lookahead token as an internal (translated) token number.  */
1234   int yytoken = 0;
1235 #if YYERROR_VERBOSE
1236   /* Buffer for error messages, and its allocated size.  */
1237   char yymsgbuf[128];
1238   char *yymsg = yymsgbuf;
1239   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1240 #endif
1241 
1242   /* Three stacks and their tools:
1243      `yyss': related to states,
1244      `yyvs': related to semantic values,
1245      `yyls': related to locations.
1246 
1247      Refer to the stacks thru separate pointers, to allow yyoverflow
1248      to reallocate them elsewhere.  */
1249 
1250   /* The state stack.  */
1251   yytype_int16 yyssa[YYINITDEPTH];
1252   yytype_int16 *yyss = yyssa;
1253   yytype_int16 *yyssp;
1254 
1255   /* The semantic value stack.  */
1256   YYSTYPE yyvsa[YYINITDEPTH];
1257   YYSTYPE *yyvs = yyvsa;
1258   YYSTYPE *yyvsp;
1259 
1260 
1261 
1262 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1263 
1264   YYSIZE_T yystacksize = YYINITDEPTH;
1265 
1266   /* The variables used to return semantic value and location from the
1267      action routines.  */
1268   YYSTYPE yyval;
1269 
1270 
1271   /* The number of symbols on the RHS of the reduced rule.
1272      Keep to zero when no symbol should be popped.  */
1273   int yylen = 0;
1274 
1275   YYDPRINTF ((stderr, "Starting parse\n"));
1276 
1277   yystate = 0;
1278   yyerrstatus = 0;
1279   yynerrs = 0;
1280   yychar = YYEMPTY;		/* Cause a token to be read.  */
1281 
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.  */
1286 
1287   yyssp = yyss;
1288   yyvsp = yyvs;
1289 
1290   goto yysetstate;
1291 
1292 /*------------------------------------------------------------.
1293 | yynewstate -- Push a new state, which is found in yystate.  |
1294 `------------------------------------------------------------*/
1295  yynewstate:
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.  */
1298   yyssp++;
1299 
1300  yysetstate:
1301   *yyssp = yystate;
1302 
1303   if (yyss + yystacksize - 1 <= yyssp)
1304     {
1305       /* Get the current used size of the three stacks, in elements.  */
1306       YYSIZE_T yysize = yyssp - yyss + 1;
1307 
1308 #ifdef yyoverflow
1309       {
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
1312 	   memory.  */
1313 	YYSTYPE *yyvs1 = yyvs;
1314 	yytype_int16 *yyss1 = yyss;
1315 
1316 
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),
1324 
1325 		    &yystacksize);
1326 
1327 	yyss = yyss1;
1328 	yyvs = yyvs1;
1329       }
1330 #else /* no yyoverflow */
1331 # ifndef YYSTACK_RELOCATE
1332       goto yyexhaustedlab;
1333 # else
1334       /* Extend the stack our own way.  */
1335       if (YYMAXDEPTH <= yystacksize)
1336 	goto yyexhaustedlab;
1337       yystacksize *= 2;
1338       if (YYMAXDEPTH < yystacksize)
1339 	yystacksize = YYMAXDEPTH;
1340 
1341       {
1342 	yytype_int16 *yyss1 = yyss;
1343 	union yyalloc *yyptr =
1344 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1345 	if (! yyptr)
1346 	  goto yyexhaustedlab;
1347 	YYSTACK_RELOCATE (yyss);
1348 	YYSTACK_RELOCATE (yyvs);
1349 
1350 #  undef YYSTACK_RELOCATE
1351 	if (yyss1 != yyssa)
1352 	  YYSTACK_FREE (yyss1);
1353       }
1354 # endif
1355 #endif /* no yyoverflow */
1356 
1357       yyssp = yyss + yysize - 1;
1358       yyvsp = yyvs + yysize - 1;
1359 
1360 
1361       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1362 		  (unsigned long int) yystacksize));
1363 
1364       if (yyss + yystacksize - 1 <= yyssp)
1365 	YYABORT;
1366     }
1367 
1368   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1369 
1370   if (yystate == YYFINAL)
1371     YYACCEPT;
1372 
1373   goto yybackup;
1374 
1375 /*-----------.
1376 | yybackup.  |
1377 `-----------*/
1378 yybackup:
1379 
1380   /* Do appropriate processing given the current state.  Read a
1381      lookahead token if we need one and don't already have one.  */
1382 
1383   /* First try to decide what to do without reference to lookahead token.  */
1384   yyn = yypact[yystate];
1385   if (yyn == YYPACT_NINF)
1386     goto yydefault;
1387 
1388   /* Not known => get a lookahead token if don't already have one.  */
1389 
1390   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1391   if (yychar == YYEMPTY)
1392     {
1393       YYDPRINTF ((stderr, "Reading a token: "));
1394       yychar = YYLEX;
1395     }
1396 
1397   if (yychar <= YYEOF)
1398     {
1399       yychar = yytoken = YYEOF;
1400       YYDPRINTF ((stderr, "Now at end of input.\n"));
1401     }
1402   else
1403     {
1404       yytoken = YYTRANSLATE (yychar);
1405       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1406     }
1407 
1408   /* If the proper action on seeing token YYTOKEN is to reduce or to
1409      detect an error, take that action.  */
1410   yyn += yytoken;
1411   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1412     goto yydefault;
1413   yyn = yytable[yyn];
1414   if (yyn <= 0)
1415     {
1416       if (yyn == 0 || yyn == YYTABLE_NINF)
1417 	goto yyerrlab;
1418       yyn = -yyn;
1419       goto yyreduce;
1420     }
1421 
1422   /* Count tokens shifted since error; after three, turn off error
1423      status.  */
1424   if (yyerrstatus)
1425     yyerrstatus--;
1426 
1427   /* Shift the lookahead token.  */
1428   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1429 
1430   /* Discard the shifted token.  */
1431   yychar = YYEMPTY;
1432 
1433   yystate = yyn;
1434   *++yyvsp = yylval;
1435 
1436   goto yynewstate;
1437 
1438 
1439 /*-----------------------------------------------------------.
1440 | yydefault -- do the default action for the current state.  |
1441 `-----------------------------------------------------------*/
1442 yydefault:
1443   yyn = yydefact[yystate];
1444   if (yyn == 0)
1445     goto yyerrlab;
1446   goto yyreduce;
1447 
1448 
1449 /*-----------------------------.
1450 | yyreduce -- Do a reduction.  |
1451 `-----------------------------*/
1452 yyreduce:
1453   /* yyn is the number of a rule to reduce with.  */
1454   yylen = yyr2[yyn];
1455 
1456   /* If YYLEN is nonzero, implement the default value of the action:
1457      `$$ = $1'.
1458 
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];
1465 
1466 
1467   YY_REDUCE_PRINT (yyn);
1468   switch (yyn)
1469     {
1470         case 2:
1471 /* Line 1269 of yacc.c.  */
1472 #line 155 "plural.y"
1473     {
1474 	    if ((yyvsp[(1) - (1)].exp) == NULL)
1475 	      YYABORT;
1476 	    ((struct parse_args *) arg)->res = (yyvsp[(1) - (1)].exp);
1477 	  }
1478     break;
1479 
1480   case 3:
1481 /* Line 1269 of yacc.c.  */
1482 #line 163 "plural.y"
1483     {
1484 	    (yyval.exp) = new_exp_3 (qmop, (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp));
1485 	  }
1486     break;
1487 
1488   case 4:
1489 /* Line 1269 of yacc.c.  */
1490 #line 167 "plural.y"
1491     {
1492 	    (yyval.exp) = new_exp_2 (lor, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1493 	  }
1494     break;
1495 
1496   case 5:
1497 /* Line 1269 of yacc.c.  */
1498 #line 171 "plural.y"
1499     {
1500 	    (yyval.exp) = new_exp_2 (land, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1501 	  }
1502     break;
1503 
1504   case 6:
1505 /* Line 1269 of yacc.c.  */
1506 #line 175 "plural.y"
1507     {
1508 	    (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1509 	  }
1510     break;
1511 
1512   case 7:
1513 /* Line 1269 of yacc.c.  */
1514 #line 179 "plural.y"
1515     {
1516 	    (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1517 	  }
1518     break;
1519 
1520   case 8:
1521 /* Line 1269 of yacc.c.  */
1522 #line 183 "plural.y"
1523     {
1524 	    (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1525 	  }
1526     break;
1527 
1528   case 9:
1529 /* Line 1269 of yacc.c.  */
1530 #line 187 "plural.y"
1531     {
1532 	    (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1533 	  }
1534     break;
1535 
1536   case 10:
1537 /* Line 1269 of yacc.c.  */
1538 #line 191 "plural.y"
1539     {
1540 	    (yyval.exp) = new_exp_1 (lnot, (yyvsp[(2) - (2)].exp));
1541 	  }
1542     break;
1543 
1544   case 11:
1545 /* Line 1269 of yacc.c.  */
1546 #line 195 "plural.y"
1547     {
1548 	    (yyval.exp) = new_exp_0 (var);
1549 	  }
1550     break;
1551 
1552   case 12:
1553 /* Line 1269 of yacc.c.  */
1554 #line 199 "plural.y"
1555     {
1556 	    if (((yyval.exp) = new_exp_0 (num)) != NULL)
1557 	      (yyval.exp)->val.num = (yyvsp[(1) - (1)].num);
1558 	  }
1559     break;
1560 
1561   case 13:
1562 /* Line 1269 of yacc.c.  */
1563 #line 204 "plural.y"
1564     {
1565 	    (yyval.exp) = (yyvsp[(2) - (3)].exp);
1566 	  }
1567     break;
1568 
1569 
1570 /* Line 1269 of yacc.c.  */
1571 #line 1572 "plural.c"
1572       default: break;
1573     }
1574   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1575 
1576   YYPOPSTACK (yylen);
1577   yylen = 0;
1578   YY_STACK_PRINT (yyss, yyssp);
1579 
1580   *++yyvsp = yyval;
1581 
1582 
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.  */
1586 
1587   yyn = yyr1[yyn];
1588 
1589   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1590   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1591     yystate = yytable[yystate];
1592   else
1593     yystate = yydefgoto[yyn - YYNTOKENS];
1594 
1595   goto yynewstate;
1596 
1597 
1598 /*------------------------------------.
1599 | yyerrlab -- here on detecting error |
1600 `------------------------------------*/
1601 yyerrlab:
1602   /* If not already recovering from an error, report this error.  */
1603   if (!yyerrstatus)
1604     {
1605       ++yynerrs;
1606 #if ! YYERROR_VERBOSE
1607       yyerror (YY_("syntax error"));
1608 #else
1609       {
1610 	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1611 	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1612 	  {
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);
1619 	    if (yymsg)
1620 	      yymsg_alloc = yyalloc;
1621 	    else
1622 	      {
1623 		yymsg = yymsgbuf;
1624 		yymsg_alloc = sizeof yymsgbuf;
1625 	      }
1626 	  }
1627 
1628 	if (0 < yysize && yysize <= yymsg_alloc)
1629 	  {
1630 	    (void) yysyntax_error (yymsg, yystate, yychar);
1631 	    yyerror (yymsg);
1632 	  }
1633 	else
1634 	  {
1635 	    yyerror (YY_("syntax error"));
1636 	    if (yysize != 0)
1637 	      goto yyexhaustedlab;
1638 	  }
1639       }
1640 #endif
1641     }
1642 
1643 
1644 
1645   if (yyerrstatus == 3)
1646     {
1647       /* If just tried and failed to reuse lookahead token after an
1648 	 error, discard it.  */
1649 
1650       if (yychar <= YYEOF)
1651 	{
1652 	  /* Return failure if at end of input.  */
1653 	  if (yychar == YYEOF)
1654 	    YYABORT;
1655 	}
1656       else
1657 	{
1658 	  yydestruct ("Error: discarding",
1659 		      yytoken, &yylval);
1660 	  yychar = YYEMPTY;
1661 	}
1662     }
1663 
1664   /* Else will try to reuse lookahead token after shifting the error
1665      token.  */
1666   goto yyerrlab1;
1667 
1668 
1669 /*---------------------------------------------------.
1670 | yyerrorlab -- error raised explicitly by YYERROR.  |
1671 `---------------------------------------------------*/
1672 yyerrorlab:
1673 
1674   /* Pacify compilers like GCC when the user code never invokes
1675      YYERROR and the label yyerrorlab therefore never appears in user
1676      code.  */
1677   if (/*CONSTCOND*/ 0)
1678      goto yyerrorlab;
1679 
1680   /* Do not reclaim the symbols of the rule which action triggered
1681      this YYERROR.  */
1682   YYPOPSTACK (yylen);
1683   yylen = 0;
1684   YY_STACK_PRINT (yyss, yyssp);
1685   yystate = *yyssp;
1686   goto yyerrlab1;
1687 
1688 
1689 /*-------------------------------------------------------------.
1690 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1691 `-------------------------------------------------------------*/
1692 yyerrlab1:
1693   yyerrstatus = 3;	/* Each real token shifted decrements this.  */
1694 
1695   for (;;)
1696     {
1697       yyn = yypact[yystate];
1698       if (yyn != YYPACT_NINF)
1699 	{
1700 	  yyn += YYTERROR;
1701 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1702 	    {
1703 	      yyn = yytable[yyn];
1704 	      if (0 < yyn)
1705 		break;
1706 	    }
1707 	}
1708 
1709       /* Pop the current state because it cannot handle the error token.  */
1710       if (yyssp == yyss)
1711 	YYABORT;
1712 
1713 
1714       yydestruct ("Error: popping",
1715 		  yystos[yystate], yyvsp);
1716       YYPOPSTACK (1);
1717       yystate = *yyssp;
1718       YY_STACK_PRINT (yyss, yyssp);
1719     }
1720 
1721   *++yyvsp = yylval;
1722 
1723 
1724   /* Shift the error token.  */
1725   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1726 
1727   yystate = yyn;
1728   goto yynewstate;
1729 
1730 
1731 /*-------------------------------------.
1732 | yyacceptlab -- YYACCEPT comes here.  |
1733 `-------------------------------------*/
1734 yyacceptlab:
1735   yyresult = 0;
1736   goto yyreturn;
1737 
1738 /*-----------------------------------.
1739 | yyabortlab -- YYABORT comes here.  |
1740 `-----------------------------------*/
1741 yyabortlab:
1742   yyresult = 1;
1743   goto yyreturn;
1744 
1745 #ifndef yyoverflow
1746 /*-------------------------------------------------.
1747 | yyexhaustedlab -- memory exhaustion comes here.  |
1748 `-------------------------------------------------*/
1749 yyexhaustedlab:
1750   yyerror (YY_("memory exhausted"));
1751   yyresult = 2;
1752   /* Fall through.  */
1753 #endif
1754 
1755 yyreturn:
1756   if (yychar != YYEMPTY)
1757      yydestruct ("Cleanup: discarding lookahead",
1758 		 yytoken, &yylval);
1759   /* Do not reclaim the symbols of the rule which action triggered
1760      this YYABORT or YYACCEPT.  */
1761   YYPOPSTACK (yylen);
1762   YY_STACK_PRINT (yyss, yyssp);
1763   while (yyssp != yyss)
1764     {
1765       yydestruct ("Cleanup: popping",
1766 		  yystos[*yyssp], yyvsp);
1767       YYPOPSTACK (1);
1768     }
1769 #ifndef yyoverflow
1770   if (yyss != yyssa)
1771     YYSTACK_FREE (yyss);
1772 #endif
1773 #if YYERROR_VERBOSE
1774   if (yymsg != yymsgbuf)
1775     YYSTACK_FREE (yymsg);
1776 #endif
1777   /* Make sure YYID is used.  */
1778   return YYID (yyresult);
1779 }
1780 
1781 
1782 /* Line 1486 of yacc.c.  */
1783 #line 209 "plural.y"
1784 
1785 
1786 void
1787 internal_function
FREE_EXPRESSION(struct expression * exp)1788 FREE_EXPRESSION (struct expression *exp)
1789 {
1790   if (exp == NULL)
1791     return;
1792 
1793   /* Handle the recursive case.  */
1794   switch (exp->nargs)
1795     {
1796     case 3:
1797       FREE_EXPRESSION (exp->val.args[2]);
1798       /* FALLTHROUGH */
1799     case 2:
1800       FREE_EXPRESSION (exp->val.args[1]);
1801       /* FALLTHROUGH */
1802     case 1:
1803       FREE_EXPRESSION (exp->val.args[0]);
1804       /* FALLTHROUGH */
1805     default:
1806       break;
1807     }
1808 
1809   free (exp);
1810 }
1811 
1812 
1813 static int
yylex(YYSTYPE * lval,const char ** pexp)1814 yylex (YYSTYPE *lval, const char **pexp)
1815 {
1816   const char *exp = *pexp;
1817   int result;
1818 
1819   while (1)
1820     {
1821       if (exp[0] == '\0')
1822 	{
1823 	  *pexp = exp;
1824 	  return YYEOF;
1825 	}
1826 
1827       if (exp[0] != ' ' && exp[0] != '\t')
1828 	break;
1829 
1830       ++exp;
1831     }
1832 
1833   result = *exp++;
1834   switch (result)
1835     {
1836     case '0': case '1': case '2': case '3': case '4':
1837     case '5': case '6': case '7': case '8': case '9':
1838       {
1839 	unsigned long int n = result - '0';
1840 	while (exp[0] >= '0' && exp[0] <= '9')
1841 	  {
1842 	    n *= 10;
1843 	    n += exp[0] - '0';
1844 	    ++exp;
1845 	  }
1846 	lval->num = n;
1847 	result = NUMBER;
1848       }
1849       break;
1850 
1851     case '=':
1852       if (exp[0] == '=')
1853 	{
1854 	  ++exp;
1855 	  lval->op = equal;
1856 	  result = EQUOP2;
1857 	}
1858       else
1859 	result = YYERRCODE;
1860       break;
1861 
1862     case '!':
1863       if (exp[0] == '=')
1864 	{
1865 	  ++exp;
1866 	  lval->op = not_equal;
1867 	  result = EQUOP2;
1868 	}
1869       break;
1870 
1871     case '&':
1872     case '|':
1873       if (exp[0] == result)
1874 	++exp;
1875       else
1876 	result = YYERRCODE;
1877       break;
1878 
1879     case '<':
1880       if (exp[0] == '=')
1881 	{
1882 	  ++exp;
1883 	  lval->op = less_or_equal;
1884 	}
1885       else
1886 	lval->op = less_than;
1887       result = CMPOP2;
1888       break;
1889 
1890     case '>':
1891       if (exp[0] == '=')
1892 	{
1893 	  ++exp;
1894 	  lval->op = greater_or_equal;
1895 	}
1896       else
1897 	lval->op = greater_than;
1898       result = CMPOP2;
1899       break;
1900 
1901     case '*':
1902       lval->op = mult;
1903       result = MULOP2;
1904       break;
1905 
1906     case '/':
1907       lval->op = divide;
1908       result = MULOP2;
1909       break;
1910 
1911     case '%':
1912       lval->op = module;
1913       result = MULOP2;
1914       break;
1915 
1916     case '+':
1917       lval->op = plus;
1918       result = ADDOP2;
1919       break;
1920 
1921     case '-':
1922       lval->op = minus;
1923       result = ADDOP2;
1924       break;
1925 
1926     case 'n':
1927     case '?':
1928     case ':':
1929     case '(':
1930     case ')':
1931       /* Nothing, just return the character.  */
1932       break;
1933 
1934     case ';':
1935     case '\n':
1936     case '\0':
1937       /* Be safe and let the user call this function again.  */
1938       --exp;
1939       result = YYEOF;
1940       break;
1941 
1942     default:
1943       result = YYERRCODE;
1944 #if YYDEBUG != 0
1945       --exp;
1946 #endif
1947       break;
1948     }
1949 
1950   *pexp = exp;
1951 
1952   return result;
1953 }
1954 
1955 
1956 static void
yyerror(const char * str)1957 yyerror (const char *str)
1958 {
1959   /* Do nothing.  We don't print error messages here.  */
1960 }
1961 
1962