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