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