blob: a0031513c7ebabbd0568c22e0fb5a43c01098940 [file] [log] [blame]
Jari Aalto31859422009-01-12 13:36:28 +00001/* A Bison parser, made by GNU Bison 2.0. */
Jari Aaltob80f6442004-07-27 13:29:18 +00002
Jari Aalto31859422009-01-12 13:36:28 +00003/* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Jari Aaltob80f6442004-07-27 13:29:18 +00005
Jari Aalto31859422009-01-12 13:36:28 +00006 This file is part of GNU Bash.
7
8 Bash is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 Bash is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22/* As a special exception, when this file is copied by Bison into a
23 Bison output file, you may use that output file without restriction.
24 This special exception was added by the Free Software Foundation
25 in version 1.24 of Bison. */
26
27/* Written by Richard Stallman by simplifying the original so called
28 ``semantic'' parser. */
29
30/* All symbols defined below should begin with yy or YY, to avoid
31 infringing on user name space. This should be done even for local
32 variables, as they might otherwise be expanded by user macros.
33 There are some unavoidable exceptions within include files to
34 define necessary library symbols; they are noted "INFRINGES ON
35 USER NAME SPACE" below. */
36
37/* Identify Bison output. */
38#define YYBISON 1
39
40/* Skeleton name. */
41#define YYSKELETON_NAME "yacc.c"
42
43/* Pure parsers. */
44#define YYPURE 1
45
46/* Using locations. */
47#define YYLSP_NEEDED 0
48
49/* Substitute the variable and function names. */
Jari Aaltob80f6442004-07-27 13:29:18 +000050#define yyparse __gettextparse
Jari Aalto31859422009-01-12 13:36:28 +000051#define yylex __gettextlex
Jari Aaltob80f6442004-07-27 13:29:18 +000052#define yyerror __gettexterror
Jari Aalto31859422009-01-12 13:36:28 +000053#define yylval __gettextlval
54#define yychar __gettextchar
Jari Aaltob80f6442004-07-27 13:29:18 +000055#define yydebug __gettextdebug
56#define yynerrs __gettextnerrs
Jari Aaltob80f6442004-07-27 13:29:18 +000057
Jari Aaltob80f6442004-07-27 13:29:18 +000058
Jari Aalto31859422009-01-12 13:36:28 +000059/* 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 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
83
84/* plural.y - Expression parsing for plural form selection. */
85
86/* Copyright (C) 2000, 2001, 2005-2009 Free Software Foundation, Inc.
Jari Aaltob80f6442004-07-27 13:29:18 +000087 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
88
Jari Aalto31859422009-01-12 13:36:28 +000089 This file is part of GNU Bash.
Jari Aaltob80f6442004-07-27 13:29:18 +000090
Jari Aalto31859422009-01-12 13:36:28 +000091 Bash is free software: you can redistribute it and/or modify
92 it under the terms of the GNU General Public License as published by
93 the Free Software Foundation, either version 3 of the License, or
94 (at your option) any later version.
95
96 Bash is distributed in the hope that it will be useful,
Jari Aaltob80f6442004-07-27 13:29:18 +000097 but WITHOUT ANY WARRANTY; without even the implied warranty of
Jari Aalto31859422009-01-12 13:36:28 +000098 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
99 GNU General Public License for more details.
Jari Aaltob80f6442004-07-27 13:29:18 +0000100
Jari Aalto31859422009-01-12 13:36:28 +0000101 You should have received a copy of the GNU General Public License
102 along with Bash. If not, see <http://www.gnu.org/licenses/>.
103*/
Jari Aaltob80f6442004-07-27 13:29:18 +0000104
105/* The bison generated parser uses alloca. AIX 3 forces us to put this
106 declaration at the beginning of the file. The declaration in bison's
107 skeleton file comes too late. This must come before <config.h>
108 because <config.h> may include arbitrary system headers. */
109#if defined _AIX && !defined __GNUC__
110 #pragma alloca
111#endif
112
113#ifdef HAVE_CONFIG_H
114# include <config.h>
115#endif
116
117#include <stddef.h>
118#include <stdlib.h>
119#include "plural-exp.h"
120
121/* The main function generated by the parser is called __gettextparse,
122 but we want it to be called PLURAL_PARSE. */
123#ifndef _LIBC
124# define __gettextparse PLURAL_PARSE
125#endif
126
127#define YYLEX_PARAM &((struct parse_args *) arg)->cp
128#define YYPARSE_PARAM arg
129
Jari Aalto31859422009-01-12 13:36:28 +0000130
131/* Enabling traces. */
132#ifndef YYDEBUG
133# define YYDEBUG 0
134#endif
135
136/* Enabling verbose error messages. */
137#ifdef YYERROR_VERBOSE
138# undef YYERROR_VERBOSE
139# define YYERROR_VERBOSE 1
140#else
141# define YYERROR_VERBOSE 0
142#endif
143
144#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
145#line 51 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
146typedef union YYSTYPE {
Jari Aaltob80f6442004-07-27 13:29:18 +0000147 unsigned long int num;
148 enum operator op;
149 struct expression *exp;
Jari Aalto31859422009-01-12 13:36:28 +0000150} YYSTYPE;
151/* Line 190 of yacc.c. */
152#line 152 "/usr/src/local/bash/bash-20080814/lib/intl/plural.c"
153# define yystype YYSTYPE /* obsolescent; will be withdrawn */
154# define YYSTYPE_IS_DECLARED 1
Jari Aaltob80f6442004-07-27 13:29:18 +0000155# define YYSTYPE_IS_TRIVIAL 1
156#endif
Jari Aalto31859422009-01-12 13:36:28 +0000157
158
159
160/* Copy the second part of user declarations. */
161#line 57 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
Jari Aaltob80f6442004-07-27 13:29:18 +0000162
163/* Prototypes for local functions. */
164static struct expression *new_exp PARAMS ((int nargs, enum operator op,
165 struct expression * const *args));
166static inline struct expression *new_exp_0 PARAMS ((enum operator op));
167static inline struct expression *new_exp_1 PARAMS ((enum operator op,
168 struct expression *right));
169static struct expression *new_exp_2 PARAMS ((enum operator op,
170 struct expression *left,
171 struct expression *right));
172static inline struct expression *new_exp_3 PARAMS ((enum operator op,
173 struct expression *bexp,
174 struct expression *tbranch,
175 struct expression *fbranch));
176static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
177static void yyerror PARAMS ((const char *str));
178
179/* Allocation of expressions. */
180
181static struct expression *
182new_exp (nargs, op, args)
183 int nargs;
184 enum operator op;
185 struct expression * const *args;
186{
187 int i;
188 struct expression *newp;
189
190 /* If any of the argument could not be malloc'ed, just return NULL. */
191 for (i = nargs - 1; i >= 0; i--)
192 if (args[i] == NULL)
193 goto fail;
194
195 /* Allocate a new expression. */
196 newp = (struct expression *) malloc (sizeof (*newp));
197 if (newp != NULL)
198 {
199 newp->nargs = nargs;
200 newp->operation = op;
201 for (i = nargs - 1; i >= 0; i--)
202 newp->val.args[i] = args[i];
203 return newp;
204 }
205
206 fail:
207 for (i = nargs - 1; i >= 0; i--)
208 FREE_EXPRESSION (args[i]);
209
210 return NULL;
211}
212
213static inline struct expression *
214new_exp_0 (op)
215 enum operator op;
216{
217 return new_exp (0, op, NULL);
218}
219
220static inline struct expression *
221new_exp_1 (op, right)
222 enum operator op;
223 struct expression *right;
224{
225 struct expression *args[1];
226
227 args[0] = right;
228 return new_exp (1, op, args);
229}
230
231static struct expression *
232new_exp_2 (op, left, right)
233 enum operator op;
234 struct expression *left;
235 struct expression *right;
236{
237 struct expression *args[2];
238
239 args[0] = left;
240 args[1] = right;
241 return new_exp (2, op, args);
242}
243
244static inline struct expression *
245new_exp_3 (op, bexp, tbranch, fbranch)
246 enum operator op;
247 struct expression *bexp;
248 struct expression *tbranch;
249 struct expression *fbranch;
250{
251 struct expression *args[3];
252
253 args[0] = bexp;
254 args[1] = tbranch;
255 args[2] = fbranch;
256 return new_exp (3, op, args);
257}
258
Jari Aalto31859422009-01-12 13:36:28 +0000259
260
261/* Line 213 of yacc.c. */
262#line 262 "/usr/src/local/bash/bash-20080814/lib/intl/plural.c"
263
264#if ! defined (yyoverflow) || YYERROR_VERBOSE
265
266# ifndef YYFREE
267# define YYFREE free
268# endif
269# ifndef YYMALLOC
270# define YYMALLOC malloc
271# endif
272
273/* The parser invokes alloca or malloc; define the necessary symbols. */
274
275# ifdef YYSTACK_USE_ALLOCA
276# if YYSTACK_USE_ALLOCA
277# ifdef __GNUC__
278# define YYSTACK_ALLOC __builtin_alloca
279# else
280# define YYSTACK_ALLOC alloca
281# endif
282# endif
283# endif
284
285# ifdef YYSTACK_ALLOC
286 /* Pacify GCC's `empty if-body' warning. */
287# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
288# else
289# if defined (__STDC__) || defined (__cplusplus)
290# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
291# define YYSIZE_T size_t
292# endif
293# define YYSTACK_ALLOC YYMALLOC
294# define YYSTACK_FREE YYFREE
295# endif
296#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
297
298
299#if (! defined (yyoverflow) \
300 && (! defined (__cplusplus) \
301 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
302
303/* A type that is properly aligned for any stack member. */
304union yyalloc
305{
306 short int yyss;
307 YYSTYPE yyvs;
308 };
309
310/* The size of the maximum gap between one aligned stack and the next. */
311# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
312
313/* The size of an array large to enough to hold all stacks, each with
314 N elements. */
315# define YYSTACK_BYTES(N) \
316 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
317 + YYSTACK_GAP_MAXIMUM)
318
319/* Copy COUNT objects from FROM to TO. The source and destination do
320 not overlap. */
321# ifndef YYCOPY
322# if defined (__GNUC__) && 1 < __GNUC__
323# define YYCOPY(To, From, Count) \
324 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
325# else
326# define YYCOPY(To, From, Count) \
327 do \
328 { \
329 register YYSIZE_T yyi; \
330 for (yyi = 0; yyi < (Count); yyi++) \
331 (To)[yyi] = (From)[yyi]; \
332 } \
333 while (0)
334# endif
335# endif
336
337/* Relocate STACK from its old location to the new one. The
338 local variables YYSIZE and YYSTACKSIZE give the old and new number of
339 elements in the stack, and YYPTR gives the new location of the
340 stack. Advance YYPTR to a properly aligned location for the next
341 stack. */
342# define YYSTACK_RELOCATE(Stack) \
343 do \
344 { \
345 YYSIZE_T yynewbytes; \
346 YYCOPY (&yyptr->Stack, Stack, yysize); \
347 Stack = &yyptr->Stack; \
348 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
349 yyptr += yynewbytes / sizeof (*yyptr); \
350 } \
351 while (0)
352
Jari Aaltob80f6442004-07-27 13:29:18 +0000353#endif
354
Jari Aalto31859422009-01-12 13:36:28 +0000355#if defined (__STDC__) || defined (__cplusplus)
356 typedef signed char yysigned_char;
357#else
358 typedef short int yysigned_char;
359#endif
Jari Aaltob80f6442004-07-27 13:29:18 +0000360
Jari Aalto31859422009-01-12 13:36:28 +0000361/* YYFINAL -- State number of the termination state. */
362#define YYFINAL 9
363/* YYLAST -- Last index in YYTABLE. */
364#define YYLAST 54
Jari Aaltob80f6442004-07-27 13:29:18 +0000365
Jari Aalto31859422009-01-12 13:36:28 +0000366/* YYNTOKENS -- Number of terminals. */
367#define YYNTOKENS 16
368/* YYNNTS -- Number of nonterminals. */
369#define YYNNTS 3
370/* YYNRULES -- Number of rules. */
371#define YYNRULES 13
372/* YYNRULES -- Number of states. */
373#define YYNSTATES 27
Jari Aaltob80f6442004-07-27 13:29:18 +0000374
Jari Aalto31859422009-01-12 13:36:28 +0000375/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
376#define YYUNDEFTOK 2
377#define YYMAXUTOK 262
Jari Aaltob80f6442004-07-27 13:29:18 +0000378
Jari Aalto31859422009-01-12 13:36:28 +0000379#define YYTRANSLATE(YYX) \
380 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
381
382/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
383static const unsigned char yytranslate[] =
Jari Aaltob80f6442004-07-27 13:29:18 +0000384{
385 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
389 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
391 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 4, 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, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Jari Aalto31859422009-01-12 13:36:28 +0000410 2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
411 8, 9, 11
Jari Aaltob80f6442004-07-27 13:29:18 +0000412};
413
414#if YYDEBUG
Jari Aalto31859422009-01-12 13:36:28 +0000415/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
416 YYRHS. */
417static const unsigned char yyprhs[] =
Jari Aaltob80f6442004-07-27 13:29:18 +0000418{
Jari Aalto31859422009-01-12 13:36:28 +0000419 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
420 35, 38, 40, 42
Jari Aaltob80f6442004-07-27 13:29:18 +0000421};
422
Jari Aalto31859422009-01-12 13:36:28 +0000423/* YYRHS -- A `-1'-separated list of the rules' RHS. */
424static const yysigned_char yyrhs[] =
Jari Aaltob80f6442004-07-27 13:29:18 +0000425{
Jari Aalto31859422009-01-12 13:36:28 +0000426 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
427 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
428 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
429 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
430 11, -1, 14, 18, 15, -1
431};
432
433/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
434static const unsigned char yyrline[] =
435{
436 0, 176, 176, 184, 188, 192, 196, 200, 204, 208,
437 212, 216, 220, 225
Jari Aaltob80f6442004-07-27 13:29:18 +0000438};
439#endif
440
Jari Aalto31859422009-01-12 13:36:28 +0000441#if YYDEBUG || YYERROR_VERBOSE
442/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
443 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
Jari Aaltob80f6442004-07-27 13:29:18 +0000444static const char *const yytname[] =
445{
Jari Aalto31859422009-01-12 13:36:28 +0000446 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
447 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
448 "$accept", "start", "exp", 0
Jari Aaltob80f6442004-07-27 13:29:18 +0000449};
450#endif
451
Jari Aalto31859422009-01-12 13:36:28 +0000452# ifdef YYPRINT
453/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
454 token YYLEX-NUM. */
455static const unsigned short int yytoknum[] =
Jari Aaltob80f6442004-07-27 13:29:18 +0000456{
Jari Aalto31859422009-01-12 13:36:28 +0000457 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
458 33, 262, 58, 110, 40, 41
Jari Aaltob80f6442004-07-27 13:29:18 +0000459};
Jari Aaltob80f6442004-07-27 13:29:18 +0000460# endif
461
Jari Aalto31859422009-01-12 13:36:28 +0000462/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
463static const unsigned char yyr1[] =
Jari Aaltob80f6442004-07-27 13:29:18 +0000464{
Jari Aalto31859422009-01-12 13:36:28 +0000465 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
466 18, 18, 18, 18
Jari Aaltob80f6442004-07-27 13:29:18 +0000467};
468
Jari Aalto31859422009-01-12 13:36:28 +0000469/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
470static const unsigned char yyr2[] =
471{
472 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
473 2, 1, 1, 3
474};
Jari Aaltob80f6442004-07-27 13:29:18 +0000475
Jari Aalto31859422009-01-12 13:36:28 +0000476/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
477 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
478 means the default is an error. */
479static const unsigned char yydefact[] =
480{
481 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
482 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
483 5, 6, 7, 8, 9, 0, 3
484};
Jari Aaltob80f6442004-07-27 13:29:18 +0000485
Jari Aalto31859422009-01-12 13:36:28 +0000486/* YYDEFGOTO[NTERM-NUM]. */
487static const yysigned_char yydefgoto[] =
488{
489 -1, 5, 6
490};
Jari Aaltob80f6442004-07-27 13:29:18 +0000491
Jari Aalto31859422009-01-12 13:36:28 +0000492/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
493 STATE-NUM. */
494#define YYPACT_NINF -10
495static const yysigned_char yypact[] =
496{
497 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
498 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
499 45, 18, -2, 14, -10, -9, 36
500};
Jari Aaltob80f6442004-07-27 13:29:18 +0000501
Jari Aalto31859422009-01-12 13:36:28 +0000502/* YYPGOTO[NTERM-NUM]. */
503static const yysigned_char yypgoto[] =
504{
505 -10, -10, -1
506};
Jari Aaltob80f6442004-07-27 13:29:18 +0000507
Jari Aalto31859422009-01-12 13:36:28 +0000508/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
509 positive, shift that token. If negative, reduce the rule which
510 number is the opposite. If zero, do what YYDEFACT says.
511 If YYTABLE_NINF, syntax error. */
512#define YYTABLE_NINF -1
513static const unsigned char yytable[] =
514{
515 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
516 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
517 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
518 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
519 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
520 16, 13, 14, 15, 16
521};
522
523static const yysigned_char yycheck[] =
524{
525 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
526 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
527 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
528 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
529 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
530 9, 6, 7, 8, 9
531};
532
533/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
534 symbol of state STATE-NUM. */
535static const unsigned char yystos[] =
536{
537 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
538 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
539 18, 18, 18, 18, 18, 12, 18
540};
Jari Aaltob80f6442004-07-27 13:29:18 +0000541
542#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
543# define YYSIZE_T __SIZE_TYPE__
544#endif
545#if ! defined (YYSIZE_T) && defined (size_t)
546# define YYSIZE_T size_t
547#endif
548#if ! defined (YYSIZE_T)
549# if defined (__STDC__) || defined (__cplusplus)
550# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
551# define YYSIZE_T size_t
552# endif
553#endif
554#if ! defined (YYSIZE_T)
555# define YYSIZE_T unsigned int
556#endif
557
558#define yyerrok (yyerrstatus = 0)
559#define yyclearin (yychar = YYEMPTY)
Jari Aalto31859422009-01-12 13:36:28 +0000560#define YYEMPTY (-2)
Jari Aaltob80f6442004-07-27 13:29:18 +0000561#define YYEOF 0
Jari Aalto31859422009-01-12 13:36:28 +0000562
Jari Aaltob80f6442004-07-27 13:29:18 +0000563#define YYACCEPT goto yyacceptlab
Jari Aalto31859422009-01-12 13:36:28 +0000564#define YYABORT goto yyabortlab
565#define YYERROR goto yyerrorlab
566
567
Jari Aaltob80f6442004-07-27 13:29:18 +0000568/* Like YYERROR except do call yyerror. This remains here temporarily
569 to ease the transition to the new meaning of YYERROR, for GCC.
570 Once GCC version 2 has supplanted version 1, this can go. */
Jari Aalto31859422009-01-12 13:36:28 +0000571
Jari Aaltob80f6442004-07-27 13:29:18 +0000572#define YYFAIL goto yyerrlab
Jari Aalto31859422009-01-12 13:36:28 +0000573
Jari Aaltob80f6442004-07-27 13:29:18 +0000574#define YYRECOVERING() (!!yyerrstatus)
Jari Aalto31859422009-01-12 13:36:28 +0000575
Jari Aaltob80f6442004-07-27 13:29:18 +0000576#define YYBACKUP(Token, Value) \
577do \
578 if (yychar == YYEMPTY && yylen == 1) \
579 { \
580 yychar = (Token); \
581 yylval = (Value); \
Jari Aalto31859422009-01-12 13:36:28 +0000582 yytoken = YYTRANSLATE (yychar); \
Jari Aaltob80f6442004-07-27 13:29:18 +0000583 YYPOPSTACK; \
584 goto yybackup; \
585 } \
586 else \
587 { \
Jari Aalto31859422009-01-12 13:36:28 +0000588 yyerror ("syntax error: cannot back up");\
Jari Aaltob80f6442004-07-27 13:29:18 +0000589 YYERROR; \
590 } \
591while (0)
592
Jari Aalto31859422009-01-12 13:36:28 +0000593
Jari Aaltob80f6442004-07-27 13:29:18 +0000594#define YYTERROR 1
595#define YYERRCODE 256
596
597
Jari Aalto31859422009-01-12 13:36:28 +0000598/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
599 If N is 0, then set CURRENT to the empty location which ends
600 the previous symbol: RHS[0] (always defined). */
Jari Aaltob80f6442004-07-27 13:29:18 +0000601
Jari Aalto31859422009-01-12 13:36:28 +0000602#define YYRHSLOC(Rhs, K) ((Rhs)[K])
Jari Aaltob80f6442004-07-27 13:29:18 +0000603#ifndef YYLLOC_DEFAULT
Jari Aalto31859422009-01-12 13:36:28 +0000604# define YYLLOC_DEFAULT(Current, Rhs, N) \
605 do \
606 if (N) \
607 { \
608 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
609 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
610 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
611 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
612 } \
613 else \
614 { \
615 (Current).first_line = (Current).last_line = \
616 YYRHSLOC (Rhs, 0).last_line; \
617 (Current).first_column = (Current).last_column = \
618 YYRHSLOC (Rhs, 0).last_column; \
619 } \
620 while (0)
621#endif
622
623
624/* YY_LOCATION_PRINT -- Print the location on the stream.
625 This macro was not mandated originally: define only if we know
626 we won't break user code: when these are the locations we know. */
627
628#ifndef YY_LOCATION_PRINT
629# if YYLTYPE_IS_TRIVIAL
630# define YY_LOCATION_PRINT(File, Loc) \
631 fprintf (File, "%d.%d-%d.%d", \
632 (Loc).first_line, (Loc).first_column, \
633 (Loc).last_line, (Loc).last_column)
634# else
635# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
636# endif
Jari Aaltob80f6442004-07-27 13:29:18 +0000637#endif
638
639
640/* YYLEX -- calling `yylex' with the right arguments. */
641
Jari Aalto31859422009-01-12 13:36:28 +0000642#ifdef YYLEX_PARAM
643# define YYLEX yylex (&yylval, YYLEX_PARAM)
644#else
645# define YYLEX yylex (&yylval)
646#endif
Jari Aaltob80f6442004-07-27 13:29:18 +0000647
648/* Enable debugging if requested. */
649#if YYDEBUG
650
651# ifndef YYFPRINTF
652# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
653# define YYFPRINTF fprintf
654# endif
655
656# define YYDPRINTF(Args) \
657do { \
658 if (yydebug) \
659 YYFPRINTF Args; \
660} while (0)
Jari Aalto31859422009-01-12 13:36:28 +0000661
662# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
663do { \
664 if (yydebug) \
665 { \
666 YYFPRINTF (stderr, "%s ", Title); \
667 yysymprint (stderr, \
668 Type, Value); \
669 YYFPRINTF (stderr, "\n"); \
670 } \
671} while (0)
672
673/*------------------------------------------------------------------.
674| yy_stack_print -- Print the state stack from its BOTTOM up to its |
675| TOP (included). |
676`------------------------------------------------------------------*/
677
678#if defined (__STDC__) || defined (__cplusplus)
679static void
680yy_stack_print (short int *bottom, short int *top)
681#else
682static void
683yy_stack_print (bottom, top)
684 short int *bottom;
685 short int *top;
686#endif
687{
688 YYFPRINTF (stderr, "Stack now");
689 for (/* Nothing. */; bottom <= top; ++bottom)
690 YYFPRINTF (stderr, " %d", *bottom);
691 YYFPRINTF (stderr, "\n");
692}
693
694# define YY_STACK_PRINT(Bottom, Top) \
695do { \
696 if (yydebug) \
697 yy_stack_print ((Bottom), (Top)); \
698} while (0)
699
700
701/*------------------------------------------------.
702| Report that the YYRULE is going to be reduced. |
703`------------------------------------------------*/
704
705#if defined (__STDC__) || defined (__cplusplus)
706static void
707yy_reduce_print (int yyrule)
708#else
709static void
710yy_reduce_print (yyrule)
711 int yyrule;
712#endif
713{
714 int yyi;
715 unsigned int yylno = yyrline[yyrule];
716 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
717 yyrule - 1, yylno);
718 /* Print the symbols being reduced, and their result. */
719 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
720 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
721 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
722}
723
724# define YY_REDUCE_PRINT(Rule) \
725do { \
726 if (yydebug) \
727 yy_reduce_print (Rule); \
728} while (0)
729
Jari Aaltob80f6442004-07-27 13:29:18 +0000730/* Nonzero means print parse trace. It is left uninitialized so that
731 multiple parsers can coexist. */
732int yydebug;
733#else /* !YYDEBUG */
734# define YYDPRINTF(Args)
Jari Aalto31859422009-01-12 13:36:28 +0000735# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
736# define YY_STACK_PRINT(Bottom, Top)
737# define YY_REDUCE_PRINT(Rule)
Jari Aaltob80f6442004-07-27 13:29:18 +0000738#endif /* !YYDEBUG */
739
Jari Aalto31859422009-01-12 13:36:28 +0000740
Jari Aaltob80f6442004-07-27 13:29:18 +0000741/* YYINITDEPTH -- initial size of the parser's stacks. */
742#ifndef YYINITDEPTH
743# define YYINITDEPTH 200
744#endif
745
746/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
747 if the built-in stack extension method is used).
748
749 Do not make this value too large; the results are undefined if
750 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
751 evaluated with infinite-precision integer arithmetic. */
752
Jari Aaltob80f6442004-07-27 13:29:18 +0000753#ifndef YYMAXDEPTH
754# define YYMAXDEPTH 10000
755#endif
Jari Aalto31859422009-01-12 13:36:28 +0000756
Jari Aaltob80f6442004-07-27 13:29:18 +0000757
Jari Aalto31859422009-01-12 13:36:28 +0000758
759#if YYERROR_VERBOSE
Jari Aaltob80f6442004-07-27 13:29:18 +0000760
761# ifndef yystrlen
762# if defined (__GLIBC__) && defined (_STRING_H)
763# define yystrlen strlen
764# else
765/* Return the length of YYSTR. */
766static YYSIZE_T
767# if defined (__STDC__) || defined (__cplusplus)
768yystrlen (const char *yystr)
769# else
770yystrlen (yystr)
771 const char *yystr;
772# endif
773{
774 register const char *yys = yystr;
775
776 while (*yys++ != '\0')
777 continue;
778
779 return yys - yystr - 1;
780}
781# endif
782# endif
783
784# ifndef yystpcpy
785# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
786# define yystpcpy stpcpy
787# else
788/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
789 YYDEST. */
790static char *
791# if defined (__STDC__) || defined (__cplusplus)
792yystpcpy (char *yydest, const char *yysrc)
793# else
794yystpcpy (yydest, yysrc)
795 char *yydest;
796 const char *yysrc;
797# endif
798{
799 register char *yyd = yydest;
800 register const char *yys = yysrc;
801
802 while ((*yyd++ = *yys++) != '\0')
803 continue;
804
805 return yyd - 1;
806}
807# endif
808# endif
Jari Aalto31859422009-01-12 13:36:28 +0000809
810#endif /* !YYERROR_VERBOSE */
811
Jari Aaltob80f6442004-07-27 13:29:18 +0000812
Jari Aalto31859422009-01-12 13:36:28 +0000813
814#if YYDEBUG
815/*--------------------------------.
816| Print this symbol on YYOUTPUT. |
817`--------------------------------*/
818
819#if defined (__STDC__) || defined (__cplusplus)
820static void
821yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
822#else
823static void
824yysymprint (yyoutput, yytype, yyvaluep)
825 FILE *yyoutput;
826 int yytype;
827 YYSTYPE *yyvaluep;
828#endif
829{
830 /* Pacify ``unused variable'' warnings. */
831 (void) yyvaluep;
832
833 if (yytype < YYNTOKENS)
834 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
835 else
836 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Jari Aaltob80f6442004-07-27 13:29:18 +0000837
838
Jari Aalto31859422009-01-12 13:36:28 +0000839# ifdef YYPRINT
840 if (yytype < YYNTOKENS)
841 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
842# endif
843 switch (yytype)
844 {
845 default:
846 break;
847 }
848 YYFPRINTF (yyoutput, ")");
849}
850
851#endif /* ! YYDEBUG */
852/*-----------------------------------------------.
853| Release the memory associated to this symbol. |
854`-----------------------------------------------*/
855
856#if defined (__STDC__) || defined (__cplusplus)
857static void
858yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
859#else
860static void
861yydestruct (yymsg, yytype, yyvaluep)
862 const char *yymsg;
863 int yytype;
864 YYSTYPE *yyvaluep;
865#endif
866{
867 /* Pacify ``unused variable'' warnings. */
868 (void) yyvaluep;
869
870 if (!yymsg)
871 yymsg = "Deleting";
872 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
873
874 switch (yytype)
875 {
876
877 default:
878 break;
879 }
880}
881
882
883/* Prevent warnings from -Wmissing-prototypes. */
Jari Aaltob80f6442004-07-27 13:29:18 +0000884
885#ifdef YYPARSE_PARAM
886# if defined (__STDC__) || defined (__cplusplus)
Jari Aalto31859422009-01-12 13:36:28 +0000887int yyparse (void *YYPARSE_PARAM);
Jari Aaltob80f6442004-07-27 13:29:18 +0000888# else
Jari Aalto31859422009-01-12 13:36:28 +0000889int yyparse ();
Jari Aaltob80f6442004-07-27 13:29:18 +0000890# endif
Jari Aalto31859422009-01-12 13:36:28 +0000891#else /* ! YYPARSE_PARAM */
892#if defined (__STDC__) || defined (__cplusplus)
Jari Aaltob80f6442004-07-27 13:29:18 +0000893int yyparse (void);
Jari Aaltob80f6442004-07-27 13:29:18 +0000894#else
Jari Aalto31859422009-01-12 13:36:28 +0000895int yyparse ();
Jari Aaltob80f6442004-07-27 13:29:18 +0000896#endif
Jari Aalto31859422009-01-12 13:36:28 +0000897#endif /* ! YYPARSE_PARAM */
Jari Aaltob80f6442004-07-27 13:29:18 +0000898
899
Jari Aaltob80f6442004-07-27 13:29:18 +0000900
Jari Aaltob80f6442004-07-27 13:29:18 +0000901
Jari Aalto31859422009-01-12 13:36:28 +0000902
903
904/*----------.
905| yyparse. |
906`----------*/
907
908#ifdef YYPARSE_PARAM
909# if defined (__STDC__) || defined (__cplusplus)
910int yyparse (void *YYPARSE_PARAM)
911# else
912int yyparse (YYPARSE_PARAM)
913 void *YYPARSE_PARAM;
914# endif
915#else /* ! YYPARSE_PARAM */
916#if defined (__STDC__) || defined (__cplusplus)
Jari Aaltob80f6442004-07-27 13:29:18 +0000917int
Jari Aalto31859422009-01-12 13:36:28 +0000918yyparse (void)
919#else
920int
921yyparse ()
922
923#endif
924#endif
Jari Aaltob80f6442004-07-27 13:29:18 +0000925{
Jari Aalto31859422009-01-12 13:36:28 +0000926 /* The look-ahead symbol. */
927int yychar;
928
929/* The semantic value of the look-ahead symbol. */
930YYSTYPE yylval;
931
932/* Number of syntax errors so far. */
933int yynerrs;
Jari Aaltob80f6442004-07-27 13:29:18 +0000934
935 register int yystate;
936 register int yyn;
937 int yyresult;
938 /* Number of tokens to shift before error messages enabled. */
939 int yyerrstatus;
Jari Aalto31859422009-01-12 13:36:28 +0000940 /* Look-ahead token as an internal (translated) token number. */
941 int yytoken = 0;
Jari Aaltob80f6442004-07-27 13:29:18 +0000942
943 /* Three stacks and their tools:
944 `yyss': related to states,
945 `yyvs': related to semantic values,
946 `yyls': related to locations.
947
948 Refer to the stacks thru separate pointers, to allow yyoverflow
949 to reallocate them elsewhere. */
950
Jari Aalto31859422009-01-12 13:36:28 +0000951 /* The state stack. */
952 short int yyssa[YYINITDEPTH];
953 short int *yyss = yyssa;
954 register short int *yyssp;
Jari Aaltob80f6442004-07-27 13:29:18 +0000955
956 /* The semantic value stack. */
957 YYSTYPE yyvsa[YYINITDEPTH];
958 YYSTYPE *yyvs = yyvsa;
959 register YYSTYPE *yyvsp;
960
Jari Aaltob80f6442004-07-27 13:29:18 +0000961
Jari Aalto31859422009-01-12 13:36:28 +0000962
963#define YYPOPSTACK (yyvsp--, yyssp--)
Jari Aaltob80f6442004-07-27 13:29:18 +0000964
965 YYSIZE_T yystacksize = YYINITDEPTH;
966
Jari Aaltob80f6442004-07-27 13:29:18 +0000967 /* The variables used to return semantic value and location from the
968 action routines. */
969 YYSTYPE yyval;
Jari Aalto31859422009-01-12 13:36:28 +0000970
Jari Aaltob80f6442004-07-27 13:29:18 +0000971
972 /* When reducing, the number of symbols on the RHS of the reduced
Jari Aalto31859422009-01-12 13:36:28 +0000973 rule. */
Jari Aaltob80f6442004-07-27 13:29:18 +0000974 int yylen;
975
976 YYDPRINTF ((stderr, "Starting parse\n"));
977
978 yystate = 0;
979 yyerrstatus = 0;
980 yynerrs = 0;
981 yychar = YYEMPTY; /* Cause a token to be read. */
982
983 /* Initialize stack pointers.
984 Waste one element of value and location stack
985 so that they stay on the same level as the state stack.
986 The wasted elements are never initialized. */
987
988 yyssp = yyss;
989 yyvsp = yyvs;
Jari Aalto31859422009-01-12 13:36:28 +0000990
991
992 yyvsp[0] = yylval;
993
Jari Aaltob80f6442004-07-27 13:29:18 +0000994 goto yysetstate;
995
996/*------------------------------------------------------------.
997| yynewstate -- Push a new state, which is found in yystate. |
998`------------------------------------------------------------*/
999 yynewstate:
1000 /* In all cases, when you get here, the value and location stacks
1001 have just been pushed. so pushing a state here evens the stacks.
1002 */
1003 yyssp++;
1004
1005 yysetstate:
1006 *yyssp = yystate;
1007
Jari Aalto31859422009-01-12 13:36:28 +00001008 if (yyss + yystacksize - 1 <= yyssp)
Jari Aaltob80f6442004-07-27 13:29:18 +00001009 {
1010 /* Get the current used size of the three stacks, in elements. */
1011 YYSIZE_T yysize = yyssp - yyss + 1;
1012
1013#ifdef yyoverflow
1014 {
1015 /* Give user a chance to reallocate the stack. Use copies of
1016 these so that the &'s don't force the real ones into
1017 memory. */
1018 YYSTYPE *yyvs1 = yyvs;
Jari Aalto31859422009-01-12 13:36:28 +00001019 short int *yyss1 = yyss;
1020
Jari Aaltob80f6442004-07-27 13:29:18 +00001021
1022 /* Each stack pointer address is followed by the size of the
Jari Aalto31859422009-01-12 13:36:28 +00001023 data in use in that stack, in bytes. This used to be a
1024 conditional around just the two extra args, but that might
1025 be undefined if yyoverflow is a macro. */
Jari Aaltob80f6442004-07-27 13:29:18 +00001026 yyoverflow ("parser stack overflow",
1027 &yyss1, yysize * sizeof (*yyssp),
1028 &yyvs1, yysize * sizeof (*yyvsp),
Jari Aalto31859422009-01-12 13:36:28 +00001029
Jari Aaltob80f6442004-07-27 13:29:18 +00001030 &yystacksize);
Jari Aalto31859422009-01-12 13:36:28 +00001031
Jari Aaltob80f6442004-07-27 13:29:18 +00001032 yyss = yyss1;
1033 yyvs = yyvs1;
1034 }
1035#else /* no yyoverflow */
1036# ifndef YYSTACK_RELOCATE
1037 goto yyoverflowlab;
1038# else
1039 /* Extend the stack our own way. */
Jari Aalto31859422009-01-12 13:36:28 +00001040 if (YYMAXDEPTH <= yystacksize)
Jari Aaltob80f6442004-07-27 13:29:18 +00001041 goto yyoverflowlab;
1042 yystacksize *= 2;
Jari Aalto31859422009-01-12 13:36:28 +00001043 if (YYMAXDEPTH < yystacksize)
Jari Aaltob80f6442004-07-27 13:29:18 +00001044 yystacksize = YYMAXDEPTH;
1045
1046 {
Jari Aalto31859422009-01-12 13:36:28 +00001047 short int *yyss1 = yyss;
Jari Aaltob80f6442004-07-27 13:29:18 +00001048 union yyalloc *yyptr =
1049 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1050 if (! yyptr)
1051 goto yyoverflowlab;
1052 YYSTACK_RELOCATE (yyss);
1053 YYSTACK_RELOCATE (yyvs);
Jari Aalto31859422009-01-12 13:36:28 +00001054
1055# undef YYSTACK_RELOCATE
Jari Aaltob80f6442004-07-27 13:29:18 +00001056 if (yyss1 != yyssa)
1057 YYSTACK_FREE (yyss1);
1058 }
1059# endif
1060#endif /* no yyoverflow */
1061
1062 yyssp = yyss + yysize - 1;
1063 yyvsp = yyvs + yysize - 1;
Jari Aalto31859422009-01-12 13:36:28 +00001064
Jari Aaltob80f6442004-07-27 13:29:18 +00001065
1066 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1067 (unsigned long int) yystacksize));
1068
Jari Aalto31859422009-01-12 13:36:28 +00001069 if (yyss + yystacksize - 1 <= yyssp)
Jari Aaltob80f6442004-07-27 13:29:18 +00001070 YYABORT;
1071 }
1072
1073 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1074
1075 goto yybackup;
1076
Jari Aaltob80f6442004-07-27 13:29:18 +00001077/*-----------.
1078| yybackup. |
1079`-----------*/
1080yybackup:
1081
1082/* Do appropriate processing given the current state. */
Jari Aalto31859422009-01-12 13:36:28 +00001083/* Read a look-ahead token if we need one and don't already have one. */
Jari Aaltob80f6442004-07-27 13:29:18 +00001084/* yyresume: */
1085
Jari Aalto31859422009-01-12 13:36:28 +00001086 /* First try to decide what to do without reference to look-ahead token. */
Jari Aaltob80f6442004-07-27 13:29:18 +00001087
1088 yyn = yypact[yystate];
Jari Aalto31859422009-01-12 13:36:28 +00001089 if (yyn == YYPACT_NINF)
Jari Aaltob80f6442004-07-27 13:29:18 +00001090 goto yydefault;
1091
Jari Aalto31859422009-01-12 13:36:28 +00001092 /* Not known => get a look-ahead token if don't already have one. */
Jari Aaltob80f6442004-07-27 13:29:18 +00001093
Jari Aalto31859422009-01-12 13:36:28 +00001094 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Jari Aaltob80f6442004-07-27 13:29:18 +00001095 if (yychar == YYEMPTY)
1096 {
1097 YYDPRINTF ((stderr, "Reading a token: "));
1098 yychar = YYLEX;
1099 }
1100
Jari Aalto31859422009-01-12 13:36:28 +00001101 if (yychar <= YYEOF)
Jari Aaltob80f6442004-07-27 13:29:18 +00001102 {
Jari Aalto31859422009-01-12 13:36:28 +00001103 yychar = yytoken = YYEOF;
Jari Aaltob80f6442004-07-27 13:29:18 +00001104 YYDPRINTF ((stderr, "Now at end of input.\n"));
1105 }
1106 else
1107 {
Jari Aalto31859422009-01-12 13:36:28 +00001108 yytoken = YYTRANSLATE (yychar);
1109 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Jari Aaltob80f6442004-07-27 13:29:18 +00001110 }
1111
Jari Aalto31859422009-01-12 13:36:28 +00001112 /* If the proper action on seeing token YYTOKEN is to reduce or to
1113 detect an error, take that action. */
1114 yyn += yytoken;
1115 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Jari Aaltob80f6442004-07-27 13:29:18 +00001116 goto yydefault;
Jari Aaltob80f6442004-07-27 13:29:18 +00001117 yyn = yytable[yyn];
Jari Aalto31859422009-01-12 13:36:28 +00001118 if (yyn <= 0)
Jari Aaltob80f6442004-07-27 13:29:18 +00001119 {
Jari Aalto31859422009-01-12 13:36:28 +00001120 if (yyn == 0 || yyn == YYTABLE_NINF)
Jari Aaltob80f6442004-07-27 13:29:18 +00001121 goto yyerrlab;
1122 yyn = -yyn;
1123 goto yyreduce;
1124 }
Jari Aaltob80f6442004-07-27 13:29:18 +00001125
1126 if (yyn == YYFINAL)
1127 YYACCEPT;
1128
Jari Aalto31859422009-01-12 13:36:28 +00001129 /* Shift the look-ahead token. */
1130 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Jari Aaltob80f6442004-07-27 13:29:18 +00001131
1132 /* Discard the token being shifted unless it is eof. */
1133 if (yychar != YYEOF)
1134 yychar = YYEMPTY;
1135
1136 *++yyvsp = yylval;
Jari Aalto31859422009-01-12 13:36:28 +00001137
Jari Aaltob80f6442004-07-27 13:29:18 +00001138
1139 /* Count tokens shifted since error; after three, turn off error
1140 status. */
1141 if (yyerrstatus)
1142 yyerrstatus--;
1143
1144 yystate = yyn;
1145 goto yynewstate;
1146
1147
1148/*-----------------------------------------------------------.
1149| yydefault -- do the default action for the current state. |
1150`-----------------------------------------------------------*/
1151yydefault:
1152 yyn = yydefact[yystate];
1153 if (yyn == 0)
1154 goto yyerrlab;
1155 goto yyreduce;
1156
1157
1158/*-----------------------------.
1159| yyreduce -- Do a reduction. |
1160`-----------------------------*/
1161yyreduce:
1162 /* yyn is the number of a rule to reduce with. */
1163 yylen = yyr2[yyn];
1164
1165 /* If YYLEN is nonzero, implement the default value of the action:
1166 `$$ = $1'.
1167
Jari Aalto31859422009-01-12 13:36:28 +00001168 Otherwise, the following line sets YYVAL to garbage.
1169 This behavior is undocumented and Bison
Jari Aaltob80f6442004-07-27 13:29:18 +00001170 users should not rely upon it. Assigning to YYVAL
1171 unconditionally makes the parser a bit smaller, and it avoids a
1172 GCC warning that YYVAL may be used uninitialized. */
1173 yyval = yyvsp[1-yylen];
1174
Jari Aaltob80f6442004-07-27 13:29:18 +00001175
Jari Aalto31859422009-01-12 13:36:28 +00001176 YY_REDUCE_PRINT (yyn);
1177 switch (yyn)
Jari Aaltob80f6442004-07-27 13:29:18 +00001178 {
Jari Aalto31859422009-01-12 13:36:28 +00001179 case 2:
1180#line 177 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1181 {
1182 if ((yyvsp[0].exp) == NULL)
Jari Aaltob80f6442004-07-27 13:29:18 +00001183 YYABORT;
Jari Aalto31859422009-01-12 13:36:28 +00001184 ((struct parse_args *) arg)->res = (yyvsp[0].exp);
Jari Aaltob80f6442004-07-27 13:29:18 +00001185 }
1186 break;
Jari Aaltob80f6442004-07-27 13:29:18 +00001187
Jari Aalto31859422009-01-12 13:36:28 +00001188 case 3:
1189#line 185 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1190 {
1191 (yyval.exp) = new_exp_3 (qmop, (yyvsp[-4].exp), (yyvsp[-2].exp), (yyvsp[0].exp));
1192 }
1193 break;
Jari Aaltob80f6442004-07-27 13:29:18 +00001194
Jari Aalto31859422009-01-12 13:36:28 +00001195 case 4:
1196#line 189 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1197 {
1198 (yyval.exp) = new_exp_2 (lor, (yyvsp[-2].exp), (yyvsp[0].exp));
1199 }
1200 break;
1201
1202 case 5:
1203#line 193 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1204 {
1205 (yyval.exp) = new_exp_2 (land, (yyvsp[-2].exp), (yyvsp[0].exp));
1206 }
1207 break;
1208
1209 case 6:
1210#line 197 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1211 {
1212 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1213 }
1214 break;
1215
1216 case 7:
1217#line 201 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1218 {
1219 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1220 }
1221 break;
1222
1223 case 8:
1224#line 205 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1225 {
1226 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1227 }
1228 break;
1229
1230 case 9:
1231#line 209 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1232 {
1233 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
1234 }
1235 break;
1236
1237 case 10:
1238#line 213 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1239 {
1240 (yyval.exp) = new_exp_1 (lnot, (yyvsp[0].exp));
1241 }
1242 break;
1243
1244 case 11:
1245#line 217 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1246 {
1247 (yyval.exp) = new_exp_0 (var);
1248 }
1249 break;
1250
1251 case 12:
1252#line 221 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1253 {
1254 if (((yyval.exp) = new_exp_0 (num)) != NULL)
1255 (yyval.exp)->val.num = (yyvsp[0].num);
1256 }
1257 break;
1258
1259 case 13:
1260#line 226 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
1261 {
1262 (yyval.exp) = (yyvsp[-1].exp);
1263 }
1264 break;
1265
1266
1267 }
1268
1269/* Line 1037 of yacc.c. */
1270#line 1270 "/usr/src/local/bash/bash-20080814/lib/intl/plural.c"
Jari Aaltob80f6442004-07-27 13:29:18 +00001271
1272 yyvsp -= yylen;
1273 yyssp -= yylen;
Jari Aaltob80f6442004-07-27 13:29:18 +00001274
Jari Aalto31859422009-01-12 13:36:28 +00001275
1276 YY_STACK_PRINT (yyss, yyssp);
Jari Aaltob80f6442004-07-27 13:29:18 +00001277
1278 *++yyvsp = yyval;
Jari Aalto31859422009-01-12 13:36:28 +00001279
Jari Aaltob80f6442004-07-27 13:29:18 +00001280
1281 /* Now `shift' the result of the reduction. Determine what state
1282 that goes to, based on the state we popped back to and the rule
1283 number reduced by. */
1284
1285 yyn = yyr1[yyn];
1286
Jari Aalto31859422009-01-12 13:36:28 +00001287 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1288 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Jari Aaltob80f6442004-07-27 13:29:18 +00001289 yystate = yytable[yystate];
1290 else
Jari Aalto31859422009-01-12 13:36:28 +00001291 yystate = yydefgoto[yyn - YYNTOKENS];
Jari Aaltob80f6442004-07-27 13:29:18 +00001292
1293 goto yynewstate;
1294
1295
1296/*------------------------------------.
1297| yyerrlab -- here on detecting error |
1298`------------------------------------*/
1299yyerrlab:
1300 /* If not already recovering from an error, report this error. */
1301 if (!yyerrstatus)
1302 {
1303 ++yynerrs;
Jari Aalto31859422009-01-12 13:36:28 +00001304#if YYERROR_VERBOSE
Jari Aaltob80f6442004-07-27 13:29:18 +00001305 yyn = yypact[yystate];
1306
Jari Aalto31859422009-01-12 13:36:28 +00001307 if (YYPACT_NINF < yyn && yyn < YYLAST)
Jari Aaltob80f6442004-07-27 13:29:18 +00001308 {
1309 YYSIZE_T yysize = 0;
Jari Aalto31859422009-01-12 13:36:28 +00001310 int yytype = YYTRANSLATE (yychar);
1311 const char* yyprefix;
Jari Aaltob80f6442004-07-27 13:29:18 +00001312 char *yymsg;
Jari Aalto31859422009-01-12 13:36:28 +00001313 int yyx;
Jari Aaltob80f6442004-07-27 13:29:18 +00001314
Jari Aaltob80f6442004-07-27 13:29:18 +00001315 /* Start YYX at -YYN if negative to avoid negative indexes in
1316 YYCHECK. */
Jari Aalto31859422009-01-12 13:36:28 +00001317 int yyxbegin = yyn < 0 ? -yyn : 0;
1318
1319 /* Stay within bounds of both yycheck and yytname. */
1320 int yychecklim = YYLAST - yyn;
1321 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1322 int yycount = 0;
1323
1324 yyprefix = ", expecting ";
1325 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1326 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1327 {
1328 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1329 yycount += 1;
1330 if (yycount == 5)
1331 {
1332 yysize = 0;
1333 break;
1334 }
1335 }
1336 yysize += (sizeof ("syntax error, unexpected ")
1337 + yystrlen (yytname[yytype]));
Jari Aaltob80f6442004-07-27 13:29:18 +00001338 yymsg = (char *) YYSTACK_ALLOC (yysize);
1339 if (yymsg != 0)
1340 {
Jari Aalto31859422009-01-12 13:36:28 +00001341 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1342 yyp = yystpcpy (yyp, yytname[yytype]);
Jari Aaltob80f6442004-07-27 13:29:18 +00001343
1344 if (yycount < 5)
1345 {
Jari Aalto31859422009-01-12 13:36:28 +00001346 yyprefix = ", expecting ";
1347 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1348 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
Jari Aaltob80f6442004-07-27 13:29:18 +00001349 {
Jari Aalto31859422009-01-12 13:36:28 +00001350 yyp = yystpcpy (yyp, yyprefix);
Jari Aaltob80f6442004-07-27 13:29:18 +00001351 yyp = yystpcpy (yyp, yytname[yyx]);
Jari Aalto31859422009-01-12 13:36:28 +00001352 yyprefix = " or ";
Jari Aaltob80f6442004-07-27 13:29:18 +00001353 }
1354 }
1355 yyerror (yymsg);
1356 YYSTACK_FREE (yymsg);
1357 }
1358 else
Jari Aalto31859422009-01-12 13:36:28 +00001359 yyerror ("syntax error; also virtual memory exhausted");
Jari Aaltob80f6442004-07-27 13:29:18 +00001360 }
1361 else
Jari Aalto31859422009-01-12 13:36:28 +00001362#endif /* YYERROR_VERBOSE */
1363 yyerror ("syntax error");
Jari Aaltob80f6442004-07-27 13:29:18 +00001364 }
Jari Aalto31859422009-01-12 13:36:28 +00001365
1366
1367
1368 if (yyerrstatus == 3)
1369 {
1370 /* If just tried and failed to reuse look-ahead token after an
1371 error, discard it. */
1372
1373 if (yychar <= YYEOF)
1374 {
1375 /* If at end of input, pop the error token,
1376 then the rest of the stack, then return failure. */
1377 if (yychar == YYEOF)
1378 for (;;)
1379 {
1380
1381 YYPOPSTACK;
1382 if (yyssp == yyss)
1383 YYABORT;
1384 yydestruct ("Error: popping",
1385 yystos[*yyssp], yyvsp);
1386 }
1387 }
1388 else
1389 {
1390 yydestruct ("Error: discarding", yytoken, &yylval);
1391 yychar = YYEMPTY;
1392 }
1393 }
1394
1395 /* Else will try to reuse look-ahead token after shifting the error
1396 token. */
Jari Aaltob80f6442004-07-27 13:29:18 +00001397 goto yyerrlab1;
1398
1399
Jari Aalto31859422009-01-12 13:36:28 +00001400/*---------------------------------------------------.
1401| yyerrorlab -- error raised explicitly by YYERROR. |
1402`---------------------------------------------------*/
1403yyerrorlab:
1404
1405#ifdef __GNUC__
1406 /* Pacify GCC when the user code never invokes YYERROR and the label
1407 yyerrorlab therefore never appears in user code. */
1408 if (0)
1409 goto yyerrorlab;
1410#endif
1411
1412yyvsp -= yylen;
1413 yyssp -= yylen;
1414 yystate = *yyssp;
1415 goto yyerrlab1;
1416
1417
1418/*-------------------------------------------------------------.
1419| yyerrlab1 -- common code for both syntax error and YYERROR. |
1420`-------------------------------------------------------------*/
Jari Aaltob80f6442004-07-27 13:29:18 +00001421yyerrlab1:
Jari Aalto31859422009-01-12 13:36:28 +00001422 yyerrstatus = 3; /* Each real token shifted decrements this. */
Jari Aaltob80f6442004-07-27 13:29:18 +00001423
Jari Aalto31859422009-01-12 13:36:28 +00001424 for (;;)
1425 {
1426 yyn = yypact[yystate];
1427 if (yyn != YYPACT_NINF)
1428 {
1429 yyn += YYTERROR;
1430 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1431 {
1432 yyn = yytable[yyn];
1433 if (0 < yyn)
1434 break;
1435 }
1436 }
1437
1438 /* Pop the current state because it cannot handle the error token. */
1439 if (yyssp == yyss)
Jari Aaltob80f6442004-07-27 13:29:18 +00001440 YYABORT;
Jari Aalto31859422009-01-12 13:36:28 +00001441
1442
1443 yydestruct ("Error: popping", yystos[yystate], yyvsp);
1444 YYPOPSTACK;
1445 yystate = *yyssp;
1446 YY_STACK_PRINT (yyss, yyssp);
Jari Aaltob80f6442004-07-27 13:29:18 +00001447 }
1448
Jari Aaltob80f6442004-07-27 13:29:18 +00001449 if (yyn == YYFINAL)
1450 YYACCEPT;
1451
Jari Aaltob80f6442004-07-27 13:29:18 +00001452 *++yyvsp = yylval;
Jari Aalto31859422009-01-12 13:36:28 +00001453
1454
1455 /* Shift the error token. */
1456 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Jari Aaltob80f6442004-07-27 13:29:18 +00001457
1458 yystate = yyn;
1459 goto yynewstate;
1460
1461
1462/*-------------------------------------.
1463| yyacceptlab -- YYACCEPT comes here. |
1464`-------------------------------------*/
1465yyacceptlab:
1466 yyresult = 0;
1467 goto yyreturn;
1468
1469/*-----------------------------------.
1470| yyabortlab -- YYABORT comes here. |
1471`-----------------------------------*/
1472yyabortlab:
Jari Aalto31859422009-01-12 13:36:28 +00001473 yydestruct ("Error: discarding lookahead",
1474 yytoken, &yylval);
1475 yychar = YYEMPTY;
Jari Aaltob80f6442004-07-27 13:29:18 +00001476 yyresult = 1;
1477 goto yyreturn;
1478
Jari Aalto31859422009-01-12 13:36:28 +00001479#ifndef yyoverflow
1480/*----------------------------------------------.
1481| yyoverflowlab -- parser overflow comes here. |
1482`----------------------------------------------*/
Jari Aaltob80f6442004-07-27 13:29:18 +00001483yyoverflowlab:
1484 yyerror ("parser stack overflow");
1485 yyresult = 2;
1486 /* Fall through. */
Jari Aalto31859422009-01-12 13:36:28 +00001487#endif
Jari Aaltob80f6442004-07-27 13:29:18 +00001488
1489yyreturn:
1490#ifndef yyoverflow
1491 if (yyss != yyssa)
1492 YYSTACK_FREE (yyss);
1493#endif
1494 return yyresult;
1495}
Jari Aalto31859422009-01-12 13:36:28 +00001496
1497
1498#line 231 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
Jari Aaltob80f6442004-07-27 13:29:18 +00001499
1500
1501void
1502internal_function
1503FREE_EXPRESSION (exp)
1504 struct expression *exp;
1505{
1506 if (exp == NULL)
1507 return;
1508
1509 /* Handle the recursive case. */
1510 switch (exp->nargs)
1511 {
1512 case 3:
1513 FREE_EXPRESSION (exp->val.args[2]);
1514 /* FALLTHROUGH */
1515 case 2:
1516 FREE_EXPRESSION (exp->val.args[1]);
1517 /* FALLTHROUGH */
1518 case 1:
1519 FREE_EXPRESSION (exp->val.args[0]);
1520 /* FALLTHROUGH */
1521 default:
1522 break;
1523 }
1524
1525 free (exp);
1526}
1527
1528
1529static int
1530yylex (lval, pexp)
1531 YYSTYPE *lval;
1532 const char **pexp;
1533{
1534 const char *exp = *pexp;
1535 int result;
1536
1537 while (1)
1538 {
1539 if (exp[0] == '\0')
1540 {
1541 *pexp = exp;
1542 return YYEOF;
1543 }
1544
1545 if (exp[0] != ' ' && exp[0] != '\t')
1546 break;
1547
1548 ++exp;
1549 }
1550
1551 result = *exp++;
1552 switch (result)
1553 {
1554 case '0': case '1': case '2': case '3': case '4':
1555 case '5': case '6': case '7': case '8': case '9':
1556 {
1557 unsigned long int n = result - '0';
1558 while (exp[0] >= '0' && exp[0] <= '9')
1559 {
1560 n *= 10;
1561 n += exp[0] - '0';
1562 ++exp;
1563 }
1564 lval->num = n;
1565 result = NUMBER;
1566 }
1567 break;
1568
1569 case '=':
1570 if (exp[0] == '=')
1571 {
1572 ++exp;
1573 lval->op = equal;
1574 result = EQUOP2;
1575 }
1576 else
1577 result = YYERRCODE;
1578 break;
1579
1580 case '!':
1581 if (exp[0] == '=')
1582 {
1583 ++exp;
1584 lval->op = not_equal;
1585 result = EQUOP2;
1586 }
1587 break;
1588
1589 case '&':
1590 case '|':
1591 if (exp[0] == result)
1592 ++exp;
1593 else
1594 result = YYERRCODE;
1595 break;
1596
1597 case '<':
1598 if (exp[0] == '=')
1599 {
1600 ++exp;
1601 lval->op = less_or_equal;
1602 }
1603 else
1604 lval->op = less_than;
1605 result = CMPOP2;
1606 break;
1607
1608 case '>':
1609 if (exp[0] == '=')
1610 {
1611 ++exp;
1612 lval->op = greater_or_equal;
1613 }
1614 else
1615 lval->op = greater_than;
1616 result = CMPOP2;
1617 break;
1618
1619 case '*':
1620 lval->op = mult;
1621 result = MULOP2;
1622 break;
1623
1624 case '/':
1625 lval->op = divide;
1626 result = MULOP2;
1627 break;
1628
1629 case '%':
1630 lval->op = module;
1631 result = MULOP2;
1632 break;
1633
1634 case '+':
1635 lval->op = plus;
1636 result = ADDOP2;
1637 break;
1638
1639 case '-':
1640 lval->op = minus;
1641 result = ADDOP2;
1642 break;
1643
1644 case 'n':
1645 case '?':
1646 case ':':
1647 case '(':
1648 case ')':
1649 /* Nothing, just return the character. */
1650 break;
1651
1652 case ';':
1653 case '\n':
1654 case '\0':
1655 /* Be safe and let the user call this function again. */
1656 --exp;
1657 result = YYEOF;
1658 break;
1659
1660 default:
1661 result = YYERRCODE;
1662#if YYDEBUG != 0
1663 --exp;
1664#endif
1665 break;
1666 }
1667
1668 *pexp = exp;
1669
1670 return result;
1671}
1672
1673
1674static void
1675yyerror (str)
1676 const char *str;
1677{
1678 /* Do nothing. We don't print error messages here. */
1679}