~ubuntu-branches/ubuntu/natty/gsetroot/natty

« back to all changes in this revision

Viewing changes to intl/plural.c

  • Committer: Bazaar Package Importer
  • Author(s): William Vera
  • Date: 2005-07-05 21:55:03 UTC
  • Revision ID: james.westby@ubuntu.com-20050705215503-0s535srcoqdz1n9v
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* A Bison parser, made by GNU Bison 1.875d.  */
 
2
 
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
 
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
5
 
 
6
   This program is free software; you can redistribute it and/or modify
 
7
   it under the terms of the GNU General Public License as published by
 
8
   the Free Software Foundation; either version 2, or (at your option)
 
9
   any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
   GNU General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU General Public License
 
17
   along with this program; if not, write to the Free Software
 
18
   Foundation, Inc., 59 Temple Place - Suite 330,
 
19
   Boston, MA 02111-1307, USA.  */
 
20
 
 
21
/* As a special exception, when this file is copied by Bison into a
 
22
   Bison output file, you may use that output file without restriction.
 
23
   This special exception was added by the Free Software Foundation
 
24
   in version 1.24 of Bison.  */
 
25
 
 
26
/* Written by Richard Stallman by simplifying the original so called
 
27
   ``semantic'' parser.  */
 
28
 
 
29
/* All symbols defined below should begin with yy or YY, to avoid
 
30
   infringing on user name space.  This should be done even for local
 
31
   variables, as they might otherwise be expanded by user macros.
 
32
   There are some unavoidable exceptions within include files to
 
33
   define necessary library symbols; they are noted "INFRINGES ON
 
34
   USER NAME SPACE" below.  */
 
35
 
 
36
/* Identify Bison output.  */
 
37
#define YYBISON 1
 
38
 
 
39
/* Skeleton name.  */
 
40
#define YYSKELETON_NAME "yacc.c"
 
41
 
 
42
/* Pure parsers.  */
 
43
#define YYPURE 1
 
44
 
 
45
/* Using locations.  */
 
46
#define YYLSP_NEEDED 0
 
47
 
 
48
/* If NAME_PREFIX is specified substitute the variables and functions
 
49
   names.  */
 
50
#define yyparse __gettextparse
 
51
#define yylex   __gettextlex
 
52
#define yyerror __gettexterror
 
53
#define yylval  __gettextlval
 
54
#define yychar  __gettextchar
 
55
#define yydebug __gettextdebug
 
56
#define yynerrs __gettextnerrs
 
57
 
 
58
 
 
59
/* Tokens.  */
 
60
#ifndef YYTOKENTYPE
 
61
# define YYTOKENTYPE
 
62
   /* Put the tokens into the symbol table, so that GDB and other debuggers
 
63
      know about them.  */
 
64
   enum yytokentype {
 
65
     EQUOP2 = 258,
 
66
     CMPOP2 = 259,
 
67
     ADDOP2 = 260,
 
68
     MULOP2 = 261,
 
69
     NUMBER = 262
 
70
   };
 
71
#endif
 
72
#define EQUOP2 258
 
73
#define CMPOP2 259
 
74
#define ADDOP2 260
 
75
#define MULOP2 261
 
76
#define NUMBER 262
 
77
 
 
78
 
 
79
 
 
80
 
 
81
/* Copy the first part of user declarations.  */
 
82
#line 1 "plural.y"
 
83
 
 
84
/* Expression parsing for plural form selection.
 
85
   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
 
86
   Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
87
 
 
88
   This program is free software; you can redistribute it and/or modify it
 
89
   under the terms of the GNU Library General Public License as published
 
90
   by the Free Software Foundation; either version 2, or (at your option)
 
91
   any later version.
 
92
 
 
93
   This program is distributed in the hope that it will be useful,
 
94
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
95
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
96
   Library General Public License for more details.
 
97
 
 
98
   You should have received a copy of the GNU Library General Public
 
99
   License along with this program; if not, write to the Free Software
 
100
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
101
   USA.  */
 
102
 
 
103
/* The bison generated parser uses alloca.  AIX 3 forces us to put this
 
104
   declaration at the beginning of the file.  The declaration in bison's
 
105
   skeleton file comes too late.  This must come before <config.h>
 
106
   because <config.h> may include arbitrary system headers.  */
 
107
#if defined _AIX && !defined __GNUC__
 
108
 #pragma alloca
 
109
#endif
 
110
 
 
111
#ifdef HAVE_CONFIG_H
 
112
# include <config.h>
 
113
#endif
 
114
 
 
115
#include <stdlib.h>
 
116
#include "gettextP.h"
 
117
 
 
118
/* Names for the libintl functions are a problem.  They must not clash
 
119
   with existing names and they should follow ANSI C.  But this source
 
120
   code is also used in GNU C Library where the names have a __
 
121
   prefix.  So we have to make a difference here.  */
 
122
#ifdef _LIBC
 
123
# define FREE_EXPRESSION __gettext_free_exp
 
124
#else
 
125
# define FREE_EXPRESSION gettext_free_exp__
 
126
# define __gettextparse gettextparse__
 
127
#endif
 
128
 
 
129
#define YYLEX_PARAM     &((struct parse_args *) arg)->cp
 
130
#define YYPARSE_PARAM   arg
 
131
 
 
132
 
 
133
/* Enabling traces.  */
 
134
#ifndef YYDEBUG
 
135
# define YYDEBUG 0
 
136
#endif
 
137
 
 
138
/* Enabling verbose error messages.  */
 
139
#ifdef YYERROR_VERBOSE
 
140
# undef YYERROR_VERBOSE
 
141
# define YYERROR_VERBOSE 1
 
142
#else
 
143
# define YYERROR_VERBOSE 0
 
144
#endif
 
145
 
 
146
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 
147
#line 53 "plural.y"
 
148
typedef union YYSTYPE {
 
149
  unsigned long int num;
 
150
  enum operator op;
 
151
  struct expression *exp;
 
152
} YYSTYPE;
 
153
/* Line 191 of yacc.c.  */
 
154
#line 155 "plural.c"
 
155
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 
156
# define YYSTYPE_IS_DECLARED 1
 
157
# define YYSTYPE_IS_TRIVIAL 1
 
158
#endif
 
159
 
 
160
 
 
161
 
 
162
/* Copy the second part of user declarations.  */
 
163
#line 59 "plural.y"
 
164
 
 
165
/* Prototypes for local functions.  */
 
166
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
 
167
                                           struct expression * const *args));
 
168
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
 
169
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
 
170
                                                   struct expression *right));
 
171
static struct expression *new_exp_2 PARAMS ((enum operator op,
 
172
                                             struct expression *left,
 
173
                                             struct expression *right));
 
174
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
 
175
                                                   struct expression *bexp,
 
176
                                                   struct expression *tbranch,
 
177
                                                   struct expression *fbranch));
 
178
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
 
179
static void yyerror PARAMS ((const char *str));
 
180
 
 
181
/* Allocation of expressions.  */
 
182
 
 
183
static struct expression *
 
184
new_exp (nargs, op, args)
 
185
     int nargs;
 
186
     enum operator op;
 
187
     struct expression * const *args;
 
188
{
 
189
  int i;
 
190
  struct expression *newp;
 
191
 
 
192
  /* If any of the argument could not be malloc'ed, just return NULL.  */
 
193
  for (i = nargs - 1; i >= 0; i--)
 
194
    if (args[i] == NULL)
 
195
      goto fail;
 
196
 
 
197
  /* Allocate a new expression.  */
 
198
  newp = (struct expression *) malloc (sizeof (*newp));
 
199
  if (newp != NULL)
 
200
    {
 
201
      newp->nargs = nargs;
 
202
      newp->operation = op;
 
203
      for (i = nargs - 1; i >= 0; i--)
 
204
        newp->val.args[i] = args[i];
 
205
      return newp;
 
206
    }
 
207
 
 
208
 fail:
 
209
  for (i = nargs - 1; i >= 0; i--)
 
210
    FREE_EXPRESSION (args[i]);
 
211
 
 
212
  return NULL;
 
213
}
 
214
 
 
215
static inline struct expression *
 
216
new_exp_0 (op)
 
217
     enum operator op;
 
218
{
 
219
  return new_exp (0, op, NULL);
 
220
}
 
221
 
 
222
static inline struct expression *
 
223
new_exp_1 (op, right)
 
224
     enum operator op;
 
225
     struct expression *right;
 
226
{
 
227
  struct expression *args[1];
 
228
 
 
229
  args[0] = right;
 
230
  return new_exp (1, op, args);
 
231
}
 
232
 
 
233
static struct expression *
 
234
new_exp_2 (op, left, right)
 
235
     enum operator op;
 
236
     struct expression *left;
 
237
     struct expression *right;
 
238
{
 
239
  struct expression *args[2];
 
240
 
 
241
  args[0] = left;
 
242
  args[1] = right;
 
243
  return new_exp (2, op, args);
 
244
}
 
245
 
 
246
static inline struct expression *
 
247
new_exp_3 (op, bexp, tbranch, fbranch)
 
248
     enum operator op;
 
249
     struct expression *bexp;
 
250
     struct expression *tbranch;
 
251
     struct expression *fbranch;
 
252
{
 
253
  struct expression *args[3];
 
254
 
 
255
  args[0] = bexp;
 
256
  args[1] = tbranch;
 
257
  args[2] = fbranch;
 
258
  return new_exp (3, op, args);
 
259
}
 
260
 
 
261
 
 
262
 
 
263
/* Line 214 of yacc.c.  */
 
264
#line 265 "plural.c"
 
265
 
 
266
#if ! defined (yyoverflow) || YYERROR_VERBOSE
 
267
 
 
268
# ifndef YYFREE
 
269
#  define YYFREE free
 
270
# endif
 
271
# ifndef YYMALLOC
 
272
#  define YYMALLOC malloc
 
273
# endif
 
274
 
 
275
/* The parser invokes alloca or malloc; define the necessary symbols.  */
 
276
 
 
277
# ifdef YYSTACK_USE_ALLOCA
 
278
#  if YYSTACK_USE_ALLOCA
 
279
#   define YYSTACK_ALLOC alloca
 
280
#  endif
 
281
# else
 
282
#  if defined (alloca) || defined (_ALLOCA_H)
 
283
#   define YYSTACK_ALLOC alloca
 
284
#  else
 
285
#   ifdef __GNUC__
 
286
#    define YYSTACK_ALLOC __builtin_alloca
 
287
#   endif
 
288
#  endif
 
289
# endif
 
290
 
 
291
# ifdef YYSTACK_ALLOC
 
292
   /* Pacify GCC's `empty if-body' warning. */
 
293
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 
294
# else
 
295
#  if defined (__STDC__) || defined (__cplusplus)
 
296
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 
297
#   define YYSIZE_T size_t
 
298
#  endif
 
299
#  define YYSTACK_ALLOC YYMALLOC
 
300
#  define YYSTACK_FREE YYFREE
 
301
# endif
 
302
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
303
 
 
304
 
 
305
#if (! defined (yyoverflow) \
 
306
     && (! defined (__cplusplus) \
 
307
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
 
308
 
 
309
/* A type that is properly aligned for any stack member.  */
 
310
union yyalloc
 
311
{
 
312
  short int yyss;
 
313
  YYSTYPE yyvs;
 
314
  };
 
315
 
 
316
/* The size of the maximum gap between one aligned stack and the next.  */
 
317
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
 
318
 
 
319
/* The size of an array large to enough to hold all stacks, each with
 
320
   N elements.  */
 
321
# define YYSTACK_BYTES(N) \
 
322
     ((N) * (sizeof (short int) + sizeof (YYSTYPE))                     \
 
323
      + YYSTACK_GAP_MAXIMUM)
 
324
 
 
325
/* Copy COUNT objects from FROM to TO.  The source and destination do
 
326
   not overlap.  */
 
327
# ifndef YYCOPY
 
328
#  if defined (__GNUC__) && 1 < __GNUC__
 
329
#   define YYCOPY(To, From, Count) \
 
330
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 
331
#  else
 
332
#   define YYCOPY(To, From, Count)              \
 
333
      do                                        \
 
334
        {                                       \
 
335
          register YYSIZE_T yyi;                \
 
336
          for (yyi = 0; yyi < (Count); yyi++)   \
 
337
            (To)[yyi] = (From)[yyi];            \
 
338
        }                                       \
 
339
      while (0)
 
340
#  endif
 
341
# endif
 
342
 
 
343
/* Relocate STACK from its old location to the new one.  The
 
344
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
 
345
   elements in the stack, and YYPTR gives the new location of the
 
346
   stack.  Advance YYPTR to a properly aligned location for the next
 
347
   stack.  */
 
348
# define YYSTACK_RELOCATE(Stack)                                        \
 
349
    do                                                                  \
 
350
      {                                                                 \
 
351
        YYSIZE_T yynewbytes;                                            \
 
352
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
 
353
        Stack = &yyptr->Stack;                                          \
 
354
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 
355
        yyptr += yynewbytes / sizeof (*yyptr);                          \
 
356
      }                                                                 \
 
357
    while (0)
 
358
 
 
359
#endif
 
360
 
 
361
#if defined (__STDC__) || defined (__cplusplus)
 
362
   typedef signed char yysigned_char;
 
363
#else
 
364
   typedef short int yysigned_char;
 
365
#endif
 
366
 
 
367
/* YYFINAL -- State number of the termination state. */
 
368
#define YYFINAL  9
 
369
/* YYLAST -- Last index in YYTABLE.  */
 
370
#define YYLAST   54
 
371
 
 
372
/* YYNTOKENS -- Number of terminals. */
 
373
#define YYNTOKENS  16
 
374
/* YYNNTS -- Number of nonterminals. */
 
375
#define YYNNTS  3
 
376
/* YYNRULES -- Number of rules. */
 
377
#define YYNRULES  13
 
378
/* YYNRULES -- Number of states. */
 
379
#define YYNSTATES  27
 
380
 
 
381
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 
382
#define YYUNDEFTOK  2
 
383
#define YYMAXUTOK   262
 
384
 
 
385
#define YYTRANSLATE(YYX)                                                \
 
386
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
387
 
 
388
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
 
389
static const unsigned char yytranslate[] =
 
390
{
 
391
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
392
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
393
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
394
       2,     2,     2,    10,     2,     2,     2,     2,     5,     2,
 
395
      14,    15,     2,     2,     2,     2,     2,     2,     2,     2,
 
396
       2,     2,     2,     2,     2,     2,     2,     2,    12,     2,
 
397
       2,     2,     2,     3,     2,     2,     2,     2,     2,     2,
 
398
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
399
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
400
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
401
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
402
      13,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
403
       2,     2,     2,     2,     4,     2,     2,     2,     2,     2,
 
404
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
405
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
406
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
407
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
408
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
409
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
410
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
411
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
412
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
413
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
414
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
415
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
416
       2,     2,     2,     2,     2,     2,     1,     2,     6,     7,
 
417
       8,     9,    11
 
418
};
 
419
 
 
420
#if YYDEBUG
 
421
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
 
422
   YYRHS.  */
 
423
static const unsigned char yyprhs[] =
 
424
{
 
425
       0,     0,     3,     5,    11,    15,    19,    23,    27,    31,
 
426
      35,    38,    40,    42
 
427
};
 
428
 
 
429
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
 
430
static const yysigned_char yyrhs[] =
 
431
{
 
432
      17,     0,    -1,    18,    -1,    18,     3,    18,    12,    18,
 
433
      -1,    18,     4,    18,    -1,    18,     5,    18,    -1,    18,
 
434
       6,    18,    -1,    18,     7,    18,    -1,    18,     8,    18,
 
435
      -1,    18,     9,    18,    -1,    10,    18,    -1,    13,    -1,
 
436
      11,    -1,    14,    18,    15,    -1
 
437
};
 
438
 
 
439
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 
440
static const unsigned char yyrline[] =
 
441
{
 
442
       0,   178,   178,   186,   190,   194,   198,   202,   206,   210,
 
443
     214,   218,   222,   227
 
444
};
 
445
#endif
 
446
 
 
447
#if YYDEBUG || YYERROR_VERBOSE
 
448
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
 
449
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
 
450
static const char *const yytname[] =
 
451
{
 
452
  "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
 
453
  "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
 
454
  "$accept", "start", "exp", 0
 
455
};
 
456
#endif
 
457
 
 
458
# ifdef YYPRINT
 
459
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
 
460
   token YYLEX-NUM.  */
 
461
static const unsigned short int yytoknum[] =
 
462
{
 
463
       0,   256,   257,    63,   124,    38,   258,   259,   260,   261,
 
464
      33,   262,    58,   110,    40,    41
 
465
};
 
466
# endif
 
467
 
 
468
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 
469
static const unsigned char yyr1[] =
 
470
{
 
471
       0,    16,    17,    18,    18,    18,    18,    18,    18,    18,
 
472
      18,    18,    18,    18
 
473
};
 
474
 
 
475
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 
476
static const unsigned char yyr2[] =
 
477
{
 
478
       0,     2,     1,     5,     3,     3,     3,     3,     3,     3,
 
479
       2,     1,     1,     3
 
480
};
 
481
 
 
482
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
 
483
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
 
484
   means the default is an error.  */
 
485
static const unsigned char yydefact[] =
 
486
{
 
487
       0,     0,    12,    11,     0,     0,     2,    10,     0,     1,
 
488
       0,     0,     0,     0,     0,     0,     0,    13,     0,     4,
 
489
       5,     6,     7,     8,     9,     0,     3
 
490
};
 
491
 
 
492
/* YYDEFGOTO[NTERM-NUM]. */
 
493
static const yysigned_char yydefgoto[] =
 
494
{
 
495
      -1,     5,     6
 
496
};
 
497
 
 
498
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
 
499
   STATE-NUM.  */
 
500
#define YYPACT_NINF -10
 
501
static const yysigned_char yypact[] =
 
502
{
 
503
      -9,    -9,   -10,   -10,    -9,     8,    36,   -10,    13,   -10,
 
504
      -9,    -9,    -9,    -9,    -9,    -9,    -9,   -10,    26,    41,
 
505
      45,    18,    -2,    14,   -10,    -9,    36
 
506
};
 
507
 
 
508
/* YYPGOTO[NTERM-NUM].  */
 
509
static const yysigned_char yypgoto[] =
 
510
{
 
511
     -10,   -10,    -1
 
512
};
 
513
 
 
514
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
 
515
   positive, shift that token.  If negative, reduce the rule which
 
516
   number is the opposite.  If zero, do what YYDEFACT says.
 
517
   If YYTABLE_NINF, syntax error.  */
 
518
#define YYTABLE_NINF -1
 
519
static const unsigned char yytable[] =
 
520
{
 
521
       7,     1,     2,     8,     3,     4,    15,    16,     9,    18,
 
522
      19,    20,    21,    22,    23,    24,    10,    11,    12,    13,
 
523
      14,    15,    16,    16,    26,    14,    15,    16,    17,    10,
 
524
      11,    12,    13,    14,    15,    16,     0,     0,    25,    10,
 
525
      11,    12,    13,    14,    15,    16,    12,    13,    14,    15,
 
526
      16,    13,    14,    15,    16
 
527
};
 
528
 
 
529
static const yysigned_char yycheck[] =
 
530
{
 
531
       1,    10,    11,     4,    13,    14,     8,     9,     0,    10,
 
532
      11,    12,    13,    14,    15,    16,     3,     4,     5,     6,
 
533
       7,     8,     9,     9,    25,     7,     8,     9,    15,     3,
 
534
       4,     5,     6,     7,     8,     9,    -1,    -1,    12,     3,
 
535
       4,     5,     6,     7,     8,     9,     5,     6,     7,     8,
 
536
       9,     6,     7,     8,     9
 
537
};
 
538
 
 
539
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
 
540
   symbol of state STATE-NUM.  */
 
541
static const unsigned char yystos[] =
 
542
{
 
543
       0,    10,    11,    13,    14,    17,    18,    18,    18,     0,
 
544
       3,     4,     5,     6,     7,     8,     9,    15,    18,    18,
 
545
      18,    18,    18,    18,    18,    12,    18
 
546
};
 
547
 
 
548
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 
549
# define YYSIZE_T __SIZE_TYPE__
 
550
#endif
 
551
#if ! defined (YYSIZE_T) && defined (size_t)
 
552
# define YYSIZE_T size_t
 
553
#endif
 
554
#if ! defined (YYSIZE_T)
 
555
# if defined (__STDC__) || defined (__cplusplus)
 
556
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 
557
#  define YYSIZE_T size_t
 
558
# endif
 
559
#endif
 
560
#if ! defined (YYSIZE_T)
 
561
# define YYSIZE_T unsigned int
 
562
#endif
 
563
 
 
564
#define yyerrok         (yyerrstatus = 0)
 
565
#define yyclearin       (yychar = YYEMPTY)
 
566
#define YYEMPTY         (-2)
 
567
#define YYEOF           0
 
568
 
 
569
#define YYACCEPT        goto yyacceptlab
 
570
#define YYABORT         goto yyabortlab
 
571
#define YYERROR         goto yyerrorlab
 
572
 
 
573
 
 
574
/* Like YYERROR except do call yyerror.  This remains here temporarily
 
575
   to ease the transition to the new meaning of YYERROR, for GCC.
 
576
   Once GCC version 2 has supplanted version 1, this can go.  */
 
577
 
 
578
#define YYFAIL          goto yyerrlab
 
579
 
 
580
#define YYRECOVERING()  (!!yyerrstatus)
 
581
 
 
582
#define YYBACKUP(Token, Value)                                  \
 
583
do                                                              \
 
584
  if (yychar == YYEMPTY && yylen == 1)                          \
 
585
    {                                                           \
 
586
      yychar = (Token);                                         \
 
587
      yylval = (Value);                                         \
 
588
      yytoken = YYTRANSLATE (yychar);                           \
 
589
      YYPOPSTACK;                                               \
 
590
      goto yybackup;                                            \
 
591
    }                                                           \
 
592
  else                                                          \
 
593
    {                                                           \
 
594
      yyerror ("syntax error: cannot back up");\
 
595
      YYERROR;                                                  \
 
596
    }                                                           \
 
597
while (0)
 
598
 
 
599
#define YYTERROR        1
 
600
#define YYERRCODE       256
 
601
 
 
602
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
 
603
   are run).  */
 
604
 
 
605
#ifndef YYLLOC_DEFAULT
 
606
# define YYLLOC_DEFAULT(Current, Rhs, N)                \
 
607
   ((Current).first_line   = (Rhs)[1].first_line,       \
 
608
    (Current).first_column = (Rhs)[1].first_column,     \
 
609
    (Current).last_line    = (Rhs)[N].last_line,        \
 
610
    (Current).last_column  = (Rhs)[N].last_column)
 
611
#endif
 
612
 
 
613
/* YYLEX -- calling `yylex' with the right arguments.  */
 
614
 
 
615
#ifdef YYLEX_PARAM
 
616
# define YYLEX yylex (&yylval, YYLEX_PARAM)
 
617
#else
 
618
# define YYLEX yylex (&yylval)
 
619
#endif
 
620
 
 
621
/* Enable debugging if requested.  */
 
622
#if YYDEBUG
 
623
 
 
624
# ifndef YYFPRINTF
 
625
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
 
626
#  define YYFPRINTF fprintf
 
627
# endif
 
628
 
 
629
# define YYDPRINTF(Args)                        \
 
630
do {                                            \
 
631
  if (yydebug)                                  \
 
632
    YYFPRINTF Args;                             \
 
633
} while (0)
 
634
 
 
635
# define YYDSYMPRINT(Args)                      \
 
636
do {                                            \
 
637
  if (yydebug)                                  \
 
638
    yysymprint Args;                            \
 
639
} while (0)
 
640
 
 
641
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
 
642
do {                                                            \
 
643
  if (yydebug)                                                  \
 
644
    {                                                           \
 
645
      YYFPRINTF (stderr, "%s ", Title);                         \
 
646
      yysymprint (stderr,                                       \
 
647
                  Token, Value);        \
 
648
      YYFPRINTF (stderr, "\n");                                 \
 
649
    }                                                           \
 
650
} while (0)
 
651
 
 
652
/*------------------------------------------------------------------.
 
653
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
 
654
| TOP (included).                                                   |
 
655
`------------------------------------------------------------------*/
 
656
 
 
657
#if defined (__STDC__) || defined (__cplusplus)
 
658
static void
 
659
yy_stack_print (short int *bottom, short int *top)
 
660
#else
 
661
static void
 
662
yy_stack_print (bottom, top)
 
663
    short int *bottom;
 
664
    short int *top;
 
665
#endif
 
666
{
 
667
  YYFPRINTF (stderr, "Stack now");
 
668
  for (/* Nothing. */; bottom <= top; ++bottom)
 
669
    YYFPRINTF (stderr, " %d", *bottom);
 
670
  YYFPRINTF (stderr, "\n");
 
671
}
 
672
 
 
673
# define YY_STACK_PRINT(Bottom, Top)                            \
 
674
do {                                                            \
 
675
  if (yydebug)                                                  \
 
676
    yy_stack_print ((Bottom), (Top));                           \
 
677
} while (0)
 
678
 
 
679
 
 
680
/*------------------------------------------------.
 
681
| Report that the YYRULE is going to be reduced.  |
 
682
`------------------------------------------------*/
 
683
 
 
684
#if defined (__STDC__) || defined (__cplusplus)
 
685
static void
 
686
yy_reduce_print (int yyrule)
 
687
#else
 
688
static void
 
689
yy_reduce_print (yyrule)
 
690
    int yyrule;
 
691
#endif
 
692
{
 
693
  int yyi;
 
694
  unsigned int yylno = yyrline[yyrule];
 
695
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
 
696
             yyrule - 1, yylno);
 
697
  /* Print the symbols being reduced, and their result.  */
 
698
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
 
699
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
 
700
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
 
701
}
 
702
 
 
703
# define YY_REDUCE_PRINT(Rule)          \
 
704
do {                                    \
 
705
  if (yydebug)                          \
 
706
    yy_reduce_print (Rule);             \
 
707
} while (0)
 
708
 
 
709
/* Nonzero means print parse trace.  It is left uninitialized so that
 
710
   multiple parsers can coexist.  */
 
711
int yydebug;
 
712
#else /* !YYDEBUG */
 
713
# define YYDPRINTF(Args)
 
714
# define YYDSYMPRINT(Args)
 
715
# define YYDSYMPRINTF(Title, Token, Value, Location)
 
716
# define YY_STACK_PRINT(Bottom, Top)
 
717
# define YY_REDUCE_PRINT(Rule)
 
718
#endif /* !YYDEBUG */
 
719
 
 
720
 
 
721
/* YYINITDEPTH -- initial size of the parser's stacks.  */
 
722
#ifndef YYINITDEPTH
 
723
# define YYINITDEPTH 200
 
724
#endif
 
725
 
 
726
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
 
727
   if the built-in stack extension method is used).
 
728
 
 
729
   Do not make this value too large; the results are undefined if
 
730
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
 
731
   evaluated with infinite-precision integer arithmetic.  */
 
732
 
 
733
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
 
734
# undef YYMAXDEPTH
 
735
#endif
 
736
 
 
737
#ifndef YYMAXDEPTH
 
738
# define YYMAXDEPTH 10000
 
739
#endif
 
740
 
 
741
 
 
742
 
 
743
#if YYERROR_VERBOSE
 
744
 
 
745
# ifndef yystrlen
 
746
#  if defined (__GLIBC__) && defined (_STRING_H)
 
747
#   define yystrlen strlen
 
748
#  else
 
749
/* Return the length of YYSTR.  */
 
750
static YYSIZE_T
 
751
#   if defined (__STDC__) || defined (__cplusplus)
 
752
yystrlen (const char *yystr)
 
753
#   else
 
754
yystrlen (yystr)
 
755
     const char *yystr;
 
756
#   endif
 
757
{
 
758
  register const char *yys = yystr;
 
759
 
 
760
  while (*yys++ != '\0')
 
761
    continue;
 
762
 
 
763
  return yys - yystr - 1;
 
764
}
 
765
#  endif
 
766
# endif
 
767
 
 
768
# ifndef yystpcpy
 
769
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
 
770
#   define yystpcpy stpcpy
 
771
#  else
 
772
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
 
773
   YYDEST.  */
 
774
static char *
 
775
#   if defined (__STDC__) || defined (__cplusplus)
 
776
yystpcpy (char *yydest, const char *yysrc)
 
777
#   else
 
778
yystpcpy (yydest, yysrc)
 
779
     char *yydest;
 
780
     const char *yysrc;
 
781
#   endif
 
782
{
 
783
  register char *yyd = yydest;
 
784
  register const char *yys = yysrc;
 
785
 
 
786
  while ((*yyd++ = *yys++) != '\0')
 
787
    continue;
 
788
 
 
789
  return yyd - 1;
 
790
}
 
791
#  endif
 
792
# endif
 
793
 
 
794
#endif /* !YYERROR_VERBOSE */
 
795
 
 
796
 
 
797
 
 
798
#if YYDEBUG
 
799
/*--------------------------------.
 
800
| Print this symbol on YYOUTPUT.  |
 
801
`--------------------------------*/
 
802
 
 
803
#if defined (__STDC__) || defined (__cplusplus)
 
804
static void
 
805
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
 
806
#else
 
807
static void
 
808
yysymprint (yyoutput, yytype, yyvaluep)
 
809
    FILE *yyoutput;
 
810
    int yytype;
 
811
    YYSTYPE *yyvaluep;
 
812
#endif
 
813
{
 
814
  /* Pacify ``unused variable'' warnings.  */
 
815
  (void) yyvaluep;
 
816
 
 
817
  if (yytype < YYNTOKENS)
 
818
    {
 
819
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
 
820
# ifdef YYPRINT
 
821
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
 
822
# endif
 
823
    }
 
824
  else
 
825
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
 
826
 
 
827
  switch (yytype)
 
828
    {
 
829
      default:
 
830
        break;
 
831
    }
 
832
  YYFPRINTF (yyoutput, ")");
 
833
}
 
834
 
 
835
#endif /* ! YYDEBUG */
 
836
/*-----------------------------------------------.
 
837
| Release the memory associated to this symbol.  |
 
838
`-----------------------------------------------*/
 
839
 
 
840
#if defined (__STDC__) || defined (__cplusplus)
 
841
static void
 
842
yydestruct (int yytype, YYSTYPE *yyvaluep)
 
843
#else
 
844
static void
 
845
yydestruct (yytype, yyvaluep)
 
846
    int yytype;
 
847
    YYSTYPE *yyvaluep;
 
848
#endif
 
849
{
 
850
  /* Pacify ``unused variable'' warnings.  */
 
851
  (void) yyvaluep;
 
852
 
 
853
  switch (yytype)
 
854
    {
 
855
 
 
856
      default:
 
857
        break;
 
858
    }
 
859
}
 
860
 
 
861
 
 
862
/* Prevent warnings from -Wmissing-prototypes.  */
 
863
 
 
864
#ifdef YYPARSE_PARAM
 
865
# if defined (__STDC__) || defined (__cplusplus)
 
866
int yyparse (void *YYPARSE_PARAM);
 
867
# else
 
868
int yyparse ();
 
869
# endif
 
870
#else /* ! YYPARSE_PARAM */
 
871
#if defined (__STDC__) || defined (__cplusplus)
 
872
int yyparse (void);
 
873
#else
 
874
int yyparse ();
 
875
#endif
 
876
#endif /* ! YYPARSE_PARAM */
 
877
 
 
878
 
 
879
 
 
880
 
 
881
 
 
882
 
 
883
/*----------.
 
884
| yyparse.  |
 
885
`----------*/
 
886
 
 
887
#ifdef YYPARSE_PARAM
 
888
# if defined (__STDC__) || defined (__cplusplus)
 
889
int yyparse (void *YYPARSE_PARAM)
 
890
# else
 
891
int yyparse (YYPARSE_PARAM)
 
892
  void *YYPARSE_PARAM;
 
893
# endif
 
894
#else /* ! YYPARSE_PARAM */
 
895
#if defined (__STDC__) || defined (__cplusplus)
 
896
int
 
897
yyparse (void)
 
898
#else
 
899
int
 
900
yyparse ()
 
901
 
 
902
#endif
 
903
#endif
 
904
{
 
905
  /* The lookahead symbol.  */
 
906
int yychar;
 
907
 
 
908
/* The semantic value of the lookahead symbol.  */
 
909
YYSTYPE yylval;
 
910
 
 
911
/* Number of syntax errors so far.  */
 
912
int yynerrs;
 
913
 
 
914
  register int yystate;
 
915
  register int yyn;
 
916
  int yyresult;
 
917
  /* Number of tokens to shift before error messages enabled.  */
 
918
  int yyerrstatus;
 
919
  /* Lookahead token as an internal (translated) token number.  */
 
920
  int yytoken = 0;
 
921
 
 
922
  /* Three stacks and their tools:
 
923
     `yyss': related to states,
 
924
     `yyvs': related to semantic values,
 
925
     `yyls': related to locations.
 
926
 
 
927
     Refer to the stacks thru separate pointers, to allow yyoverflow
 
928
     to reallocate them elsewhere.  */
 
929
 
 
930
  /* The state stack.  */
 
931
  short int yyssa[YYINITDEPTH];
 
932
  short int *yyss = yyssa;
 
933
  register short int *yyssp;
 
934
 
 
935
  /* The semantic value stack.  */
 
936
  YYSTYPE yyvsa[YYINITDEPTH];
 
937
  YYSTYPE *yyvs = yyvsa;
 
938
  register YYSTYPE *yyvsp;
 
939
 
 
940
 
 
941
 
 
942
#define YYPOPSTACK   (yyvsp--, yyssp--)
 
943
 
 
944
  YYSIZE_T yystacksize = YYINITDEPTH;
 
945
 
 
946
  /* The variables used to return semantic value and location from the
 
947
     action routines.  */
 
948
  YYSTYPE yyval;
 
949
 
 
950
 
 
951
  /* When reducing, the number of symbols on the RHS of the reduced
 
952
     rule.  */
 
953
  int yylen;
 
954
 
 
955
  YYDPRINTF ((stderr, "Starting parse\n"));
 
956
 
 
957
  yystate = 0;
 
958
  yyerrstatus = 0;
 
959
  yynerrs = 0;
 
960
  yychar = YYEMPTY;             /* Cause a token to be read.  */
 
961
 
 
962
  /* Initialize stack pointers.
 
963
     Waste one element of value and location stack
 
964
     so that they stay on the same level as the state stack.
 
965
     The wasted elements are never initialized.  */
 
966
 
 
967
  yyssp = yyss;
 
968
  yyvsp = yyvs;
 
969
 
 
970
 
 
971
  goto yysetstate;
 
972
 
 
973
/*------------------------------------------------------------.
 
974
| yynewstate -- Push a new state, which is found in yystate.  |
 
975
`------------------------------------------------------------*/
 
976
 yynewstate:
 
977
  /* In all cases, when you get here, the value and location stacks
 
978
     have just been pushed. so pushing a state here evens the stacks.
 
979
     */
 
980
  yyssp++;
 
981
 
 
982
 yysetstate:
 
983
  *yyssp = yystate;
 
984
 
 
985
  if (yyss + yystacksize - 1 <= yyssp)
 
986
    {
 
987
      /* Get the current used size of the three stacks, in elements.  */
 
988
      YYSIZE_T yysize = yyssp - yyss + 1;
 
989
 
 
990
#ifdef yyoverflow
 
991
      {
 
992
        /* Give user a chance to reallocate the stack. Use copies of
 
993
           these so that the &'s don't force the real ones into
 
994
           memory.  */
 
995
        YYSTYPE *yyvs1 = yyvs;
 
996
        short int *yyss1 = yyss;
 
997
 
 
998
 
 
999
        /* Each stack pointer address is followed by the size of the
 
1000
           data in use in that stack, in bytes.  This used to be a
 
1001
           conditional around just the two extra args, but that might
 
1002
           be undefined if yyoverflow is a macro.  */
 
1003
        yyoverflow ("parser stack overflow",
 
1004
                    &yyss1, yysize * sizeof (*yyssp),
 
1005
                    &yyvs1, yysize * sizeof (*yyvsp),
 
1006
 
 
1007
                    &yystacksize);
 
1008
 
 
1009
        yyss = yyss1;
 
1010
        yyvs = yyvs1;
 
1011
      }
 
1012
#else /* no yyoverflow */
 
1013
# ifndef YYSTACK_RELOCATE
 
1014
      goto yyoverflowlab;
 
1015
# else
 
1016
      /* Extend the stack our own way.  */
 
1017
      if (YYMAXDEPTH <= yystacksize)
 
1018
        goto yyoverflowlab;
 
1019
      yystacksize *= 2;
 
1020
      if (YYMAXDEPTH < yystacksize)
 
1021
        yystacksize = YYMAXDEPTH;
 
1022
 
 
1023
      {
 
1024
        short int *yyss1 = yyss;
 
1025
        union yyalloc *yyptr =
 
1026
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 
1027
        if (! yyptr)
 
1028
          goto yyoverflowlab;
 
1029
        YYSTACK_RELOCATE (yyss);
 
1030
        YYSTACK_RELOCATE (yyvs);
 
1031
 
 
1032
#  undef YYSTACK_RELOCATE
 
1033
        if (yyss1 != yyssa)
 
1034
          YYSTACK_FREE (yyss1);
 
1035
      }
 
1036
# endif
 
1037
#endif /* no yyoverflow */
 
1038
 
 
1039
      yyssp = yyss + yysize - 1;
 
1040
      yyvsp = yyvs + yysize - 1;
 
1041
 
 
1042
 
 
1043
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 
1044
                  (unsigned long int) yystacksize));
 
1045
 
 
1046
      if (yyss + yystacksize - 1 <= yyssp)
 
1047
        YYABORT;
 
1048
    }
 
1049
 
 
1050
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
1051
 
 
1052
  goto yybackup;
 
1053
 
 
1054
/*-----------.
 
1055
| yybackup.  |
 
1056
`-----------*/
 
1057
yybackup:
 
1058
 
 
1059
/* Do appropriate processing given the current state.  */
 
1060
/* Read a lookahead token if we need one and don't already have one.  */
 
1061
/* yyresume: */
 
1062
 
 
1063
  /* First try to decide what to do without reference to lookahead token.  */
 
1064
 
 
1065
  yyn = yypact[yystate];
 
1066
  if (yyn == YYPACT_NINF)
 
1067
    goto yydefault;
 
1068
 
 
1069
  /* Not known => get a lookahead token if don't already have one.  */
 
1070
 
 
1071
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
 
1072
  if (yychar == YYEMPTY)
 
1073
    {
 
1074
      YYDPRINTF ((stderr, "Reading a token: "));
 
1075
      yychar = YYLEX;
 
1076
    }
 
1077
 
 
1078
  if (yychar <= YYEOF)
 
1079
    {
 
1080
      yychar = yytoken = YYEOF;
 
1081
      YYDPRINTF ((stderr, "Now at end of input.\n"));
 
1082
    }
 
1083
  else
 
1084
    {
 
1085
      yytoken = YYTRANSLATE (yychar);
 
1086
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
 
1087
    }
 
1088
 
 
1089
  /* If the proper action on seeing token YYTOKEN is to reduce or to
 
1090
     detect an error, take that action.  */
 
1091
  yyn += yytoken;
 
1092
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
 
1093
    goto yydefault;
 
1094
  yyn = yytable[yyn];
 
1095
  if (yyn <= 0)
 
1096
    {
 
1097
      if (yyn == 0 || yyn == YYTABLE_NINF)
 
1098
        goto yyerrlab;
 
1099
      yyn = -yyn;
 
1100
      goto yyreduce;
 
1101
    }
 
1102
 
 
1103
  if (yyn == YYFINAL)
 
1104
    YYACCEPT;
 
1105
 
 
1106
  /* Shift the lookahead token.  */
 
1107
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
 
1108
 
 
1109
  /* Discard the token being shifted unless it is eof.  */
 
1110
  if (yychar != YYEOF)
 
1111
    yychar = YYEMPTY;
 
1112
 
 
1113
  *++yyvsp = yylval;
 
1114
 
 
1115
 
 
1116
  /* Count tokens shifted since error; after three, turn off error
 
1117
     status.  */
 
1118
  if (yyerrstatus)
 
1119
    yyerrstatus--;
 
1120
 
 
1121
  yystate = yyn;
 
1122
  goto yynewstate;
 
1123
 
 
1124
 
 
1125
/*-----------------------------------------------------------.
 
1126
| yydefault -- do the default action for the current state.  |
 
1127
`-----------------------------------------------------------*/
 
1128
yydefault:
 
1129
  yyn = yydefact[yystate];
 
1130
  if (yyn == 0)
 
1131
    goto yyerrlab;
 
1132
  goto yyreduce;
 
1133
 
 
1134
 
 
1135
/*-----------------------------.
 
1136
| yyreduce -- Do a reduction.  |
 
1137
`-----------------------------*/
 
1138
yyreduce:
 
1139
  /* yyn is the number of a rule to reduce with.  */
 
1140
  yylen = yyr2[yyn];
 
1141
 
 
1142
  /* If YYLEN is nonzero, implement the default value of the action:
 
1143
     `$$ = $1'.
 
1144
 
 
1145
     Otherwise, the following line sets YYVAL to garbage.
 
1146
     This behavior is undocumented and Bison
 
1147
     users should not rely upon it.  Assigning to YYVAL
 
1148
     unconditionally makes the parser a bit smaller, and it avoids a
 
1149
     GCC warning that YYVAL may be used uninitialized.  */
 
1150
  yyval = yyvsp[1-yylen];
 
1151
 
 
1152
 
 
1153
  YY_REDUCE_PRINT (yyn);
 
1154
  switch (yyn)
 
1155
    {
 
1156
        case 2:
 
1157
#line 179 "plural.y"
 
1158
    {
 
1159
            if (yyvsp[0].exp == NULL)
 
1160
              YYABORT;
 
1161
            ((struct parse_args *) arg)->res = yyvsp[0].exp;
 
1162
          }
 
1163
    break;
 
1164
 
 
1165
  case 3:
 
1166
#line 187 "plural.y"
 
1167
    {
 
1168
            yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
 
1169
          }
 
1170
    break;
 
1171
 
 
1172
  case 4:
 
1173
#line 191 "plural.y"
 
1174
    {
 
1175
            yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
 
1176
          }
 
1177
    break;
 
1178
 
 
1179
  case 5:
 
1180
#line 195 "plural.y"
 
1181
    {
 
1182
            yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
 
1183
          }
 
1184
    break;
 
1185
 
 
1186
  case 6:
 
1187
#line 199 "plural.y"
 
1188
    {
 
1189
            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
 
1190
          }
 
1191
    break;
 
1192
 
 
1193
  case 7:
 
1194
#line 203 "plural.y"
 
1195
    {
 
1196
            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
 
1197
          }
 
1198
    break;
 
1199
 
 
1200
  case 8:
 
1201
#line 207 "plural.y"
 
1202
    {
 
1203
            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
 
1204
          }
 
1205
    break;
 
1206
 
 
1207
  case 9:
 
1208
#line 211 "plural.y"
 
1209
    {
 
1210
            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
 
1211
          }
 
1212
    break;
 
1213
 
 
1214
  case 10:
 
1215
#line 215 "plural.y"
 
1216
    {
 
1217
            yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
 
1218
          }
 
1219
    break;
 
1220
 
 
1221
  case 11:
 
1222
#line 219 "plural.y"
 
1223
    {
 
1224
            yyval.exp = new_exp_0 (var);
 
1225
          }
 
1226
    break;
 
1227
 
 
1228
  case 12:
 
1229
#line 223 "plural.y"
 
1230
    {
 
1231
            if ((yyval.exp = new_exp_0 (num)) != NULL)
 
1232
              yyval.exp->val.num = yyvsp[0].num;
 
1233
          }
 
1234
    break;
 
1235
 
 
1236
  case 13:
 
1237
#line 228 "plural.y"
 
1238
    {
 
1239
            yyval.exp = yyvsp[-1].exp;
 
1240
          }
 
1241
    break;
 
1242
 
 
1243
 
 
1244
    }
 
1245
 
 
1246
/* Line 1010 of yacc.c.  */
 
1247
#line 1248 "plural.c"
 
1248
 
 
1249
  yyvsp -= yylen;
 
1250
  yyssp -= yylen;
 
1251
 
 
1252
 
 
1253
  YY_STACK_PRINT (yyss, yyssp);
 
1254
 
 
1255
  *++yyvsp = yyval;
 
1256
 
 
1257
 
 
1258
  /* Now `shift' the result of the reduction.  Determine what state
 
1259
     that goes to, based on the state we popped back to and the rule
 
1260
     number reduced by.  */
 
1261
 
 
1262
  yyn = yyr1[yyn];
 
1263
 
 
1264
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
 
1265
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
 
1266
    yystate = yytable[yystate];
 
1267
  else
 
1268
    yystate = yydefgoto[yyn - YYNTOKENS];
 
1269
 
 
1270
  goto yynewstate;
 
1271
 
 
1272
 
 
1273
/*------------------------------------.
 
1274
| yyerrlab -- here on detecting error |
 
1275
`------------------------------------*/
 
1276
yyerrlab:
 
1277
  /* If not already recovering from an error, report this error.  */
 
1278
  if (!yyerrstatus)
 
1279
    {
 
1280
      ++yynerrs;
 
1281
#if YYERROR_VERBOSE
 
1282
      yyn = yypact[yystate];
 
1283
 
 
1284
      if (YYPACT_NINF < yyn && yyn < YYLAST)
 
1285
        {
 
1286
          YYSIZE_T yysize = 0;
 
1287
          int yytype = YYTRANSLATE (yychar);
 
1288
          const char* yyprefix;
 
1289
          char *yymsg;
 
1290
          int yyx;
 
1291
 
 
1292
          /* Start YYX at -YYN if negative to avoid negative indexes in
 
1293
             YYCHECK.  */
 
1294
          int yyxbegin = yyn < 0 ? -yyn : 0;
 
1295
 
 
1296
          /* Stay within bounds of both yycheck and yytname.  */
 
1297
          int yychecklim = YYLAST - yyn;
 
1298
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
 
1299
          int yycount = 0;
 
1300
 
 
1301
          yyprefix = ", expecting ";
 
1302
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
 
1303
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
1304
              {
 
1305
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
 
1306
                yycount += 1;
 
1307
                if (yycount == 5)
 
1308
                  {
 
1309
                    yysize = 0;
 
1310
                    break;
 
1311
                  }
 
1312
              }
 
1313
          yysize += (sizeof ("syntax error, unexpected ")
 
1314
                     + yystrlen (yytname[yytype]));
 
1315
          yymsg = (char *) YYSTACK_ALLOC (yysize);
 
1316
          if (yymsg != 0)
 
1317
            {
 
1318
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
 
1319
              yyp = yystpcpy (yyp, yytname[yytype]);
 
1320
 
 
1321
              if (yycount < 5)
 
1322
                {
 
1323
                  yyprefix = ", expecting ";
 
1324
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
 
1325
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
1326
                      {
 
1327
                        yyp = yystpcpy (yyp, yyprefix);
 
1328
                        yyp = yystpcpy (yyp, yytname[yyx]);
 
1329
                        yyprefix = " or ";
 
1330
                      }
 
1331
                }
 
1332
              yyerror (yymsg);
 
1333
              YYSTACK_FREE (yymsg);
 
1334
            }
 
1335
          else
 
1336
            yyerror ("syntax error; also virtual memory exhausted");
 
1337
        }
 
1338
      else
 
1339
#endif /* YYERROR_VERBOSE */
 
1340
        yyerror ("syntax error");
 
1341
    }
 
1342
 
 
1343
 
 
1344
 
 
1345
  if (yyerrstatus == 3)
 
1346
    {
 
1347
      /* If just tried and failed to reuse lookahead token after an
 
1348
         error, discard it.  */
 
1349
 
 
1350
      if (yychar <= YYEOF)
 
1351
        {
 
1352
          /* If at end of input, pop the error token,
 
1353
             then the rest of the stack, then return failure.  */
 
1354
          if (yychar == YYEOF)
 
1355
             for (;;)
 
1356
               {
 
1357
                 YYPOPSTACK;
 
1358
                 if (yyssp == yyss)
 
1359
                   YYABORT;
 
1360
                 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
 
1361
                 yydestruct (yystos[*yyssp], yyvsp);
 
1362
               }
 
1363
        }
 
1364
      else
 
1365
        {
 
1366
          YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
 
1367
          yydestruct (yytoken, &yylval);
 
1368
          yychar = YYEMPTY;
 
1369
 
 
1370
        }
 
1371
    }
 
1372
 
 
1373
  /* Else will try to reuse lookahead token after shifting the error
 
1374
     token.  */
 
1375
  goto yyerrlab1;
 
1376
 
 
1377
 
 
1378
/*---------------------------------------------------.
 
1379
| yyerrorlab -- error raised explicitly by YYERROR.  |
 
1380
`---------------------------------------------------*/
 
1381
yyerrorlab:
 
1382
 
 
1383
#ifdef __GNUC__
 
1384
  /* Pacify GCC when the user code never invokes YYERROR and the label
 
1385
     yyerrorlab therefore never appears in user code.  */
 
1386
  if (0)
 
1387
     goto yyerrorlab;
 
1388
#endif
 
1389
 
 
1390
  yyvsp -= yylen;
 
1391
  yyssp -= yylen;
 
1392
  yystate = *yyssp;
 
1393
  goto yyerrlab1;
 
1394
 
 
1395
 
 
1396
/*-------------------------------------------------------------.
 
1397
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
 
1398
`-------------------------------------------------------------*/
 
1399
yyerrlab1:
 
1400
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
1401
 
 
1402
  for (;;)
 
1403
    {
 
1404
      yyn = yypact[yystate];
 
1405
      if (yyn != YYPACT_NINF)
 
1406
        {
 
1407
          yyn += YYTERROR;
 
1408
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
 
1409
            {
 
1410
              yyn = yytable[yyn];
 
1411
              if (0 < yyn)
 
1412
                break;
 
1413
            }
 
1414
        }
 
1415
 
 
1416
      /* Pop the current state because it cannot handle the error token.  */
 
1417
      if (yyssp == yyss)
 
1418
        YYABORT;
 
1419
 
 
1420
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
 
1421
      yydestruct (yystos[yystate], yyvsp);
 
1422
      YYPOPSTACK;
 
1423
      yystate = *yyssp;
 
1424
      YY_STACK_PRINT (yyss, yyssp);
 
1425
    }
 
1426
 
 
1427
  if (yyn == YYFINAL)
 
1428
    YYACCEPT;
 
1429
 
 
1430
  YYDPRINTF ((stderr, "Shifting error token, "));
 
1431
 
 
1432
  *++yyvsp = yylval;
 
1433
 
 
1434
 
 
1435
  yystate = yyn;
 
1436
  goto yynewstate;
 
1437
 
 
1438
 
 
1439
/*-------------------------------------.
 
1440
| yyacceptlab -- YYACCEPT comes here.  |
 
1441
`-------------------------------------*/
 
1442
yyacceptlab:
 
1443
  yyresult = 0;
 
1444
  goto yyreturn;
 
1445
 
 
1446
/*-----------------------------------.
 
1447
| yyabortlab -- YYABORT comes here.  |
 
1448
`-----------------------------------*/
 
1449
yyabortlab:
 
1450
  yyresult = 1;
 
1451
  goto yyreturn;
 
1452
 
 
1453
#ifndef yyoverflow
 
1454
/*----------------------------------------------.
 
1455
| yyoverflowlab -- parser overflow comes here.  |
 
1456
`----------------------------------------------*/
 
1457
yyoverflowlab:
 
1458
  yyerror ("parser stack overflow");
 
1459
  yyresult = 2;
 
1460
  /* Fall through.  */
 
1461
#endif
 
1462
 
 
1463
yyreturn:
 
1464
#ifndef yyoverflow
 
1465
  if (yyss != yyssa)
 
1466
    YYSTACK_FREE (yyss);
 
1467
#endif
 
1468
  return yyresult;
 
1469
}
 
1470
 
 
1471
 
 
1472
#line 233 "plural.y"
 
1473
 
 
1474
 
 
1475
void
 
1476
internal_function
 
1477
FREE_EXPRESSION (exp)
 
1478
     struct expression *exp;
 
1479
{
 
1480
  if (exp == NULL)
 
1481
    return;
 
1482
 
 
1483
  /* Handle the recursive case.  */
 
1484
  switch (exp->nargs)
 
1485
    {
 
1486
    case 3:
 
1487
      FREE_EXPRESSION (exp->val.args[2]);
 
1488
      /* FALLTHROUGH */
 
1489
    case 2:
 
1490
      FREE_EXPRESSION (exp->val.args[1]);
 
1491
      /* FALLTHROUGH */
 
1492
    case 1:
 
1493
      FREE_EXPRESSION (exp->val.args[0]);
 
1494
      /* FALLTHROUGH */
 
1495
    default:
 
1496
      break;
 
1497
    }
 
1498
 
 
1499
  free (exp);
 
1500
}
 
1501
 
 
1502
 
 
1503
static int
 
1504
yylex (lval, pexp)
 
1505
     YYSTYPE *lval;
 
1506
     const char **pexp;
 
1507
{
 
1508
  const char *exp = *pexp;
 
1509
  int result;
 
1510
 
 
1511
  while (1)
 
1512
    {
 
1513
      if (exp[0] == '\0')
 
1514
        {
 
1515
          *pexp = exp;
 
1516
          return YYEOF;
 
1517
        }
 
1518
 
 
1519
      if (exp[0] != ' ' && exp[0] != '\t')
 
1520
        break;
 
1521
 
 
1522
      ++exp;
 
1523
    }
 
1524
 
 
1525
  result = *exp++;
 
1526
  switch (result)
 
1527
    {
 
1528
    case '0': case '1': case '2': case '3': case '4':
 
1529
    case '5': case '6': case '7': case '8': case '9':
 
1530
      {
 
1531
        unsigned long int n = result - '0';
 
1532
        while (exp[0] >= '0' && exp[0] <= '9')
 
1533
          {
 
1534
            n *= 10;
 
1535
            n += exp[0] - '0';
 
1536
            ++exp;
 
1537
          }
 
1538
        lval->num = n;
 
1539
        result = NUMBER;
 
1540
      }
 
1541
      break;
 
1542
 
 
1543
    case '=':
 
1544
      if (exp[0] == '=')
 
1545
        {
 
1546
          ++exp;
 
1547
          lval->op = equal;
 
1548
          result = EQUOP2;
 
1549
        }
 
1550
      else
 
1551
        result = YYERRCODE;
 
1552
      break;
 
1553
 
 
1554
    case '!':
 
1555
      if (exp[0] == '=')
 
1556
        {
 
1557
          ++exp;
 
1558
          lval->op = not_equal;
 
1559
          result = EQUOP2;
 
1560
        }
 
1561
      break;
 
1562
 
 
1563
    case '&':
 
1564
    case '|':
 
1565
      if (exp[0] == result)
 
1566
        ++exp;
 
1567
      else
 
1568
        result = YYERRCODE;
 
1569
      break;
 
1570
 
 
1571
    case '<':
 
1572
      if (exp[0] == '=')
 
1573
        {
 
1574
          ++exp;
 
1575
          lval->op = less_or_equal;
 
1576
        }
 
1577
      else
 
1578
        lval->op = less_than;
 
1579
      result = CMPOP2;
 
1580
      break;
 
1581
 
 
1582
    case '>':
 
1583
      if (exp[0] == '=')
 
1584
        {
 
1585
          ++exp;
 
1586
          lval->op = greater_or_equal;
 
1587
        }
 
1588
      else
 
1589
        lval->op = greater_than;
 
1590
      result = CMPOP2;
 
1591
      break;
 
1592
 
 
1593
    case '*':
 
1594
      lval->op = mult;
 
1595
      result = MULOP2;
 
1596
      break;
 
1597
 
 
1598
    case '/':
 
1599
      lval->op = divide;
 
1600
      result = MULOP2;
 
1601
      break;
 
1602
 
 
1603
    case '%':
 
1604
      lval->op = module;
 
1605
      result = MULOP2;
 
1606
      break;
 
1607
 
 
1608
    case '+':
 
1609
      lval->op = plus;
 
1610
      result = ADDOP2;
 
1611
      break;
 
1612
 
 
1613
    case '-':
 
1614
      lval->op = minus;
 
1615
      result = ADDOP2;
 
1616
      break;
 
1617
 
 
1618
    case 'n':
 
1619
    case '?':
 
1620
    case ':':
 
1621
    case '(':
 
1622
    case ')':
 
1623
      /* Nothing, just return the character.  */
 
1624
      break;
 
1625
 
 
1626
    case ';':
 
1627
    case '\n':
 
1628
    case '\0':
 
1629
      /* Be safe and let the user call this function again.  */
 
1630
      --exp;
 
1631
      result = YYEOF;
 
1632
      break;
 
1633
 
 
1634
    default:
 
1635
      result = YYERRCODE;
 
1636
#if YYDEBUG != 0
 
1637
      --exp;
 
1638
#endif
 
1639
      break;
 
1640
    }
 
1641
 
 
1642
  *pexp = exp;
 
1643
 
 
1644
  return result;
 
1645
}
 
1646
 
 
1647
 
 
1648
static void
 
1649
yyerror (str)
 
1650
     const char *str;
 
1651
{
 
1652
  /* Do nothing.  We don't print error messages here.  */
 
1653
}
 
1654