~ubuntu-branches/ubuntu/maverick/tvtime/maverick

« back to all changes in this revision

Viewing changes to intl/plural.c

  • Committer: Bazaar Package Importer
  • Author(s): Simon Law
  • Date: 2004-01-13 18:00:36 UTC
  • Revision ID: james.westby@ubuntu.com-20040113180036-h996q67t476jymsu
Tags: upstream-0.9.12
ImportĀ upstreamĀ versionĀ 0.9.12

Show diffs side-by-side

added added

removed removed

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